help-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Specify different config file for i386-xen_pvh grub2 image?


From: Shaun Reitan
Subject: Specify different config file for i386-xen_pvh grub2 image?
Date: Sat, 11 Dec 2021 23:57:53 +0000
User-agent: eM_Client/8.2.1659.0

I'm transitioning from using grub2 for a PV guest to grub2 for a PVH guest due to the fact that the PV version cannot load lz4 compressed kernels. I've been using the following command to build the image.

./grub-mkstandalone --grub-mkimage=./grub-mkimage -o grub2-pvh -O i386-xen_pvh -d grub-core/ "/boot/grub/grub.cfg=./grub.cfg"

In my grub.cfg i have the following
search -s root -f /boot/grub/grub.cfg

So I think I'm finally realizing that my problem in my grub.cfg is that the search is going to create a loop and will find and load the grub.cfg on the memdisk? Is that correct?

The issue I'm having is that some distros have their grub.cfg in /boot/grub/grub.cfg. How can i tell my grub image to use/load a different configfile? For example i'd like to rename my grub.cfg to maybe bootstrap.cfg so that the search line above finds the grub.cfg on the disk rather than the one on the memdisk.

Hopefully that makes sense. My grub.cfg will actually have alot more logic than what I have above. It will be searching for grub.cfg in multiple paths until it finds it's first match and then use that.

For example probably something like...

for grubcfg in /boot/grub/grub.cfg /boot/grub2/grub.cfg /boot/grub/grub2.cfg /grub2/grub2.cfg /etc/grub2.cfg /etc/grub.cfg ; do
   if search -s -f $grubcfg ; then
      echo "Reading (${root}$grubcfg"
      configfile $grubcfg
   fi
done

--
Shaun Reitan
NDCHost.com


reply via email to

[Prev in Thread] Current Thread [Next in Thread]