U disk booting kernel and mounting root file system method

U disk partitioning and formatting:
1. Insert the U disk into the PC, and find the device file corresponding to the U disk under the /dev/ folder of the linux system, such as sdb
2. Use the fdisk command to divide the U disk into 2 areas
fdisk /dev /sdb
n //New partition
p
1 //Partition 1
Enter key//Select default
+1G //Set partition size to 1GB
n
p
2 //Partition 2
Enter key//Select default
+1G //Set partition size to 1GB
w //Save
3. Format the partition
umount /dev/sdb1
umount /dev/sdb2
sudo mkfs.vfat /dev/sdb1 -n boot
sudo mkfs.ext3 -L rootfs /dev/sdb2
4. Re-plug the u disk, you can See the boot and rootfs folders under the /media/ folder.
5. Copy the Image and dtb files into the boot folder, and copy the root file system into the rootfs folder and unzip it.

Boot from U Disk After powering on the
board, modify the uboot command in uboot
setenv usbload'fatload usb 0 0x48080000 Image; fatload usb 0 0x48000000 r8a7795-salvator-xs.dtb'
setenv bootcmd'usb start; run usbload; booti 0x48080000-0x48000000'
setenv bootargs'root=/dev/sda2 rw rootdelay=5' After
saveenv
is powered on again, the kernel will be booted from the U disk and the root file system will be mounted.

Guess you like

Origin blog.csdn.net/baidu_38410526/article/details/81162629