I'm trying to boot my system in ro, but for the system to boot correctly /var and /dev need to be loaded into a ramdisk. I was able to get /var loaded into the ramdisk by copying the directory to /lib/var then adding the following lines to the beginning of my rc.S
echo "Loading /var to ramdisk"
mke2fs -q -I 1024 /dev/ram1 4096
mount /dev/ram1 /var -o defaults,rw
cp -a /lib/var /
The system will boot (if you don't mind all the errors about not being able to write to /dev) and when I log in, /var is sucsessfully loaded into the ramdisk.
So then I try to do the same thing with /dev
echo "Loading /dev to ramdisk"
mke2fs -q -I 1024 /dev/ram2 1024
mount /dev/ram2 /dev -o defaults,rw
cp -a /lib/dev /
Now the system will no longer boot. It get's though all the kernel stuff, but when it starts trying to work with the devices, the system hangs and I have to hit "oops" button on my computer.
I'm not sure if I'm doing this right, I got the instructions from some old documentation on creating a live CD that I tried to apply to what I'm doing. The tutorial
recommended using devfs to load /dev into a ramdisk but I guess this is now obsolete.
I rebooted to my ro test partition to try and get some usefull kernel mesages. Forgive me for paraphrazing, I didn't want to write down the entire demesg verbatim.
Uncompressing Kernel... OK booting
<bunch of kernel crap>
Ramdisk driver initialized: 16 Ram disks of 7777K size 1024 block size
<more kernel crap>
loop loaded (max 8 devices)
Warning: unable to open initial console
<just a little more crap then...>
SCSI0: SCSI host adapter emulation for IDE ATAPI devices
I forgot to mention that I'm using 2.4.31 kernel for the ro boot.