uboot的MMC启动参数设置--Apple的学习笔记
  2Nv1H5BMjysw 2023年11月02日 45 0

一,前言

因为之前编译了新的uboot和kernel,但是uboot的nfs挂载好像是硬件网口问题,所以先用MMC启动kernel来看下效果。bootcmd 和 bootargs是最重要的启动参数,先要复习下。

二,实践

1,uboot中mmc的常用查询命令

=> mmc dev
switch to partitions #0, OK
mmc0 is current device
=> mmc part

Partition Map for MMC device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     61              136579          30199adf-01     0c Boot
  2     136640          1852992         30199adf-02     83
=> ls mmc 0:1
            System Volume Information/
  4997632   zImage
   108812   MLO
   798536   u-boot.img
    93418   am335x-boneblack.dtb
      479   uEvn.txt

5 file(s), 1 dir(s)

2,手工操作bootargs

mmc dev 0
load mmc 0:1 0x82000000 zImage
setenv bootargs concole=ttyO0,115200n8 root=mmcroot=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait
load mmc 0:1 0x88000000 am335x-boneblack.dtb

可以看到Starting kernel ...就停止了,感觉参数传递不正确导致的,检查了如下语句console写成了concole导致的,另外root文件的地址也不对。

=> mmc dev 0
switch to partitions #0, OK
mmc0 is current device
=> load mmc 0:1 0x82000000 zImage
4997632 bytes read in 328 ms (14.5 MiB/s)
=> setenv bootargs concole=ttyO0,115200n8 root=mmcroot=/dev/mmcblk0p1 ro rootfstype=ext4 rootwait
=> load mmc 0:1 0x88000000 am335x-boneblack.dtb
93418 bytes read in 8 ms (11.1 MiB/s)
=> bootz 0x82000000 - 0x88000000
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Device Tree to 8ffe6000, end 8ffffce9 ... OK

Starting kernel ...

所以上述过程中修改下bootargs即可通过mmc正确启动kernel。

setenv bootargs console=ttyO0,115200n8 root=mmc root=/dev/mmcblk0p2 ro rootfstype=ext4 rootwait。

最后还是直接设置保存环境变量吧,通过MMC启动。

setenv bootargs 'console=ttyO0,115200n8 root=/dev/mmcblk0p2 rootwait rw'
setenv bootcmd 'mmc dev 0; fatload mmc 0:1 82000000 zImage; fatload mmc 0:1 88000000 am335x-boneblack.dtb; bootz 82000000 - 88000000;'
saveenv
boot

uboot成功启动kernel的效果,只是文件系统我是copy了tiny的文件,出现了错误。

U-Boot 2021.01 (Oct 07 2023 - 03:00:38 -0700)

CPU  : AM335X-GP rev 2.1
Model: TI AM335x BeagleBone Black
DRAM:  512 MiB
WDT:   Started with servicing (60s timeout)
NAND:  0 MiB
MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
Loading Environment from FAT... OK
Net:   Could not get PHY for ethernet@4a100000: addr 0
eth2: ethernet@4a100000, eth3: usb_ether
Hit any key to stop autoboot:  0
=> setenv bootargs 'console=ttyO0,115200n8 root=/dev/mmcblk0p2 rootwait rw'
=> setenv bootcmd 'mmc dev 0; fatload mmc 0:1 82000000 zImage; fatload mmc 0:1 88000000 am335x-boneblack.dtb; bootz 82000000 - 88000000;'
=> saveenv
Saving Environment to FAT... OK
=> boot
switch to partitions #0, OK
mmc0 is current device
4997632 bytes read in 328 ms (14.5 MiB/s)
93418 bytes read in 9 ms (9.9 MiB/s)
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Device Tree to 8ffe6000, end 8ffffce9 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.10.100-g7a7a3af903 (oe-user@oe-host) (arm-none-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025, GNU ld (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 2.33.1.20191209) #1 PREEMPT Sat May 14 22:36:58 UTC 2022
[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: TI AM335x BeagleBone Black
[    0.000000] Memory policy: Data cache writeback
......
[    3.120803] tilcdc 4830e000.lcdc: [drm] Cannot find any crtc or sizes
[    8.911882] EXT4-fs (mmcblk0p2): recovery complete
[    8.921570] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    8.929879] VFS: Mounted root (ext4 filesystem) on device 179:50.
[    8.936209] devtmpfs: mounted
[    8.941706] Freeing unused kernel memory: 1024K
[    8.947320] Run /sbin/init as init process
/sbin/init: error while loading shared libraries: /usr/lib/libkm[    9.002920] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00
[    9.016117] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00 ]---
od.so.2: file too short

三,小结

先找到一个方法跑起来,这样才能继续玩下去。不过到最后加载文件系统出现了kernel panic的问题,我认为这个问题倒是可以之后用qemu仿真来解决的。文件系统不是我自己编译的,用了tisdk-tiny-image-am335x-evm.tar解压后的内容。不过我暂时不研究文件系统,这个问题可以保留,主要研制了uboot可以启动kernel。

于是我先快速解决下问题,用了8G的sd卡通过etcher烧录了tisdk-default-image-am335x-evm.wic.xz,先确保有个完整的环境,免除我自己做文件系统了,其实我不用tiny-image,用default-image的文件系统估计也是可行的,唯一的问题是没有usb虚拟网卡了。

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

2Nv1H5BMjysw