Booting the pandaboard over NFS

17 Aug

I strangled some days to get this working: I want to boot the filesystem of my embedded pandaboard over NFS, so that I can make quicker changes to it from my development machine. As always with this stuff, it sounds simple and – in the end – it is simple. But the timespan between is really annoying while you are googeling and trying this until four o’clock in the morning…

So to make things hopefully shorter for you, here a quick tutorial how to do all that stuff.

Kernel

First step is our kernel. I’m using the 3.0.2 final which is atm the newest stable release. The guys commited a lot for the omap branch there, especially OMAP4 which is used on Pandaboard. But I’m really not sure, why the kernelguys are not making more defconfigs for starters. Sure they must not be perfect, but simple things like networking should work out of the box…

So go to your development machine and get the 3.0.2 sources from kernel.org and untar them:

wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.0.2.tar.bz2
tar xzf linux-3.0.2.tar.bz2

Now make a OMAP-generic default config (defconfig) and edit it (I’m assuming, that you have downloaded/untared/exported the path of i.e. the CodeSourcery Cross Compiler Toolchain):

cd linux-3.0.2
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm omap2plus_defconfig
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm menuconfig

Because of the generic type of this defconfig, you have to do some manual changes to get everything working. This can easily done by selecting via the ncurse-based “menuconfig” command.
Make sure that the following point are selected ([*] in front of it):

Networking support
--> [*] TCP/IP networking
--> --> [*] IP: kernel level autoconfiguration
--> --> --> [*] IP: DHCP support
--> --> --> [*] IP: BOOTP support
--> --> --> [*] IP: RARP support
Device Drivers
--> [*] Network device support
--> --> USB Network Adapters
--> --> --> [*] SMSC LAN95XX based USB 2.0 10/100 ethernet devices
--> [*] USB support
--> --> [*] EHCI HCD (USB 2.0) support
File systems
--> [*] Network File Systems
--> --> NFS client support
--> --> --> [*] NFS client support for NFS version 3 --> [*] Root file system on NFS

Or do it via bash by checking the .config in the same dir for those variables enabled ( XXX=y ):

CONFIG_IP_PNP=y
CONFIG_IP_PNP_DHCP=y
CONFIG_IP_PNP_BOOTP=y
CONFIG_IP_PNP_RARP=y
CONFIG_USB_USBNET=y
CONFIG_USB_NET_SMSC95XX=y
CONFIG_USB=y
CONFIG_USB_SUPPORT=y
CONFIG_USB_ARCH_HAS_EHCI=y
CONFIG_NETWORK_FILESYSTEMS=y
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
CONFIG_NFS_V3_ACL=y
CONFIG_ROOT_NFS=y

Now build your kernel and (according to the number of CPU Cores in your system) change the number behind “j”:

make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm -j4 all
make CROSS_COMPILE=arm-none-linux-gnueabi- uImage

Now your kernel is ready to be used!
I’m assuming here, that you already have a clue how to setup the SD Card right and have U-boot and X-Loader correctly in place. I will make further tutorials on that, too – later!

NFS Server

To use NFS, your development system also needs the NFS server to be installed. On debian systems you can install it simply with

sudo apt-get install nfs-common nfs-kernel-server

The next step is to create the folder (here /panda/fs) for the filesystem and make it ready for “export”.
Edit the /etc/exports to match your config:
/panda/fs 192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check)
I allow all adresses in this IP Range to access the NFS, due to multiple systems on the network. If you are changing the config and want to reload it, restart the nfs server with

/etc/init.d/nfs-kernel-server restart

My development System/NFS-Server is using 192.168.1.1 and pandaboard uses the 192.168.1.2 .

U-Boot

Now copy the kernel from arch/arm/boot/uImage over to your SD Card partition 1 and connect your board to a serial cable. Get into U-Boot and enter the following commands to make a network boot:

mmc rescan
fatload mmc 0:1 0x80000000 uImage
setenv bootargs vram=32M console=ttyO2,115200 mem=456M@0x80000000 mem=512M@0xA0000000 smsc95xx.macaddr=76:2F:97:85:4F:56 root=/dev/nfs rw nfsroot=192.168.1.1:/panda/fs,nolock,wsize=1024,rsize=1024 ip=192.168.1.2 rootdelay=2 init=/linuxrc
bootm 0x80000000

Change here the arguments to fit it to your system, i.e. change the MAC Address of your NIC, the IP Address of your server if necessary (nfsroot=X.X.X.X) and the folder (here /panda/fs).
The second IP beginning with “ip=” is the IP address your board will choose after kernel has started up. You can also assign DHCP as choice here (ip=DHCP) – No subnetmask is needed.

To make this executed every boot, you have to create a new textfile on your development system called “boot.script”. Copy your boot commands into it and save it. Then convert it to a file namend “boot.scr” with the command:

mkimage -A arm -T script -C none -n "Pandaboard boot script" -d boot.script boot.scr

and copy it over to your SD Cards first partition. It will then be executed as first action first by U-Boot on every boot.

Note: If mkimage is not found, install it with “sudo apt-get install uboot-mkimage”!

Et voila! Thanks to the guys over at Googleboard for the startup.

Facebooktwittergoogle_plusFacebooktwittergoogle_plus

20 Replies to “Booting the pandaboard over NFS

  1. Nice! Some of the options for USB are still needed even in kernel 3.2-rc5, saved me the time to dig around 🙂

  2. Hi,

    thanks for your blog, helped me to get started 🙂

    I am working on a Pandaboard ES. When booting via NFS the register_netdev call for the smsc95xx needs exactly 120 seconds. Did you experience the same on the “old” Pandaboard?

    Best regards,
    Matthias

    • Hey Matthias,

      I remember something similiar, yes. But I thought it was a Bug with DHCP – if you assign a fixed IP address it should be solved…

  3. Hi,
    great job, your blog help me remember how to setup a development environment through NFS.

    I am playing android on a Pandaboard. Could you please tell me how to setup android image on server, then make it can be boot from NFS on pandaboard?

  4. ifb0: no IPv6 routers present
    [ 101.575500] ifb1: no IPv6 routers present
    [ 102.992492] eth0: no IPv6 routers present


  5. sandeep:

    Kernel is booting up while connecting to my pc connection established and its waiting for ip6 here is my log
    ***log****
    Sending DHCP requests .
    smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0xC1
    ..
    ifb0: no IPv6 routers present
    ifb1: no IPv6 routers present
    [ 102.992492] eth0: no IPv6 routers present

  6. Nice blog.. But sorry for the silly question.
    What can i copy into /panda/fs ? complete directory of Android FS or system.img ?
    My question is, there should be a valid form of file system on exported path on server so that the client can read from it. What should be that into /panda/fs folder ?

  7. Hi,
    Thank you for your blog !

    I am working on a Pandaboard ES.
    I try to boot my Pandaboard over NFS, using Ubuntu 12.04
    My NFS connection is OK, but it stops during the start of modules.
    When I boot the same fs, using an SD card, it works fine.



    [ 9.431549] Sending DHCP requests .
    [ 11.005828] smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
    [ 11.871856] ., OK
    [ 11.909912] IP-Config: Got DHCP answer from 10.1.2.21, my address is 10.1.9.22
    [ 11.918365] IP-Config: Complete:
    [ 11.921752] device=eth0, addr=10.1.9.22, mask=255.255.0.0, gw=10.1.2.251,
    [ 11.928161] host=10.1.9.22, domain=bse.priv, nis-domain=(none),
    [ 11.936035] bootserver=10.1.2.21, rootserver=10.1.9.40, rootpath=
    [ 11.943511] Waiting 2sec before mounting root device…
    [ 13.963836] VFS: Mounted root (nfs filesystem) on device 0:14.
    [ 13.970977] devtmpfs: mounted
    [ 13.974334] Freeing init memory: 420K
    * Starting network connection manager[ OK ]
    * Starting mDNS/DNS-SD daemon[ OK ]
    * Starting User Mode Init Manager for TI shared transport[ OK ]
    * Starting bluetooth daemon[ OK ]
    * Starting load fallback graphics devices[ OK ]
    * Starting Userspace bootsplash[ OK ]
    * Stopping load fallback graphics devices[ OK ]

    And nothing else.

    I found on the Internet that there is an issue concerning upstart and the NFS.
    Do you have any idea to help me ?

    Best regards,
    PixMe

    • Sorry, i dont have any pandaboard flying around at the moment, so i cannot look deeply into this. But i think you can switch from upstart back with some packages…

  8. Hi,

    Thanks for your blog, helped me to get statred.

    When i am trying to boot root fs on NFS, getting errors,

    log :

    Sending DHCP requests .
    smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0xC1
    ….
    ….
    VFS : cannot open root device “nfs” or unknown block (0,255)
    please append a correct “root=” boot option;

    can anybody please help me

    Advance thanks,
    Rajashekar

  9. Hi,

    can you please share the root fs directory or provide link from where you downloaded

    Advance Thanks,
    rajashekar

  10. Hi,

    i downloaded fs from
    wget -c http://rcn-ee.net/deb/minfs/wheezy/debian-wheezy-minimal-armhf-2012-08-19.tar.xz

    and use this as root fs,

    when i am boot fs over nfs, it shows error as

    logs :

    VFS : mounted root (nfs file system ) on device 0:15
    devtmpfs: mounted
    freeing init memory : 280 k

    init : failed to create pty – disabling logging for job
    init : temporary process spawn error : no such file or directory

    can anybody please help me

    Advance Thanks
    rajasekar

    • Looks like your kernel or your bootargs parameters aren’t correct (so kernel is looking in wrong place or maybe for wrong stuff).

  11. Hi,

    I had a same problem that NFS boot stops after some of the modules.

    I am testing in the following software and hardware environment:

    OS Kernel : Linux® 3.0
    Android : Android IcecreamSandwich 4.0.4(MR1.1)
    Toolchain : CodeSourcery compiler version Sourcery G++ Lite 2010q1-202 for ARM GNU/Linux
    Reference hardware platforms : PANDA BOARD REV A2 (OMAP4430)
    Build Host OS : Ubuntu 11.10
    Android ICS Release : 4AI.1.4 OMAP4 Icecream Sandwich Panda
    SD Card : Sandisk 4 GB

    By tracking all the services that starts from init.rc i found that there is a issue regarding “netd daemon” in my case.

    By disabling “service netd /system/bin/netd” from init.rc i found that my NFS boot issue resolved but i could not get any display on LCD.

    So by tracking “system/netd/NatController.cpp” the issue was due to netd issues two ip commands.

    ========================================================

    ======================== Change =========================

    ========================================================

    int NatController::setDefaults() {

    if (runCmd(IPTABLES_PATH, “-P INPUT ACCEPT”))
    return -1;
    if (runCmd(IPTABLES_PATH, “-P OUTPUT ACCEPT”))
    return -1;
    if (runCmd(IPTABLES_PATH, “-P FORWARD DROP”))
    return -1;
    if (runCmd(IPTABLES_PATH, “-F FORWARD”))
    return -1;
    if (runCmd(IPTABLES_PATH, “-t nat -F”))
    return -1;

    // Added by BK

    // runCmd(IP_PATH, “rule flush”);
    // runCmd(IP_PATH, “-6 rule flush”);
    // runCmd(IP_PATH, “rule add from all lookup default prio 32767”);
    // runCmd(IP_PATH, “rule add from all lookup main prio 32766”);
    // runCmd(IP_PATH, “-6 rule add from all lookup default prio 32767”);
    // runCmd(IP_PATH, “-6 rule add from all lookup main prio 32766”);
    runCmd(IP_PATH, “route flush cache”);

    natCount = 0;

    setupOemIptablesHook();
    return 0;
    }

    ========================================================

    I had cross verified that this change is already done in 4AI.1.7 OMAP4 Icecream Sandwich Panda Release.

    Please find log of the successful boot using nfs on
    http://e2e.ti.com/support/omap/f/849/p/211650/754377.aspx#754377

    Now my NFS boot is working successfully on Pandaboard by following all the steps given on this blog.

    Thank you for the nice blog this helped me to set development environment.

  12. Hi Michael,

    I am using Pandaboard Rev 2(OMAP4430) with android ICS.As per my last post NFS boot is working perfectly but i am having issue regarding random crashes of Android ICS.This issue is not related to NFS boot but related to the release which i am using.

    I am using Android ICS Release : 4AI.1.4 OMAP4 Icecream Sandwich Panda.

    As per the discussion over e2e.ti.com (http://e2e.ti.com/support/omap/f/849/p/213462/754424.aspx#754424)
    they told me that “this release is working better in OMAP4460, the kernel has not be optimized to work on OMAP4430”

    I am working on USB Camera based application.So i need a proper release having support for
    –> OMAP 4430
    –> USB Camera Support
    –> Hardware encoder decoder support

    Can you suggest me where to get the release which can full fill my requirement.

    Advance Thanks
    BK

  13. Note: If mkimage is not found, install it with “sudo apt-get install uboot-mkimage”!

    Et voila! Thanks to the guys over at Googleboard for the startup.

    – Thanks for the thanks.! 🙂
    – It was totally my pleasure dear friend.

    Anyways,
    Update for ubuntu 12.04 –> “sudo apt-get install uboot-mkimage u-boot-tools”

  14. Hey, I am trying to boot FireFox OS on Pandaboard through NFS.
    Build machine : Ubuntu 12.04
    I tried the instructions.
    The kernel boots up and stops at the following:
    [ 82.317138] IP-Config: Retrying forever (NFS root)…
    [ 18.106231] Bluetooth: st_register failed -22
    [ 19.606903] …
    [ 62.007446] omap-rproc omap-rproc.1: rproc_loader_cont: failed to load ducati-m3.bin
    [ 65.135467] wl1271: ERROR could not get nvs file: -2
    [ 65.148498] wl1271: loaded
    [ 65.148498] wl1271: initialized
    [ 82.083435] timed out!
    [ 83.934661] smsc95xx 1-1.1:1.0: eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
    [ 91.352264] ifb0: no IPv6 routers present
    [ 91.352355] ifb1: no IPv6 routers present
    [ 93.050872] eth0: no IPv6 routers present
    [ 143.138793] wl1271: ERROR could not get firmware: -2 [ 204.139984] wl1271: ERROR could not get firmware: -2 [ 265.133422] wl1271: ERROR could not get firmware: -2 [ 265.139526] wl1271: ERROR firmware boot failed despite 3 retries [ 265.146667] IP-Config: Failed to open wlan0 [ 265.170654] Sending DHCP and RARP requests …
    [ 274.595733] DHCP/BOOTP: Ignoring delayed packet [ 283.380310] … timed out!

    Could you pls let me know if we are supposed to make any specific kernel config changes?
    My uImage is under the folder /NFS/source/boot/
    and I am providing the NFS path as /NFS/src/

    Regards,
    Pranami

Leave a Reply

Your email address will not be published. Required fields are marked *