02.02.2017 03:33, Shaun Reitan пишет: > I'm attempting to build a grub2 image that will be used with QEMU to > load the grub configuration from a flat disk image (no partitioning, > just a filesystem). I've created a grub.cfg with the following inside of > it. > > echo "Hold onto your grub!" > for grubcfg in /boot/grub2/grub.cfg /etc/grub.cfg; do > echo $grubcfg > done > > I've then built the image by doing the following... > > grub-mkimage -O i386-pc -c grub.cfg -o grub2.img at_keyboard configfile > biosdisk ext2 linux serial halt minicmd terminal all_video cat echo gzio > search linux16 normal disk test true fat memdisk tar ls sleep -p > /usr/src/grub/grub-core/ > > When starting qemu using that image as the kernel I do see grub loaded, > however i'm dumped at a shell. What i've realized is that the for loop > in my grub.cfg is not working, but whats weird is that a for loop in the > shell works fine.
That's correct. Embedded config is executed in very limited environment (this is rescue mode you end in when normal.mod cannot be loaded), before normal.mod is loaded, and does not support scripting which is implemented by normal.mod. Embedded config is intended only to provide information about normal.mod (or in general $prefix) location. > I am able to load the grub.cfg from the disk if i do > the following... > > set root=(hd0) > configfile /boot/grub2/grub.cfg > > Any help on what i'm doing wrong here. This grub2 image will boot many > different linux distros so i need grub to search for the grub.cfg in a > few places. > Use grub-mkstandalone to create image that includes internal memory disk and place your config on this memory disk. Do not include your modules in image itself. By default grub-mkstandalone adds all available modules; if size is an issue (but this is really a couple of megabytes, so I do not expect it), you can restrict module list and other components - see help output. _______________________________________________ Help-grub mailing list [email protected] https://lists.gnu.org/mailman/listinfo/help-grub
