|Version 3 (modified by divx118, 2 years ago)|
Building a Debian rootfs for gen8
Some general info:
This guide will probably work for other distros. You will need to install SDE angstrom which can be retained from archos and atleast booted angstrom one time. To get me started I used some guidelines from http://www.dev.katlea-studio.com/. To make this guide complete I am using some copy/paste from his guide. I am running Ubuntu 10.04 so commands or dependencies that need to be installed are based on that. Also note that I own an A101IT so all the tests are done on that. I am using qemu with a virtual machine to install the distro. I know it isn't perfect, but it is a very easy way to get started.
1) Creating a work directory
We need a place on or host PC where we can get our work done. I am using /usr/src/debian. First make the dir and then make run the chown command so you get full read/write access as normal user. If it isn't stated otherwise in this guide I assume you run the commands that are mentioned in this directory.
$ sudo mkdir /usr/src/debian $ sudo chown <your login> /usr/src/debian $ cd /usr/src/debian
2) Installing Qemu on your host PC
$ sudo apt-get install qemu $ sudo apt-get install qemu-kvm-extras
3) Create an image disk to use with qemu
First we will have to create an image disk where we can later install debian on. The command below will create a 2 Gb image which will be enough for debian with lxde desktop. If you want a bigger image just adjust the count accordingly. For example making a 3Gb image use count=3072. This is however not so important right now, you can also do it later when we make the final rootfs.img that we put on the archos. The only thing you have to think about is that your image will be large enough for your emulator and the things you want to install to get an initial image to get it working on the archos.
$ dd if=/dev/zero of=debianlxde.img bs=1M count=2048
We don't need to format the image, this will be done by the debian installer.
4) Download boot image and kernel for your virtual machine
You can find the following kernel (vmlinuz-2.6.32-5-versatile) and initrd (initrd.img-2.6.32-5-versatile) on http://people.debian.org/~aurel32/qemu/armel/
$ wget http://people.debian.org/~aurel32/qemu/armel/initrd.img-2.6.32-5-versatile $ wget http://people.debian.org/~aurel32/qemu/armel/vmlinuz-2.6.32-5-versatile
Then we also need the net installer from debian (initrd.gz). http://ftp.de.debian.org/debian/dists/squeeze/main/installer-armel/current/images/versatile/netboot/
$ wget http://ftp.de.debian.org/debian/dists/squeeze/main/installer-armel/current/images/versatile/netboot/initrd.gz
5) Installing debian on our debianlxde.img
Now we are going to install debian on our earlier created debianlxde.img. Like mentioned above we are using the net installer, so you should be connected through the internet.
$ sudo qemu-system-arm -M versatilepb -kernel ./vmlinuz-2.6.32-5-versatile -initrd ./initrd.gz -hda ./debianlxde.img -m 256 -append "root=/dev/ram"
Before you will open a window in which will appear the debian net installer. Follow the onscreen instructions and install debian. The installer is idiot proof :) so if in doubt use the default option. Important is that you make a note of your username, password and the root password you use. In my case I used the following:
user: debian password: debian root password: debianroot
This all will take some time, so please be patient. When the installer is completed it will reboot in the emulator, that is the moment you can close your qemu window and move on to the next step.
6) Installing the GUI and some basic apps
We now start qemu with the normal initrd.
$ sudo qemu-system-arm -M versatilepb -kernel ./vmlinuz-2.6.32-5-versatile -initrd ./initrd.img-2.6.32-5-versatile -hda ./debian.img -m 256 -append "root=/dev/sda1 m=256M"
Qemu will start again and now with a debian command prompt. Login with the credentials you used in the installer, in my case user debian with password debian. Get root to install a GUI.
Enter your root password, in my case it was debianroot. Update the installer and install the lxde GUI.
$ aptitude update $ aptitude install lxde
Please note this will take some time to complete, so again be patient.
After that I installed the following apps that I think are usefull in a first startup. ssh server, onscreen keyboard, battery moonitor and the network manager wicd.
$ aptitude install openssh-server $ aptitude install matchbox-keyboard-im $ aptitude install xbattbar $ aptitude install wicd $ shutdown now
I don't recommend installing more apps, because that can also easily be done on your archos. After the shutdown now debian will shutdown and you can close the qemu window.
7) Adjusting the debianlxde.img
Because we installed debian with a different kernel then we have on our archos to run angstrom we need to adjust the image a bit. Before we can modify the image we have to mount it to a directory so we can access the files. We also need some old files from the angstrom image so we need to mount that to.
First we create two directories so we can mount the images in them.
$ mkdir ./debianlxde $ mkdir ./angstrom
Connect shutdown your archos and connect it to your PC. Start it up in recovery by holding the minus button and shortly press the power button. Keep the minus button presses until the white recovery screen appears. Go to recovery --> repair system and then start USB.MSC The A101IT mounts under /media/A101IT on ubuntu. Change this path to what yours needs to be in the following commands.
Because we are going to replace the rootfs.img from angstrom, we will rename it first so we don't overwrite it in the next steps.
$ mv /media/A101IT/rootfs.img /media/A101IT/rootfs.angstrom
Now we mount the image to our directory.
$ sudo mount - o loop /media/A101IT/rootfs.angstrom ./angstrom
We also have to mount our debianlxde.img, but that is a bit more work, because the net installer in debian creates also a swap partition in the image file. So we need to determine wich partition we need to mount in the image. I found a nice tutorial for this here http://www.andremiller.net/content/mounting-hard-disk-image-including-partitions-using-linux
$ parted ./debianlxde.img
and we get the following
parted debian_2G_first.img WARNING: You are not superuser. Watch out for permissions. Warning: Unable to open /usr/src/debian/debianlxde.img read-write (Permission denied). /usr/src/debian/debianlxde.img has been opened read-only. Warning: Unable to open /usr/src/debian/debianlxde.img read-write (Permission denied). /usr/src/debian/debianlxde.img has been opened read-only. GNU Parted 2.2 Using /usr/src/debian/debianlxde.img Welcome to GNU Parted! Type 'help' to view a list of commands. (parted)
Now type the following at the prompt "unit" --> "B" --> "print" and the last "quit" to exit parted. You should see something like this
Welcome to GNU Parted! Type 'help' to view a list of commands. (parted) unit Unit? [compact]? B (parted) print Model: (file) Disk /usr/src/android/debian_2G_first.img: 2147483648B Sector size (logical/physical): 512B/512B Partition Table: msdos Number Start End Size Type File system Flags 1 1048576B 2003828735B 2002780160B primary ext3 boot 2 2004876288B 2146435071B 141558784B extended 5 2004877312B 2146435071B 141557760B logical linux-swap(v1) (parted) quit
The biggest is the ext3 partition and that is the one that we want. Notice the start offset "1048576B" which we need to declare in the mount loop command.T To mount the debianlxde.img we do the following
sudo mount -o loop,offset=1048576B ./debianlxde.img ./debianlxde
Needed a break and a big black coffee, more to come :)