Skip to contentSkip to conversation

How to change the root filesystem

DISCUSSION 新 月 3 participants 3 messages Jul 24, 2001

lore
Share & tools
lore

新 月

author
#0 lore raw

Hi:
I want change the root filesystem from ext2 to
cramfs,I read the init code about the filesystem.But I cannot understand how to make a device that is used as cramfs device.

#1 lore raw

Hello ÐÂ,

Tuesday, July 24, 2001, 1:55:30 PM, you wrote:

ÐÔ> Hi:
ÐÔ> I want change the root filesystem from ext2 to
ÐÔ> cramfs,I read the init code about the filesystem.But I ÐÔ> cannot understand how to make a device that is used as ÐÔ> cramfs device.

ÐÔ> -
ÐÔ> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in ÐÔ> the body of a message to [email protected]
ÐÔ> More majordomo info at http://vger.kernel.org/majordomo-info.html
ÐÔ> Please read the FAQ at http://www.tux.org/lkml/

Pls download the relative tools for cramfs at
http://cvs.bofh.asn.au/cramfs

Signature · 2 lines
Best regards,
 michael                            mailto:[email protected]
#2 lore raw
In reply to 新 月
Quoted 3 lines · [email protected] writes:

I want change the root filesystem from ext2 to cramfs, I read the init code about the filesystem. But I cannot understand how to make a device that is used as cramfs device.

(I asked: "desktop system?" Reply: "No! embedded system!" So, here's the answer.)

cramfs should work out of the box as the root filesystem. I'm not sure what you mean by "make a device". cramfs is meant to be used on a block device like ext2 such as /dev/hda1.

If you want to include the kernel on the root filesystem, it's a bit more complicated.

Option 1

- use Midori Linux: http://midori.transmeta.com/

Option 2

You need a few things:

- linux 2.4.7 kernel
- mkcramfs version from linux 2.4.7
- cramfsboot (part of Midori Linux) which is located here:
http://midori.transmeta.com/pub/midori-1.0.0-beta2/apps/
(includes an MBR, the cramfs secondary loader, set_boot, and make_active)

Run mkcramfs with a command line of something like:

mkcramfs -E -p -i bzImage -z root root.img.cram

where bzImage is the kernel, root is the directory to cram, and root.img.cram is the output. Actually, it's worse than that because cramfsboot wants the kernel to start 1024 bytes from the beginning of the partition.

dd if=/dev/zero of=bzImage.padded bs=436c count=1 cat bzImage >> bzImage.padded
mkcramfs -E -p -i bzImage.padded -z root roott.img.cram
cp cramfsboot.bin root1.img.cram # from cramfsboot
tail +513c roott.img.cram >> root1.img.cram cramfsck root1.img.cram
set_boot root1.img.cram 1
rm roott.img.cram

Then root1.img.cram can be put on the first partition of say a Compact Flash or other IDE device. You will need to use the MBR that's included with cramfsboot and don't forget to set the active flag (the cramfsboot MBR uses it).

This code is a much-simplified version of what's in the Midori Linux "mlbuild" package. (I haven't tried the simplified version, so if you need more help, please refer to the mlbuild package, same location as the cramfsboot package.)

It sounds like you're just getting started on your embedded system, though, so I'd strongly recommend looking at what's out there. Midori Linux makes heavy use of cramfs, but a bunch of the other offerings also use cramfs.

- Dan