{
    "mode": "man",
    "parameter": "mkinitramfs",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/mkinitramfs/8/json",
    "generated": "2026-06-03T01:41:44Z",
    "synopsis": "mkinitramfs [option]...  -o outfile [version]",
    "sections": {
        "NAME": {
            "content": "mkinitramfs - low-level tool for generating an initramfs image\n\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "mkinitramfs [option]...  -o outfile [version]",
            "subsections": [
                {
                    "name": "mkinitramfs -h",
                    "content": ""
                }
            ]
        },
        "DESCRIPTION": {
            "content": "The  mkinitramfs script generates an initramfs image.  The initramfs is a compressed cpio ar‐\nchive. The archive can be used on a different box of the same  arch  with  the  corresponding\nLinux  kernel.   mkinitramfs  is meant for advanced usage. On your local box update-initramfs\ncalls mkinitramfs with the relevant parameters.  update-initramfs keeps sha1sum of  generated\ninitramfs. It takes care to generate backups and eventually runs the bootloader.\n\nAt  boot  time,  the kernel unpacks that archive into RAM disk, mounts and uses it as initial\nroot file system. All finding of the root device happens in this early userspace.\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-c",
                    "content": "Override the COMPRESS setting in initramfs.conf.\n\n",
                    "flag": "-c"
                },
                {
                    "name": "-d",
                    "content": "Set an alternate configuration directory.\n\n",
                    "flag": "-d"
                },
                {
                    "name": "-k",
                    "content": "",
                    "flag": "-k"
                },
                {
                    "name": "-o",
                    "content": "Write the image to outfile.\n\n",
                    "flag": "-o"
                },
                {
                    "name": "-r",
                    "content": "Override the ROOT setting in initramfs.conf.\n\n",
                    "flag": "-r"
                },
                {
                    "name": "-v",
                    "content": "version\nSet the kernel version of the initramfs image (defaults to the running kernel).\n\n",
                    "flag": "-v"
                },
                {
                    "name": "-h --help",
                    "content": "Display usage information and exit.\n\n",
                    "flag": "-h",
                    "long": "--help"
                }
            ]
        },
        "ENVIRONMENT": {
            "content": "mkinitramfs honours the TMPDIR environment variable. If set, it uses  subdirectories  in  the\ngiven directory to create its temporary working directories. Else it uses /var/tmp as default\nvalue for that purpose. The given directory should be on a filesystem which allows the execu‐\ntion of files stored there, i.e.  should not be mounted with the noexec mount option.\n\nIf SOURCEDATEEPOCH is set, mkinitramfs attempts to generate a reproducible initramfs image.\n\n",
            "subsections": []
        },
        "FILES": {
            "content": "/etc/initramfs-tools/initramfs.conf\nThe default configuration file for the script. See initramfs.conf(5) for a description\nof the available configuration parameter.\n\n\n/etc/initramfs-tools/modules\nSpecified modules will be put in the generated image and loaded when the system boots.\nThe  format  - one per line - is identical to that of /etc/modules, which is described\nin modules(5).\n\n\n/etc/initramfs-tools/conf.d\nThe conf.d directory allows one to hardcode bootargs at initramfs build time via  con‐\nfig  snippets.  This  allows one to set ROOT or RESUME.  This is especially useful for\nbootloaders, which do not pass an root bootarg.\n\n\n/etc/initramfs-tools/DSDT.aml\nIf this file exists, it will be appended to the initramfs in a way that causes  it  to\nbe loaded by ACPI.\n\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "Create an initramfs for current running kernel:\n\n",
            "subsections": [
                {
                    "name": "mkinitramfs -o ~/tmp/initramfs-$(uname -r)",
                    "content": "Create an initramfs for specific kernel and keep builddirs:\n\n"
                },
                {
                    "name": "mkinitramfs -k -o ~/tmp/initramfs-2.6.21-686 2.6.21-686",
                    "content": "Debug initramfs creation (check out written logfile)\n"
                },
                {
                    "name": "sh -x mkinitramfs -o ~/tmp/initramfs-$(uname -r) 2> ~/tmp/log",
                    "content": ""
                }
            ]
        },
        "AUTHOR": {
            "content": "The  initramfs-tools  are  written by Maximilian Attems <maks@debian.org>, Jeff Bailey <jbai‐\nley@raspberryginger.com> and numerous others.\n\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "initramfs.conf(5),   initramfs-tools(7),    update-initramfs(8),    lsinitramfs(8),    un‐\nmkinitramfs(8).\n\n\n\ninitramfs-tools                              2018/07/18                               MKINITRAMFS(8)",
            "subsections": []
        }
    },
    "summary": "mkinitramfs - low-level tool for generating an initramfs image",
    "flags": [
        {
            "flag": "-c",
            "long": null,
            "arg": null,
            "description": "Override the COMPRESS setting in initramfs.conf."
        },
        {
            "flag": "-d",
            "long": null,
            "arg": null,
            "description": "Set an alternate configuration directory."
        },
        {
            "flag": "-k",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-o",
            "long": null,
            "arg": null,
            "description": "Write the image to outfile."
        },
        {
            "flag": "-r",
            "long": null,
            "arg": null,
            "description": "Override the ROOT setting in initramfs.conf."
        },
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": "version Set the kernel version of the initramfs image (defaults to the running kernel)."
        },
        {
            "flag": "-h",
            "long": "--help",
            "arg": null,
            "description": "Display usage information and exit."
        }
    ],
    "examples": [
        "Create an initramfs for current running kernel:",
        "Create an initramfs for specific kernel and keep builddirs:",
        "Debug initramfs creation (check out written logfile)"
    ],
    "see_also": [
        {
            "name": "initramfs.conf",
            "section": "5",
            "url": "https://www.chedong.com/phpMan.php/man/initramfs.conf/5/json"
        },
        {
            "name": "initramfs-tools",
            "section": "7",
            "url": "https://www.chedong.com/phpMan.php/man/initramfs-tools/7/json"
        },
        {
            "name": "update-initramfs",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/update-initramfs/8/json"
        },
        {
            "name": "lsinitramfs",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/lsinitramfs/8/json"
        }
    ]
}