Creating a Debian Image
From PlugWiki
Creating a Debian image for the Sheeva Plug
(rough draft / framework)
On an existing Debian system you will first need the utility debootstrap
apt-get install debootstrap
Move on to setting up the image. The "armel" architecture will run on the plug. We will use debootstrap to create the base installation.
mkdir debian-plug debootstrap --verbose --foreign --arch armel lenny debian-plug http://ftp.debian.org/debian
At this point you will need to copy the contents of the debian-plug directory onto a flashdrive (512MB or more). Boot the plug computer and via console or SSH login and mount the flash drive.
mount /dev/sda1 /mnt mount -t proc proc /mnt/proc chroot /mnt /debootstrap/debootstrap --second-stage
If you are building on a non arm architecture (such as x86 or amd64) then you will most likely get the error message: chroot: cannot run command `/bin/bash': No such file or directory. To fix this, make sure qemu-arm-static is installed and copy /usr/bin/qemu-arm-static to /mnt/usr/bin.
You will need to create the following files on the image:
/etc/resolv.conf
# replace here the name server of your ISP nameserver 4.2.2.2
/etc/hosts
127.0.0.1 localhost
/etc/network/interfaces
auto lo iface lo inet loopback auto eth0 iface eth0 inet dhcp
/etc/hostname
debian
/etc/apt/sources.list
deb http://ftp.us.debian.org/debian/ lenny main contrib non-free deb http://security.debian.org/ lenny/updates main contrib non-free deb http://volatile.debian.org/debian-volatile lenny/volatile main contrib non-free
/etc/fstab should look similar to this:
/dev/root / ext3 defaults,rw 0 1 #lines below are optional uncomment to use #tmpfs /var/run tmpfs size=1M,rw,nosuid,mode=0755 0 0 #tmpfs /var/lock tmpfs size=1M,rw,noexec,nosuid,nodev,mode=1777 0 0 #tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0
Install udev:
apt-get install udev
Edit your /etc/inittab file to include the line:
T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100
Comment out the following lines in /etc/inittab by putting a # in front of them as they are useless for a headless system:
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
/etc/default/locale
LANG="C"
Set the root password:
passwd root
At this point you can run "apt-get update" and "apt-get install" to add additional packages to your system. I would recommend the openssh-server as a start as well as udev and locales.
Ready to attempt to try out your filesystem?
umount /mnt/proc umount /mnt reboot
Interrupt the U-boot sequence
We can test the filesystem on the flash drive without modifying u-boot. The parameters below will only be effective for this boot and will reset on reboot.
Run the commands:
set bootargs 'console=ttyS0,115200 mtdparts=nand_mtd:0x400000@0x100000(uImage),0x1fb00000@0x500000(rootfs) rw root=/dev/sda1 rw rootdelay=10' boot
Links
- More detailed instructions: http://blog.bofh.it/debian/id_265
