SGD BootScript

From Super Grub Disk Wiki
Jump to navigationJump to search

Boot Script for CDROM with autodetection of USB drive.

Purpose

This menu.lst configuration file demonstrates how you can autodetect the location of a USB drive and boot the linux system installed on it.

Example 1 - configfile

The configuration file (menu.lst) found at the cdrom/floppy is as follows:

default 0                           # default is option 0
timeout 3                           # timeout for autoboot is 3 seconds
title Booting from CD ROM
findf /boot/grub/mydeviceidfile.txt # This sets out_hd to the device id of the USB drive
map (hd0) ($(out_hd))                 # swap hd0 with the USB drive (works even if USB is hd0)
map ($(out_hd)) (hd0)                 # swap USB drive with hd0
liveswap                            # execute the swap
root (hd0,0)                        # set root
configfile /boot/grub/menu.lst      # boot from USB

Example 2 - chainload

The configuration file (menu.lst) found at the cdrom/floppy is as follows:

default 0                           # default is option 0
timeout 3                           # timeout for autoboot is 3 seconds
title Booting from CD ROM
findf /boot/grub/mydeviceidfile.txt # This sets out_hd to the device id of the USB drive
map (hd0) ($(out_hd))                 # swap hd0 with the USB drive (works even if USB is hd0)
map ($(out_hd)) (hd0)                 # swap USB drive with hd0
liveswap                            # execute the swap
rootnoverify (hd0)                  # set root
chainloader +1
boot                                # boot from USB

Custom SGD Build

The assumption here is that you have created a file named mydeviceidfile.txt and placed it in /boot/grub/.

The file does not need to contain anything.

You will need to burn a CDROM with SGD and this menu.lst file.

Check: How to make a custom Super Grub Disk for more information.

Problems that can be solved with this option

This script allows you to boot a USB Linux without knowing beforehand which device id the USB drive is.