From 6f40ffdfc7b58459c43efefe0fb9f538b5dd33d4 Mon Sep 17 00:00:00 2001 From: Tomas Mudrunka Date: Mon, 30 Dec 2024 21:08:12 +0100 Subject: [PATCH] Added documentation for mdraid and f2fs images Signed-off-by: Tomas Mudrunka --- README.rst | 54 ++++++++++++++++++++++++++++++++++++++++++++++++-- image-mdraid.c | 2 +- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index d3f1e97..5c34922 100644 --- a/README.rst +++ b/README.rst @@ -105,8 +105,8 @@ Here are all options for images: Additionally each image can have one of the following sections describing the type of the image: -cpio, cramfs, ext2, ext3, ext4, file, flash, hdimage, iso, jffs2, qemu, squashfs, -tar, ubi, ubifs, vfat. +cpio, cramfs, ext2, ext3, ext4, f2fs, file, flash, hdimage, iso, +jffs2, mdraid, qemu, squashfs, tar, ubi, ubifs, vfat. Partition options: @@ -297,6 +297,15 @@ Options: :usage-type: Specify the usage type for the filesystem. Only valid with mke2fs. More details can be found in the mke2fs man-page. +f2fs +**** +Generates F2FS images. + +Options: + +:label: Specify the volume-label. +:extraargs: Extra arguments passed to mkfs.f2fs + file **** @@ -472,6 +481,43 @@ Options: :extraargs: Extra arguments passed to mkfs.jffs2 +mdraid +**** +Generates MD RAID images. + +Options: + +:label: Text name of array, eg: localhost:42 +:level: RAID level, currently only level 1 (default) is supported +:devices: Number of devices in array (default 1) +:role: 0 based index of this image in whole array. (autoassigned by default) +:timestamp: Unix timestamp of array creation (current time by default) +:raid-uuid: UUID of whole array (has to be identical across all disks in array, random by default) +:disk-uuid: UUID of disk (has to be unique for each array member disk, random by default) +:image: Image of data to be preloaded into array (optional) +:inherit: Image to inherit array identity/config from (when creating extra members of existing array) + +For example here only the first image has configuration and the UUID/timestamp is generated on demand:: + + image mdraid-a.img { + mdraid { + level = 1 + devices = 2 + image = "mdraid-ext4.img" + } + } + +Then to create second member to that array we just inherit config from the first member:: + + image mdraid-b.img { + mdraid { + inherit = "mdraid-a.img" + } + } + +Role number is 0 for the master image and when other images inherit configuration from it, they are assigned roles from autoincrementing counter. + + qemu **** Generates a QEMU image. Needs at least one valid partition. @@ -683,6 +729,7 @@ variable. :mmd: path to the mmd program (default mmd) :mkcramfs: path to the mkcramfs program (default mkcramfs) :mkdosfs: path to the mkdosfs program (default mkdosfs) +:mkfsf2fs: path to the mkfs.f2fs program (default mkfs.f2fs) :mkfsjffs2: path to the mkfs.jffs2 program (default mkfs.jffs2) :mkfsubifs: path to the mkfs.ubifs program (default mkfs.ubifs) :mksquashfs: path to the mksquashfs program (default mksquashfs) @@ -742,3 +789,6 @@ commits (e.g. using ``git commit -s``) looking as follows: Signed-off-by: Random J Developer with your identity and email address matching the commit meta data. + +Before creating pull request, please make sure your tree is passing +all unit tests by running ``make distcheck``. diff --git a/image-mdraid.c b/image-mdraid.c index a8840f6..6281852 100644 --- a/image-mdraid.c +++ b/image-mdraid.c @@ -182,7 +182,7 @@ static int mdraid_generate(struct image *image) { /* constant array information - 128 bytes */ sb->magic = MD_SB_MAGIC; /* MD_SB_MAGIC: 0xa92b4efc - little endian. This is actualy just char string saying "bitm" :-) */ sb->major_version = 1; /* 1 */ - sb->feature_map = MD_FEATURE_BITMAP_OFFSET; /* bit 0 set if 'bitmap_offset' is meaningful */ //TODO: internal bitmap bit is ignored, unless there is correct bitmap with BITMAP_MAGIC in place + sb->feature_map = MD_FEATURE_BITMAP_OFFSET; /* bit 0 set if 'bitmap_offset' is meaningful */ sb->pad0 = 0; /* always set to 0 when writing */ char *raid_uuid = cfg_getstr(image->imagesec, "raid-uuid");