Grub

From IAVIT
Jump to: navigation, search

Playing A Tune At Boot

The grub bootloader can be configured to beep or even to play a tune at boot. This allows you to select different kernels or operating systems at boot without sight. On debian based systems you can make grup beep by doing the following:

Edit the file /etc/default/grub. At the end there are lines like the following:

	# Uncomment to get a beep at grub start
	#GRUB_INIT_TUNE="480 440 1"
 

Remove the hash sign from the beginning of the line that begins "#GRUB_INIT_TUNE". Save the file and exit your text editor.

Open a terminal window and issue the following command:

sudoo update-grub
 

The next time you reboot, you should hear a single beep when the grub menu appears.

Using grub-init-tune

Making grub play a tune at boot time is somewhat more difficult. To make this process easier, you can use a utility called

grub-init-tune. 

Download the grub-init-tune script.

	wget http://www.iavit.org/~john/debian/grub-init-tune
	chmod 0755 grub-init-tune
 

The easiest way to start testing tunes is to uncomment one of the pre-defined tunes in the grub-init-tune script. To do this, open the script in a text editor and remove the hash sign from the beginning of the line for the tune you want to try. Save the file and exit your text editor. Then run the script again. It should play your selected tune and echo the configuration line to your screen.

Another way to test a tune is to set the GRUB_INIT_TUNE environmental variable to the tune you wish to try. For example:

	export GRUB_INIT_TUNE="220 900 2 1000 2 800 2 400 2 600 3" 
	grub-init-tune
 

This will play the theme from the movie "Close Encounters". If you have not uncommented a line for a tune within the script or set the GRUB_INIT_TUNE environmental variable, the script plays the tune defined in /etc/default/grub (if any).

Once you have settled on a tune, you can configure grub to play it at boot by saving it to the file /etc/default/grub.

	sudo grub-init-tune >> /etc/default/grub
	sudo update-grub
 

Mor information on writing your own tunes can be found in the

GNU GRUB Manual,

specifically, the section on the

play command.