Grub installation with customized grub.cfg filename possible?

Hi to all,
I have dug many websites and I found that the legacy grub configuration filename “grub.cfg” is not hard coded. I want to let grub use another filename than grub.cfg but I did not find any option of grub-install to do this… Is it possible to use different filename - or not?

I don’t have an answer to your question, but a related answer is: you can use file
/boot/grub/custom.cfg in addition to grub.cfg. So you can add your special manual grub menu entries into custom.cfg, and grub will not overwrite them when updating grub.cfg.

I am not an expert, but it looks pretty hardcoded to me.

Question: Why do you want to use a different filename? Is it something that can be done a different way?

I have build an installation from https://www.system-rescue.org . I put the files for a 64bit and a 32 bit system in different folders, also configured boot with legacy BIOS and EFI. Everything works fine but I have to use two different grub configs. If I boot via legacy BIOS grub uses grub.cfg and if I use EFI grub uses grubrscd.cfg. By using cpuid module within grub I am able to show only 32 bit entries if processor only supports 32 bit. Everything is working - but I have to maintain two grub configurations (one for legacy boot and one for EFI) and I want to learn if this can be simplified. I dug into mbr binary and have not found the string grub.cfg. But I have found it in module normal.mod. But I think that cannot be the place it is hard coded because modules are loaded AFTR configuration is loaded?

Grub entries can call other grub config files. Can you setup the entries to load the correct file?

See here for an example:
https://www.gnu.org/software/grub/manual/grub/grub.html#Multi_002dboot-manual-config

Alternatively, can you chainload one from the other?

1 Like