XMLTagsEditHistoryDiscussion (2)

(También en Español)

  1. Intro
  2. Server
    1. DHCP
    2. NFS
  3. Client
    1. u-boot
  4. A boot log
  5. References

Intro

Thanks to u-boot, we can use a root file-system over NFS. If you also load the kernel using TFTP, you will be able to make tests with kernels and root file-systems faster. You can of course upload a kernel to the flash memory using the serial port (example with the ecb_at91), but since the xmodem transfer is slow, you might want to defer that for production or when you already have a kernel and file-system you're happy with.

Server

Let's prepare the server. We use Debian GNU/Linux as an example, but those instructions should be applicable to other Distributions.

DHCP

Let's install the DHCP server. You might have conflicting DHCP servers in your network so make sure that there is no DHCP server already running and that you will not interfere with normal network operator. Ask your network administrator if you have one. Perhaps you don't need to install one and rather use the one available.

apt-get install dhcp

Then edit /etc/dhcpd.conf. Here is one example. Change it to match your needs.

option domain-name "emqbit.com";
option domain-name-servers 192.168.0.1;
default-lease-time 600;
max-lease-time 7200;

subnet 192.168.0.0 netmask 255.255.255.0
{
  range 192.168.0.2 192.168.0.4;
  option routers 192.168.0.1;
}

NFS

Let's install a NFS server. Note that we are using liberal permissions here. Anyone in your subnet would be able to mount the directory.

 apt-get install nfs-kernel-server

Edit /etc/exports.

/home/ecbat91/rootfs 192.168.0.0/255.255.255.0(rw,no_root_squash,sync,no_subtree_check)

Remember to copy a root file-system in /home/ecbat91/rootfs.

Client

Let's configure the client.

u-boot

This is the environment we use in u-boot. Note that it's also configured to load the kernel using TFTP. The important variable here is bootargs.

baudrate=115200
ethaddr=00:00:00:00:00:5b
loadaddr=0x20200000
bootdelay=1
bootfile="ecb_at91.img"
bootcmd=bootm 20200000
boot_flash=bootm C0020000
filesize=1616a2
fileaddr=20200000
gatewayip=192.168.0.1
netmask=255.255.255.0
ipaddr=192.168.0.2
serverip=192.168.0.1
bootargs=mem=32M root=/dev/nfs nfsroot=<server-ip>:/home/n/at91/rootfs ip=<ecb-at91-ip>:<server-ip>:<gateway-ip>:<netmask>::eth0:
stdin=serial
stdout=serial
stderr=serial

Remember to replace the following variables with your own data.

 <server-ip>
 <ecb-at91-ip>
 <server-ip>
 <gateway-ip>
 <netmask>

A boot log


Initializing SDRAM
64MB?
32MB?
Writing... Reading...
Memory size : 32 MB

1: Upload loader to Dataflash with vector 6 modification.
2: Upload u-boot to Dataflash.
3: Upload Linux to Dataflash
4: Start u-boot
5: Upload Filesystem image
6: Memory test
DataFlash:AT45DB161
Dataflash read successful: Starting U-boot


U-Boot 1.1.4 (Nov 15 2006 - 21:52:01)

U-Boot code: 21F00000 -> 21F1684C  BSS: -> 21F338C4
RAM Configuration:
Bank #0: 20000000 32 MB
Atmel: Flash:  0 kB
DataFlash:AT45DB161
Nb pages:   4096
Page Size:    528
Size= 2162688 bytes
Logical address: 0xC0000000
Area 0: C0000000 to C0007FFF (RO)
Area 1: C0008000 to C001FFFF (RO)
Area 2: C0020000 to C0027FFF
Area 3: C0028000 to C020FFFF
In:    serial
Out:   serial
Err:   serial
MAC: error during MII initialization
Hit any key to stop autoboot:  0
ecb_at91 >tftp
TFTP from server 192.168.0.1; our IP address is 192.168.0.2
Filename 'ecb_at91.img'.
Load address: 0x20200000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #######################
done
Bytes transferred = 1446678 (161316 hex)
ecb_at91 >
cb_at91 >boot
## Booting image at 20200000 ...
   Image Name:   Linux Kernel Image
   Image Type:   ARM Linux Kernel Image (gzip compressed)
   Data Size:    1446614 Bytes =  1.4 MB
   Load Address: 20008000
   Entry Point:  20008000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel ...

Linux version 2.6.20 (n@gaira) (gcc version 4.1.1) #4 PREEMPT Sat Feb 17 19:03:23 COT 2007
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0003177
Machine: Atmel AT91RM9200-DK
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 179 MHz, master 59 MHz, main 18.432 MHz
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists.  Total pages: 8128
Kernel command line: mem=32M rootfstype=reiserfs root=/dev/nfs nfsroot=192.168.0.1:/home/n/at91/rootfs ip=:192.168.0.2:192.168.0.1:192.168.0.1:255.255.255.0::eth0:
AT91: 96 gpio irqs in 3 banks
PID hash table entries: 128 (order: 7, 512 bytes)
Console: colour dummy device 80x30
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 32MB = 32MB total
Memory: 29356KB available (2744K code, 246K data, 92K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 1024 bind 512)
TCP reno registered
NetWinder Floating Point Emulator V0.97 (double precision)
io scheduler noop registered
io scheduler anticipatory registered (default)
atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
atmel_usart.1: ttyS1 at MMIO 0xfffc0000 (irq = 6) is a ATMEL_SERIAL
nbd: registered device at major 43
eth0: Link now 100-FullDuplex
eth0: AT91 ethernet at 0xfefbc000 int=24 100-FullDuplex (00:00:00:00:00:5b)
eth0: Intel LXT971A PHY
at91_ohci at91_ohci: AT91 OHCI
at91_ohci at91_ohci: new USB bus registered, assigned bus number 1
at91_ohci at91_ohci: irq 23, io mem 0x00300000
usb usb1: Product: AT91 OHCI
usb usb1: Manufacturer: Linux 2.6.20 ohci_hcd
usb usb1: SerialNumber: at91
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mice: PS/2 mouse device common for all mice
AT91 MMC: 4 wire bus mode not supported by this driver - using 1 wire
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
eth0: Link now 100-FullDuplex
Sending DHCP requests .., OK
IP-Config: Got DHCP answer from 192.168.0.1, my address is 192.168.0.3
IP-Config: Unable to set interface netmask (-22).
Looking up port of RPC 100003/2 on 192.168.0.1
Looking up port of RPC 100005/1 on 192.168.0.1
VFS: Mounted root (nfs filesystem).
Freeing init memory: 92K
INIT: version 2.86 booting

And so on. Good luck. Using TFTP and root over NFS can help you a lot. As a final tip, if you want to boot this way automatically, you can define the following variable in the U-boot environment:

setenv bootcmd 'tftp;bootm 20200000'

References

Last update: 2007-06-11 (Rev 338)

svnwiki $Rev: 12966 $