Booting using NFS and TFTP (updated)

Rather than slowly wearing out your NAND flash you can boot the mini2440 over a network by loading the kernel using TFTP and the OS from an NFS share. This also makes it much faster to test changes. Using Fedora 11 you can use YUM to install tftp, tftp-server and nfs-utils.

yum install tftp tftp-server nfs-utils

I created a folder /home/doug/mini2440/root_fs and added the following line to /etc/exports to allow r/w access from 192.168.1.*:

/home/doug/mini2440/root_fs 192.168.1.1/24(rw,sync,no_root_squash)

..and extracted the Angstrom file system as root to /home/doug/mini2440/root_fs

You’ll need to edit /etc/xinetd.d/tftp to setup TFTP. Mine is posted below for reference, you at least need to set disable = no.

# default: off
# description: The tftp server serves files using the trivial file transfer
#    protocol.  The tftp protocol is often used to boot diskless
#    workstations, download configuration files to network-aware printers,
#    and to start the installation process for some operating systems.
service tftp
{
disable    = no
socket_type        = dgram
protocol        = udp
wait            = yes
user            = root
server            = /usr/sbin/in.tftpd
server_args        = -s /home/doug/mini2440/kernel
per_source        = 11
cps            = 100 2
flags            = IPv4
}

I then started the services :

/etc/init.d/nfs start

/sbin/service xinetd start

To automate these i think you can do:

chkconfig tftp on

chkconfig xinetd on

chkconfig nfs on

Next i edited the uboot environment. Use the command setenv to modify or add entries and savenev when you’re finished. I ended up with the following:

MINI2440 # printenv
bootdelay=3
baudrate=115200
ethaddr=08:08:11:18:12:27
usbtty=cdc_acm
mtdparts=mtdparts=mini2440-nand:256k@0(u-boot),128k(env),5m(kernel),-(root)
mini2440=mini2440=0tb
bootargs_base=console=ttySAC0,115200 noinitrd
bootargs_init=init=/sbin/init
root_nand=root=/dev/mtdblock3 rootfstype=jffs2
root_mmc=root=/dev/mmcblk0p2 rootdelay=2
root_nfs=/mnt/nfs
set_root_nfs=setenv root_nfs root=/dev/nfs rw nfsroot=${serverip}:${root_nfs}
ifconfig_static=run setenv ifconfig ip=${ipaddr}:${serverip}::${netmask}:mini2440:eth0
ifconfig_dhcp=run setenv ifconfig ip=dhcp
ifconfig=ip=dhcp
set_bootargs_mmc=setenv bootargs ${bootargs_base} ${bootargs_init} ${mini2440} ${root_mmc}
set_bootargs_nand=setenv bootargs ${bootargs_base} ${bootargs_init} ${mini2440} ${root_nand}
set_bootargs_nfs=run set_root_nfs; setenv bootargs ${bootargs_base} ${bootargs_init} ${mini2440} ${root_nfs} ${ifconfig}
mtdids=nand0=mini2440-nand
bootargs=console=ttySAC0,115200 noinitrd init=/sbin/init mini2440=0tb ip=192.168.1.85 root=/dev/nfs rw nfsroot=192.168.1.10:/home/doug/mini2440/root_fs
bootfile="uImage"
filesize=1E9088
fileaddr=32000000
gatewayip=192.168.1.100
netmask=255.255.255.0
ipaddr=192.168.1.85
serverip=192.168.1.10
bootcmd=tftp;bootm 32000000
partition=nand0,0
mtddevnum=0
mtddevname=u-boot

Note when you setenv you have to omit the = sign. Obviously you’ll want to change some of this to suit your network setup. Here my laptop is 192.168.1.10 and 192.168.1.100 is my pfsense box which is assigning 192.168.1.85 to the mini2440 by DHCP.

When you boot the system uboot will download the kernel over TFTP and then mount the NFS share.

If you have DHCP on your network Angstrom should automatically get an IP. You can skip the rest in this case!

If you want a static address you can change /etc/network/interfaces. I simply changed dhcp to static for eth0:

iface eth0 inet static

And after this the system booted up fine. Lastly i have a note which says I deleted the symlink /etc/resolve.conf and replaced it with:

domain local
search local
nameserver 192.168.1.100

Be warned that the the entire of above needs to be compliant with your firewall and selinux, it won’t work otherwise!

I found the following Links helpful:

TFTP

NFS

U-boot NFS / TFTP boot

5 Replies to “Booting using NFS and TFTP (updated)”

  1. Dear Friends,
    I have build an openembedded distrubition for mini2440 . I have copied
    mini2440-base-image.tar.gz to my host pc and I arrenged a NFS for cross
    building. It works OK , but when I copied and extract the
    mini2440-console-image.tar.gz , my NFS is not responding. Do you have any
    advice for me? I copied my minicom console messages and attached it.

    Also I tried with rootfs for NFS sistem below link, but it is still not
    responding.

    http://mini2440.googlecode.com/files/Angstrom-mini2440-image-glibc-ipk-2009.X-test-20090405-mini2440.rootfs.tar.bz2

    U-Boot 1.3.2-mini2440 (Oct 6 2009 – 12:51:09)

    I2C: ready
    DRAM: 64 MB
    Flash: 2 MB
    NAND: Bad block table not found for chip 0
    Bad block table not found for chip 0
    128 MiB
    Found Environment offset in OOB..
    USB: S3C2410 USB Deviced
    In: serial
    Out: serial
    Err: serial
    MAC: 08:08:11:18:12:27
    Hit any key to stop autoboot: 0
    dm9000 i/o: 0x20000300, id: 0x90000a46
    DM9000: running in 16 bit mode
    MAC: 08:08:11:18:12:27
    TFTP from server 192.168.1.10; our IP address is 192.168.1.85
    Filename ‘uImage.bin’.
    Load address: 0x32000000
    Loading: checksum bad
    checksum bad
    T #################################################################
    #################################################################
    #########
    done
    Bytes transferred = 2031220 (1efe74 hex)
    ## Booting kernel from Legacy Image at 32000000 …
    Image Name: Angstrom/2.6.31+git/mini2440
    Created: 2009-10-30 9:06:09 UTC
    Image Type: ARM Linux Kernel Image (uncompressed)
    Data Size: 2031156 Bytes = 1.9 MB
    Load Address: 30008000
    Entry Point: 30008000
    Verifying Checksum … OK
    Loading Kernel Image … OK
    OK

    Starting kernel …

    Uncompressing Linux…………………………………………………………………………………………………………
    Linux version 2.6.31.1 (sven@office) (gcc version 4.2.4) #1 Fri Oct 30 17:04:01 CST 2009
    CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
    CPU: VIVT data cache, VIVT instruction cache
    Machine: MINI2440
    Memory policy: ECC disabled, Data cache writeback
    CPU S3C2440A (id 0x32440001)
    S3C24XX Clocks, (c) 2004 Simtec Electronics
    S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
    CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
    Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
    Kernel command line: console=ttySAC0,115200 noinitrd init=/sbin/init mini2440=0tb ip=192.168.1.85 root=/dev/nfs rw nfsroot=192.168.1.10:/hd
    PID hash table entries: 256 (order: 8, 1024 bytes)
    Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
    Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
    Memory: 64MB = 64MB total
    Memory: 60640KB available (3568K code, 417K data, 132K init, 0K highmem)
    SLUB: Genslabs=11, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
    NR_IRQS:85
    irq: clearing pending status 02000000
    irq: clearing subpending status 00000002
    Console: colour dummy device 80×30
    console [ttySAC0] enabled
    Calibrating delay loop… 201.93 BogoMIPS (lpj=504832)
    Mount-cache hash table entries: 512
    CPU: Testing write buffer coherency: ok
    NET: Registered protocol family 16
    MINI2440: Option string mini2440=0tb
    MINI2440: LCD [0:240×320] 1:800×480 2:1024×768
    S3C2440: Initialising architecture
    S3C2440: IRQ Support
    S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
    DMA channel 0 at c4808000, irq 33
    DMA channel 1 at c4808040, irq 34
    DMA channel 2 at c4808080, irq 35
    DMA channel 3 at c48080c0, irq 36
    S3C244X: Clock Support, DVS off
    bio: create slab at 0
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    s3c-i2c s3c2440-i2c: slave address 0x10
    s3c-i2c s3c2440-i2c: bus frequency set to 98 KHz
    s3c-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
    NET: Registered protocol family 2
    IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
    TCP established hash table entries: 2048 (order: 2, 16384 bytes)
    TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
    TCP: Hash tables configured (established 2048 bind 2048)
    TCP reno registered
    NET: Registered protocol family 1
    JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
    ROMFS MTD (C) 2007 Red Hat, Inc.
    msgmni has been set to 118
    alg: No test for stdrng (krng)
    io scheduler noop registered
    io scheduler anticipatory registered (default)
    io scheduler deadline registered
    io scheduler cfq registered
    Console: switching to colour frame buffer device 60×53
    fb0: s3c2410fb frame buffer device
    s3c2440-uart.0: ttySAC0 at MMIO 0x50000000 (irq = 70) is a S3C2440
    s3c2440-uart.1: ttySAC1 at MMIO 0x50004000 (irq = 73) is a S3C2440
    s3c2440-uart.2: ttySAC2 at MMIO 0x50008000 (irq = 76) is a S3C2440
    brd: module loaded
    at24 0-0050: 1024 byte 24c08 EEPROM (writable)
    dm9000 Ethernet Driver, V1.31
    eth0: dm9000e at c486e300,c4872304 IRQ 51 MAC: 08:08:11:18:12:27 (chip)
    S3C24XX NAND Driver, (c) 2004 Simtec Electronics
    s3c24xx-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns
    s3c24xx-nand s3c2440-nand: NAND soft ECC
    NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)
    Creating 4 MTD partitions on “NAND 128MiB 3,3V 8-bit”:
    0x000000000000-0x000000040000 : “u-boot”
    ftl_cs: FTL header not found.
    0x000000040000-0x000000060000 : “u-boot-env”
    ftl_cs: FTL header not found.
    0x000000060000-0x000000560000 : “kernel”
    ftl_cs: FTL header not found.
    0x000000560000-0x000008000000 : “root”
    ftl_cs: FTL header not found.
    ohci_hcd: USB 1.1 ‘Open’ Host Controller (OHCI) Driver
    s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
    s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
    s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
    usb usb1: configuration #1 chosen from 1 choice
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 2 ports detected
    usbcore: registered new interface driver libusual
    s3c2440-usbgadget s3c2440-usbgadget: S3C2440: increasing FIFO to 128 bytes
    mice: PS/2 mouse device common for all mice
    input: gpio-keys as /devices/platform/gpio-keys/input/input0
    s3c2440-ts s3c2440-ts: Starting
    Created group ts filter len 12 depth 2 close 10 thresh 6
    Created Median ts filter len 20 depth 2 dec 24
    Created Mean ts filter len 4 depth 2 thresh 65535
    Created Linear ts filter depth 2
    s3c2440-ts s3c2440-ts: 4 filter(s) initialized
    s3c2440-ts s3c2440-ts: successfully loaded
    input: s3c2410 TouchScreen as /devices/virtual/input/input1
    S3C24XX RTC, (c) 2004,2006 Simtec Electronics
    s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling
    s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
    i2c /dev entries driver
    S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
    s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
    cpuidle: using governor ladder
    sdhci: Secure Digital Host Controller Interface driver
    sdhci: Copyright(c) Pierre Ossman
    mapped channel 0 to 0
    s3c2440-sdi s3c2440-sdi: powered down.
    s3c2440-sdi s3c2440-sdi: initialisation done.
    Registered led device: led1
    Registered led device: led2
    Registered led device: led3
    Registered led device: led4
    Registered led device: backlight
    usbcore: registered new interface driver hiddev
    usbcore: registered new interface driver usbhid
    usbhid: v2.6:USB HID core driver
    Advanced Linux Sound Architecture Driver Version 1.0.20.
    No device for DAI UDA134X
    No device for DAI s3c24xx-i2s
    S3C24XX_UDA134X SoC Audio driver
    UDA134X SoC Audio Codec
    asoc: UDA134X s3c24xx-i2s mapping ok
    ALSA device list:
    #0: S3C24XX_UDA134X (UDA134X)
    TCP cubic registered
    NET: Registered protocol family 17
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    s3c2410-rtc s3c2410-rtc: setting system clock to 2009-12-19 00:36:25 UTC (1261182985)
    eth0: link down
    IP-Config: Guessing netmask 255.255.255.0
    IP-Config: Complete:
    device=eth0, addr=192.168.1.85, mask=255.255.255.0, gw=255.255.255.255,
    host=192.168.1.85, domain=, nis-domain=(none),
    bootserver=255.255.255.255, rootserver=192.168.1.10, rootpath=
    Looking up port of RPC 100003/2 on 192.168.1.10
    eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
    Looking up port of RPC 100005/1 on 192.168.1.10
    VFS: Mounted root (nfs filesystem) on device 0:14.
    Freeing init memory: 132K
    INIT: version 2.86 booting
    Please wait: booting…
    Starting udev
    Populating dev cache
    Remounting root file system…
    Unknown HZ value! (90) Assume 100.
    ALSA: Restoring mixer settings…
    Configuring network interfaces… No state is present for card S3C24XXUDA134X
    /usr/sbin/alsactl: parse:1639: Unable to open file ‘/usr/share/alsa/init/00main’: No such file or directory
    No state is present for card S3C24XXUDA134X
    nfs: server 192.168.1.10 not responding, still trying

  2. Hi everybody,

    I have exactly the same behavior using openembedded with NFS

    I suppose that after the message “No state is present for card S3C24XXUDA134X” openembedded try to reconfig ethernet interface and fails NFS link but i don’t know what to do to avoid this.
    has anybody found a solution?
    thanks for helping me
    jmboy

  3. Hi
    I had same problem, network was reconfigured and NFS connection was lost.
    I could not find URL of the solution to post here, but I still have changed file on my rootfs.
    edit file /etc/init.d/networking on your rootfs
    find lines that look like this:
    echo -n “Configuring network interfaces… ”
    ifup -a
    echo “done.”
    and comment out second line to have something like this:
    echo -n “Configuring network interfaces… ”
    # ifup -a
    echo “done.”
    after this rootfs over NFS has no problems. At least for me.
    This looks like ugly workaround but hope it will help you.

  4. Hi, yeah, when i came across this problem i changed to a fixed IP address. The strange thing was when i tried the same thing on a different network, configured in pretty much the same way, i didn’t need to change anything. I never figured out what the difference was. Thanks for the post Irakli.

Leave a Reply

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