Hallo,
ich habe bei meinem sarge herumgespielt, damit ich der initrd ein dsdt(korrigiertes ACPI-BIOS) anhängen konnte.
Da das einfache Anhängen mit 'cat' an die initrd nicht funktionierte, habe ich die initrd als cpio-Archiv verwendet:
Code: Alles auswählen
MKIMAGE='cd %s && find . | sort -u | cpio -H newc --create | gzip -cn9 > %s'
(+ ein paar kleine Änderungen im Erstellungsprozess)
Im Gegensatz dazu der Standardbefehl (sarge!) zum Vergleich:
Der eigentliche Bastelteil ganz am Ende der /usr/sbin/mkinitrd:
Code: Alles auswählen
...
gendir $workdir
eval "$(printf "$MKIMAGE" $workdir/initrd ${initrd_file})" 3>&1 >&2
...
Dazu der "Bastelteil" aus der suse-mkinitrd:
Code: Alles auswählen
...
# create an empty initrd
mkdir $tmp_mnt || error 1 "could not create temporary directory"
if [ "$mkinit_type" = "rd" ]; then
dd if=/dev/zero of=$tmp_initrd bs=1k count=$image_blocks 2>/dev/null
mke2fs -q -F -b 1024 -m 0 -N $image_inodes $tmp_initrd 2>/dev/null 1>&2
tune2fs -i 0 $tmp_initrd >/dev/null 2>&1
# check for loop device
grep -q loop /proc/devices
if [ $? != 0 ] ; then
if [ -f /lib/loop.o ] ; then
insmod /lib/loop.o
else
modprobe loop
fi
fi
# mount it
if ! mount -t ext2 -oloop $tmp_initrd $tmp_mnt ; then
error 3 "failed to mount image"
fi
is_mounted=1
rmdir $tmp_mnt/lost+found
fi
# fill the initrd
mkdir -p $tmp_mnt/{sbin,bin,etc,dev,proc,sys}
# Create a dummy /etc/mtab for mount/umount
echo -n > $tmp_mnt/etc/mtab
...
Es wird ein ext2-Image erstellt und gemountet. Ab "# fill the initrd" könnte dann MKIMAGE einsetzen, mit dem Unterschied dass statt 'find ... | sort ... | cpio ... | gzip ...' ein rekursives Kopieren durchgeführt wird. (prinzipiell)
Das Erstellen und Mounten des ext2-Images könnte als Befehl in die /etc/mkinitrd/mkinitrd.conf gepackt werden:
Code: Alles auswählen
...
export LOOP-FILE=...
export LOOP-MNT=...
'loop-mount-erstellung' && mount -oloop $LOOP-FILE $LOOP-MNT
MKIMAGE='cd %s && cp -a * \$LOOP-MNT && umount \$LOOP-MNT && mv \$LOOP-FILE %s'
...
(als erster Entwurf)
ext2fs muss im Kernel kompiliert sein.