Partitioning and formatting the flash card
Create a single partition on the flash card and put an ext2 filesystem on it. Don’t forget to erase any existing partitions first. Afterwards, mount the newly create filesystem. Note that we are using an Ext2 filesystem. Using a journaled filesystem such as Ext3 is not a good idea, as this creates extra wear on your flash card.
fdisk /dev/sdb
mkfs.ext2 /dev/sdb1
mkdir /mnt/cf
mount /dev/sdb1 /mnt/cf
Loading a basic debian system on the CF
debootstrap --arch i386 squeeze /mnt/cf http://ftp.debian.org/debian
Mount special filesystems and chroot
mount -t proc none /mnt/cf/proc
mount -t sysfs none /mnt/cf/sys
mount -o bind /dev /mnt/cf/dev/
LC_ALL=C chroot /mnt/cf /bin/bash
mount devpts /dev/pts -t devpts
Filesystems
In order to minimize wear on the flash card, noatime was added to the mount options. This prevents the filesystem from updating access times. The tmpfs memory filesystem was used for some of the folders, basically for the same reason (minimize wear). The CF will be /dev/sda once installed in the Alix. Edit the file /etc/fstab :
proc /proc proc noatime,defaults 0 0
/dev/sda1 / ext2 noatime,defaults 0 1
tmpfs /tmp tmpfs noatime,defaults 0 0
tmpfs /var/tmp tmpfs noatime,defaults 0 0
tmpfs /var/run tmpfs noatime,defaults 0 0
tmpfs /var/log tmpfs noatime,defaults 0 0
tmpfs /var/lock tmpfs noatime,defaults 0 0
Network configuration
Edit the file /etc/network/interfaces. The example below will configure one of the network interfaces with IP address 192.168.1.250. Feel free to edit these values for your specific situation.
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.250
netmask 255.255.255.0
Serial console
Disable TTYs and put a getty on the serial console. Edit the file /etc/inittab :
#1:2345:respawn:/sbin/getty 38400 tty1
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6
T0:23:respawn:/sbin/getty -L ttyS0 19200 vt100
Grub: preparations
Install the grub package on the CF and create the file menu.lst, which will be used later on. Don’t configure grub at this stage.
apt-get install grub
cp /usr/lib/grub/i386-pc/* /boot/grub
Create /boot/grub/menu.lst (flash card will be sda on Alix):
default 0
timeout 5
serial --unit=0 --speed=19200 --word=8 --parity=no --stop=1
terminal --timeout=5 serial console
title Debian
root (hd0,0)
kernel /vmlinuz root=/dev/sda1 ro console=ttyS0,19200n8
initrd /boot/initrd.img
Install the kernel
We will install a 486 kernel, as this seems to be the best option for the CPU present in the Alix. More information about this can be found via the links at the bottom of this post.
apt-get install linux-image-486
Final customizations
Change the root password:
passwd root
Install the SSH server daemon. You can skip this skip if console access via serial connection is sufficient.
apt-get install openssh-server
Disable udev network interface rules:
rm /etc/udev/rules.d/70-persistent-net.rules
chmod 444 /lib/udev/write_net_rules
Configure the locale to en_US.UTF-8:
apt-get install locales
dpkg-reconfigure locales
Create the file setlocale.sh in /etc/profile.d, with the following contents:
#!/bin/bash
export LC_ALL=en_US.UTF-8
Final steps before booting the Alix
umount /dev/pts
Exit the chroot & umount special filesystems:
exit
umount /mnt/cf/proc
umount /mnt/cf/sys
umount /mnt/cf/dev/
Install grub in the MBR & umount the flash card:
grub-install --no-floppy --root-directory=/mnt/cf /dev/sdb
umount /mnt/cf
Login with the root user and the password you picked in one of the previous steps. Next, edit the file /etc/default/grub :
GRUB_CMDLINE_LINUX_DEFAULT="console=ttyS0,19200n8"
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=19200 --unit=0 --word=8 --parity=no --stop=1"
Now run:
update-grub
It's done !
-- Voir aussi --