How to create bare minimum Debian Wheezy rootfs from scratch

debian-wheezy-download

In this post we will explain how you can create your own Debian rootfs with pre-installed packages of your choice, which to allow tiny Linux images to be created.

All steps below should work on any Debian host (Debian/Ubuntu etc) and are verified with Ubuntu 12.04LTS.

First of all you need to install the support packages on your pc

sudo apt-get install qemu-user-static debootstrap binfmt-support

 

Next you need to choose the version of Debian in this case we are building a wheezy image.

targetdir=rootfs
distro=wheezy

 

Now we will build first stage of Debian rootfs :

mkdir $targetdir
sudo debootstrap --arch=armhf --foreign $distro $targetdir

 

Next copy the qemu-arm-static binary into the right place for the binfmt packages to find it and copy in resolv.conf from the host.

sudo cp /usr/bin/qemu-arm-static $targetdir/usr/bin/
sudo cp /etc/resolv.conf $targetdir/etc

 

If everything is right we now have a minimal Debian Rootfs

sudo chroot $targetdir

 

Inside the chroot we need to set up the environment again

distro=wheezy
export LANG=C

 

Now we are setup the second stage of debootstrap needs to run install the packages downloaded earlier

/debootstrap/debootstrap --second-stage

 

Once the package installation has finished, setup some support files and apt configuration.

 

cat <<EOT > /etc/apt/sources.list
deb http://ftp.uk.debian.org/debian $distro main contrib non-free
deb-src http://ftp.uk.debian.org/debian $distro main contrib non-free
deb http://ftp.uk.debian.org/debian $distro-updates main contrib non-free
deb-src http://ftp.uk.debian.org/debian $distro-updates main contrib non-free
deb http://security.debian.org/debian-security $distro/updates main contrib non-free
deb-src http://security.debian.org/debian-security $distro/updates main contrib non-free
EOT
 

Update Debian package database:

apt-get update

 

set up locales dpkg scripts tend to complain otherwise, note in jessie you will also need to install the dialog package as well.

 

apt-get install locales dialog
dpkg-reconfigure locales

 

Install some useful packages inside the chroot

apt-get install openssh-server ntpdate

 

Set a root password so you can login

passwd

 

Build a basic network interface file so that the board will DHCP on eth0

echo <<EOT >> /etc/network/interfaces
allow-hotplug eth0
iface eth0 inet static
	address 192.168.1.254
	netmask 255.255.255.248
	gateway 192.168.1.1	
EOT

 

Note: Your board will be accessible over SSH on IP address defined above !

 

Set the hostname

echo nameme > /etc/hostname

 

Enable the serial console, Debian sysvinit way

echo T0:2345:respawn:/sbin/getty -L ttyS0 115200 vt100 >> /etc/inittab

 

We are done inside the chroot, so quit the chroot shell

exit

 

Tidy up the support files

sudo rm $targetdir/etc/resolv.conf
sudo rm $targetdir/usr/bin/qemu-arm-static

 

Now you have your Debian rootfs. Next step is to build Kernel, Uboot and to make your SD-card as explained in our early posts and Build instructions but instead to use the rootfs in the posts you can use your own minimal rootfs which you created above. The rootfs image created above is approx 150MB, it could be made smaller if you remove more packages.

Special thanks to Dimitar Gamishev (aka HEHOPMAJIEH) for creating this tutorial.

A13-OLinuXino-(WIFI) Debian Build with Kernel 3.4.90+

Image

 

A while ago we put on our Forum wishlist for the next Debian release, now in this Debian release we implemented most of the requests we read on the forum.

Here is Debian image for A13-OLinuXino-(WiFi) with Kernel 3.4.90+

Here is Building description.

Here is List of installed packages.

Here is image description.

A13-SOM-XXX Debian build with Kernel 3.4.90+ and many new features

Image

Here is Debian image for A13-SOM-256 with Kernel 3.4.90+

Here is Debian image for A13-SOM-512 with Kernel 3.4.90+

Here is Building description.

Here is List of installed packages.

Here is image description.

A10-OLinuXino-LIME Debian Build with Kernel 3.4.90+

Image

 

A while ago we put on our Forum wishlist for the next Debian release, now in this Debian release we implemented most of the requests we read on the forum.

Here is Debian image for A10-OLinuXino-LIME with Kernel 3.4.90+

Here is Building description.

Here is List of installed packages.

Here is image description.

New Product in Stock: A13-SOM-256, A13-SOM-512, A13-SOM-WIFI, A13-SOM-WIFI-4GB

Image

A13-SOM-256 and A13-SOM-512 the smallest SOM modules for Allwinner A13 Cortex-A8 processors are now in stock.

Image

A13-SOM-WIFI add internet connectivity, A13-SOM-WIFI-4GB adds also 4GB NAND to run Android.

A20-SOM Debian with Kernel 3.4.79+ building

 

Image

 

We completed Debian image for A20-SOM with Kernel 3.4.79+

Here is Building description.

Here is List of installed packages.

Here is image description.

 

Digikey’s Wiki for A10-OLinuXino-LIME is up with instructions how to make Debian 7 and Ubuntu 13.10 images

Image

 

Robert Nelson again did a great job with Digikey’s Wiki and instructions how to build Debian 7 and Ubuntu 13.10 images with Linux-Next Kernel and uboot.

Previous Older Entries Next Newer Entries