My computer has grub installed. During booting before normal.mod is loaded, I need to be able to run if and while commands in my config file which has been linked into core.img (using grub-mkimage -c myconfig.confg). In myconfig.config, I have an if statement and I kept getting "unknown command if" during booting. I saw an example in http://www.gnu.org/software/grub/manual/html_node/Embedded-configuration.html and looks like I just need to include search, test, and normal modules. Am I missing something? Thanks
Using grub, is it possible to use "if, while" during booting (before loading normal.mod)?
1.1k views Asked by user2679024 At
1
Not sure whether this is a bug or the documentation is lacking information.
Anyway there is a workaround by putting your config file in a memdisk image which you can append to the core.img. The config file can then be executed - including scripting support - via
configfile:Create a tarball formatted memdisk image including your config file:
Create
early.cfg: (which will serve to executemyconfig.configviaconfigfile):Create
core.img: (note that you will need the additional modulesmemdisk tar configfile)