LinuxCommandLibrary

grub-mkstandalone

Create standalone GRUB images (e.g., for ISOs)

SYNOPSIS

grub-mkstandalone [OPTION...] --output=FILE [--format=FORMAT] [MODULES ...]

PARAMETERS

-?, --help
    Print help message and exit.

-v, --version
    Print version information and exit.

--compress[=no|gzip|xz]
    Compress the image, even with modules (gzip by default).

--directory=DIR
    Use GRUB images/modules from DIR (default: /usr/lib/grub).

--format=FORMAT
    Output format: i386-efi, x86_64-efi, arm-efi, arm64-efi, ia64-efi, riscv32-efi, riscv64-efi.

--locale-dir=DIR
    Use DIR for locale data (default: PREFIX/locale).

--locales=LANG1[,LANG2,...]
    Include translations for specified languages.

--modules=MODULE1[,MODULE2,...]
    Include listed modules in the image.

--no-uefi-ls
    Exclude ls module, even if available.

--output=FILE (-o)
    Set output file name (required).

--prefix=STRING
    GRUB prefix directory (default: /boot/grub).

--theme=THEME
    Use theme relative to prefix.

--xorriso=PATH
    Path to xorriso binary.

DESCRIPTION

The grub-mkstandalone command generates a single, self-contained GRUB bootloader image for EFI firmware platforms. It embeds essential GRUB modules directly into the binary, eliminating the need for a separate filesystem or prefix directory during boot. This is particularly useful for creating bootable images for USB drives, CDs, or embedded systems where GRUB must operate standalone.

Commonly used by grub-mkrescue to build bootable ISO images, it supports multiple EFI architectures like x86_64, i386, ARM, and RISC-V. Users specify output file, format, modules, prefix, and optional compression. The resulting image includes core functionality such as terminal, config loading, and filesystem support based on included modules.

Key benefits include portability and simplicity for EFI booting without GRUB's full installation. Specify modules explicitly or rely on defaults; compression reduces size. Ideal for rescue disks, live systems, or minimal boot environments.

CAVEATS

Requires EFI firmware; --output mandatory. Modules must be architecture-compatible. Large module sets increase image size. Not for BIOS/legacy boot.

TYPICAL USAGE

grub-mkstandalone --format=x86_64-efi --output=bootx64.efi /boot/grub/grubx64.efi

MODULE SELECTION

Defaults include core modules; add via --modules=ext2,linux for filesystem/kernel support.

HISTORY

Introduced in GRUB 2.00 (2012) to support EFI standalone images, enhancing rescue and live media tools. Evolved with new EFI architectures in GRUB 2.04+.

SEE ALSO

Copied to clipboard