On Linux, with GRUB 2 Bootloader, I try to figure out the actual usage of the --config= option in grub-mkimage. The man 1 grub-mkimage on this topic:

-c, --config=FILE
embed FILE as an early config

My first guess would be /boot/grub/grub.cfg -> but then there's a separate command to build this file, which leads me away from this guess. Another guess is /boot/config-3.16.0-4-686-pae (file's output: "Linux make config build file, ASCII text"). The other files I found were not ASCII but binary files, which also isn't much likely to be meant, I guess.

Question: What file, or kind of file, could be meant?

UPDATE: Found this one in the gnu.org documentation for GRUB 2, among commands for the GRUB prompt:

configfile file
Load FILE as a configuration file. If FILE defines any menu entries, then show a menu containing them immediately.

Probably the same file? Funny sidenot: The online manual seemingly doesn't mention this option.

UPDATE 2: Found the following line in the output of grub-mkrescue --output grub.iso --verbose

grub-mkrescue: info: grub-mkimage --directory '/usr/lib/grub/i386-pc' --prefix '/boot/grub' --output '/tmp/grub.ZiXwO6/boot/grub/i386-pc/eltorito.img' --format 'i386-pc-eltorito' --compression 'auto' --config '/tmp/grub.UtCj8W' 'biosdisk' 'iso9660'`

So --config '/tmp/grub.UtCj8W' rules out /boot/grub/grub.cfg .. somehow? And no, I didn't find anything mentioned about configuration when executing grub-install with verbose output activated

UPDATE 3: man 1 grub2-mkstandalone opens man 3 grub2-mkstandalone, but issuing man 3 grub2-mkstandalone leads to an error message. Also: grub-mkimage --config= seems to appear in the man page only but neither in --help nor in --usage output.


grub-mkimage is the key central for grub to build all other stuffs when needed. For example, grub-[install,mkstandalone,mkrescue] all refer to the use of grub-mkimage, so once grub-mkimage is understood, everything looks easy to do.

grub-mkimage has 2 ways to "attach" a config file to its image :

  1. option -c,--config=File (embed FILE as an early config)

  2. option -m,--memdisk=file (embed FILE as a memdisk containing eventually config file)

Example: embedded config [$prefix]/boot/grub/[x86_64-efi/]grub.cfg

The memdisk is a virtual disk device viewed by grub, having a tarfs filesystem; the various modules sitting there are "ready for use", meaning they can be loaded by insmod directly. But they are not directly callabled as the "preloaded modules" as those in the options --modules="blah blah...:" (the last ones are similar to drivers loaded in initramfs in Linux OS)

The best demonstration for this assertion is using one line command to remaster a livecd_only_biosPC_awared into a livecd_isohybrid_bios_and_efi_awared

xorriso -osirrox on -indev TinyCorePure64-6.0.iso -outdev new.iso \
-cpr efime.img /boot -- \
-rm /boot/isolinux/boot.cat -- \
-mkdir /.disk /boot/grub -- \
-cpr grub.cfg /boot/grub -- \
-cpr info /.disk/info -- \
 -as mkisofs  -graft-points -volid "tinyefi" -r -J -l -eltorito-boot boot/isolinux/isolinux.bin -eltorito-catalog boot/isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -isohybrid-mbr /usr/lib/syslinux/isohdpfx.bin -eltorito-alt-boot -e boot/efime.img -no-emul-boot -isohybrid-gpt-basdat


  1. ftp://ftp.nluug.nl/pub/os/Linux/distr/tinycorelinux/6.x/x86_64/archive/6.0/TinyCorePure64-6.0.iso
  2. grub.cfg is plain config to reproduce isolinux.cfg of original live ISO
  3. The bootloader efime.img is obtained with

    grub-mkimage -m memdisk -O x86_64-efi -o grubx64.efi --compression=xz disk part_msdos part_gpt linux linux16 loopback normal configfile test search search_fs_uuid search_fs_file true iso9660 test search_label efi_uga efi_gop gfxterm gfxmenu gfxterm_menu fat ext2 ntfs cat echo ls memdisk tar

  4. The simplest memdisk contains (memdisk)/boot/grub/grub.cfg as early-embedded config file.

All about this will soon appear as exercises on grub-mkBootx64.efi @sourceforge.net/projects/toysbox

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.