How to make a debian rootfs for MIPS CI20

Making a debian rootfs tarball for MIPS CI20
Start by running

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

Then run mkdebrootfs. Get the script from mkdebianrfs

sudo ./mkdebianrfs.sh --tar mipsel wheezy rootfs.tar.bz2

The script will ask to set up the local keyboard format and a root password.

The script will setup core debian and then give you root access via chroot. Installing the following packages via chroot is much faster than native installation.

apt-get update apt-get install xfce4 apt-get install lightdm apt-get install wicd apt-get install iceweasel apt-get install pulseaudio apt-get install bluez

Add a user using

adduser ci20

Follow the on-screen steps for setting a password and the username

If you want the user to autologin, edit

nano /etc/lightdm/lightdm.conf

And edit the following lines

[SeatDefaults] autologin-user=ci20

/sbin contains quite a few useful commands such as ifconfig. But /sbin is not added to the default PATH environment for new users.

First switch to the new user using

su ci20

Then, to add /sbin to the default PATH environment edit .bashrc

nano /home/ci20/.bashrc

And add the following line at the end.

export PATH=$PATH:/sbin

Exit the ci20 user by running 'exit'. Exit the root user by running 'exit' again.

The rest of the mkdebianrfs script will now make a rootfs tarball that you can use to make a bootable sd card

Factory default rootfs tarball
Lots of tiny steps went into making the factory default rootfs. Some are listed below.


 * extract linux kernel modules.tar
 * copy uImage to /boot/vmlinux.img
 * copy brcm firmware to /lib/firmware/iw8103
 * extract the SGX demos into /usr/local/bin/SGX
 * make the pvrsrvkm module with respect to the release kernel and copy it to /lib/modules/3.0....
 * extract the userland pvr driver to the rootfs
 * check permisions for userland xorg.
 * add contents of /etc/powervr.ini
 * add user ci20 to groups pulse-audio, audio, sudo, netdev

Loading the rootfs tarball with chroot
At times, it is handy to load the rootfs tarball on the main desktop using qemu and chroot. Under debian based distros, the method is given below.

{target_dir} is where your rootfs tarball is. {target_qemu} is where your qemu-mipsel-static binary is. {target_arch} is mipsel

To load

mount "${target_dir}/proc" >/dev/null 2>&1 mount "${target_dir}/sys" >/dev/null 2>&1 cp "${target_qemu}" "${target_dir}/usr/bin/qemu-${target_arch}-static" chroot "${target_dir}" /bin/bash

Type exit to quit shell.

chroot "${target_dir}" apt-get clean rm -f "${target_dir}/usr/bin/qemu-${target_arch}-static" umount "${target_dir}/proc" >/dev/null 2>&1 umount "${target_dir}/sys" >/dev/null 2>&1
 * 1) Clean up.

To make a tarball with that folder again tar -capf rootfs.tar "${target_dir}"