[Eisfair] Eisfair-ng mit grub2 booten?
Thomas Bork
tom at eisfair.org
Di Nov 3 01:01:08 CET 2015
Am 02.11.2015 um 23:58 schrieb Stefan Welte:
> kannst du eisfair2 derzeit mit lilo starten?
> Falls ja, cat /proc/cmdline machen; dort findest du die korrekte root=-Angabe für die linux-Zeile von grub2.
> Falls nein, unter eisfair1 musste ich wunderlicherweise root=806 nehmen für sda6. Evtl. ist für sdd3
> root=833 passend? Erst seit ca. eiskernel 2.12.0 geht bei eisfair1 die root=/dev/sda6-Angabe.
833 passt, siehe Link im u.s. Skript-Auszug.
Das liegt vermutlich an der Verwendung von initramfs und der Behandlung
des von Lilo/anderem Bootloader übergebenen Boot-Devices durch das
Skript init in der initramfs. Eine initramfs wird seit eiskernel
Testing-2.11.0 (stable ab 2.12.0) verwendet (vorher initrd).
Das Skript init in der Vorlage ohne Treiber in
/var/install/initrd/initramfs_empty.tar.gz kommt mit beiden Angaben
(numerisch oder Device) klar. Die Angabe wird aus der
Kernel-Kommandozeile gelesen (/proc/cmdline), die der Bootloader
übergibt. Steht dort nicht /dev/xyz, wird aus dem numerischen Wert das
Device ermittelt:
[...]
# Get the default root device if it exist on the kernel command-line
RTDEV="$($AWK '/root=/ {sub(/.*root=/,""); sub(/[ ].*/,""); print}' $KCMD)"
# check if /rootdev is empty or missing
if [ ! -s /rootdev ]
then
# Get root dev from kernel boot command-line
# uses some awk magic to extract first "root=.*",
# then extracts the ".*" from within that
$RDEV "$RTDEV" || echo "Failed to make /rootdev!"
fi
# Check if ROOTDEV is a number (major and minor)
if ! $($GREP -q '^/dev/.*' /rootdev)
then
string="$(cat /rootdev)"
echo "rootdev is a number: $string"
stringlenght="$(echo ${#string})"
# hdd3 is 1643 (0x1643)
# sda1 is 801 (0x0801)
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=193730
case $stringlenght in
3)
# Get the major number (first digit only)
# sda1 is MAJOR 8
MAJOR="$($AWK '{ print substr($0,1,1) }' /rootdev)"
# Make sure the major number doesn't have leading 0's
# MAJOR="$(echo $MAJOR | $AWK '{ sub(/^0+/,"",$0); print $0 }')"
# Get the minor number (everything after the first digit)
# sda1 is MINOR 01
MINOR="$($AWK '{ print substr($0,2) }' /rootdev)"
# Make sure the minor number doesn't have leading 0's
# MINOR="$(echo $MINOR | $AWK '{ sub(/^0+/,"",$0); print $0 }')"
;;
4)
# Get the major number (first two digits only)
# hdd3 is MAJOR 16
MAJOR="$($AWK '{ print substr($0,1,2) }' /rootdev)"
# Make sure the major number doesn't have leading 0's
# MAJOR="$(echo $MAJOR | $AWK '{ sub(/^0+/,"",$0); print $0 }')"
# Get the minor number (everything after the second digit)
# hdd3 is MINOR 43
MINOR="$($AWK '{ print substr($0,3) }' /rootdev)"
# Make sure the minor number doesn't have leading 0's
# MINOR="$(echo $MINOR | $AWK '{ sub(/^0+/,"",$0); print $0 }')"
;;
esac
echo "MAJOR in hex is $MAJOR."
echo "MINOR in hex is $MINOR."
# Convert hex to dec
# sda1 is MAJOR 8 and MINOR 1
# hdd3 is MAJOR 22 and MINOR 67
MAJOR="$(echo $((0x${MAJOR})))"
MINOR="$(echo $((0x${MINOR})))"
echo "MAJOR in dec is $MAJOR."
echo "MINOR in dec is $MINOR."
# Get the /dev node name using the major and minor numbers by
# looking it up in /proc/diskstats
DISKS="/proc/diskstats"
BOOT="$($AWK '$1=='$MAJOR' && $2=='$MINOR' { print $3 }' $DISKS)"
$RDEV "/dev/$BOOT"
fi
echo "rootdev is $($CAT /rootdev)."
[...]
Dabei sehe ich gerade:
Das ist gar nicht im svn
@Holger:
Wo legen wir das ab, wenn das sowieso in die base wandern soll?
--
der tom
[eisfair-team]
Mehr Informationen über die Mailingliste Eisfair