From 5e1651cfcde39a141bbf4b33b4132403a663fd98 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 1 Feb 2017 16:21:13 +0100 Subject: [PATCH 1/2] refkit image: flexible partition sizes The VFAT parition size specified in the DSK_IMAGE_LAYOUT no longer matched the actual size used for images, and 15MB indeed is barely large enough. Adding tools like cryptsetup to the initramfs causes it to exceed that limit. Instead of hard-coding a fixed size in the .wks.in file, now a per-image variable is inserted instead. The size of the rootfs can also be controlled, including not limiting it at all and thus adapting the image size to the size of the rootfs. This will be needed for the installer image which is larger than normal images. The default is the same as before (30MB for the VFAT partitions, 4GB total image size). Signed-off-by: Patrick Ohly --- meta-refkit/classes/image-dsk.bbclass | 4 ++-- meta-refkit/classes/refkit-image.bbclass | 4 ++++ meta-refkit/wic/refkit-directdisk.wks.in | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/meta-refkit/classes/image-dsk.bbclass b/meta-refkit/classes/image-dsk.bbclass index f3b7b8397f..d1366a5769 100644 --- a/meta-refkit/classes/image-dsk.bbclass +++ b/meta-refkit/classes/image-dsk.bbclass @@ -75,7 +75,7 @@ DSK_IMAGE_LAYOUT ??= ' \ "partition_01_primary_uefi_boot": { \ "name": "primary_uefi", \ "uuid": 0, \ - "size_mb": 15, \ + "size_mb": ${REFKIT_VFAT_MB}, \ "source": "${IMAGE_ROOTFS}/boot/", \ "filesystem": "vfat", \ "type": "${PARTITION_TYPE_EFI}" \ @@ -83,7 +83,7 @@ DSK_IMAGE_LAYOUT ??= ' \ "partition_02_secondary_uefi_boot": { \ "name": "secondary_uefi", \ "uuid": 0, \ - "size_mb": 15, \ + "size_mb": ${REFKIT_VFAT_MB}, \ "source": "${IMAGE_ROOTFS}/boot/", \ "filesystem": "vfat", \ "type": "${PARTITION_TYPE_EFI_BACKUP}" \ diff --git a/meta-refkit/classes/refkit-image.bbclass b/meta-refkit/classes/refkit-image.bbclass index 78be54db69..ae1b9ac10c 100644 --- a/meta-refkit/classes/refkit-image.bbclass +++ b/meta-refkit/classes/refkit-image.bbclass @@ -274,7 +274,11 @@ IMAGE_FSTYPES_remove = "live" # Activate "dsk" image type. IMAGE_CLASSES += "${@ 'image-dsk' if ${REFKIT_USE_DSK_IMAGES} else ''}" +# By default, the full image is going to use roughly 4GB, independent +# of the actual roofs size. WKS_FILE = "refkit-directdisk.wks.in" +REFKIT_VFAT_MB ??= "30" +REFKIT_IMAGE_SIZE ??= "--fixed-size 3700M" WIC_CREATE_EXTRA_ARGS += " -D" # Inherit after setting variables that get evaluated when importing diff --git a/meta-refkit/wic/refkit-directdisk.wks.in b/meta-refkit/wic/refkit-directdisk.wks.in index a3cc14324a..7bc7eddb8a 100644 --- a/meta-refkit/wic/refkit-directdisk.wks.in +++ b/meta-refkit/wic/refkit-directdisk.wks.in @@ -4,6 +4,6 @@ # EFI stub, kernel, kernel cmdline, and the initrd bootloader --ptable gpt -part --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/boot --fstype=vfat --fixed-size 30M --label primary_uefi --part-type C12A7328-F81F-11D2-BA4B-00A0C93EC93B --align 1024 --use-uuid -part --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/boot --fstype=vfat --fixed-size 30M --label secondary_uefi --part-type E3C9E316-0B5C-4DB8-817D-F92DF00215AE --align 1024 --use-uuid -part / --source rootfs --fixed-size 3700M --fstype=ext4 --label rootfs --align 1024 --uuid ${REMOVABLE_MEDIA_ROOTFS_PARTUUID_VALUE} +part --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/boot --fstype=vfat --fixed-size ${REFKIT_VFAT_MB}M --label primary_uefi --part-type C12A7328-F81F-11D2-BA4B-00A0C93EC93B --align 1024 --use-uuid +part --source rootfs --rootfs-dir=${IMAGE_ROOTFS}/boot --fstype=vfat --fixed-size ${REFKIT_VFAT_MB}M --label secondary_uefi --part-type E3C9E316-0B5C-4DB8-817D-F92DF00215AF --align 1024 --use-uuid +part / --source rootfs ${REFKIT_IMAGE_SIZE} --fstype=ext4 --label rootfs --align 1024 --uuid ${REMOVABLE_MEDIA_ROOTFS_PARTUUID_VALUE} From 65b8cf758c11d7b58bf954b3f82c5d38163eaff9 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Wed, 15 Feb 2017 16:07:32 +0100 Subject: [PATCH 2/2] refkit-image.bbclass: bump size of partitions 30MB are not enough for an initramfs with cryptsetup included. Bumping it up to the next power of two. The size of the rootfs gets adjusted so that the full image fits into 4*10^9 bytes, i.e. "4GB" regardless whether 1000 or 1024 is used as base. 64M are reserved for potential partitioning overhead. Signed-off-by: Patrick Ohly --- meta-refkit/classes/refkit-image.bbclass | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/meta-refkit/classes/refkit-image.bbclass b/meta-refkit/classes/refkit-image.bbclass index ae1b9ac10c..a697e3249a 100644 --- a/meta-refkit/classes/refkit-image.bbclass +++ b/meta-refkit/classes/refkit-image.bbclass @@ -274,11 +274,13 @@ IMAGE_FSTYPES_remove = "live" # Activate "dsk" image type. IMAGE_CLASSES += "${@ 'image-dsk' if ${REFKIT_USE_DSK_IMAGES} else ''}" -# By default, the full image is going to use roughly 4GB, independent -# of the actual roofs size. +# By default, the full image is meant to fit into 4*10^9 bytes, i.e. +# "4GB" regardless whether 1000 or 1024 is used as base. 64M are reserved +# for potential partitioning overhead. WKS_FILE = "refkit-directdisk.wks.in" -REFKIT_VFAT_MB ??= "30" -REFKIT_IMAGE_SIZE ??= "--fixed-size 3700M" +REFKIT_VFAT_MB ??= "64" +REFKIT_IMAGE_SIZE ??= "--fixed-size 3622M" +REFKIT_EXTRA_PARTITION ??= "" WIC_CREATE_EXTRA_ARGS += " -D" # Inherit after setting variables that get evaluated when importing