[System transplantation] uboot configuration realizes network download of Linux kernel

Hardware environment: 100ask stm32mp157 development board

Configure in Uboot

To obtain the IP address from the router, it is necessary to ensure that the server and the development board are in the same network segment.

dhcp

Use the nfs command to download the linux kernel of the nfs service folder

nfs C2000000 192.168.31.143:/home/book/nfs_rootfs/uImage  

Check the data of C2000000 in DDR

md.b C2000000 100

Download the device tree file using the nfs command

nfs   c4000000  192.168.31.143:/home/book/nfs_rootfs/stm32mp157c-100ask-512d-lcd-v1.dtb

Start the Linux system

bootm c2000000 - c4000000  

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-WoF2duc8-1681999522761)(image/system transplantation/1681999426146.png)]

  • Automatically use the network to remotely download the linux kernel and device tree files after power-on

Need to set the bootcmd command, bootcmd is a very important environment variable! Its name is divided into "boot" and "cmd", that is, "
boot " and "command", indicating that this environment variable stores the boot command, which is actually a collection of multiple boot commands, and the specific content of the boot command can be modified . bootcmd saves the default commands of uboot, and the commands in bootcmd will be executed after the countdown of uboot ends. These commands are generally used to start the Linux kernel, such as reading the Linux kernel image file and device tree file in EMMC or NAND Flash to DRAM, and then start the Linux kernel.

setenv bootcmd 'nfs C2000000 192.168.31.143:/home/book/nfs_rootfs/uImage;
				nfs c4000000  192.168.31.143:/home/book/nfs_rootfs/stm32mp157c-100ask-512d-lcd-v1.dtb;
				bootm c2000000 - c4000000'
 
saveenv  

After the next power-on or run bootcmd execution, the commands in the bootcmd will be executed, and the Linux kernel will be automatically downloaded and loaded.

Since there is no file system mounted, booting the kernel will prompt Kernel panican error at the end.

Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

Guess you like

Origin blog.csdn.net/m0_61737429/article/details/130276944