从美元卡启动时出错 - 没有文件系统可以挂载根目录,尝试过:Ext4

AA *_*Son 2 sd-card embedded-linux buildroot u-boot beagleboard

我正在尝试使用 Buildroot 构建一个在 PocketBeagle 上运行的嵌入式 Linux;并按照 ( source1。然后将生成的图像复制到 USB 卡。\n将 USB 卡插入 Pocketbeagle 并通过串行连接监视启动过程时;我收到以下错误:

\n\n
No filesystem could mount root, tried: \next4\nKernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1)\n---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1).\n
Run Code Online (Sandbox Code Playgroud)\n\n

使用的资源是:\nBuildroot:2018.02
\n文件系统:ext4
\nBootloader:U-Boot(自定义版本2018.01)
\n内核版本:4.14.24 \n应用上面源中所述的所有补丁,可以在( source2
)中找到:\n- 0001-Stripped-back-pocketbeagle-devicetree.patch \n- 0001-am335x_evm-uEnv.txt-bootz-n-fixes.patch \n- 0002-U-Boot-BeagleBone-Cape-Manager.patch \n - 0003-pocketbeagle-tweaks.patch



\n\n

运行构建会产生以下文件和映像:
\nMLO:第一阶段引导加载程序
\nU-boot.img:第二阶段引导加载程序
\nuEnv.txt:U-boot 环境
\nzImage:Linux 内核映像
\nam335x-pocketbeagle.dtb:Linux内核设备树 Blob
\nrootfs.ext4:根文件系统映像

\n\n

uEnv.txt如下:

\n\n
fdtfile=am335x-pocketbeagle.dtb  \nbootpart=0:1  \nbootdir=  \nbootargs=console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4   rootwait  \nuenvcmd=run loadimage;run loadfdt;printenv bootargs;bootz ${loadaddr} - ${fdtaddr};  \n
Run Code Online (Sandbox Code Playgroud)\n\n

然后通过在 buildroot 中使用genimage(并重建)来生成包含两个分区的美元映像:
\n1. 包含引导加载程序映像、内核映像和设备树的 FAT 分区
\n2. 包含根文件系统 ext4 的 Rootfs 分区

\n\n

生成的图像称为sdcard.img,通过使用程序 etcher (etcher-electron-1.4.3-x86_64.AppImage) 或 ( sudo dd if=output/images/sdcard.img of=/dev /mmcblk0 bs=1M )

\n\n

我使用了两种不同的美元卡来测试构建,但结果是相同的:
\n1。金士顿 32 GB (SDHC 10)
\n2. 闪迪 16GB (SDHC 10)

\n\n

值得一提的是,我使用相同的美元卡从官方网站加载 PocketBeagle 的原始映像并从中启动,卡启动没有问题。

\n\n

任何有帮助的想法都将受到高度赞赏。

\n\n
\n\n

附录

\n\n

日志文件中显示的另一个错误发生在启动开始时:

\n\n
U-Boot SPL 2018.01 (Mar 24 2018 - 21:13:25) \nTrying to boot from MMC1 \n*** Warning - bad CRC, using default environment \nreading u-boot.img \nreading u-boot.img \nU-Boot 2018.01 (Mar 24 2018 - 21:13:25 +0100) \nCPU : AM335X-GP rev 2.1 I2C: ready DRAM: 512 MiB \nNo match for driver \'omap_hsmmc\' \nNo match for driver \'omap_hsmmc\' \nSome drivers were not found \nReset Source: Power-on reset has occurred. \nMMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1 \n*** Warning - bad CRC, using default environment  \n
Run Code Online (Sandbox Code Playgroud)\n\n

完整日志如下:

\n\n
U-Boot SPL 2018.01 (Mar 24 2018 - 21:13:25)\nTrying to boot from MMC1\n*** Warning - bad CRC, using default environment\n\nreading u-boot.img\nreading u-boot.img\n\n\nU-Boot 2018.01 (Mar 24 2018 - 21:13:25 +0100)\n\nCPU  : AM335X-GP rev 2.1\nI2C:   ready\nDRAM:  512 MiB\nNo match for driver \'omap_hsmmc\'\nNo match for driver \'omap_hsmmc\'\nSome drivers were not found\nReset Source: Power-on reset has occurred.\nMMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1\n*** Warning - bad CRC, using default environment\n\nModel: BeagleBoard.org PocketBeagle\n<ethaddr> not set. Validating first E-fuse MAC\nNet:   No ethernet found.\nPress SPACE to abort autoboot in 2 seconds\nswitch to partitions #0, OK\nmmc0 is current device\nScanning mmc 0:1...\ngpio: pin 56 (gpio 56) value is 0\ngpio: pin 55 (gpio 55) value is 0\ngpio: pin 54 (gpio 54) value is 0\ngpio: pin 53 (gpio 53) value is 1\nswitch to partitions #0, OK\nmmc0 is current device\ngpio: pin 54 (gpio 54) value is 1\nChecking for: /uEnv.txt ...\nreading uEnv.txt\n218 bytes read in 4 ms (52.7 KiB/s)\ngpio: pin 55 (gpio 55) value is 1\nLoaded environment from /uEnv.txt\nImporting environment from mmc ...\nChecking if uenvcmd is set ...\ngpio: pin 56 (gpio 56) value is 1\nRunning uenvcmd ...\nreading /zImage\n5540120 bytes read in 351 ms (15.1 MiB/s)\nloading /am335x-pocketbeagle.dtb ...\nreading /am335x-pocketbeagle.dtb\n33516 bytes read in 9 ms (3.6 MiB/s)\nbootargs=console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait\n## Flattened Device Tree blob at 88000000\n   Booting using the fdt blob at 0x88000000\n   Loading Device Tree to 8fff4000, end 8ffff2eb ... OK\n\nStarting kernel ...\n\n[    0.000000] Booting Linux on physical CPU 0x0\n[    0.000000] Linux version 4.14.24 (ammar@ammar-System-Product-Name) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #1 SMP Sat Mar 24 21:23:50 CET 2018\n[    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c5387d\n[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache\n[    0.000000] OF: fdt: Machine model: TI AM335x PocketBeagle\n[    0.000000] Memory policy: Data cache writeback\n[    0.000000] cma: Reserved 16 MiB at 0x9e800000\n[    0.000000] CPU: All CPU(s) started in SVC mode.\n[    0.000000] AM335X ES2.1 (sgx neon)\n[    0.000000] random: fast init done\n[    0.000000] percpu: Embedded 17 pages/cpu @df93f000 s40872 r8192 d20568 u69632\n[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 129412\n[    0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait\n[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)\n[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)\n[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)\n[    0.000000] Memory: 479900K/522240K available (8192K kernel code, 810K rwdata, 2412K rodata, 1024K init, 7547K bss, 25956K reserved, 16384K cma-reserved, 0K highmem)\n[    0.000000] Virtual kernel memory layout:\n[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)\n[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)\n[    0.000000]     vmalloc : 0xe0000000 - 0xff800000   ( 504 MB)\n[    0.000000]     lowmem  : 0xc0000000 - 0xdfe00000   ( 510 MB)\n[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)\n[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)\n[    0.000000]       .text : 0xc0008000 - 0xc0900000   (9184 kB)\n[    0.000000]       .init : 0xc0c00000 - 0xc0d00000   (1024 kB)\n[    0.000000]       .data : 0xc0d00000 - 0xc0dca9b8   ( 811 kB)\n[    0.000000]        .bss : 0xc0dcc000 - 0xc152af94   (7548 kB)\n[    0.000000] Running RCU self tests\n[    0.000000] Hierarchical RCU implementation.\n[    0.000000]  RCU event tracing is enabled.\n[    0.000000]  RCU lockdep checking is enabled.\n[    0.000000]  RCU restricting CPUs from NR_CPUS=2 to nr_cpu_ids=1.\n[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1\n[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16\n[    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts\n[    0.000000] OMAP clockevent source: timer2 at 24000000 Hz\n[    0.000017] sched_clock: 32 bits at 24MHz, resolution 41ns, wraps every 89478484971ns\n[    0.000044] clocksource: timer1: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns\n[    0.000097] OMAP clocksource: timer1 at 24000000 Hz\n[    0.000569] timer_probe: no matching timers found\n[    0.001470] Console: colour dummy device 80x30\n[    0.001516] Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar\n[    0.001530] ... MAX_LOCKDEP_SUBCLASSES:  8\n[    0.001542] ... MAX_LOCK_DEPTH:          48\n[    0.001554] ... MAX_LOCKDEP_KEYS:        8191\n[    0.001566] ... CLASSHASH_SIZE:          4096\n[    0.001578] ... MAX_LOCKDEP_ENTRIES:     32768\n[    0.001589] ... MAX_LOCKDEP_CHAINS:      65536\n[    0.001601] ... CHAINHASH_SIZE:          32768\n[    0.001613]  memory used by lock dependency info: 4655 kB\n[    0.001626]  per task-struct memory footprint: 1536 bytes\n[    0.001663] Calibrating delay loop... 996.14 BogoMIPS (lpj=4980736)\n[    0.078740] pid_max: default: 32768 minimum: 301\n[    0.079147] Security Framework initialized\n[    0.079285] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)\n[    0.079306] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)\n[    0.082392] CPU: Testing write buffer coherency: ok\n[    0.083889] CPU0: thread -1, cpu 0, socket -1, mpidr 0\n[    0.085406] Setting up static identity map for 0x80100000 - 0x80100078\n[    0.085975] Hierarchical SRCU implementation.\n[    0.087625] smp: Bringing up secondary CPUs ...\n[    0.087648] smp: Brought up 1 node, 1 CPU\n[    0.087665] SMP: Total of 1 processors activated (996.14 BogoMIPS).\n[    0.087679] CPU: All CPU(s) started in SVC mode.\n[    0.091643] devtmpfs: initialized\n[    0.116033] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3\n[    0.116853] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns\n[    0.116916] futex hash table entries: 256 (order: 2, 16384 bytes)\n[    0.118550] pinctrl core: initialized pinctrl subsystem\n[    0.123225] NET: Registered protocol family 16\n[    0.130326] DMA: preallocated 256 KiB pool for atomic coherent allocations\n[    0.171692] omap_hwmod: debugss: _wait_target_disable failed\n[    0.226390] cpuidle: using governor menu\n[    0.237629] OMAP GPIO hardware version 0.1\n[    0.262333] No ATAGs?\n[    0.262360] hw-breakpoint: debug architecture 0x4 unsupported.\n[    0.262655] omap4_sram_init:Unable to allocate sram needed to handle errata I688\n[    0.262675] omap4_sram_init:Unable to get sram pool needed to handle errata I688\n[    0.298256] edma 49000000.edma: TI EDMA DMA engine driver\n[    0.303666] SCSI subsystem initialized\n[    0.305374] omap_i2c 44e0b000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/pinmux_i2c0_pins, deferring probe\n[    0.307447] omap_i2c 4802a000.i2c: bus 1 rev0.11 at 400 kHz\n[    0.307764] omap_i2c 4819c000.i2c: could not find pctldev for node /ocp/l4_wkup@44c00000/scm@210000/pinmux@800/mma8452_pins_default, deferring probe\n[    0.308058] pps_core: LinuxPPS API ver. 1 registered\n[    0.308076] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>\n[    0.308128] PTP clock support registered\n[    0.312478] clocksource: Switched to clocksource timer1\n[    0.448001] VFS: Disk quotas dquot_6.6.0\n[    0.448193] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)\n[    0.473020] NET: Registered protocol family 2\n[    0.474843] TCP established hash table entries: 4096 (order: 2, 16384 bytes)\n[    0.474948] TCP bind hash table entries: 4096 (order: 5, 147456 bytes)\n[    0.476120] TCP: Hash tables configured (established 4096 bind 4096)\n[    0.476506] UDP hash table entries: 256 (order: 2, 20480 bytes)\n[    0.476689] UDP-Lite hash table entries: 256 (order: 2, 20480 bytes)\n[    0.477446] NET: Registered protocol family 1\n[    0.479566] RPC: Registered named UNIX socket transport module.\n[    0.479614] RPC: Registered udp transport module.\n[    0.479629] RPC: Registered tcp transport module.\n[    0.479643] RPC: Registered tcp NFSv4.1 backchannel transport module.\n[    0.482107] hw perfevents: no interrupt-affinity property for /pmu, guessing.\n[    0.483357] hw perfevents: enabled with armv7_cortex_a8 PMU driver, 5 counters available\n[    0.487455] audit: initializing netlink subsys (disabled)\n[    0.490304] audit: type=2000 audit(0.480:1): state=initialized audit_enabled=0 res=1\n[    0.490640] workingset: timestamp_bits=14 max_order=17 bucket_order=3\n[    0.493682] NFS: Registering the id_resolver key type\n[    0.494058] Key type id_resolver registered\n[    0.494099] Key type id_legacy registered\n[    0.494253] jffs2: version 2.2. (NAND) (SUMMARY)  \xc2\xa9 2001-2006 Red Hat, Inc.\n[    0.500669] io scheduler noop registered\n[    0.500700] io scheduler deadline registered\n[    0.500822] io scheduler cfq registered (default)\n[    0.500841] io scheduler mq-deadline registered\n[    0.500856] io scheduler kyber registered\n[    0.503256] pinctrl-single 44e10800.pinmux: 142 pins at pa f9e10800 size 568\n[    0.510527] Serial: 8250/16550 driver, 6 ports, IRQ sharing enabled\n[    0.516492] omap_uart 44e09000.serial: no wakeirq for uart0\n[    0.516942] 44e09000.serial: ttyO0 at MMIO 0x44e09000 (irq = 30, base_baud = 3000000) is a OMAP UART0\n[    1.250345] console [ttyO0] enabled\n[    1.255586] omap_uart 48022000.serial: no wakeirq for uart1\n[    1.261829] 48022000.serial: ttyO1 at MMIO 0x48022000 (irq = 31, base_baud = 3000000) is a OMAP UART1\n[    1.272744] omap_uart 48024000.serial: no wakeirq for uart2\n[    1.278844] 48024000.serial: ttyO2 at MMIO 0x48024000 (irq = 32, base_baud = 3000000) is a OMAP UART2\n[    1.289570] omap_uart 481a8000.serial: no wakeirq for uart4\n[    1.295781] 481a8000.serial: ttyO4 at MMIO 0x481a8000 (irq = 33, base_baud = 3000000) is a OMAP UART4\n[    1.334046] brd: module loaded\n[    1.362138] loop: module loaded\n[    1.368162] mtdoops: mtd device (mtddev=name/number) must be supplied\n[    1.383297] libphy: Fixed MDIO Bus: probed\n[    1.390588] i2c /dev entries driver\n[    1.398755] omap_hsmmc 48060000.mmc: Got CD GPIO\n[    1.465093] ledtrig-cpu: registered to indicate activity on CPUs\n[    1.472542] oprofile: using arm/armv7\n[    1.477095] Initializing XFRM netlink socket\n[    1.481985] NET: Registered protocol family 10\n[    1.493215] Segment Routing with IPv6\n[    1.497190] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver\n[    1.505262] NET: Registered protocol family 17\n[    1.509973] NET: Registered protocol family 15\n[    1.515090] Key type dns_resolver registered\n[    1.519724] omap_voltage_late_init: Voltage driver support not added\n[    1.526481] sr_dev_init: No voltage domain specified for smartreflex0. Cannot initialize\n[    1.535007] sr_dev_init: No voltage domain specified for smartreflex1. Cannot initialize\n[    1.543566] ThumbEE CPU extension supported.\n[    1.548049] Registering SWP/SWPB emulation handler\n[    1.553116] SmartReflex Class3 initialized\n[    1.623490] mmc0: host does not support reading read-only switch, assuming write-enable\n[    1.635560] mmc0: new high speed SDHC card at address 0007\n[    1.644119] mmcblk0: mmc0:0007 SD32G 28.8 GiB \n[    1.655081]  mmcblk0: p1 p2\n[    1.671199] tps65217 0-0024: TPS65217 ID 0xe version 1.2\n[    1.677649] omap_i2c 44e0b000.i2c: bus 0 rev0.11 at 400 kHz\n[    1.686633] omap_i2c 4819c000.i2c: bus 2 rev0.11 at 400 kHz\n[    1.694194] hctosys: unable to open rtc device (rtc0)\n[    1.699490] sr_init: No PMIC hook to init smartreflex\n[    1.705144] sr_init: platform driver register failed for SR\n[    1.720670] List of all partitions:\n[    1.724586] 0100           16384 ram0 \n[    1.724597]  (driver?)\n[    1.730999] 0101           16384 ram1 \n[    1.731008]  (driver?)\n[    1.737842] 0102           16384 ram2 \n[    1.737854]  (driver?)\n[    1.744389] 0103           16384 ram3 \n[    1.744400]  (driver?)\n[    1.750791] 0104           16384 ram4 \n[    1.750800]  (driver?)\n[    1.757269] 0105           16384 ram5 \n[    1.757278]  (driver?)\n[    1.763737] 0106           16384 ram6 \n[    1.763746]  (driver?)\n[    1.770139] 0107           16384 ram7 \n[    1.770148]  (driver?)\n[    1.776597] 0108           16384 ram8 \n[    1.776607]  (driver?)\n[    1.783061] 0109           16384 ram9 \n[    1.783071]  (driver?)\n[    1.789456] 010a           16384 ram10 \n[    1.789465]  (driver?)\n[    1.795999] 010b           16384 ram11 \n[    1.796008]  (driver?)\n[    1.802540] 010c           16384 ram12 \n[    1.802549]  (driver?)\n[    1.809029] 010d           16384 ram13 \n[    1.809038]  (driver?)\n[    1.815571] 010e           16384 ram14 \n[    1.815580]  (driver?)\n[    1.822056] 010f           16384 ram15 \n[    1.822065]  (driver?)\n[    1.828679] b300        30228480 mmcblk0 \n[    1.828690]  driver: mmcblk\n[    1.835867]   b301           16384 mmcblk0p1 00000000-01\n[    1.835877] \n[    1.843044]   b302          524288 mmcblk0p2 00000000-02\n[    1.843053] \n[    1.850164] No filesystem could mount root, tried: \n[    1.850173]  ext4\n[    1.855340] \n[    1.858913] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1)\n[    1.867873] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(179,1)\n
Run Code Online (Sandbox Code Playgroud)\n\n
\n

saw*_*ust 5

由于未指定 SD 卡的正确分区,导致挂载 rootfs 失败。
在内核命令行中,(错误地)指示内核在/dev/mmcblk0p1对应的分区中查找 rootfs 。

bootargs=console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait
Run Code Online (Sandbox Code Playgroud)

[    0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p1 rw rootfstype=ext4 rootwait
Run Code Online (Sandbox Code Playgroud)

然而,mmc 子系统报告您的 SD 卡上有两个分区,启动日志会为您报告两次这些分区的设备名称。
第一的:

[    1.635560] mmc0: new high speed SDHC card at address 0007
[    1.644119] mmcblk0: mmc0:0007 SD32G 28.8 GiB 
[    1.655081]  mmcblk0: p1 p2
Run Code Online (Sandbox Code Playgroud)

进而:

[    1.720670] List of all partitions:
 ...
[    1.828679] b300        30228480 mmcblk0 
[    1.828690]  driver: mmcblk
[    1.835867]   b301           16384 mmcblk0p1 00000000-01
[    1.835877] 
[    1.843044]   b302          524288 mmcblk0p2 00000000-02
Run Code Online (Sandbox Code Playgroud)

因此,内核命令行(通过bootargs)应指定第二个分区/dev/mmcblk0p2,而不是 rootfs 的第一个分区。

由于 U-Boot 环境的存储区域尚未正确初始化(即“警告 - CRC 错误,使用默认环境”消息)(或者uEnv.txt文件丢失或损坏),U-Boot 正在引导 Linux具有在主板配置文件中定义的硬编码bootargs值的内核。
您可以编辑该文件并重新构建 U-Boot,或者中止自动引导并使用
setenv bootargs console=ttyO0,115200n8 root=/dev/mmcblk0p2 rw rootfstype=ext4 rootwait命令saveenv来纠正此错误规范。

  • “警告 - CRC 错误,使用默认环境”仅表示未从预期位置读取环境,而是使用默认值。所有“读取 uEnv.txt 218 字节读取时间为 4 ms (52.7 KiB/s) gpio: pin 55 (gpio 55) 值为 1 从 /uEnv.txt 加载环境 从 mmc 导入环境...检查是否设置了 uenvcmd 。 .. gpio: pin 56 (gpio 56) value is 1 Running uenvcmd ...”表示 uEnv.txt 已被读取、进入环境并使用。 (2认同)