# create 2GB image file (adjust size if desired) dd if=/dev/zero of=/path/to/image_file bs=1M count=2048 # format image file with ext2 (or ext3 etc.) mkfs.ext2 /path/to/image_file # mount image mount -o loop /path/to/image_file /mountpoint # install base system (if you ommit --arch debootstrap will use the host's architecture, armel on an N900, armhf on a Cubieboard2; chose the Debian mirror closest to your location [1]) debootstrap --arch=armhf wheezy /mountpoint http://ftp.de.debian.org/debian # copy /etc/apt sources.list and /etc/apt/apt.conf (I don't want suggests and recommends [2]) from host system cp /etc/apt/sources.list /mountpoint/etc/apt/ cp /etc/apt/apt.conf /mountpoint/etc/apt/ # In the image /var/run is a symlink to /run. For pulseaudio and dbus to work we need this to be swapped (the missing /mountpoint in the last line is not a typo) rm -rf /mountpoint/var/run mkdir /mountpoint/var/run rm -rf /mountpoint/run ln -s /var/run /mountpoint/run # we also need directories for pulse and dbus in /var/run mkdir /mountpoint/var/pulse mkdir /mountpoint/var/dbus # replace standard keyboard layout in the chroot with N900 keyboard (assuming you are already on the N900) rm -rf /mountpoint/usr/share/X11/xkb/* cp -r /usr/share/X11/xkb/* /mountpoint/usr/share/X11/xkb/ # chroot into image (everything after this step will happen in the chroot unless indicated otherwise) mount -o bind /proc /mountpoint/proc mount -o bind /sys /mountpoint/sys mount -o bind /dev/pts /mountpoint/dev/pts chroot /mountpoint # update apt and install additional required packages (add any packages you like) apt-get update apt-get install locales lxde-core dbus-x11 roxterm-gtk2 lxde-icon-theme xserver-xephyr bash-completion sudo libgtkstylus pulseaudio # fix this locales warning we just received (adjust the locale if you wish; info from here [3]) export LANGUAGE=en_US.UTF-8 export LANG=en_US.UTF-8 export LC_ALL=en_US.UTF-8 locale-gen en_US.UTF-8 dpkg-reconfigure locales # replace Debian's pulseaudio packages with recompiled ones, either from the provided archive or your own ones (see [4]) dpkg -i pulseaudio_2.0-6.1_armhf.deb libpulse0_2.0-6.1_armhf.deb # make sure they won't be overwritten by future Debian updates (note: if you use synaptic you have to hold them there as well because synaptic doesn't care for what dpkg says) echo pulseaudio hold |dpkg --set-selections echo libpulse0:armhf hold |dpkg --set-selections # also hold xkb-data (this is where the keyboard layout comes from) echo xkb-data hold |dpkg --set-selections # you'll need these binaries for keyboard focus in the chroot (take them from the provided archive, an existing image you have, or compile them on your own; sources are here [5][6]) /sbin/qobi-wmhint-fix /usr/bin/set-focus # if you use the provided armel binaries on a armhf image you'll need this symlink (see [7]) ln -s /lib/ld-linux-armhf.so.3 /lib/ld-linux.so.3 # additionally you'll need a script that starts lxde on $DISPLAY :1 (again, take it from the archive or an old image) /usr/bin/startlxde1 # for an unknown reason I had to add export GTK_MODULES=libgtkstylus.so here although it's supposed to be set in debbie-sue on the host; both versions are in the archive; I believe the rest of the scripts aren't necessary anymore, but I included them nevertheless in the archive