kernel - 如何从u-boot启动Linux内核?

标签 kernel u-boot

我的Linux内核镜像uImage在我的U盘中。我想从 U-Boot 启动它。另外,设备树文件am335x-evm.dtb在我的U盘中。 我所做的如下:

U-Boot# usb start
(Re)start USB...
USB0:   scanning bus 0 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
U-Boot# fatls usb 0:1
  3821960   uimage
            kit3/
  4065280   modules.tar
            my_modules/
            extra/
            system volume information/
      375   uenv.txt
    40474   am335x-evm.dtb

4 file(s), 4 dir(s)

U-Boot# fatload usb 0:1 0xC0700000 uImage
reading uImage
3821960 bytes read in 2375 ms (1.5 MiB/s)
U-Boot# fatload usb 0:1 0xC0e00000 am335x-evm.dtb
reading am335x-evm.dtb
40474 bytes read in 48 ms (823.2 KiB/s)
U-Boot# bootm 0xC0700000 - 0xC0e00000
## Booting kernel from Legacy Image at c0700000 ...
   Image Name:   Linux-3.12.10-ge35dc10-dirty
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3821896 Bytes = 3.6 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
## Flattened Device Tree blob at c0e00000
   Booting using the fdt blob at 0xc0e00000
   Loading Kernel Image ... OK
OK
   Using Device Tree in place at c0e00000, end c0e0ce19

Starting kernel ...

就到此为止了。怎么做?谢谢!

结果: 感谢所有在这篇文章中回答的人!现在我可以使用U盘中的镜像来启动系统了。我所做的是:

setenv bootargs "console=ttyO0,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext4 mem=512M coherent_pool=8M loglevel=0 lpj=3317760 rootwait"
usb start; fatls usb 0:1; fatload usb 0:1 0x82000000 uImage-orig-onUSB;fatload usb 0:1 0x80F80000 am335x-evm.dtb;bootm 0x82000000 - 0x80F80000

没有第一句话,系统也可以启动并启动GUI程序,该程序将显示在显示屏上。但是调试串口已经没有反应了!

对于第二句,如果我使用0xC0700000和0xC0e00000的ram地址,如下所示,那么它将停止加载内核。原因应该是锯末在他的回答中提到的。 @锯末

setenv bootargs "console=ttyO0,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext4 mem=512M coherent_pool=8M loglevel=0 lpj=3317760 rootwait"
usb start; fatls usb 0:1; fatload usb 0:1 0xC0700000 uImage-orig-onUSB;fatload usb 0:1 0xC0e00000 am335x-evm.dtb;bootm 0xC0700000 - 0xC0e00000

最佳答案

尽管出现消息“正在启动内核...”,但内核实际上尚未开始执行(因为必须首先重新定位镜像并解压缩),因此启用了earlyprintk 还没有任何效果。
看起来可疑的是 RAM 地址。

典型的“am33xx-evm”板只有 512MB RAM,从 0x80000000 开始。
然而,您正在尝试使用从 0xC0700000 到 0xC0E0CE19 的 RAM 地址,其中物理内存不应该存在。
显然,内核和设备树正确加载。

而不是

fatload usb 0:1 0xC0700000 uImage
fatload usb 0:1 0xC0e00000 am335x-evm.dtb
bootm 0xC0700000 - 0xC0e00000

尝试使用

fatload usb 0:1 0x80200000 uImage 
fatload usb 0:1 0x80e00000 am335x-evm.dtb
bootm 0x80200000 - 0x80e00000 

关于kernel - 如何从u-boot启动Linux内核?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30488942/

相关文章:

linux - list_for_each_entry 重置游标

c - 如何转发/多路复用 ioctl 组?

linux-kernel - 如何在uboot中添加新设备?

c - 从函数地址获取调用者函数名称

linux - Yocto 自定义层在 mkfs.ext4 之后在 do_rootfs 上运行 Tune2fs

linux - 如何在 Linux 3.2.x 中添加新的系统调用?

linux-kernel - down_read(semaphore) 在内核中如何工作?

c - 如何打印(或转储)任何类型的十六进制指针?

linux - NAND flash & MDT 分区 - uboot -- Atmel SAMA5D3 Xplained boards

embedded-linux - u-boot.bin 和 u-boot.img 有什么不同