01/26/2008

How to create android.img

Following explains how the android.img was created.

First of all, I read an article by a Japanese blogger, Weboo, who successfully Android up on C-860. I appreciate Weboo for sharing his idea.
o Android run on Zaurus | Weboo! Returns. - All written in Japanese

What he has done is make a Android rootfs as a file on SD card and loopback mounted it, then chroot there. He clevery gets workaround mmap issue of jffs2.

After I posted Android Zaurus without chroot, I find tmpfs is very suitable. So, I gathered everything together and packaged it.

My Zaurus's /home directory is almost full, so I used /media/hdd, which is vfat and original Qtopia application data sits on.
$ ssh root@zaurus
# dd if=/dev/zero of=/media/hdd/android.img bs=512 count=131072
# mkfs.ext2 /media/hdd/android.img
# mkdir android-sd
# sudo mount -o loop /media/hdd/android.img android-sd/
# cd android-sd/
# ls
lost+found
Looking good. Then, I went back to my PC and copied Android files.
$ scp /tmp/system.tar root@zaurus:/media/hdd
$ scp /tmp/data.tar root@zaurus:/media/hdd
$ scp /tmp/ramdisk.img root@zaurus:/media/hdd
Now unpack them into the loopback mounted image file.
$ ssh root@zaurus
# cd android-sd/
# tar xvf /media/hdd/sytem.tar
# tar xvf /media/hdd/data.tar
# cpio -iv < /media/hdd/ramdisk.img
Also, I copied binderdev.ko, start-up script and some useful files saved in my work directory.
# cp ~/work/a.sh a.sh
# cp ~/work/qwerty.kl system/usr/keylayout
# mkdir -p lib/modules/2.6.23/kernel/drivers/binder
# cp ~/work/binderdev.ko lib/modules/2.6.23/kernel/drivers/binder
# cp ~/work/RotateView.apk data/app
# vi etc/default.prop
# cat etc/default.prop | grep net.eth0.dns1
net.eth0.dns1 = 208.67.222.222
This DNS points to OpenDNS.

One very important thing. I modified a.sh to mount tmpfs to /tmp. Add a line to a.sh
mount -t tmpfs tmpfs /tmp
Now /tmp goes out to RAM. This is the reason why tmpfs required to boot this image up.

Once the image file has everything in it, copy it to SD card.
# umount android-sd
# cp /media/hdd/android.img /media/card
OK. A new start-android.sh will be android-sd.sh
# cat -android-sd.sh
#!/bin/sh
mount -o loop android.img rfs

if [ ! -e /dev/binder ]; then
echo "No /dev/binder. Try to insmod it."
insmod rfs/lib/modules/2.6.23/kernel/drivers/binder/binderdev.ko
if [ ! -e /dev/binder ]; then
echo "failed."
exit 0
fi
fi

if [ ! -e rfs/dev/binder ]; then
cp -a /dev rfs
chmod 666 rfs/dev/binder
fi

umask 000
chroot ./rfs /a.sh
# ./android-sd.sh
As seen, the script insmod binderdev.ko if /dev/binder is not found. Then copy /dev files to Android's rootfs and change permission of binder device file.

Have fun.
posted by 安藤恐竜 at 16:33 | Comment(1) | TrackBack(0) | 日記
Comments for this entry
日本語は、はてなに書きます。こっちは英語専用にします。

http://d.hatena.ne.jp/androidzaurus/
Posted by 安藤恐竜 at 01/26/2008 18:22
Leave your comment
Name: [Must]

EMail: [Must]

URL: [Must]

Comment: [Must]

Confirmation Code: [Must]


Type in alphabets what you see in this image.
Trackback URI:  http://blog.seesaa.jp/tb/80730942
Trackback entries must contain URL of this entry.

Trackbacks to this entry
×

この広告は1年以上新しい記事の投稿がないブログに表示されております。