Category:Howto
What is initrd
-ToDo-
A few hints on initrd
The Script that is executed after Startup is located
/usr/share/initrd-tools/lnuxrc
Runlevel?
Files, executalbles and modules that should be present on the new System are located in
/etc/mkinitrd/exe, /etc/mkinitrd/files, /etc/mkinitrd/modules
The initrd image is build and stored in the
tftp/boot/ dir calling
mkinitrd -o /srv/tftp/boot/initrd
File listings
linuxrc
Files are fetched via
tftp from the server.
#!/bin/bash
#
# $Id: linuxrc,v 1.11 2004/04/26 12:04:46 herbert Exp $
dir="etc dev var"
modules="dm-mod usbhid forcedeth loop"
export PATH=/sbin:/bin:/usr/bin
mount -nt proc proc proc
# load modules
for i in $modules; do
modprobe $i
done
The folowing makes the initrd System read-writeable by creating ramdisks, copying the contents of the
$dirs and remounting the ramdisks
num=2
for i in $dir; do
# formatting the ram-disk
mkfs.ext3 -m0 /dev/ram$num
mount /dev/ram$num /mnt
cp -ar /$i/* /mnt/.
umount /mnt
mount /dev/ram$num /$i
let num=$num+1
done
mkfs.ext3 /dev/ram$num
mount /dev/ram$num /tmp
dhclient <-- What is that line for?
cd /tmp
Fdisk is used to create partitions according to the
format for further information visit
dfisk, where the actual listing is explained. A swap, /boot and LVM parition are created.
tftp 192.168.0.1 -c get cfg/format
cat format | fdisk /dev/sda
rm format
The
lvm script is downloaded and executed. The Script is explained under
lvm
tftp 192.168.0.1 -c get cfg/lvm
chmod 0755 lvm
./lvm
rm lvm
The
install script is executed, installing a minimal image, visit
install-script
tftp 192.168.0.1 -c get cfg/install
chmod 0755 install
./install
rm install
# umount all mounted directories to avoid trouble
for i in $dir; do
umount /$i
done
root=$(cat proc/sys/kernel/real-root-dev)
echo 256 > proc/sys/kernel/real-root-dev
#root=/dev/sda3
mount -nt tmpfs tmpfs bin || mount -nt ramfs ramfs bin
echo $root > bin/root