Hi Guys,
I am just finishing off development of an embedded system but I'm having
a bit of a problem with an ATA Flash disk that I'm trying to use.
Everything is fine with it, except I want to mount it in Read Only mode
to prevent killing the flash media. I have read a few articles on this
and they seem to imply the following sequence of events:
(1) Use initrd to load a small kernel image
(2) Write a linuxrc script to zcat a root file system onto a ram disk
with links to the permanent files on the flash disk
(3) mount the flash disk as read only, say in the /mnt directory
(4) unmount the ram disk and exit the linuxrc script so initrd can
remount it and continue the boot sequence.
All sounds relatively easy and, to this end, I did the following:
(1) Made up a small kernel image (mkinitrd) and used zcat to unpack it
onto a ram disk
(2) Edited the /etc/fstab to mount /dev/ram as root file system
(3) Edited linuxrc to the following:
#!/bin/sash
aliasall
# This mounts the flash card into /mnt
mount -t minix /dev/hdc1 /mnt
# This is unnecessary but I'm doing it just to make sure
mkfs.minix /dev/ram 2000
# Extract the new root file system to the ram disk
zcat /mnt/boot/rootfs.img.gz >/dev/ram
# Now unmount the flash disk
umount /dev/hdc1
# Just for testing purposes mount the ram disk and do
# a directory listing
mount -t minix /dev/ram /mnt
ls /mnt
# unmount the ram disk (as initrd will re-mount it)
umount /dev/ram
(4) Copied extra executables / libraries into /bin and /lib as
determined using ldd
I have traced this every step of the way and cannot work out what is
going wrong. The final "ls /mnt" command shows me that the ram disk is
empty... despite having unpacked a file into it.
I am 99.9% sure that the zcat line is not doing anything although I
can't determine why it doesn't report any errors (yes, tried 2>
error.file).
Things I have checked:
(1) "zcat -h" in linuxrc DOES produce help text on screen so its not
simply that it can't find the executable.
(2) rootfs.img.gz IS a valid zcat file system, i.e. from a command
line I CAN type "zcat rootfs.img.gz >/dev/ram" and it WILL create
the file system.
(3) I've tried simply copying the file "rootfs.img.gz" from the flash
to the ram disk just to check I have made a valid ram disk and the
mount is valid and that works just fine.
PLEASE PLEASE PLEASE! If anyone's done this I need an answer asap...I've
spent 3 days already trying to work out what's gone wrong!
Jeremy