XMLTagsEditHistoryDiscussion

(Also in English)

  1. Servidor
    1. DHCP
    2. NFS
  2. Cliente
    1. u-boot
  3. Un ejemplo del arranque
  4. Referencias

Gracias a u-boot también es posible usar un sistema de archivos por NFS. Si también carga el kernel usando TFTP, podrá hacer pruebas con kernels y sistemas de archivos raíz más rápido. Por supuesto, puede también grabar un kernel a la memoria flash usando el puerto serial (ejemplo con el ecb_at91), pero debido a que la transferencia por xmodem es lenta, puede que usted prefiera hacer esto para producción o cuando ya este satisfecho con un kernel y un sistema de archivos.

Servidor

Preparemos el servidor. Usamos en el ejemplo Debian GNU/Linux, pero las instrucciones también aplican a otras distribuciones con cambios menores.

DHCP

Instalemos el servidor DHCP. Puede que en la red haya otros servidores DHCP. Es importante que no haya ya un servidor DHCP corriendo en la red. Y si lo hay, tal vez no tenga que instalar uno sino usar el existente. Si tiene dudas, consulte el administrador de la red.

apt-get install dhcp

Luego edite el archivo /etc/dhcpd.conf. Acá hay un ejemplo, cámbielo para adaptarlo a sus necesidades.

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

Ahora instalemos un servidor NFS. Note que estamos usando permisos relajados acá. Cualquiera en la sub-red podrá montar el directorio expuesto.

 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)

Recuerde copiar un sistema de archivos raíz en /home/ecbat91/rootfs.

Cliente

Configuremos el cliente.

u-boot

Este es el entorno que usamos en u-boot. Note que también está configurado para cargar el kernel usando TFTP. La variable más importante acá es 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 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:
stdin=serial
stdout=serial
stderr=serial

Un ejemplo del arranque


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

Y ahí continuá el sistema operativo arrancando. Usar TFTP y el sistema de archivos raíz sobre NFS puede ser muy útil.

Referencias

Last update: 2007-05-09 (Rev 288)

svnwiki $Rev: 12966 $