Kernel panic报错排查:基于Buildroot 20011.02的ARMv7 Cortex-A9 NFS启动问题
Alright, let's break down how to troubleshoot this kernel panic you're facing when booting your ARMv7 Cortex-A9 board via NFS. I’ve run into this exact issue a few times with older kernels like 3.18, so here’s a step-by-step approach to get to the bottom of it:
1. Validate Your U-Boot Boot Arguments
First, double-check your U-Boot bootargs—incorrect parameters here are a super common culprit. Your bootargs should look something like this:
setenv bootargs 'console=ttyAMA0,115200 root=/dev/nfs nfsroot=<YOUR_NFS_SERVER_IP>:/export/users/buildroot,proto=tcp rw ip=dhcp'
Pay close attention to these details:
- Ensure the
nfsrootpath matches exactly what you exported (no typos in directory names!) - Add
proto=tcp—UDP can cause flaky mounts with older NFS setups - Don’t forget the
rwflag—init needs write permissions to run properly - For kernel 3.18, explicitly add
nfsvers=3if your NFS server defaults to v4 (many older setups don’t support v4 well)
2. Verify NFS Server Export Configuration & Permissions
This is another top cause of init panics:
- Open
/etc/exportson your NFS server and confirm your export line includesno_root_squash:
Without/export/users/buildroot <YOUR_BOARD_SUBNET>(rw,sync,no_root_squash,no_subtree_check)no_root_squash, your board’s root user gets mapped tonobodyon the server, which will block init from accessing critical files. - Run
exportfs -vto check the active export permissions—make surerwandno_root_squashare listed. - Test the export from another machine (or your board, if you can get to a U-Boot shell) with:
If the directory doesn’t show up, your NFS export isn’t working correctly.showmount -e <YOUR_NFS_SERVER_IP>
3. Check Root Filesystem Integrity & Toolchain Compatibility
Your rootfs might be corrupted or mismatched with your kernel/board:
- On the NFS server, verify that
/export/users/buildroot/init(or/export/users/buildroot/sbin/init) exists and has executable permissions:
Buildroot’s default rootfs usesls -l /export/users/buildroot/init /export/users/buildroot/sbin/init/initas the startup script—if it’s missing or has wrong permissions, init can’t run. - Test the rootfs locally with
chrootto rule out filesystem issues:
If this fails (e.g., missing libraries), your rootfs is broken—rebuild it with Buildroot, making sure you selected the correct ARMv7 Cortex-A9 target.cd /export/users/buildroot sudo chroot . /bin/sh - Confirm your Buildroot toolchain matches your kernel’s ARM configuration: Check if both use hard-float (
CONFIG_ARM_FPin kernel, corresponding toolchain setting in Buildroot) or soft-float—mismatched ABIs will break binary execution.
4. Audit Kernel Configuration for NFS & Boot Support
Even if you enabled ext4, you need specific NFS-related kernel configs:
- Ensure these options are set (either built-in
yor modulem—built-in is safer for boot):CONFIG_NFS_FS=yCONFIG_NFS_V3=yCONFIG_ROOT_NFS=yCONFIG_IP_PNP=y(for DHCP support)
- Make sure your board’s network driver is compiled into the kernel (not as a module)—modules can’t be loaded before the root filesystem is mounted.
- Check that
CONFIG_INITRAMFS_SOURCEis empty—if you set an initramfs, it might override your NFS root setup.
5. Get More Debug Logs to Pinpoint the Issue
Add debug to your bootargs to get more detailed kernel output before the panic:
setenv bootargs 'console=ttyAMA0,115200 root=/dev/nfs nfsroot=<IP>:/export/users/buildroot,proto=tcp rw ip=dhcp debug'
Look for messages right before the panic—common clues include:
execve failed for /init(permission or binary issue)error loading shared library(missing libraries or ABI mismatch)VFS: Unable to mount root fs via NFS(NFS mount failure)
Quick Win Checks
If you’re short on time, start with these high-probability fixes:
- Add
no_root_squashto your NFS export line and re-runexportfs -rv - Confirm
/export/users/buildroot/inithas755permissions - Verify your bootargs include
rwandproto=tcp
内容的提问来源于stack exchange,提问作者shaikh kamal

