Wandboard的NFS rootfs

时间:2016-01-12 01:23:41

标签: linux-kernel embedded-linux nfs u-boot

我第一次使用Uboot和串口。我正在尝试将我的/nfsroot从我的ubuntu主机挂载到wandboard目标,以便我可以使用内核中的TFTP和作为rootfs的NFS启动主板。

在这里和那里得到错误,不知道它们是什么意思。

请建议。

这是带有root = / dev / nfs

的完整Error Log

这是我尝试将nfs挂载到SDCard的某个分区(mmcblk2p2)时出现的错误。根=的/ dev / mmcblk2p2

它已安装,但随后devtmpfs返回错误安装-2。

EXT3-fs (mmcblk2p2): error: couldn't mount because of unsupported optional features (240)
EXT2-fs (mmcblk2p2): error: couldn't mount because of unsupported optional features (244)
EXT4-fs (mmcblk2p2): recovery complete
EXT4-fs (mmcblk2p2): mounted filesystem with ordered data mode. Opts: (null)
VFS: Mounted root (ext4 filesystem) on device 179:2.
devtmpfs: error mounting -2
Freeing unused kernel memory: 328K (80d22000 - 80d74000)
Failed to execute /sbin/init (error -2).  Attempting defaults...
Kernel panic - not syncing: No working init found.  Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
CPU1: stopping

这是我的printenv

=> printenv
baudrate=115200
boot_fdt=try
bootargs=console=ttymxc0,115200 root=/dev/mmcblk0p2 rw nfsroot=192.168.0.227:/nfsroot,v3,tcp
bootcmd=mmc dev ${mmcdev}; if mmc rescan; then if run loadbootscript; then run bootscript; else if run loadimage; then run mmcboot; else run netboot; fi; fi; else run netboot; fi
bootdelay=5
bootfile=zImage-wandboard-quad.bin
bootscript=echo Running bootscript from mmc ...; source
console=ttymxc0
ethact=FEC
ethaddr=00:1f:7b:b4:14:ce
ethprime=FEC
fdt_addr=0x18000000
fdt_file=zImage-imx6q-wandboard.dtb
fdt_high=0xffffffff
get_cmd=dhcp
image=zImage-wandboard-quad.bin
initrd_high=0xffffffff
ip_dyn=yes
loadaddr=0x12000000
loadbootscript=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};
loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}
loadimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${image}
mmcargs=setenv bootargs console=${console},${baudrate} root=${mmcroot}; run videoargs
mmcboot=echo Booting from mmc ...; run mmcargs; if test ${boot_fdt} = yes || test ${boot_fdt} = try; then if run loadfdt; then bootz ${loadaddr} - ${fdt_addr}; else if test ${boot_fdt} = try; then bootz; e;
mmcdev=0
mmcpart=1
mmcroot=/dev/mmcblk2p2 rootwait rw
netargs=setenv bootargs console=${console},${baudrate} ${smp} root=/dev/mmcblk2p2 rw ip={ipaddr} nfsroot=${serverip}:${nfsroot},v3,tcp init=/sbin/init
netboot=echo Booting from net ...; run netargs; if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; ${get_cmd} ${image}; if test ${boot_fdt} = yes || test ${boot_fdt} = try; th;
nfsroot=/nfsroot
script=boot.scr
serverip=192.168.0.227
splashpos=m,m
update_sd_firmware=if test ${ip_dyn} = yes; then setenv get_cmd dhcp; else setenv get_cmd tftp; fi; if mmc dev ${mmcdev}; then if ${get_cmd} ${update_sd_firmware_filename}; then setexpr fw_sz ${filesize} /i
update_sd_firmware_filename=u-boot.imx
videoargs=setenv nextcon 0; if hdmidet; then setenv bootargs ${bootargs} video=mxcfb${nextcon}:dev=hdmi,1280x720M@60,if=RGB24; setenv fbmen fbmem=28M; setexpr nextcon ${nextcon} + 1; else echo - no HDMI mo}

Environment size: 2810/8188 bytes

2 个答案:

答案 0 :(得分:0)

在主机(Ubuntu)上:

  • sudo apt-get install nfs-kernel-server
  • sudo mkdir /nfsroot
  • /nfsroot目录添加到/etc/exports文件中:

    /nfsroot    *(rw,sync,no_root_squash)
    
  • sudo /etc/init.d/nfs-common startsudo /etc/init.d/nfs-kernel-server start

在目标(Wandboard)上:

    编译内核时必须启用
  • Root filesystem on NFS(希望是,否则你需要重新编译Linux内核)
  • root=/dev/nfs rw ip=target_IP nfsroot=NFS_server_IP>:/nfsroot/添加到U-Boot的bootargs变量,其中target_IP是目标的静态IP地址,NFS_server_IP是主机IP地址。

答案 1 :(得分:0)

事实证明,我需要在从DHCP获取IP后设置客户端IP参数。我认为DHCP将处理netboot参数的所有IP配置,但我错了;

setenv ip 192.168.0.172:192.168.0.227::::eth0:on

setenv ipaddr 192.168.0.172

setenv netargs 'setenv bootargs console=${console},${baudrate} ${smp} root=/dev/nfs ip=${ipaddr} nfsroot=${serverip}:${nfsroot},v3,tcp'