Hi out there,

due to some questions here in the past I wrote down my methode how I got
along with booting a harddiskless computer.

The 'initrd' (init ramdisk) is in fact a zipped file containing a bitmap
of a complete filesystem, eg ext2, with all the standard paths and
files. In general, you can zip '/' with all files and directories to get
such a initrd. The problem is, of course, that it's much to big this
way. So it's the magic to reduce it by concentrate to the really needed
files, which is application specific. By the way, on the CDs of the Suse
Linux Distribution are some emergency filesystems as initrd which should
work as a base.
I myself need the initrd to boot a small card-pc which is controlling a
machine. So I format a normal ramdisk for example with mke2fs and  make
a standard dir tree, which I need for my application, e.g.:
/
/bin
/sbin
/usr
/usr/bin
/usr/sbin
/dev
/proc
/etc
/lib
and so on, the files therein result from your application. At me there
are in general network tools, login, shells, telnet and ftp-server and
my appilication. Tricky is the choosing of the needed lib files, because
some programs give misleading error messages. (for example says ping:
unknown protocol icmp, when a special lib file is missing.) Hint: load
not working programs to an editor an search for "lib". So you should get
all needed lib file names easily.

Is the contens of your filesystem fixed (it ouly needs the necessary
files for running, so no kernel files, no '/boot' directory etc), zip it
with gzip to a file named initrd.img.gz or so.

After that you heads to your destination drive. For me it's a
IDE-Flash-Disk (so there are no special drivers necessary like for
DiskOnChip), but this should work for floppys also, you just don't have
so much space...

I made a script for that, on which I can explain the steps best:
All my files are under /rdisk, what has to be taken care of in the
relative pathnames. This is necessary to make lilo working on this files
and not on your regular harddisk files for booting your desktop machine.

Script: "mkflash":
#cfdisk                         #make a partition an make it bootable
(only for flash disks)
mke2fs -m0 /dev/hda1            #make ext2 filesystem
mount /dev/hda1 ./mnt           #mount flash to /rdisk/mnt
cp -av ./boot ./mnt             #copy boot folder with files
cp -av ./initrd.img.gz ./mnt    #copy initrd image
echo
echo "lilo with ./etc/lilo.conf!"
./makelilo                      #install kernel+initrd
umount ./mnt

Well: the boot folder, needed by lilo, is written to the formatted and
mounted disk. In the folder has to be the kernel for your destination
system, the map file and the bootsector boot.b, which you can copy from
the /boot dir from your desktop machine. It's important, that the kernel
was compiled with initrd support! (make menuconfig in /usr/src/linux and
then make dep clean zImage).
After that also our initrd.img.gz is copied to the disk. In the end,
lilo is called with a command line that is in a own script "makelilo"
for historical reasons:

lilo -r /rdisk -C /etc/lilo.conf

The parameters are a little bit doubled, but better keep on the safe
side. They tell lilo to read it's config file from
/rdisk/etc/headlilo.conf where the parameters for my embedded pc are.
Normally it would take /etc/lilo.conf by default, what would giva a
mess.

The configuration file looks like this:

# LILO config file
# Start LILO global Section

boot=/dev/hda               #boote from flashdisk
map=/mnt/boot/map       #here's the mapfile for the Kernel: Attention
Flashdisc must still be mounted
install=/mnt/boot/boot.b  #here's the bootsector
read-only                        #mount the initrd readonly
vga = normal                   # force sane state
verbose = 3                    #tell what you do
#prompt
delay=25                        #wait for some useraction
# End LILO global section
#
# Linux bootable partition config begins
append="initrd=initrd.img.gz" #tell the kernel that is has a initrd
#append="initrd=initrd.img.gz init=/bin/sh"   #this way a shell is
started after booting, good for debugging the boot sequence
image = /mnt/boot/kernel #here's the Kernel
initrd= /mnt/initrd.img.gz #here's the initrd
root = /dev/ram #mount the ramdisk as rootfilesystem
label = Linux #that's the name of our system
ramdisk= 10240 #this is the size of my unzipped ramdisk in kbytes
# Linux bootable partition config ends
#
#

Okay, this way a PC should boot a linux and work just as normal, only
that the system is on a ramdisk. It's especially good for embedded
systems, because after a power loss the machine is booting just normal
(without checking the filesystem) and is back to work in some seconds.

Please eMail me if I've forgotten something....

read you
Bernd







--
[EMAIL PROTECTED], http://www.basysprint.de
basysPrint GmbH, Guelzer Str. 15, 19258 Boizenburg, Germany
Tel.: ++49-38847-99-163, Fax:++49-38847-99-192


--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/

Reply via email to