Moving home to a bigger rootfs...
20 08 06 - 11:59 The default rootfs you'll find in that previous link is a little small for actually doing stuff with. We'll obviously need a bigger one if we actually plan to do something interesting.I'm going to create a 230MB rootfs (to put on a 256 SD card, but it actually ended up going on my 1GB card...). You can create any size you want I guess, limited only by SD card.
You could of course partition your SD card, but I may want to use my SD in various devices, and don't want, say, a digital camera messing up the ext2 partition because it doesn't know what it is. So I use a rootfs file on the SD card.
First of all, we need to create the blank file to make the rootfs onto. Make it the size you want. You will need a linux machine and a SD reader. I met some trouble here as my Linux laptop is on the other side of town and I removed the Linux partition off my main laptop (needed the 10GB for something else). So, I picked a PowerPC Ubuntu CD up off the stack on my desk (my order came in a few days ago), and threw it into the G4's CD drive. I booted up to the live environment and did all this.
Maybe it could be done on the Palm. Theoretically it is possible, and it might work, but I haven't tried, nor do I want to.
dd if=/dev/zero of=linux_root.ext2 bs=1M count=230
bs is the block size - not of the filesystem we are about to make - but of the dd copy. We make a 1MB block from /dev/zero, and do so 230 times - 230x1MB is 230MB. You can replace the 230 with the size you want the filesystem.
Now run
mke2fs linux_root.ext2
or
mkfs.ext2 linux_root.ext2
depending on your distro. Most distros I've seen have the first, but Gentoo has the second.
Now, we need to loopmount the filesystems, so we can do our thing. We will mount them both at /mnt/im1 and /mnt/im2, tar up the contents of one, and untar it to the other. Why not just cp them? cp messes up static linked files, by copying the original file instead of the symlink.
cd to wherever the card is mounted (in /mnt or /media), and run the following commands at a root shell (sudo su if you have sudo, or su if you have a root password, or use "root terminal" or whatever is necessary to see a # prompt).
mkdir /mnt/im1
mkdir /mnt/im2
mount -o loop opie-image-v0.8.4-rc3-palmtx.rootfs.ext2 /mnt/im1
mount -o loop linux_root.ext2 /mnt/im2
cd /mnt/im1
tar -cvf /opie.tar .
cd /mnt/im2
tar -xvf /opie.tar .
rm /opie.tar
cd /
umount /mnt/im1
umount /mnt/im2
(yeah, there's probably a better way to manage those tar commands. maybe
tar -cv /mnt/im1 | tar -xv /mnt/im2 will work, but i haven't tried)
Remove the old opie image, and edit linux.boot.cfg to change ROOT_DEV to /media/mmc1/linux_root.ext2.
Now, unmount and eject the SD from the card reader, and put it into the Palm. Boot into Linux and enjoy your less spacious SD card, and more spacious Linux root device.
Coming soon: How to actually install stuff onto the bigger rootfs.
Trackback link: http://gm.stackunderflow.com/blog/pivot/tb.php?tb_id=30