Jump to content
Read the Funtoo Newsletter: Summer 2023 ×
  • 0

Set Grub Theme via /etc/boot.conf ?


jorgicio

Question

8 answers to this question

Recommended Posts

  • 0

This is the beginning section of my /etc/boot.conf, if it gives any ideas:

boot {
generate grub
default "And we're gonna have Funtoo!" 
timeout 3 
}
display {
gfxmode 1440x900x32
background /boot/grub-startup.png
}
color {
normal light-blue/black
highlight white/light-blue
}
The memtest+ could be trickier, some of those things are not yet implemented in boot-update.  Although I vaguely recall seeing someone doing it with memtest on the old (now non-existent) funtoo forum.  
A couple of weeks ago I submitted the following code that adds a loop mounted sysrescuedisk entry to grub.  But it's either been trashed or is still in limbo.  Probably because the right way to do it would be to submit a patch to boot-update, only I'm not so hot on python, which is what it's coded in.  Here it is:
#!/bin/bash
 
# boot-fix
 
FILENAME=`ls /opt/sysrcd/systemrescuecd*`
 
sed -i 's/gfxpayload=text/gfxpayload=keep/g' /boot/grub/grub.cfg
 
sed -i 's%set menu_color_highlight=white/light-blue%set menu_color_highlight=white/light-blue\
set color_normal=brown/black%' /boot/grub/grub.cfg
 
sed -i 's%set default%menuentry "SystemRescueCd (isoloop with backstore)" {\
insmod part_gpt\
        insmod ext2\
        set root=(hostdisk//dev/sda,gpt4)\
        loopback loop (hd0,gpt4)'$FILENAME'\
        linux (loop)/isolinux/rescue64 setkmap=us backstore=alldev,/opt/sysrcd/sysrcd.bs docache isoloop='$FILENAME'\
        initrd (loop)/isolinux/initram.igz\
}\n\
menuentry "SystemRescueCd (isoloop no backstore)" {\
        insmod ext2\
        insmod part_gpt\
        set root=(hostdisk//dev/sda,gpt4)\
        loopback loop (hd0,gpt4)'$FILENAME'\
        linux (loop)/isolinux/rescue64 setkmap=us backstore=off docache isoloop='$FILENAME'\
        initrd (loop)/isolinux/initram.igz\
}\n\
set default%' /boot/grub/grub.cfg
It's a bash bandage with just a bunch of sed statements modifying your grub.cfg after boot-update generates it.  If all else fails, you can do something like that.

 

Link to comment
Share on other sites

  • 0

Well, I mean another initramfs image fallback kernel. When I used Gentoo and compiled the kernel with genkernel, it generated 2 images: a normal one and a fallback one. Funtoo genkernel generates only one.

 

Just saying...

 

Take your known "good/stable" kernel image and initrd and copy them to new names that genkernel won't overwrite.  The problem with automatically doing this is that you might be running genkernel because the old one doesn't work, which would overwrite the other ".old" that is good, or you end up with a million copies of kernels (like my Ubuntu-based system that likes to upgrade the kernel and break shit all the time and leave with a million kernels in my grub menu.

Link to comment
Share on other sites

  • 0

Couple questions since we are on the topic. 

 

Will Grub scale the given image to the current resolution, or do you have to provide a copy of the image in every resolution?

 

Is there a tutorial on how to change the menu size?  I've seen the menus placed in various parts of the screen, changed to use icons, and all sorts of stuff.  The last Gentoo live DVD is a good example.  Its a big download, but the grub on it is newer than what funtoo has available and the configuration is very well done! 

 

In the loopback mount that you did, have you ever tried to grab the ISO off NFS?  I think its possible.  And if grub can do that (would need NFS drivers in grub) then you should be able to chainload the ISO image as if it was a CD without having to give it the kernel and initrd lines ... just chainload to whatever secondary bootloader is on the medium.  I was thinking that with some careful scripting, you could have an NFS server with a bunch of ISOs and a script that generates a grub config file for all those entries.  You would then just need a grub menu item that loads the remote config file.

 

I guess grub can load files through tftp.  Anyone tried to load a whole ISO via tftpboot and loopback it in grub?

Link to comment
Share on other sites

  • 0

Couple questions since we are on the topic. 

 

Will Grub scale the given image to the current resolution, or do you have to provide a copy of the image in every resolution?

 

Is there a tutorial on how to change the menu size?  I've seen the menus placed in various parts of the screen, changed to use icons, and all sorts of stuff.  The last Gentoo live DVD is a good example.  Its a big download, but the grub on it is newer than what funtoo has available and the configuration is very well done! 

 

In the loopback mount that you did, have you ever tried to grab the ISO off NFS?  I think its possible.  And if grub can do that (would need NFS drivers in grub) then you should be able to chainload the ISO image as if it was a CD without having to give it the kernel and initrd lines ... just chainload to whatever secondary bootloader is on the medium.  I was thinking that with some careful scripting, you could have an NFS server with a bunch of ISOs and a script that generates a grub config file for all those entries.  You would then just need a grub menu item that loads the remote config file.

 

I guess grub can load files through tftp.  Anyone tried to load a whole ISO via tftpboot and loopback it in grub?

I don't think it will scale the image, but frankly I forget.  Try it!

Menu size (including font) changes with the resolution changes.  AFAIK you need to size the picture to match gfxmode.  But not the box, it fills the screen no matter what, I don't know how to change that.  Also you can try dinking around with changing the default grub font, too much to go into here, but you can find lots of info on that on the web.

I haven't tried the NFS idea.  Sounds like a cool idea, but I think you would have to modify the initrd for sysrescue, that could be hairy because it's a compressed filesystem.  I have made custom sysrescue iso's and it's a several step process because of that.  And then the same for any other iso's.  It would be cool though.

Link to comment
Share on other sites

  • 0

Have you see the way grub is configured on the Gentoo liveCD?  Doesn't look like grub at all except for the "Welcome to Grub" printed by the EFI loader right before the graphical menu starts.  Even boots the kernel in a little window!  I have no idea how they pulled that off  yet, but I'll be looking into it.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...