[arch-general] How best to adapt grub configuration?

respiranto arch023 at respiranto.de
Mon Apr 16 14:20:28 UTC 2018


Hi Jeanette,

in my opinion, the easiest option is to just write grub.cfg by hand.
Fortunately, in Arch, grub.cfg will never be overwritten by an update.

For basic functionality, grub.cfg may e.g. look like the following:
---
set default=0
set timeout=5

play <tune>

menuentry 'Arch' {
  play <tune_arch>
  search --fs-uuid --set=root --hint=(hdX,gptY) <BOOT_UUID>
  linux /vmlinuz-linux root=UUID=<ARCH_UUID>
  initrd /initramfs-linux.img
}

menuentry 'Debian' {
  play <tune_debian>
  search --fs-uuid --set=root --hint=(hdU,gptV) <DEBIAN_UUID>
  linux /boot/vmlinuz-<ver> root=UUID=<DEBIAN_UUID>
  initrd /boot/initrd.img-<ver>
}

menuentry 'OpenBSD' {
  play <tune_obsd>
  search --fs-uuid --set=root --hint=(hdR,gptS) <SOME_UUID>
  insmod chain
  chainloader <some_path>/BOOTX64.efi
}
---
assuming /boot is on a separate partition on Arch, but not on Debian.
And, for OpenBSD, that you are using (U)EFI.

In case you use Debian or another Operating System where parameters like
the kernel path change, you will have to update it manually though (or
by using a custom script running after update).

I am not sure where you would like the sounds to hear, so you might have
to change things. Also, I assumed the sound files to be located on the
current partition, i.e. - unless changed - the partition GRUB's
configuration files reside on.

Also, you should make sure, grub.cfg is not overwritten by another
distribution's package manager, like Debian's.

Note that the sounds will be played once the respective OS is about to
be booted. I don't know whether it is possible to hear the sound just
upon just selecting an option using arrow keys.

Also, you might consider writing functions for the separate boot options
that you can just call from the GRUB command line.


Regards,
Einhard


On 2018-04-16 13:20, Jeanette C. via arch-general wrote:
> Hey hey,
> how would I best adapt Grub's configuration file (gurb.cfg)?
> 
> The usecase: I use Grub's play command to play different melodies for
> different entries and one when Grub is ready to be used. The reason
> behind it: I'm blind and like to know quite early on what is happening.
> 
> Where would I best put these changes so they will survive Grub updates
> and regeneration of the config file?
> 
> Thanks and best wishes,
> 
> Jeanette
> 
> --------
>  * Website: http://juliencoder.de - for summer is a state of sound
>  * SoundCloud: https://soundcloud.com/jeanette_c
>  * Youtube: https://www.youtube.com/channel/UCMS4rfGrTwz8W7jhC1Jnv7g
>  * GitHub: https://github.com/jeanette-c
>  * Twitter: https://twitter.com/jeanette_c_s
> 
> You should never try to change me
> I can be nobody else
> And I like the way I am <3
> (Britney Spears)


More information about the arch-general mailing list