user Apprentice
Joined: 08 Feb 2004 Posts: 202
|
Posted: Sat Feb 21, 2009 2:24 pm Post subject: GRUB2 - autoselect right kernel/initrd |
|
|
hi,
i played with grub-9999 (grub2 svn 1996)
because i search a solution for booting from a USB flash drive with autoselect kernel feature.
With UUID search feature i able to identify each computer because each computer have a local disk.
Why not boot from local disk? For some reason i want to boot from USB flash drive.
There are some caveats and wishes, but look and comment it.
Code: | #
# Config file for GRUB2 - The GNU GRand Unified Bootloader
# /boot/grub/grub.cfg
#
# Caveat grub2 svn 1996 (20090214):
# - dollar character quote with backslash or strange errors
# - broken variables usage inside of if statements
# - set root changes after search dummy usage, search root again before linux/initrd
# - if-statement dependent menuentry not yet(?) possible
# - gfxterm too slow
#
# Todo/Wish:
# - consolidate UUID in variable
# - grub2 text console support for 80x50
# - detect computer by unique bios string / serial
##############################################################################
# search for USB flash drive
search --fs-uuid --set 1e3c1548-27f1-4c45-b217-6e514415e721
echo "Press ESC to enter the menu"
echo ""
if search --fs-uuid 73617e33-bf15-42b9-a2dd-da390e7bfa47 --set DUMMYVAR ; then
echo -n "Boot Desktop in "
if sleep --verbose --interruptible 3 ; then
echo ""
search --fs-uuid --set 1e3c1548-27f1-4c45-b217-6e514415e721
linux /kernel/desktop/vmlinuz root=/dev/loop3 vga=0x31b
initrd /kernel/initramfs.igz
boot
fi
fi
if search --fs-uuid ebe48cc7-67d0-4d20-ab94-4df36acd85d1 --set DUMMYVAR ; then
echo -n "Boot Notebook in "
if sleep --verbose --interruptible 3 ; then
echo ""
search --fs-uuid --set 1e3c1548-27f1-4c45-b217-6e514415e721
linux /kernel/notebook/vmlinuz root=/dev/loop3 vga=0x37d
initrd /kernel/initramfs.igz
boot
fi
fi
if search --fs-uuid a91b65a1-53c9-415c-9cce-90ef7f121483 --set DUMMYVAR ; then
echo -n "Boot Router in "
if sleep --verbose --interruptible 3 ; then
echo ""
search --fs-uuid --set 1e3c1548-27f1-4c45-b217-6e514415e721
linux /kernel/router/vmlinuz root=/dev/loop3 vga=ext memmap=0x10000\$0x14800000
initrd /kernel/initramfs.igz
boot
fi
fi
menuentry "Desktop - Gentoo Linux (1280x1024)" {
search --fs-uuid --set 1e3c1548-27f1-4c45-b217-6e514415e721
linux /kernel/desktop/vmlinuz root=/dev/loop3 vga=0x31b
initrd /kernel/initramfs.igz
}
menuentry "Notebook - Gentoo Linux (1920x1200)" {
search --fs-uuid --set 1e3c1548-27f1-4c45-b217-6e514415e721
linux /kernel/notebook/vmlinuz root=/dev/loop3 vga=0x37d
initrd /kernel/initramfs.igz
}
menuentry "Router - Gentoo Linux (80x50)" {
search --fs-uuid --set 1e3c1548-27f1-4c45-b217-6e514415e721
linux /kernel/router/vmlinuz root=/dev/loop3 vga=ext memmap=0x10000\$0x14800000
initrd /kernel/initramfs.igz
}
menuentry "SystemRescueCd 64bit v1.1.5 (80x60)" {
search --fs-uuid --set 1e3c1548-27f1-4c45-b217-6e514415e721
linux /image/sysrcd115/rescue64 vga=0xf07 docache backstore=off subdir=image/sysrcd115
initrd /image/sysrcd115/initram.igz
}
menuentry "Memtest86+ v2.11" {
linux /image/memtest86+-2.11.bin
}
menuentry "Reboot" {
reboot
}
|
|
|