Sd Card With Ext2 Filesystem


neurocyp

Still Fresh
Joined
Feb 12, 2011
Messages
41
Website
picasaweb.google.com
Hi,
not sure, if it is a right place, to start this thread, so don't scream :)

I noticed that sometimes my caanoo breaks the fat filesystem on sd card . So I thought that perhaps it would not do it with ext2 fs.
here is what I did.

First of all I tried to modify initscripts, but then I discovered, that caanoo does not load /sbin/init (nor /bin/init), but it loads /etc/rd.d/binscript instead.
I'm not sure what does this program do (it is compiled, I googled a bit to find it's source code, but I couldn't, and I'm not at all fluent with ARM assembly code), but I found out, that one of the things it does, it runs gp2xmenu. So I copied the gp2xmenu into gp2xmenu.orig
and I had created a script file in its' place. Now, when I turn on the caanoo with ext2 formatted card, it would get mounted, and it would be used, but when you take it out, or connect the unit with a PC the card would be umounted, and you should reboot the unit in order to get it remounted. the FAT formatted SD cards would be used as usual (you can pull them and place them back, and these would be mounted just the usual way).

so here is how I did it.
Warning, I take no responsibility for any damage, you coud do trying to reproduce, what I did to my unit.

you need dropbear server and a way to get to your caanoo (you could use usbnetwowrking, or wifi connection, the choice is yours).
then log in to your unit, and remount root filesystem:
Code:
mount /dev/root / -o rw,remount
now change the gp2xmenu:
Code:
cd /usr/gp2x
mv /usr/gp2x/gp2xmenu /usr/gp2x/gp2xmenu.orig
now create a wrapper script, that will be running gp2xmenu:
Code:
cd /usr/gp2x
vi gp2xmenu

I put into the script something like this:
Code:
#!/bin/sh
dir=/usr/gp2x
hostname caanoo
/sbin/insmod /lib/modules/2.6.24/kernel/fs/ext2.ko 
mount /dev/mmcblk0p1 /mnt/sd 
${dir}/gp2xmenu.orig

change permissions to the script
Code:
chmod 777 gp2xmenu

and then remount rootfs

Code:
mount /dev/root / -o ro,remount

and turn off the unit.

now, let's prepare a sd card, let's say, your card is seen in your pc as /dev/sdc1
Code:
mke2fs -b 4096 -L caanoo /dev/sdc1
blocksize is set to 4KB, why? because I read somewhere, that if we want optimal write speed on an SD card, we need to have as large blocks, as it is possible (the more sectors are written at once the better see http://elm-chan.org/docs/mmc/mmc_e.html ), and it seems to work a bit:)

and that's it.

few things you have to have in mind:

apps,game, ebook, etc... directory names should should have names in lowercase.
these directories above, should be accessible by anyone.

and gngeo emulator needs its' rc file named ad "gngeorc." (I've spent a moment on figuring out why it does not want to work:) )


Hope, that some more people would like to experiment with caanoo hacking:)
 
thanks for the hint, but you may be very carefull if you want to upgrade your fw. I'm not sure if the fw flash process support ext2 (i guess not).

I'm using ext2 to get a chroot env on a usb pen, with all my debug env installed :p
 
zx-81 said:
thanks for the hint, but you may be very carefull if you want to upgrade your fw. I'm not sure if the fw flash process support ext2 (i guess not).

I'm using ext2 to get a chroot env on a usb pen, with all my debug env installed :p
well, I have another SD card, which would be used only for upgrades, my final goal is to change the firmware updater, so I could have automunt ext2/vfat sd cards options. I have few ideas, on how exactly utilize the fact i have ext2 on sd card :)
but first I have to do some research:)
 
Last edited by a moderator:
i succeed even to launch a debian chroot distro. I'm using ext2 + chroot stuff mainly for debug purposes (gdb etc ...)
 
Back
Top