Aujourd'hui, toujours pas d'ADSL mais une Debian Sarge sur la carte CompactFlash qui marche parfaitement.

Procédure

Partitionnement

Après avoir testé le système de fichier racine en bootant un noyau via PXE qui le monte en NFS, je genère une image Cramfs (système de fichier compressé en lecture seule contrairement à ce qu'indique son nom). La carte flash est partitionnée de la façon suivante :

  • /dev/hda1 : 5 Mo, ext2, montée en lecteure seule sur /boot, contient notamment le noyau ainsi que la configuration de Grub
  • /dev/hda2 : 5 Mo, ext2, montée en lecture seule sur /data, contient la copie du contenu de /etc qui va être copié dans le disque mémoire lors du démarrage (permet de ne pas à avoir à regenerer le cramfs à chaque modification d'un fichier de configuration
  • /dev/hda3 : 118 Mo, cramfs, montée en lecture seule sur /, contient la racine du système de fichier (y compris un /etc puisque init va en avoir besoin avant même de pouvoir monter /dev/hda2...). L'image cramfs generée ne pèse en fait que 48 Mo.

Script de démarrage (/etc/rcS.d/S03needwrite -> /etc/init.d/needwrite)

#!/bin/sh

PATH=/lib/init:/bin:/sbin

VAR="cache lib/misc lib/urandom lib/setserial local lock log/news mail opt run/screen \
         spool/cron/crontabs spool/cron/atjobs spool/cron/atspool"

echo "Montage de /data..."
mount -t ext2 -o ro,suid,nodev,exec,nouser,async /dev/hda2 /data

echo "Montage de /boot..."
mount -t ext2 -o ro,nosuid,nodev,noexec,nouser,async /dev/hda1 /boot

echo "Montage d'un tmpfs sur needwrite..."
mount -n -t tmpfs tmpfs /needwrite

echo -n "Creation des repertoires sur needwrite... "
echo -n "var/tmp "
mkdir -p /needwrite/var/tmp
chmod 1777 /needwrite/var/tmp

echo -n "etc "
#cp -a /etc /needwrite
cp -a /data/etc /needwrite
mount -n --bind /needwrite/etc /etc

echo -n "var "
for dir in $VAR ; do
    mkdir -p /needwrite/var/${dir}
done

# utmp, btmp, wtmp & lastlog
touch /needwrite/var/run/utmp /needwrite/var/log/btmp /needwrite/var/log/wtmp /needwrite/var/log/lastlog
chgrp utmp /needwrite/var/run/utmp /needwrite/var/log/btmp /needwrite/var/log/wtmp /needwrite/var/log/lastlog
chmod 664 /needwrite/var/run/utmp /needwrite/var/log/btmp /needwrite/var/log/wtmp /needwrite/var/log/lastlog

# at directories and files
chown daemon:daemon /needwrite/var/spool/cron/atjobs /needwrite/var/spool/cron/atspool
chmod 0700 /needwrite/var/spool/cron/atjobs /needwrite/var/spool/cron/atspool
touch /needwrite/var/spool/cron/atjobs/.SEQ
chown daemon:daemon /needwrite/var/spool/cron/atjobs/.SEQ
chmod 0600 /needwrite/var/spool/cron/atjobs/.SEQ

# cron directory
chown root:crontab /needwrite/var/spool/cron/crontabs
chmod 1730 /needwrite/var/spool/cron/crontabs

mount -n --bind /needwrite/var /var

echo -n "home "
mkdir -p /needwrite/home/tux
chown tux /needwrite/home/tux
mount -n --bind /needwrite/home /home

echo "root "
mkdir -p /needwrite/root
mount -n --bind /needwrite/root /root

Le script effectue les opérations suivantes :

  • Montage de /dev/hda1 et /dev/hda2 sur /boot et /data respectivement
  • Création d'un disque mémoire (tmpfs) et montage de ce dernier sur /needwrite
  • Création d'un /needwrite/var/tmp (/tmp pointe sur /var/tmp dans le cramfs) et affectation des droits correspondant
  • Création de /needwrite/etc
  • Copie du contenu de /data/etc vers /needwrite/etc
  • Montage de /needwrite/etc à la place de /etc
  • Création de /needwrite/var et des répertoires sous-jacents nécessaires
  • Montage de /needwrite/var à la place de /var
  • Mêmes opérations pour /root et /home

Problèmes rencontrés

  • Grub passe en paramètre au noyau console=/dev/ttyS0,19200n8 afin d'avoir les messages de démarrage sur la console série. Ceci fonctionne bien, y compris lors du démarrage de init sauf si le /dev n'est pas peuplé lors du démarrage d'init (j'utilise udev pour peupler automatiquement /dev (mais après le demarrage de init) mais dans les premières images cramfs que j'avais generées, le /dev était vide donc init ne trouvait pas /dev/ttyS0)
  • Kernel Oops lors du démarrage d'init à partir de l'image cramfs pour le premier noyau que j'ai testé (un 2.6.8 patché Debian). Pas de problèmes avec le 2.6.11.8.

Prochaines étapes

Quelques informations supplémentaires sur la net4801

/proc/cpuinfo

processor	: 0
vendor_id	: Geode by NSC
cpu family	: 5
model		: 9
model name	: Unknown
stepping	: 1
cpu MHz		: 266.655
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 2
wp		: yes
flags		: fpu tsc msr cx8 cmov mmx pni cxmmx
bogomips	: 524.28

Boot d'un noyau 2.6.11.8

Linux version 2.6.11.8 (tux@thinkpad) (version gcc 3.3.5 (Debian 1:3.3.5-8)) #1 Sat Apr 30 18:25:51 CEST 2005
BIOS-provided physical RAM map:
 BIOS-e820: 0000000000000000 - 000000000009fc00 (usable)
 BIOS-e820: 000000000009fc00 - 00000000000a0000 (reserved)
 BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
 BIOS-e820: 0000000000100000 - 0000000008000000 (usable)
 BIOS-e820: 00000000fff00000 - 0000000100000000 (reserved)
128MB LOWMEM available.
On node 0 totalpages: 32768
  DMA zone: 4096 pages, LIFO batch:1
  Normal zone: 28672 pages, LIFO batch:7
  HighMem zone: 0 pages, LIFO batch:1
DMI not present.
Allocating PCI resources starting at 08000000 (gap: 08000000:f7f00000)
Built 1 zonelists
Kernel command line: root=/dev/hda3 ro console=ttyS0,19200n8 
Initializing CPU#0
PID hash table entries: 1024 (order: 10, 16384 bytes)
Detected 266.655 MHz processor.
Using tsc for high-res timesource
Console: colour dummy device 80x25
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 126152k/131072k available (1859k kernel code, 4472k reserved, 747k data, 144k init, 0k highmem)
Checking if this processor honours the WP bit even in supervisor mode... Ok.
Calibrating delay loop... 524.28 BogoMIPS (lpj=262144)
Mount-cache hash table entries: 512 (order: 0, 4096 bytes)
CPU: After generic identify, caps: 00808131 01818131 00000000 00000000 00000000 00000000 00000000
CPU: After vendor identify, caps: 00808131 01818131 00000000 00000000 00000000 00000000 00000000
CPU: After all inits, caps: 00808131 00818131 00000000 00000001 00000000 00000000 00000000
CPU: NSC Unknown stepping 01
Checking 'hlt' instruction... OK.
NET: Registered protocol family 16
PCI: PCI BIOS revision 2.00 entry at 0xf7861, last bus=0
PCI: Using configuration type 1
mtrr: v2.0 (20020519)
SCSI subsystem initialized
usbcore: registered new driver usbfs
usbcore: registered new driver hub
PCI: Probing PCI hardware
PCI: Probing PCI hardware (bus 00)
scx200: NatSemi SCx200 Driver
scx200: GPIO base 0x6100
Initializing Cryptographic API
Real Time Clock Driver v1.12
scx200_gpio: NatSemi SCx200 GPIO Driver
scx200_gpio: got dynamic major 254
i8042.c: Can't read CTR while initializing i8042.
Serial: 8250/16550 driver $Revision: 1.90 $ 6 ports, IRQ sharing disabled
ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
ttyS1 at I/O 0x2f8 (irq = 3) is a 16550A
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
loop: loaded (max 8 devices)
natsemi dp8381x driver, version 1.07+LK1.0.17, Sep 27, 2002
  originally by Donald Becker <becker@scyld.com>
  http://www.scyld.com/network/natsemi.html
  2.4.x kernel port by Jeff Garzik, Tjeerd Mulder
natsemi eth0: NatSemi DP838156 at 0xa0000000 (0000:00:06.0), 00:00:24:c4:2f:fc, IRQ 10, port TP.
natsemi eth1: NatSemi DP838156 at 0xa0001000 (0000:00:07.0), 00:00:24:c4:2f:fd, IRQ 10, port TP.
natsemi eth2: NatSemi DP838156 at 0xa0002000 (0000:00:08.0), 00:00:24:c4:2f:fe, IRQ 10, port TP.
PPP generic driver version 2.4.2
PPP Deflate Compression module registered
PPP BSD Compression module registered
NET: Registered protocol family 24
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
ide: Assuming 33MHz system bus speed for PIO modes; override with idebus=xx
SC1200: IDE controller at PCI slot 0000:00:12.2
SC1200: chipset revision 1
SC1200: not 100% native mode: will probe irqs later
    ide0: BM-DMA at 0xe000-0xe007, BIOS settings: hda:pio, hdb:pio
    ide1: BM-DMA at 0xe008-0xe00f, BIOS settings: hdc:pio, hdd:pio
Probing IDE interface ide0...
hda: SanDisk SDCFH-128, CFA DISK drive
SC1200: set xfer mode failure
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
Probing IDE interface ide1...
Probing IDE interface ide1...
Probing IDE interface ide2...
Probing IDE interface ide3...
Probing IDE interface ide4...
Probing IDE interface ide5...
hda: max request size: 128KiB
hda: 250880 sectors (128 MB) w/1KiB Cache, CHS=980/8/32
hda: cache flushes not supported
 hda: hda1 hda2 hda3
ohci_hcd: 2004 Nov 08 USB 1.1 'Open' Host Controller (OHCI) Driver (PCI)
ohci_hcd 0000:00:13.0: Compaq Computer Corporation ZFMicro Chipset USB
ohci_hcd 0000:00:13.0: irq 11, pci mem 0xa0003000
ohci_hcd 0000:00:13.0: new USB bus registered, assigned bus number 1
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
mice: PS/2 mouse device common for all mice
u32 classifier
    Perfomance counters on
    OLD policer on 
NET: Registered protocol family 2
IP: routing cache hash table of 1024 buckets, 8Kbytes
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
GRE over IPv4 tunneling driver
ip_conntrack version 2.1 (1024 buckets, 8192 max) - 212 bytes per conntrack
ip_tables: (C) 2000-2002 Netfilter core team
ipt_recent v0.3.1: Stephen Frost <sfrost@snowman.net>.  http://snowman.net/projects/ipt_recent/
Initializing IPsec netlink socket
NET: Registered protocol family 1
NET: Registered protocol family 17
NET: Registered protocol family 15
 hda: hda1 hda2 hda3
 hda: hda1 hda2 hda3
 hda: hda1 hda2 hda3
VFS: Mounted root (cramfs filesystem) readonly.
Freeing unused kernel memory: 144k freed
eth0: DSPCFG accepted after 0 usec.
eth0: link up.
eth0: Setting full-duplex based on negotiated link capability.