Debian Root File System

From Gumstix User Wiki
Revision as of 07:19, 20 February 2012 by Dan Nelson (Talk | contribs) (Created page with "This how-to describes the procedure to build a Debian root file system. I originally installed an Emdebian file system, but had dependency problems with some packages. But with...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This how-to describes the procedure to build a Debian root file system. I originally installed an Emdebian file system, but had dependency problems with some packages. But with the generous amount of memory on a micro SD card there's no reason not to build Debian itself. I worked from the command line of Ubuntu.

Start by creating a bootable micro SD card following the instructions on the Gumstix wiki. This will have the Angstrom distro that Gumstix uses. We can take the kernel modules from the Angstrom root file system along with some other files. Log into Angstrom on Gumstix and go to /lib/modules. You will see a directory named something similar to 2.6.39. This contains all the kernel modules. Tar it up:

$ tar zcvf modules.tar.gz 2.6.39/

Now copy it to your development machine:

$ scp module.tar.gz ip.address.of.dev.machine:/path/to/dev/area

You can scp /etc/inittab, /etc/fstab and /etc/network/interfaces as well. Use these as a reference in when you build your Debian root file system.

The Debian root file system is built with 'debootstrap'. Install it with apt-get, along with 'qemu-arm-static' (qemu-user-static on Debian):

$ sudo apt-get install debootstrap qemu-arm-static

Once these are installed run the following:

$ sudo debootstrap --foreign --verbose --arch=armel --include=debootstrap,vim-nox,openssh-server --exclude=nano squeeze ./squeeze http://ftp.au.debian.org/debian

The --include option must include debootstrap, the others are optional. I prefer vim to the standard vim-tiny, vim-nox is the non-gui version. I don't use nano so I've excluded it from the build. The above command will download the required packages and create a squeeze root file system in a directory called squeeze.

Now we chroot into our newly created file system to finish off. But the packages in the new file system are for the arm architecture so we need an emulator. We installed it onto our development machine earlier, copy the relevant file:

$ cp /usr/bin/qemu-are-static squeeze/usr/bin

Now chroot into our new file system:

$ sudo chroot squeeze

You will see a directory named debootstrap. Go to it:

$ cd debootstrap

Finish off the installation:

$ ./debootstap -- second-stage

The above command will install all the Debian packages into our file system.

We now need to create a password for the root user or we'll have a system that we can't log into:

$ passwd

Delete the .deb packages now that we've installed them:

$ apt-get clean

With that done we can exit:

$ exit

Our root file system needs kernel modules:

$ tar zxvf modules.tar.gz squeeze/lib/modules