grub-mkstandalone
Create standalone GRUB images (e.g., for ISOs)
SYNOPSIS
grub-mkstandalone [OPTION...] -o FILE [FILES...]
PARAMETERS
-o, --output=FILE
Specify the output file path for the standalone GRUB image.
-d, --directory=DIR
Use GRUB images and modules from the specified directory. Defaults to GRUB's installation directory.
-C, --compress=(gzip|lzma|xz|none)
Compress the core image using the specified algorithm (gzip, lzma, xz) or none.
-c, --config-file=FILE
Embed a custom GRUB configuration file (e.g., grub.cfg) into the image.
-k, --kernel-file=FILE
Embed a kernel file (e.g., vmlinuz) into the image.
-i, --initrd-file=FILE
Embed an initramfs/initrd file into the image.
-M, --memdisk-image=FILE
Embed a memdisk image into the generated GRUB image.
-m, --modules=MODULES
Comma-separated list of GRUB modules to embed (e.g., 'linux,part_msdos,ext2').
-L, --locale-directory=DIR
Specify the directory containing GRUB locale files.
-l, --locale=LOCALE
Embed a specific locale into the image (e.g., 'en_US').
-O, --format=FORMAT
Specify the target platform and image format (e.g., 'i386-pc' for BIOS, 'x86_64-efi' for UEFI). This is crucial for compatibility.
--install-modules=MODULES
Similar to -m, but ensures these modules are installed as part of the core image for initial boot.
--modules-only
Generate an image containing only specified modules, without a full core, useful for specific module testing or loading.
--themes=THEMES
Embed specified GRUB themes into the image.
--fonts=FONTS
Embed specified GRUB fonts into the image.
--debug
Enable debug messages during the image generation process, useful for troubleshooting.
--version
Display version information and exit.
--help
Display a help message and exit.
FILES...
Any additional files or directories to be included in the GRUB image. These will be accessible from the GRUB environment.
DESCRIPTION
grub-mkstandalone is a powerful utility from the GRUB (Grand Unified Bootloader) 2 project designed to generate a single, self-contained GRUB image. Unlike a full GRUB installation that relies on a specific file system structure, this command consolidates the necessary GRUB core, essential modules, custom configuration files, and optionally a kernel and initrd into one portable binary file. This standalone image can then be embedded into a Master Boot Record (MBR), a GUID Partition Table (GPT) boot sector, or used for creating bootable media such as USB drives, CD-ROMs, or network boot (PXE) images. It provides a convenient way to create a bootloader that does not depend on an existing GRUB installation on the target system, making it ideal for rescue disks, firmware updates, or specialized boot environments. Essentially, it streamlines the process of preparing GRUB for diverse and non-standard boot scenarios, ensuring all necessary components are bundled together for immediate use.
CAVEATS
The generated standalone image is highly specific to the target architecture and firmware type (e.g., PC-BIOS, UEFI, ARM). Incorrectly chosen options for --format (-O) can lead to an unbootable image.
While grub-mkstandalone simplifies the process, a deep understanding of GRUB modules, file systems, and boot processes is often required for advanced or troubleshooting scenarios. Missing essential modules or incorrect paths can prevent the image from booting or recognizing necessary hardware/partitions.
TYPICAL USE CASES
Creating custom bootable USB drives or CD-ROMs for system rescue, diagnostics, or minimal installations.
Generating images for network booting (PXE) environments, allowing multiple machines to boot from a central server.
Embedding a minimal GRUB bootloader into a custom device or firmware where a full OS installation is not present.
Preparing 'memdisk' images for specific boot requirements, allowing an entire system image to reside in RAM.
RELATIONSHIP WITH GRUB-MKIMAGE
grub-mkstandalone often acts as a higher-level wrapper around grub-mkimage. While grub-mkimage focuses on generating the core GRUB image and basic modules for a specific platform, grub-mkstandalone adds the capability to embed additional user-specified files like configuration, kernels, initramfs, locales, themes, and arbitrary data, thus providing a more complete, 'standalone' boot package ready for deployment.
HISTORY
grub-mkstandalone is a core component of GRUB 2, which superseded GRUB Legacy. GRUB 2 was developed to support a broader range of architectures, file systems, and firmware interfaces like UEFI, providing more flexibility and robustness. This specific utility emerged to address the growing need for easily deployable, self-contained bootloaders. Its development reflects the evolution of boot environments, moving beyond traditional hard disk installations to encompass USB drives, network boots (PXE), and embedded systems. It consolidates functionalities that previously might have required manual assembly of GRUB components, simplifying the creation of highly portable and adaptable boot solutions.
SEE ALSO
grub-install(8), grub-mkimage(1), grub-mkconfig(8), grub(8)