{"id":13470451,"url":"https://github.com/pengutronix/genimage","last_synced_at":"2025-10-21T13:07:19.800Z","repository":{"id":28538720,"uuid":"32055723","full_name":"pengutronix/genimage","owner":"pengutronix","description":"tool to generate multiple filesystem and flash images from a tree","archived":false,"fork":false,"pushed_at":"2025-01-23T16:25:51.000Z","size":648,"stargazers_count":333,"open_issues_count":18,"forks_count":115,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-01-23T17:29:11.111Z","etag":null,"topics":["disk-image","embedded-linux","filesystems"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pengutronix.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-03-12T03:48:36.000Z","updated_at":"2025-01-23T16:42:40.000Z","dependencies_parsed_at":"2024-03-06T13:31:15.489Z","dependency_job_id":"b0027c29-6298-4d72-83a6-0fbb338f8c52","html_url":"https://github.com/pengutronix/genimage","commit_stats":{"total_commits":407,"total_committers":53,"mean_commits":7.679245283018868,"dds":"0.46928746928746934","last_synced_commit":"fa614899a550ed0bb4c3ca38cb32308169a37b72"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengutronix%2Fgenimage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengutronix%2Fgenimage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengutronix%2Fgenimage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pengutronix%2Fgenimage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pengutronix","download_url":"https://codeload.github.com/pengutronix/genimage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245644432,"owners_count":20649203,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["disk-image","embedded-linux","filesystems"],"created_at":"2024-07-31T16:00:30.585Z","updated_at":"2025-10-21T13:07:19.789Z","avatar_url":"https://github.com/pengutronix.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"==================================\nGenimage - The Image Creation Tool\n==================================\n\ngenimage is a tool to generate multiple filesystem and flash/disk images\nfrom a given root filesystem tree. genimage is intended to be run\nin a fakeroot environment.\nIt also supports creating flash/disk images out of different file-system images and files.\n\nConfiguration is done in a config file parsed by libconfuse. Options\nlike the path to tools can be given via environment variables, the config\nfile or from commandline switches.\n\nThe Configuration File\n======================\n\nThe config file of genimage uses a simple configuration language, provided by `libconfuse`_.\nThis supports nested sections, as well as simple key-value pairs.\n\n.. _libconfuse: https://github.com/libconfuse/libconfuse\n\nSingle-line comments can be introduced with ``#`` or ``//``,\nmulti-line comments look like ``/* … */`` (as in C).\n\nThe config file is separated into the main sections ``image``, ``flash`` and ``config``,\nand provides an ``include`` primitive.\n\nThe image section\n-----------------\n\nAn image section describes a single filesystem or disk image to be built. It can be given\nmultiple times to generate multiple images. An image can also have multiple\npartitions which refer to images themselves.\nEach image must have a type which can have different suboptions depending on\nthe type.\n\nLet's have a look at an example::\n\n  image nand-pcm038.img {\n\t  flash {\n\t  }\n\t  flashtype = \"nand-64M-512\"\n\t  partition barebox {\n\t\t  image = \"barebox-pcm038.bin\"\n\t\t  size = 512K\n\t  }\n\t  partition root {\n\t\t  image = \"root-nand.jffs2\"\n\t\t  size = 24M\n\t  }\n  }\n\nThis would generate a nand-pcm038.img which is a flash of type \"nand-64M-512\"\nThe image contains two partitions, \"barebox-pcm038.bin\" and \"root-nand.jffs2\"\nwhich must refer to images described elsewhere in the config file. For example\n\"root-nand.jffs2\" partition could be described like this::\n\n  image root-nand.jffs2 {\n\t  name = \"root\"\n\t  jffs2 {}\n\t  size = 24M\n\t  mountpoint = \"/\"\n  }\n\nIn this case a single jffs2 image is generated from the root mountpoint.\n\nHere are all options for images:\n\n:name:\t\tThe name of this image. This is used for some image types\n\t\tto set the name of the image.\n:size:\t\tSize of this image in bytes. 'k', 'M' or 'G' can be used as\n\t\tsuffix to specify the size in multiple of 1024\n\t\tetc. The suffix 's' specifies a multiple of the\n\t\t(traditional) sector size of 512. If the image if\n\t\tfilled from a mountpoint then '%' as suffix indicates\n\t\ta percentage. '200%' means the resulting filesystem\n\t\tshould be about 50% filled. Note that is is only a\n\t\trough estimate based on the original size of the\n\t\tcontent.\n:mountpoint:\tmountpoint if image refers to a filesystem image. The\n\t\tdefault is \"/\". The content of \"${rootpath}${mountpoint}\"\n\t\twill be used to fill the filesystem.\n:srcpath:\tIf this is set, specified path will be directly used\n\t\tto fill the filesystem. Ignoring rootpath/mountpoint logic.\n\t\tPath might be absolute or relative\n\t\tto current working directory.\n:empty:\t\tIf this is set to true, then the specified rootpath and\n\t\tmountpoint are ignored for this image and an empty\n\t\tfilesystem is created. This option is only used for\n\t\twriteable filesystem types, such as extX, vfat, ubifs and\n\t\tjffs2. This defaults to false.\n:temporary:\tIf this is set to true, the image is created in\n\t\t``tmppath`` rather than ``outputpath``. This can be\n\t\tuseful for intermediate images defined in the\n\t\tconfiguration file which are not needed by themselves\n\t\tafter the main image is created. This defaults to\n\t\tfalse.\n:exec-pre:\tCustom command to run before generating the image.\n\t\tAvailable variables are documented in the `Environment\n\t\tVariables`_ section below.\n:exec-post:\tCustom command to run after generating the image.\n:flashtype:\trefers to a flash section. Optional for non flash like images\n\t\tlike hd images\n:partition:\tcan be given multiple times and refers to a partition described\n\t\tbelow\n\nAdditionally each image can have one of the following sections describing the\ntype of the image:\n\ncpio, cramfs, custom, erofs, ext2, ext3, ext4, f2fs, file, flash, hdimage, iso,\njffs2, mdraid, qemu, squashfs, tar, ubi, ubifs, vfat.\n\nPartition options:\n\n:offset:\t\tThe offset of this partition as a total offset to the beginning\n\t\t\tof the device.\n:size:\t\t\tThe size of this partition in bytes. If the size and\n\t\t\tautoresize are both not set then the size of the partition\n\t\t\timage is used.\n:align:\t\t\tAlignment value to use for automatic computation of ``offset``\n\t\t\tand ``size``.  Defaults to 1 for partitions not in the partition\n\t\t\ttable, otherwise to the image's ``align`` value.\n:partition-type:\tUsed by dos partition tables to specify the partition type.\n:image:\t\t\tThe image file this partition shall be filled with\n:imageoffset:\t\tThe offset within the partition image to start\n\t\t\treading from.\n:fill:\t\t\tBoolean specifying that all bytes of the partition should be\n\t\t\texplicitly initialized. Any bytes beyond the size of the specified\n\t\t\timage will be set to 0.\n:sparse:\t\tIf true (the default) 'holes' in the input images are preserved\n\t\t\tand the remaining free space in the partition is also a 'hole'.\n\t\t\tIf false, the 'holes' in the input image are explicitly\n\t\t\tfilled with zeros when the image is copied. If ``fill``\n\t\t\tis specified as well then the remaining free space is\n\t\t\talso filled with zeros.\n:autoresize:\t\tBoolean specifying that the partition should be resized\n\t\t\tautomatically. For UBI volumes this means that the\n\t\t\t``autoresize`` flag is set. Only one volume can have this flag.\n\t\t\tFor hd images this can be used for the last partition. If set\n\t\t\tthe partition will fill the remaining space of the image.\n:bootable:\t\tBoolean specifying whether to set the bootable flag.\n:hidden:\t\tBoolean specifying whether to set the hidden flag (only with GPT).\n:no-automount:\t\tBoolean specifying whether to set the no-automount flag (only with GPT).\n:read-only:\t\tBoolean specifying whether to set the read-only flag (only with GPT).\n:in-partition-table:\tBoolean specifying whether to include this partition in\n\t\t\tthe partition table. Defaults to true.\n:forced-primary:\tForce this partition to be a primary partition in the\n\t\t\tMBR partition table, useful when the extended partition should be\n\t\t\tfollowed by primary partitions. If there are more partitions\n\t\t\tdefined after the first forced-primary, they must be also defined\n\t\t\tas forced-primary. Defaults to false.\n:partition-uuid:\tUUID string used by GPT partition tables to specify the partition\n\t\t\tid. Defaults to a random value.\n:partition-type-uuid:\tString used by GPT partition tables to specify the partition type.\n\t\t\tEither a UUID or a shortcut:\n\n\t\t\t* ``L``, ``linux``, ``linux-generic``: Linux filesystem (0fc63daf-8483-4772-8e79-3d69d8477de4)\n\t\t\t* ``S``, ``swap``: Swap (0657fd6d-a4ab-43c4-84e5-0933c84b4f4f)\n\t\t\t* ``H``, ``home``: Home (933ac7e1-2eb4-4f13-b844-0e14e2aef915)\n\t\t\t* ``U``, ``esp``, ``uefi``: EFI System Partition (c12a7328-f81f-11d2-ba4b-00a0c93ec93b)\n\t\t\t* ``R``, ``raid``: Linux RAID (a19d880f-05fc-4d3b-a006-743f0f84911e)\n\t\t\t* ``V``, ``lvm``: Linux LVM (e6d6d379-f507-44c2-a23c-238f2a3df928)\n\t\t\t* ``F``, ``fat32``: FAT32 / Basic Data Partition (ebd0a0a2-b9e5-4433-87c0-68b6b72699c7)\n\t\t\t* ``barebox-state`` (previously ``B``): Barebox State (4778ed65-bf42-45fa-9c5b-287a1dc4aab1)\n\t\t\t* ``barebox-env``: Barebox Environment (6c3737f2-07f8-45d1-ad45-15d260aab24d)\n\t\t\t* ``u-boot-env``: U-Boot Environment (3de21764-95bd-54bd-a5c3-4abe786f38a8)\n\n\t\t\tFurthermore, for ``{arch}`` being one of ``alpha``,\n\t\t\t``arc``, ``arm``, ``arm64``, ``ia64``, ``loongarch64``,\n\t\t\t``mips``, ``mips64``, ``mips-le``, ``mips64-le``, ``parisc``, ``ppc``,\n\t\t\t``ppc64``, ``ppc64-le``, ``riscv32``, ``riscv64``,\n\t\t\t``s390``, ``s390x``, ``tilegx``, ``x86``, ``x86-64``,\n\t\t\tthe following shortcuts from the `Discoverable\n\t\t\tPartitions Specification \u003cdps-spec_\u003e`_ are accepted (see the spec\n\t\t\tfor the respective UUIDs):\n\n\t\t\t* ``root-{arch}``: Root Partition\n\t\t\t* ``usr-{arch}``: /usr Partition\n\t\t\t* ``root-{arch}-verity``: Root Verity Partition\n\t\t\t* ``usr-{arch}-verity``: /usr Verity Partition\n\t\t\t* ``root-{arch}-verity-sig``: Root Verity Signature Partition\n\t\t\t* ``usr-{arch}-verity-sig``: /usr Verity Signature Partition\n\t\t\t* ``xbootldr``: Extended Boot Loader Partition\n\t\t\t* ``srv``: Server Data Partition\n\t\t\t* ``var``: Variable Data Partition\n\t\t\t* ``tmp``: Temporary Data Partition\n\t\t\t* ``user-home``: Per-user Home Partition\n\n\t\t\tCustom shortcuts can be defined in the global ``config`` section::\n\n\t\t\t  config {\n\t\t\t\tgpt-shortcuts {\n\t\t\t\t\tforty-two = \"2a422a42-2a42-2a42-2a42-2a422a422a42\"\n\t\t\t\t}\n\t\t\t  }\n\n\t\t\tDefaults to ``L``.\n\n.. _dps-spec: https://uapi-group.org/specifications/specs/discoverable_partitions_specification/\n\nFor each partition, its final alignment, offset and size are determined as follows:\n\n* If the ``align`` option is not present, it defaults to the value of\n  the image's ``align`` option if the partition is in the partition\n  table, otherwise to 1.\n\n* If the ``offset`` option is absent or zero, and\n  ``in-partition-table`` is true, the partition is placed after the\n  end of all previously defined partitions, with the final offset\n  rounded up to the partition's ``align`` value.\n\n* Otherwise, the ``offset`` option is used as-is. Note that if absent,\n  that option defaults to 0, so in practice one must specify an\n  ``offset`` for any partition that is not in the partition table\n  (with at most one exception, e.g. a bootloader).\n\n* If the partition has the ``autoresize`` flag set, its size is\n  computed as the space remaining in the image from its offset (for a\n  GPT image, space is reserved at the end for the backup GPT table),\n  rounded down to the partition's ``align`` value. If the partition\n  also has a ``size`` option, it is ensured that the computed value is\n  not less than that size.\n\n* Otherwise, if the ``size`` option is present and non-zero, its value\n  is used as-is.\n\n* Otherwise, if the partition has an ``image`` option, the size of\n  that image, rounded up to the partition's ``align`` value, is used\n  to determine the size of the partition.\n\nThe following sanity checks are done on these final values (in many\ncases, these will automatically be satisfied when the value has been\ndetermined via one of the above rules rather than given explicitly):\n\n* For a partition in the partition table, the partition's ``align``\n  value must be greater than or equal to the image's ``align`` value.\n\n* The partition's ``offset`` and ``size`` must both be multiples of\n  its ``align``.\n\n* The size must not be 0.\n\n* The partition must not overlap any other partition, or the areas\n  occupied by the partition table.\n\nThe image configuration options\n-------------------------------\n\nandroid-sparse\n**************\nGenerate android sparse images. They are typically used by fastboot. Sparse\nimages encode \"don't care\" areas and areas that are filled with a single\n32 bit value. As a result, they are often much smaller than raw disk\nimages.\nGenimage assumes that all 'holes' in the input file are \"don't care\" areas.\nThis is a reasonable assumption: Tools to generate filesystems typically\noperate on devices. So they only create holes in areas they don't care\nabout. Genimage itself operates the same way when generating HD images.\n\nOptions:\n\n:image:\t\t\tThe source image that will be converted.\n:block-size:\t\tThe granularity that the sparse image uses to\n\t\t\tfind \"don't care\" or \"fill\" blocks. The supported\n\t\t\tblock sizes depend on the user. The default is 4k.\n:fill-holes:\t\tIf enabled, 'holes' are filled with zero instead of\n\t\t\t\"don't care\". Disabled by default.\n:add-crc:\t\tGenerate sparse comptible images containing the CRC. Ensure\n\t\t\tthat your sparse tool can handle CRC sparse images.\n\t\t\tDefaults to false.\n\ncpio\n****\nGenerates cpio images.\n\nOptions:\n\n:format:\t\tarchive format. Passed to the ``-H`` option to the cpio command.\n\t\t\tValid options are ``bin``, ``odc``, ``newc``, ``crc``, ``tar``,\n\t\t\t``ustar``, ``hpbin`` and ``hpodc``\n:extraargs:\t\tExtra arguments passed to the cpio tool\n:compress:\t\tIf given, pipe image through compression tool. Valid options are\n\t\t\tfor example ``gzip``, ``lzop`` or any other tool that compresses\n\t\t\tfrom stdin to stdout.\n\ncramfs\n******\nGenerates cramfs images.\n\nOptions:\n\n:extraargs:\t\tExtra arguments passed to mkfs.cramfs\n\ncustom\n******\nGenerate images with a custom command.\n\n:exec:\t\t\tThe command that creates the image.\n\nIf the image size is set, then image is created with the configured size\nbefore the `exec` command is executed. Otherwise the file is removed and\nthe size is queried after the command is executed.\n\nThe image file that should be generated is defined in the environment\nvariable $IMAGEOUTFILE. It can be used directly in the ``exec`` command.\nFor more variables and pitfalls when using them, see the `Environment\nVariables`_ section below.\n\nerofs\n******\nGenerates erofs images.\n\nOptions:\n\n:extraargs:\t\tExtra arguments passed to mkfs.erofs.\n\next2, ext3, ext4\n****************\nGenerates ext* images.\n\nOptions:\n\n:use-mke2fs:\t\tIf set to true, then mke2fs is used to create the\n\t\t\timage. Otherwise, genext2fs is used. Defaults to false.\n:mke2fs-conf:\t\tmke2fs.conf that should be used. If unspecified, the system\n\t\t\tdefault is used.\n:extraargs:\t\tExtra arguments passed to genext2fs or mke2fs.\n:features:\t\tFilesystem features. Passed to the ``-O`` option of tune2fs. This\n\t\t\tis a comma separated list of enabled or disabled features. See\n\t\t\t``man ext4`` for features.\n\t\t\tFor genext2fs all feature are specified. Default for ext3 images is\n\t\t\t``has_journal``. Default for ext4 images is\n\t\t\t``extents,uninit_bg,dir_index,has_journal``.\n\t\t\tFor mke2fs these features are added in addition to the default\n\t\t\tfeatures of the ext type. Already enabled features can be disabled\n\t\t\tby prefixing the feature with ``^``.\n:label:\t\t\tSpecify the volume-label. Passed to the ``-L`` option of tune2fs\n:fs-timestamp:\t\tSets different timestamps in the image. Sets the given timestamp\n\t\t\tusing the debugfs commands ``set_current_time``,\n\t\t\t``set_super_value mkfs_time`` and ``set_super_value lastcheck``\n:root-owner:\t\tUser and group IDs for the root directory. Defaults to ``0:0``.\n\t\t\tOnly valid with mke2fs.\n:usage-type:\t\tSpecify the usage type for the filesystem. Only valid with mke2fs.\n\t\t\tMore details can be found in the mke2fs man-page.\n\nf2fs\n****\nGenerates F2FS images.\n\nOptions:\n\n:label:\t\t\tSpecify the volume-label.\n:extraargs:\t\tExtra arguments passed to mkfs.f2fs\n\nfile\n****\n\nThis represents a pre-existing image which will be used as-is. When a\npartition section references an image that is not defined elsewhere in\nthe configuration file, a ``file`` rule is implicitly generated. It is\nup to the user to ensure that the image exists in the input directory,\nor to use an absolute path to the image.\n\nIt is possible to add a ``file`` image explicitly, which allows one to\nprovide ``genimage`` with some information about the image which can\nnot be deduced automatically. Currently, one such option exists:\n\n:holes:\t\t\tA list of ``\"(\u003cstart\u003e;\u003cend\u003e)\"`` pairs specifying ranges of the\n\t\t\tfile that do not contain meaningful data, and which can therefore\n\t\t\tbe allowed to overlap other partitions or image metadata.\n\nFor example::\n\n  image foo {\n\t  hdimage {\n\t\t  partition-table-type = \"gpt\"\n\t\t  gpt-location = 64K\n\t  }\n\n\t  partition bootloader {\n\t\t  in-partition-table = false\n\t\t  offset = 0\n\t\t  image = \"/path/to/bootloader.img\"\n\t  }\n\n\t  partition rootfs {\n\t\t  offset = 1M\n\t\t  image = \"rootfs.ext4\"\n\t  }\n  }\n\n  image /path/to/bootloader.img {\n\t  file {\n\t\t  holes = {\"(440; 1K)\", \"(64K; 80K)\"}\n\t  }\n  }\n\nThis tells ``genimage`` that despite the ``bootloader`` partition\noverlapping both the last 72 bytes of the MBR (where the DOS partition\ntable is located) and the GPT header occupying the sector starting at\noffset 512, this is all OK because ``bootloader.img`` does not contain\nuseful data in that range. Further, in this example, the bootloader\nimage has been carefully crafted to also allow placing the GPT array\nat offset 64K (the GPT header is always at offset 512).\n\nIf the bootloader image is not declared explicitly and only used once then\nthe holes can also be configured in the partition. This simplifies the\nconfig file for simple use-cases.\n\nFor example::\n\n  image bar {\n\t  hdimage {}\n\n\t  partition bootloader {\n\t\t  in-partition-table = false\n\t\t  offset = 0\n\t\t  image = \"/path/to/bootloader.img\"\n\t\t  holes = {\"(440; 512)\"}\n\t  }\n\n\t  partition rootfs {\n\t\t  offset = 1M\n\t\t  image = \"rootfs.ext4\"\n\t  }\n  }\n\nFIT\n***\nGenerates U-Boot FIT images.\n\nOptions:\n\n:its:\t\t\tString option holding the path of the input its file\n:keydir:\t\tString option holding the directory containing the keys\n\t\t\tused for signing.\n\nflash\n*****\nGenerates flash images. These are basically the partition contents padded to the\npartition sizes concatenated together. There is no partition table. Needs a valid\nflashtype where the flash parameters are read from.\n\nhdimage\n*******\nGenerates DOS partition images.\n\nOptions:\n\n:align:\t\t\tPartition alignment. Defaults to 512 bytes\n:partition-table:\tBoolean. If true, writes a partition table. If false, no\n\t\t\tpartition table is generated. Defaults to true.\n\t\t\tDeprecated: use ``partition-table-type`` instead.\n:partition-table-type:\tDefine what kind of partition table should be used.\n\t\t\tValid options are:\n\t\t\t * ``none``: No partition table at all. In this case, the\n\t\t\t   ``in-partition-table`` option for each partition is ignored.\n\t\t\t * ``mbr``: Legacy DOS/MBR partition table\n\t\t\t * ``gpt``: GUID Partition Table\n\t\t\t * ``hybrid``: A hybrid MBR/GPT partition table. Partitions with\n\t\t\t   an explicit `partition-type` will be placed in in the MBR\n\t\t\t   table. At most 3 such partitions are allowed. This limit does\n\t\t\t   not effect the maximum number of GPT partition entries in the\n\t\t\t   same image.\n:extended-partition:\tNumber of the extended partition. Contains the number of the\n\t\t\textended partition between 1 and 4 or 0 for automatic. Defaults\n\t\t\tto 0.\n:disk-signature:\t32 bit integer used as disk signature (offset 440 in the\n                        MBR). Using a special value ``random`` will result in\n                        using random 32 bit number.\n:gpt:\t\t\tBoolean. If true, a GPT type partition table is written. If false\n\t\t\ta DOS type partition table is written. Defaults to false.\n\t\t\tDeprecated: use ``partition-table-type`` instead.\n:gpt-location:\t\tLocation of the GPT table. Occasionally useful for moving the GPT\n\t\t\ttable away from where a bootloader is placed due to hardware\n\t\t\trequirements.  All partitions in the table must begin after this\n\t\t\ttable.  Regardless of this setting, the GPT header will still be\n\t\t\tplaced at 512 bytes (sector 1).  Defaults to 1024 bytes (sector 2).\n:gpt-no-backup:         Boolean. If true, then the backup partition table at the end of\n                        the image is not written.\n:disk-uuid:\t\tUUID string used as disk id in GPT partitioning. Defaults to a\n\t\t\trandom value.\n:fill:\t\t\tIf this is set to true, then the image file will be filled\n\t\t\tup to the end of the last partition. This might make the file\n\t\t\tbigger. This is necessary if the image will be processed by\n\t\t\tsuch tools as libvirt, libguestfs or parted.\n\nGPT partition flags\n~~~~~~~~~~~~~~~~~~~\n\nA GPT partition table will translate the following partition configurations to\nthe respective GPT flags and set it in the GPT partiton table:\n\n====================== ==============================\ngenimage configuration GPT FLAG\n====================== ==============================\nread-only              GPT_PE_FLAG_READ_ONLY (Bit 60)\nbootable               GPT_PE_FLAG_BOOTABLE (Bit 2)\nhidden                 GPT_PE_FLAG_HIDDEN (Bit 62)\nno-automount           GPT_PE_FLAG_NO_AUTO (Bit 63)\n====================== ==============================\n\nOther GPT Flags are currently not supported.\n\n\niso\n***\nGenerates an ISO image.\n\nOptions:\n\n:boot-image:\t\tPath to the El Torito boot image. Passed to the ``-b`` option\n\t\t\tof genisofs\n:bootargs:\t\tBootargs for the El Torito boot image. Defaults to\n\t\t\t``-no-emul-boot -boot-load-size 4 -boot-info-table -c boot.cat -hide boot.cat``\n:extraargs:\t\tExtra arguments passed to genisofs\n:input-charset:\t\tThe input charset. Passed to the -input-charset option of genisofs.\n\t\t\tDefaults to ``default``\n:volume-id:\t\tVolume ID. Passed to the ``-V`` option of genisofs\n\njffs2\n*****\nGenerates a JFFS image. Needs a valid flashtype where the flash parameters are\nread from.\n\nOptions:\n\n:extraargs:\t\tExtra arguments passed to mkfs.jffs2\n\nmdraid\n****\nGenerates MD RAID images.\n\nOptions:\n\n:label:\t\t\tOptional hostname and name of array separated by colon, eg: ``any:42``.\n\t\t\tSpecial hostname ``any`` can be used to make array local to machine with any hostname.\n\t\t\tName will be used by OS to name ``/dev/md/*`` device (as long as the hostname matches).\n:level:\t\t\tRAID level, currently only level 1 (default) is supported\n:devices:\t\tNumber of devices in array (default 1)\n:role:\t\t\t0 based index of this image in whole array. (autoassigned by default)\n:timestamp:\t\tUnix timestamp of array creation (current time by default, has to match across array devices)\n:raid-uuid:\t\tUUID of whole array (has to be identical across all disks in array, random by default)\n:disk-uuid:\t\tUUID of disk (has to be unique for each array member disk, random by default)\n:image:\t\t\tImage of data to be preloaded into array (optional)\n:parent:\t\tImage to inherit array identity/config from (when creating extra members of existing array).\n\t\t\tEffectively overrides all array-wide options mentioned here and replaces them with values from parent.\n\nFor example here only the first image has configuration and the UUID/timestamp is generated on demand::\n\n  image mdraid-a.img {\n\t  mdraid {\n\t\t  level = 1\n\t\t  devices = 2\n\t\t  image = \"mdraid-ext4.img\"\n\t  }\n  }\n\nThen to create second member to that array we just inherit config from the parent member::\n\n  image mdraid-b.img {\n\t  mdraid {\n\t\t  parent = \"mdraid-a.img\"\n\t  }\n  }\n\nDefault role number is 0 for the parent image and when other images inherit configuration from it, they are assigned roles from autoincrementing counter.\n\n\nqemu\n****\nGenerates a QEMU image. Needs at least one valid partition.\n\nOptions:\n\n:format:\t\tA valid ``qemu-img`` like ``qcow``, ``qcow2``, ``parallels``, ``vdi``,\n\t\t\t``vhdx`` or ``vmdk``. Check ``qemu-img convert --help`` for the complete\n\t\t\tlist of possible values. Defaults to ``qcow2``.\n:extraargs:\t\tExtra arguments passed to ``qemu-img convert``\n\nsquashfs\n********\nGenerates a squashfs image.\n\nOptions:\n\n:extraargs:\t\tExtra arguments passed to mksquashfs\n:compression:\t\tcompression type for the image. Possible values are ``gzip``\n\t\t\t(default), ``none`` and any other compressors supported by ``mksquashfs``\n\t\t\tsuch as ``lzo``, ``lz4``, ``xz``, ``zstd`` or ``lzma``.\n:block-size:\t\tBlock size. Passed to the ``-b`` option of mksquashfs. Defaults\n\t\t\tto 4096.\n\nrauc\n****\nGenerates a RAUC update bundle.\n\nOptions:\n\n:extraargs:\t\tExtra arguments passed to RAUC\n:file:\t\t\tSpecify a file to be added into the RAUC bundle. Usage is:\n\t\t\t``file foo { image = \"bar\" }`` which adds a file \"foo\" in the\n\t\t\tRAUC bundle from then input file \"bar\"\n:files:\t\t\tA list of filenames added into the RAUC bundle. Like **file**\n\t\t\tabove, but without the ability to add the files under different\n\t\t\tname.\n:key:\t\t\tPath to the key file or PKCS#11 URI. Passed to the ``--key`` option of\n\t\t\tRAUC\n:cert:\t\t\tPath to the certificate file or PKCS#11 URI. Passed to the ``--cert``\n\t\t\toption of RAUC\n:keyring:\t\tOptional path to the keyring file. Passed to the ``--keyring``\n\t\t\toption of RAUC\n:manifest:\t\tcontent of the manifest file\n\ntar\n***\n\nGenerates a tar image. The image will be compressed as defined by the filename suffix.\n\nubi\n***\nGenerates an UBI image. Needs a valid flashtype where the flash parameters are\nread from.\n\nOptions:\n\n:extraargs:\t\tExtra arguments passed to ubinize\n\nubifs\n*****\nGenerates a UBIFS image. Needs a valid flashtype where the flash parameters are\nread from.\n\nOptions:\n\n:extraargs:\t\tExtra arguments passed to mkfs.ubifs\n:max-size:\t\tMaximum size of the UBIFS image\n:space-fixup:           Instructs the file-system free space to be freed up on first mount.\n\nvfat\n****\nGenerates a VFAT image.\n\nOptions:\n\n:extraargs:\t\tExtra arguments passed to mkdosfs\n:label:\t\tSpecify the volume-label. Passed to the ``-n`` option of mkdosfs\n:file:\t\t\tSpecify a file to be added into the filesystem image. Usage is:\n\t\t\t``file foo { image = \"bar\" }`` which adds a file \"foo\" in the\n\t\t\tfilesystem image from the input file \"bar\"\n:files:\t\t\tA list of filenames added into the filesystem image. Like **file**\n\t\t\tabove, but without the ability to add the files under different\n\t\t\tname.\n\nNote: If no content is specified with ``file`` or ``files`` then\n``rootpath`` and ``mountpoint`` are used to provide the content.\n\nfip\n***\nGenerates a Firmware Image Package (FIP). A format used to bundle\nfirmware to be loaded by ARM Trusted Firmware.\n\nOptions:\n\n:extraargs:\t\tExtra arguments passed to fiptool\n:fw-config:\t\tFirmware Configuration (device tree), usually provided by BL2 (Trusted Firmware)\n:nt-fw:\t\t\tNon-Trusted Firmware (BL33)\n:hw-config:\t\tHardware Configuration (device tree), passed to BL33\n:tos-fw:\t\tTrusted OS (BL32) binaries. Second and third binary are used as\n\t\t\textra1 and extra2 binaries if specified. Example:\n\t\t\t``tos-fw = {\"tee-header_v2.bin\", \"tee-pager_v2.bin\", \"tee-pageable_v2.bin\"}``\n:scp-fwu-cfg:\t\tSCP Firmware Updater Configuration FWU SCP_BL2U\n:ap-fwu-cfg:\t\tAP Firmware Updater Configuration BL2U\n:fwu:\t\t\tFirmware Updater NS_BL2U\n:fwu-cert:\t\tNon-Trusted Firmware Updater certificate\n:tb-fw:\t\t\tTrusted Boot Firmware BL2\n:scp-fw:\t\tSCP Firmware SCP_BL2\n:soc-fw:\t\tEL3 Runtime Firmware BL31\n:tb-fw-config:\t\tTB_FW_CONFIG\n:soc-fw-config:\t\tSOC_FW_CONFIG\n:tos-fw-config:\t\tTOS_FW_CONFIG\n:nt-fw-config:\t\tNT_FW_CONFIG\n:rot-cert:\t\tRoot Of Trust key certificate\n:trusted-key-cert:\tTrusted key certificate\n:scp-fw-key-cert:\tSCP Firmware key certificate\n:soc-fw-key-cert:\tSoC Firmware key certificate\n:tos-fw-key-cert:\tTrusted OS Firmware key certificate\n:nt-fw-key-cert:\tNon-Trusted Firmware key certificate\n:tb-fw-cert:\t\tTrusted Boot Firmware BL2 certificate\n:scp-fw-cert:\t\tSCP Firmware content certificate\n:soc-fw-cert:\t\tSoC Firmware content certificate\n:tos-fw-cert:\t\tTrusted OS Firmware content certificate\n:nt-fw-cert:\t\tNon-Trusted Firmware content certificate\n:sip-sp-cert:\t\tSiP owned Secure Partition content certificate\n:plat-sp-cert:\t\tPlatform owned Secure Partition content certificate\n\nThe Flash Section\n-----------------\n\nThe flash section can be given multiple times and each section describes a\nflash chip. The option names are mostly derived from the UBI terminology.\nThere are the following options:\n\n:pebsize:\t\tThe size of a physical eraseblock in bytes\n:lebsize:\t\tThe size of a logical eraseblock in bytes (for ubifs)\n:numpebs:\t\tNumber of physical eraseblocks on this device. The total\n\t\t\tsize of the device is determined by pebsize * numpebs\n:minimum-io-unit-size:\tThe minimum size in bytes accessible on this device\n:vid-header-offset:\toffset of the volume identifier header\n:sub-page-size:\t\tThe size of a sub page in bytes.\n\nSeveral flash related image types need a valid flash section. From the image types\nthe flash type section is referred to using the ``flashtype`` option which contains\nthe name of the flash type to be used.\n\nFor more information of the meaning of these values see the ubi(fs) and mtd FAQs:\n\nhttp://www.linux-mtd.infradead.org/faq/general.html\n\nExample flash section::\n\n  flash nand-64M-512 {\n\t  pebsize = 16384\n\t  lebsize = 15360\n\t  numpebs = 4096\n\t  minimum-io-unit-size = 512\n\t  vid-header-offset = 512\n\t  sub-page-size = 512\n  }\n  ...\n  image jffs2 {\n\t  flashtype = \"nand-64M-512\"\n  }\n\n\nThe config section\n------------------\n\nIn this section the global behaviour of the program is\ndescribed. Except as noted below, all options here can be given from\neither environment variables, the config file or command line\nswitches. For instance, a config option ``foo`` can be passed as a\n``--foo`` command line switch or as a GENIMAGE_FOO environment\nvariable.\n\n:config:\tdefault: ``genimage.cfg``\n\t\tPath to the genimage config file.\n\n:loglevel:\tdefault: 1\n\t\tgenimage log level.\n\n:outputpath:\tdefault: images\n\t\tMandatory path where all images are written to (must exist).\n:inputpath:\tdefault: input\n\t\tThis mandatory path is searched for input images, for example\n\t\tbootloader binaries, kernel images (must exist).\n:rootpath:\tdefault: root\n\t\tMandatory path to the root filesystem (must exist).\n:tmppath:\tdefault: tmp\n\t\tOptional path to a temporary directory. There must be enough space\n\t\tavailable here to hold a copy of the root filesystem.\n:includepath:\tColon-separated list of directories to search for files\n\t\tincluded via the ``include`` function. The current\n\t\tdirectory is searched after these. Thus, if this\n\t\toption is not given, only the current directory is\n\t\tsearched. This has no effect when given in the config file.\n:configdump:\tFile to write the final configuration to. This includes\n\t\tthe results of all ``include`` directives, expansions\n\t\tof environment variables and application of default\n\t\tvalues - think ``gcc -E``. Use ``-`` for stdout.\n\n:cpio:\t\tpath to the cpio program (default cpio)\n:dd:\t\tpath to the dd program (default dd)\n:e2fsck:\tpath to the e2fsck program (default e2fsck)\n:genext2fs:\tpath to the genext2fs program (default genext2fs)\n:genisoimage:\tpath to the genisoimage program (default genisoimage)\n:mcopy:\t\tpath to the mcopy program (default mcopy)\n:mmd:\t\tpath to the mmd program (default mmd)\n:mkcramfs:\tpath to the mkcramfs program (default mkfs.cramfs)\n:mkdosfs:\tpath to the mkdosfs program (default mkdosfs)\n:mkfserofs:\tpath to the mkfs.erofs program (default mkfs.erofs)\n:mkfsf2fs:\tpath to the mkfs.f2fs program (default mkfs.f2fs)\n:mkfsjffs2:\tpath to the mkfs.jffs2 program (default mkfs.jffs2)\n:mkfsubifs:\tpath to the mkfs.ubifs program (default mkfs.ubifs)\n:mksquashfs:\tpath to the mksquashfs program (default mksquashfs)\n:qemu-img:\tpath to the qemu-img program (default qemu-img)\n:tar:\t\tpath to the tar program (default tar)\n:tune2fs:\tpath to the tune2fs program (default tune2fs)\n:ubinize:\tpath to the ubinize program (default ubinize)\n:fiptool:\tpath to the fiptool utility (default fiptool)\n\n\nInclude Configurations Fragments\n--------------------------------\n\nTo include a ``\"foo.cfg\"`` config file, use the following statement::\n\n    include(\"foo.cfg\")\n\nThis allows to re-use, for example flash configuration files, across different image configurations.\n\nEnvironment Variables\n---------------------\n\nThe following environment variables are defined when the commands that\ncreate images are executed. This includes the ``exec-pre``, ``exec-post``\ncommands and the ``exec`` command of the custom image type.\n\nWarning: If an ``exec*`` command is quoted with double-quotes and a\nvariable is specified with curly braces then variables are substituted\nwhen the config file is parsed. At that point variables defined by\ngenimage are not yet set.\nSo use single quotes instead.\n\nCommon Variables for all Images\n*******************************\n\n==============\t=============================================\n**OUTPUTPATH**\tDirectory where images are created\n**INPUTPATH**\tDirectory where input images are searched\n**ROOTPATH**\tRoot directory of the content for the images\n**TMPPATH**\tDirectory where temporary files are created\n==============\t=============================================\n\nImage Specific Variables\n************************\n\n===================\t=============================================\n**IMAGE**\t\tFile name relative to $OUTPUTPATH\n**IMAGEOUTFILE**\tFull path of the file\n**IMAGENAME**\t\tName of the image\n**IMAGESIZE**\t\tConfigured size\n**IMAGEMOUNTPOINT**\tAbsolute 'mountpoint' to use. It defines with\n\t\t\tdirectory relative to $ROOTPATH should be used\n**IMAGEMOUNTPATH**\tFull path to the data to use. This is effectively\n\t\t\t$ROOTPATH/$IMAGEMOUNTPOINT\n===================\t=============================================\n\nLicense and Developing\n======================\n\nTo contribute to genimage please prepare a pull request on Github. To make\nit possible to include your modifications it's required that your code\nadditions are licensed under the same terms as genimage itself. So you\nare required to agree to the following document:\n\n  Developer's Certificate of Origin 1.1\n\n  By making a contribution to this project, I certify that:\n\n  (a) The contribution was created in whole or in part by me and I\n      have the right to submit it under the open source license\n      indicated in the file; or\n\n  (b) The contribution is based upon previous work that, to the best\n      of my knowledge, is covered under an appropriate open source\n      license and I have the right under that license to submit that\n      work with modifications, whether created in whole or in part\n      by me, under the same open source license (unless I am\n      permitted to submit under a different license), as indicated\n      in the file; or\n\n  (c) The contribution was provided directly to me by some other\n      person who certified (a), (b) or (c) and I have not modified\n      it.\n\n  (d) I understand and agree that this project and the contribution\n      are public and that a record of the contribution (including all\n      personal information I submit with it, including my sign-off) is\n      maintained indefinitely and may be redistributed consistent with\n      this project or the open source license(s) involved.\n\nYour agreement is expressed by adding a sign-off line to each of your\ncommits (e.g. using ``git commit -s``) looking as follows:\n\n        Signed-off-by: Random J Developer \u003crandom@developer.example.org\u003e\n\nwith your identity and email address matching the commit meta data.\n\nBefore creating pull request, please make sure your tree is passing\nall unit tests by running ``make distcheck``.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpengutronix%2Fgenimage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpengutronix%2Fgenimage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpengutronix%2Fgenimage/lists"}