embedded-linuxbuildroot

rootfs corrupted upon mount with Buildroot-built image


When testing a SD image built with Buildroot, everything works until the rootfs is mounted by the kernel. Mounting the rootfs fails, and also appears to corrupt the rootfs itself (halting boot with a freshly flashed SD card just before the mount then checking with e2fsck reveals no errors. Multiple errors appear if the boot process is continued until the mount error appears).

The specific mount errors are:

[    2.499914] EXT4-fs (mmcblk0p4): mounted filesystem with ordered data mode. Opts: (null). Quota mode: disabled.
[    2.508903] VFS: Mounted root (ext4 filesystem) readonly on device 179:4.
[    2.517423] devtmpfs: mounted
[    2.520778] Freeing unused kernel image (initmem) memory: 1024K
[    2.541720] Run /sbin/init as init process
[    2.679595] EXT4-fs error (device mmcblk0p4): ext4_lookup:1831: inode #138: comm init: iget: checksum invalid
[    2.690303] EXT4-fs error (device mmcblk0p4): ext4_lookup:1831: inode #127: comm init: iget: checksum invalid

After booting, the root filesystem appears partially mounted despite the errors, but missing a lot of files. For example the init program is present and runs correctly.

The following was attempted:

What could produce such an error? What options can I enable in the kernel to help me with debugging this?


Solution

  • Turns out I was using the wrong device tree in U-Boot. The difference between the device tree is minimal but certainly there must be some difference regarding the SDMMC peripherals.