Tuesday, May 7, 2024
 Popular · Latest · Hot · Upcoming
7
rated 0 times [  7] [ 0]  / answers: 1 / hits: 7539  / 2 Years ago, fri, august 26, 2022, 6:09:20

How to change the header title and help message in GRUB menu?



My Grub version is 1.99-21ubuntu3 and I'm using Ubuntu 12.04 LTS.



enter image description here


More From » 12.04

 Answers
2

You can try to edit the grub2 source code to modify those strings (Header,Footer etc).




NOTE: I recommend you to do this in a Virtual Machine or in a Test Machine to see is everything is OK. (In this example I'm running Ubuntu 12.04 with grub2 1.99-21ubuntu3.10).




1) Make sure you have enable the Source code repository.



  • Open the Ubuntu Software Center.

  • In the Menu Bar choose Edit -> Software Sources. Click to enable "Source code repository".
    Just in case I use the "Main Server" to Download.


enter image description here


Open a Terminal window Ctrl+Alt+T and type:



  • sudo apt-get update


2) In the Terminal type the following to install the necessary packages.



  • sudo apt-get install build-essential quilt


3) Install build dependencies.



  • sudo apt-get build-dep grub2


4) Create a folder to download the source code.



  • mkdir ~/Downloads/src



  • cd ~/Downloads/src




5) Download the source code & Export variables.



  • apt-get source grub2



  • export QUILT_PATCHES=debian/patches



  • export EDITOR=gedit




6) Create the patch and edit the source code.



  • cd grub2-1.99



  • quilt new 99_custom-header-footer.patch






Edit the main.c file



  • quilt edit grub-core/normal/main.c


enter image description here


As an example I changed the line 214


From:


  const char *msg = _("GNU GRUB  version %s");

To:


  const char *msg = _("My Custon Grub Title");



Edit the menu_text.c file



  • quilt edit grub-core/normal/menu_text.c


Edit the "Strings" (Pink Color) According to your needs.


enter image description here


Only as an example I changed the lines 159 & 160


From:


  const char *msg = _("Use the %C and %C keys to select which "
"entry is highlighted.
");

To:


      const char *msg = _("You can write a text message here according 
to your needs...
");

And the lines 187 to 189


From:


(_("Press enter to boot the selected OS, "
"'e' to edit the commands before booting "
"or 'c' for a command-line.
"),

To:


        (_("You can put a message here... to press 
a key to boot the OS.
Or a Help text... etc."),



7) Build the deb packages.



  • quilt refresh

  • fakeroot dpkg-buildpackage


NOTE: This may take awhile.


8) Install the deb packages.



  • cd ..



  • sudo dpkg -i grub-pc*.deb grub2-common*.deb




9) Finally you can Restart your machine to see the changes.


Before:


enter image description here


After:


enter image description here


Hope this helps.


[#29052] Friday, August 26, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
tialmes

Total Points: 14
Total Questions: 108
Total Answers: 102

Location: Oman
Member since Thu, Jun 16, 2022
2 Years ago
;