Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GRUB2 - autoselect right kernel/initrd
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
user
Tux's lil' helper
Tux's lil' helper


Joined: 08 Feb 2004
Posts: 145

PostPosted: Sat Feb 21, 2009 2:24 pm    Post subject: GRUB2 - autoselect right kernel/initrd Reply with quote

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
}
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum