使用我自己编译的内核映像,BeagleboneBlack中的U-Boot启动失败了吗?

时间:2017-10-02 07:53:59

标签: linux-kernel kernel beagleboneblack u-boot buildroot

我正在尝试使用Buildroot根据以下教程编译内核:http://free-electrons.com/doc/training/buildroot/buildroot-labs.pdf

我严格遵循所有步骤,当我将SD卡插入BeagleboneBlack(由USB线供电)时,选择从SD卡启动,启动不成功。控制台的输出如下:

    U-Boot 2017.09 (Sep 27 2017 - 17:41:38 +0200)

CPU  : AM335X-GP rev 2.1
I2C:   ready
DRAM:  512 MiB
No match for driver 'omap_hsmmc'
No match for driver 'omap_hsmmc'
Some drivers were not found
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
<ethaddr> not set. Validating first E-fuse MAC
Net:   cpsw, usb_ether
Press SPACE to abort autoboot in 2 seconds
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
reading boot.scr
** Unable to read file boot.scr **
reading uEnv.txt
98 bytes read in 4 ms (23.4 KiB/s)
Loaded env from uEnv.txt
Importing environment from mmc0 ...
Running uenvcmd ...
** Bad device 0:1 0x82000000 **
reading ramdisk.gz
** Unable to read file ramdisk.gz **
** Bad device 0:1 0x88000000 **
** Bad device 0:1 0x88000000 **
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
reading /am335x-boneblack.dtb
35712 bytes read in 10 ms (3.4 MiB/s)
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
** File not found /zImage **
switch to partitions #0, OK
mmc1(part 0) is current device
Scanning mmc 1:1...
switch to partitions #0, OK
mmc1(part 0) is current device
SD/MMC found on device 1
** File not found /zImage **
## Error: "bootcmd_nand0" not defined
starting USB...
USB0:   Port not available.
cpsw Waiting for PHY auto negotiation to complete......... TIMEOUT !
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
musb-hdrc: peripheral reset irq lost!
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
BOOTP broadcast 15
BOOTP broadcast 16
BOOTP broadcast 17
BOOTP broadcast 18
BOOTP broadcast 19
BOOTP broadcast 20
BOOTP broadcast 21
BOOTP broadcast 22
BOOTP broadcast 23
BOOTP broadcast 24
BOOTP broadcast 25
BOOTP broadcast 26
BOOTP broadcast 27
BOOTP broadcast 28
BOOTP broadcast 29

Retry time exceeded; starting again
missing environment variable: pxeuuid
Retrieving file: pxelinux.cfg/01-98-84-e3-ae-c4-14
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/00000000
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/0000000
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/000000
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/00000
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/0000
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/000
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/00
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/0
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/default-arm-am33xx
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/default-arm
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `serverip' not set
Retrieving file: pxelinux.cfg/default
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
*** ERROR: `serverip' not set
Config file not found
starting USB...
USB0:   Port not available.
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
BOOTP broadcast 15
BOOTP broadcast 16
BOOTP broadcast 17
BOOTP broadcast 18
BOOTP broadcast 19
BOOTP broadcast 20
BOOTP broadcast 21
BOOTP broadcast 22
BOOTP broadcast 23
BOOTP broadcast 24
BOOTP broadcast 25
BOOTP broadcast 26
BOOTP broadcast 27
BOOTP broadcast 28
BOOTP broadcast 29

Retry time exceeded; starting again
using musb-hdrc, OUT ep1out IN ep1in STATUS ep2in
MAC 98:84:e3:ae:c4:12
HOST MAC de:ad:be:af:00:00
RNDIS ready
high speed config #2: 2 mA, Ethernet Gadget, using RNDIS
USB RNDIS network up!
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
BOOTP broadcast 7
BOOTP broadcast 8
BOOTP broadcast 9
BOOTP broadcast 10
BOOTP broadcast 11
BOOTP broadcast 12
BOOTP broadcast 13
BOOTP broadcast 14
BOOTP broadcast 15
BOOTP broadcast 16
BOOTP broadcast 17
BOOTP broadcast 18
BOOTP broadcast 19
BOOTP broadcast 20
BOOTP broadcast 21
BOOTP broadcast 22
BOOTP broadcast 23
BOOTP broadcast 24
BOOTP broadcast 25
BOOTP broadcast 26
BOOTP broadcast 27
BOOTP broadcast 28
BOOTP broadcast 29

Retry time exceeded; starting again
=> 

以下是我在uEnv.txt文件中写的内容:

bootdir=
bootpart=0:1
uenvcmd=run loadimage;run loadramdisk;run findfdt;run loadfdt;run mmcloados

谁能告诉我我做错了什么(尽可能具体)?似乎启动无法找到zImage,但在/ boot分区中,我确实有zImage文件。

非常感谢你。

1 个答案:

答案 0 :(得分:2)

  

有谁能告诉我我做错了什么(尽可能具体)?

看起来U-Boot启动环境与SD卡上的内容不一致 默认的U-Boot环境设置为从SD卡的第二个分区的 / boot 目录加载内核,DT blob或FIT映像。从第一个分区(即 uEnv.txt 文件)加载的修改只是部分有效。

你声称:

  

...但是在/ boot分区中,我确实有zImage文件。

/ boot 将是“分区”的目录。)
假设上述内容是准确的,那么根文件系统中内核映像文件的完整路径为 / boot / zImage
但是启动日志报告了

switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
** File not found /zImage **  

这意味着内核正在查看第一个分区的根目录 / ,而不是根文件系统的 / boot 。 您的SD卡可能在第一个分区中有FAT fs,而不是ext3 / 4根文件系统。

但是,启动日志确实表明在根目录中找到了设备树blob, /

switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
reading /am335x-boneblack.dtb
35712 bytes read in 10 ms (3.4 MiB/s)

通常,内核文件与DT blob一起存储(在同一目录中) 但是你似乎把这两个文件分开了。

将这两个文件存储在FAT文件系统的根目录 / 中(以及缺少的 ramdisk.gz ),
/> OR
修复环境中的加载命令和路径将根文件系统安装到SD卡上的另一个分区中。
前者最简单(即复制 zImage )。

解决方案需要研究环境变量以获得适当的更改(例如, uEnv.txt 中的bootdir=/boot可能是修复的一部分。)

更新

我回顾了U-Boot 2017.09以及它为您的主板构建的默认环境。可疑的环境变量是

 bootcmd_legacy_mmc0=setenv mmcdev 0; setenv bootpart 0:2 ; run mmcboot

其中setenv bootpart 0:2指定rootfs分区(而不是VFAT /“boot”分区)是源分区。
此setenv将覆盖在读取和评估 uEnv.txt 文件时分配的bootpart=0:1
相反,指定文件的 / boot 目录的默认bootdir=/boot会被 uEnv.txt 文件中的bootdir=覆盖。

最终结果是,当运行 mmcboot 及其 loadimage 变量时,将从 zImage 的根目录加载 zImage rootfs,由于该文件位于 / boot 目录中而失败。

  

在设备0上找到SD / MMC       **找不到文件/ zImage **

请注意,加载错误之前的“设备0上找到的SD / MMC”消息来自 mmcboot 变量中的echo命令:

mmcboot=mmc dev ${mmcdev}; setenv devnum ${mmcdev}; setenv devtype mmc; \
  if mmc rescan; then \
    echo SD/MMC found on device ${mmcdev}; \
    if run loadimage; then \
      if test ${boot_fit} -eq 1; \
        then run loadfit; \          
        else run mmcloados; \
      fi; \
    fi; \
  fi;

解决方法

一个。要从第一个分区加载,请修改变量 bootcmd_legacy_mmc0 以使用 bootpart 的当前定义加载 zImage ,即不要重新定义它。编辑U-Boot源代码并重建,或使用以下U-Boot命令(中止自动引导后, 启动失败之前):

setenv bootcmd_legacy_mmc0 'setenv mmcdev 0\; run mmcboot'
bootd

OR

B中。修改 uEnv.txt 文件。只需插入新的第一行:

devtype=mmc

ADDENDUM

  

确实是版本不兼容问题。

如果你坚持使用U-Boot 2017.09,那么解决方法B就足够了。

U-Boot 2016.03有loadimage=load mmc ${bootpart} ...,而
U-Boot 2017.09有loadimage=load ${devtype} ${bootpart} ... uEnv.txt 文件运行 uenvcmd 时,未定义变量 devtype 。因此,较新版本的U-Boot会生成错误消息

  

**设备错误0:1 0x82000000 **
      **坏设备0:1 0x88000000 **
      **坏设备0:1 0x88000000 **

解决方法B确保在运行 uenvcmd 时定义 devtype ,因此load命令可以访问mmc设备,就像旧版本一样