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 (assuming that your rootfs is called "rootfs" and you're root).
To load
mount -t proc proc rootfs/proc mount -t sysfs sysfs rootfs/sys mount -o bind /dev rootfs/dev cp /usr/bin/qemu-mipsel-static rootfs/usr/bin/ chroot rootfs /bin/bash
Type exit to quit shell.
# Clean up. chroot rootfs apt-get clean rm -f rootfs/usr/bin/qemu-mipsel-static umount rootfs/proc umount rootfs/sys umount rootfs/dev
To make a tarball with that folder again
cd rootfs tar -capf ../rootfs.tar *
network/dns errors under chroot
If ping www.elinux.org doesn't work inside chroot and does outside, before chrooting in the folder, run
echo "nameserver 8.8.8.8" > {target_dir}/etc/resolv.conf
This adds the google open dns to resolve hosts.
|