how to load Linux file system into 16 Mb RAM Disk ?

how to load Linux file system into 16 Mb RAM Disk ?

Post by ey39 » Tue, 26 Oct 2004 22:26:20



THE GOAL
I need custom Linux system that will boot either from a small IDE hard
disk, CDROM drive or using BOOTP from the network. The file system
must be loaded into RAM disk of size 16 Megs, and as a structure it
will be much like what we have on a normal, disk-based Linux system.
Targeted hardware is Pentium, 200 MHz, 128 Mb RAM

THE EFFORT
So, I took color.gz (the so called root disk' in the installation set
for Slackware 7.1) as a starting point of my efforts to produce an
image of desired  File System:

gzip v9 color.gz  
mount o loop color /temp01

then I create a targeted file system:
dd if=/dev/zero of=RootSystem bs=1k count=16384
mke2fs m 0 N 2100 RootSystem
mount o loop RootSystem /temp02

File system is created by hand in /temp02 and files are copied over
from /temp01 to /temp02; except for device files in /dev they are
copied from /temp01 like this:

cp dpR /temp01/ra* /temp02/dev/
cp dpR /temp01/tt* /temp02/dev/
cp dpR /temp01/null /temp02/dev/
cp dpR /temp01/console /temp02/dev/

(or even created on spot using mknod) and so on
I change /temp02/etc/fstab to have:

/dev/ram0     /       ext2  defaults 1   1
none          /proc   proc  defaults 0   0

I keep on customizing my /temp02 file system, using most of the stuff
from /temp01, and adding other things to extend of ~4Megs; after
all, presumably  I have 16Megs disk' space!
Next is:
umount RootSystem' and dd if= RootSystem bs=1k | gzip v9 >
RootSystem.gz'

Then I compile new kernel with option size for RAMDISK=16384 (on make
xconfig', I find Block devices') as a product I have
bz16megsRamKernel'

As a testing bed for this ram-disk based system I use a small DOS
partition, equipped with loadlin.exe to load my kernel and compressed
image of root system like this:

loadlin.exe bz16megsRamKernel initrd=RootSystem.gz root=/dev/ram0 rw

THE PROBLEM
when this system boots, I can see that df reports RAM disk with total
size of some 3897  blocks, even though the kernel specified 16Megs (in
a brief moment at boot time I saw Ramdisk driver initializing 16 disks
of 16384 M size)

The same happens when
loadlin.exe bz16megsRamKernel initrd=color.gz root=/dev/ram0 rw

THE QUESTION
What is inside color.gz file system that over-writes the RAM disk size
word in the Kernel? How can I change it to recognize the settings of
the kernel?