diff --git a/buildroot b/buildroot index 5379c358b..ead21eb6d 160000 --- a/buildroot +++ b/buildroot @@ -1 +1 @@ -Subproject commit 5379c358bf5157bdab42dd187b9859e2d9b378c7 +Subproject commit ead21eb6d24055317b7281b1a8e7d1d6e809313b diff --git a/buildroot-external/configs/generic_aarch64_defconfig b/buildroot-external/configs/generic_aarch64_defconfig index c2ebbdc6a..7a699babd 100644 --- a/buildroot-external/configs/generic_aarch64_defconfig +++ b/buildroot-external/configs/generic_aarch64_defconfig @@ -1,4 +1,5 @@ BR2_aarch64=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/generic_x86_64_defconfig b/buildroot-external/configs/generic_x86_64_defconfig index 7d207fbda..ce9e87fd1 100644 --- a/buildroot-external/configs/generic_x86_64_defconfig +++ b/buildroot-external/configs/generic_x86_64_defconfig @@ -1,4 +1,5 @@ BR2_x86_64=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/green_defconfig b/buildroot-external/configs/green_defconfig index 89b606469..35201bccb 100755 --- a/buildroot-external/configs/green_defconfig +++ b/buildroot-external/configs/green_defconfig @@ -1,4 +1,5 @@ BR2_aarch64=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/khadas_vim3_defconfig b/buildroot-external/configs/khadas_vim3_defconfig index 9744ba55b..72f372218 100644 --- a/buildroot-external/configs/khadas_vim3_defconfig +++ b/buildroot-external/configs/khadas_vim3_defconfig @@ -1,4 +1,5 @@ BR2_aarch64=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/odroid_c2_defconfig b/buildroot-external/configs/odroid_c2_defconfig index db1bebd01..b653555ae 100644 --- a/buildroot-external/configs/odroid_c2_defconfig +++ b/buildroot-external/configs/odroid_c2_defconfig @@ -1,4 +1,5 @@ BR2_aarch64=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/odroid_c4_defconfig b/buildroot-external/configs/odroid_c4_defconfig index 671054f2d..c0c3456e6 100644 --- a/buildroot-external/configs/odroid_c4_defconfig +++ b/buildroot-external/configs/odroid_c4_defconfig @@ -1,4 +1,5 @@ BR2_aarch64=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/odroid_m1_defconfig b/buildroot-external/configs/odroid_m1_defconfig index 9b2c99f14..e385acb5e 100644 --- a/buildroot-external/configs/odroid_m1_defconfig +++ b/buildroot-external/configs/odroid_m1_defconfig @@ -1,4 +1,5 @@ BR2_aarch64=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/odroid_m1s_defconfig b/buildroot-external/configs/odroid_m1s_defconfig index 6e6edb1ca..e37a06056 100644 --- a/buildroot-external/configs/odroid_m1s_defconfig +++ b/buildroot-external/configs/odroid_m1s_defconfig @@ -1,4 +1,5 @@ BR2_aarch64=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/odroid_n2_defconfig b/buildroot-external/configs/odroid_n2_defconfig index 460a8902e..09860a050 100644 --- a/buildroot-external/configs/odroid_n2_defconfig +++ b/buildroot-external/configs/odroid_n2_defconfig @@ -1,4 +1,5 @@ BR2_aarch64=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/odroid_xu4_defconfig b/buildroot-external/configs/odroid_xu4_defconfig index ec862ea88..0132d1117 100644 --- a/buildroot-external/configs/odroid_xu4_defconfig +++ b/buildroot-external/configs/odroid_xu4_defconfig @@ -1,5 +1,6 @@ BR2_arm=y BR2_cortex_a7=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/ova_defconfig b/buildroot-external/configs/ova_defconfig index 2d3b4a1ad..007266ed8 100644 --- a/buildroot-external/configs/ova_defconfig +++ b/buildroot-external/configs/ova_defconfig @@ -1,4 +1,5 @@ BR2_x86_64=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/rpi2_defconfig b/buildroot-external/configs/rpi2_defconfig index b75dffd0e..2f590a204 100644 --- a/buildroot-external/configs/rpi2_defconfig +++ b/buildroot-external/configs/rpi2_defconfig @@ -1,6 +1,7 @@ BR2_arm=y BR2_cortex_a7=y BR2_ARM_FPU_VFPV4=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/rpi3_64_defconfig b/buildroot-external/configs/rpi3_64_defconfig index b857692b6..8cb1c64b3 100644 --- a/buildroot-external/configs/rpi3_64_defconfig +++ b/buildroot-external/configs/rpi3_64_defconfig @@ -1,5 +1,6 @@ BR2_aarch64=y BR2_ARM_FPU_VFPV4=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/rpi3_defconfig b/buildroot-external/configs/rpi3_defconfig index 8560b3fab..3dbe28d7a 100644 --- a/buildroot-external/configs/rpi3_defconfig +++ b/buildroot-external/configs/rpi3_defconfig @@ -1,6 +1,7 @@ BR2_arm=y BR2_cortex_a53=y BR2_ARM_FPU_VFPV4=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/rpi4_64_defconfig b/buildroot-external/configs/rpi4_64_defconfig index 9a503aeee..a48870fbf 100644 --- a/buildroot-external/configs/rpi4_64_defconfig +++ b/buildroot-external/configs/rpi4_64_defconfig @@ -1,5 +1,6 @@ BR2_aarch64=y BR2_cortex_a72=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/rpi4_defconfig b/buildroot-external/configs/rpi4_defconfig index de59da288..22d9fbbcf 100644 --- a/buildroot-external/configs/rpi4_defconfig +++ b/buildroot-external/configs/rpi4_defconfig @@ -1,6 +1,7 @@ BR2_arm=y BR2_cortex_a72=y BR2_ARM_FPU_NEON_VFPV4=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/rpi5_64_defconfig b/buildroot-external/configs/rpi5_64_defconfig index 24fe9031a..38b2e71e0 100644 --- a/buildroot-external/configs/rpi5_64_defconfig +++ b/buildroot-external/configs/rpi5_64_defconfig @@ -1,5 +1,6 @@ BR2_aarch64=y BR2_cortex_a76=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/tinker_defconfig b/buildroot-external/configs/tinker_defconfig index 28e961985..32a4fc6fd 100644 --- a/buildroot-external/configs/tinker_defconfig +++ b/buildroot-external/configs/tinker_defconfig @@ -1,6 +1,7 @@ BR2_arm=y BR2_cortex_a17=y BR2_ARM_FPU_NEON_VFPV4=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/configs/yellow_defconfig b/buildroot-external/configs/yellow_defconfig index 93ca5ab61..4877e610f 100644 --- a/buildroot-external/configs/yellow_defconfig +++ b/buildroot-external/configs/yellow_defconfig @@ -1,5 +1,6 @@ BR2_aarch64=y BR2_cortex_a72=y +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_6=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_DL_DIR="/cache/dl" BR2_CCACHE=y diff --git a/buildroot-external/patches/genimage/0001-image-hd-add-forced-primary-flag-for-higher-MBR-layo.patch b/buildroot-external/patches/genimage/0001-image-hd-add-forced-primary-flag-for-higher-MBR-layo.patch deleted file mode 100644 index cf544e6c6..000000000 --- a/buildroot-external/patches/genimage/0001-image-hd-add-forced-primary-flag-for-higher-MBR-layo.patch +++ /dev/null @@ -1,598 +0,0 @@ -From 90f09d1766dfaad29f1c19c39f6b4b7a8483a86e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= -Date: Tue, 28 May 2024 15:49:32 +0200 -Subject: [PATCH] image-hd: add forced-primary flag for higher MBR layout - flexibility -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The current limitation of Genimage is that it is not able to create -MBR images that have primary partitions that start after a logical -partition. This can be useful for images that can be later resized based -on the actual device size - for this operation the partition must be at -the end of the device, and if it is present in a logical partition, it -must be resized first, making it a two-step process. - -This commit adds the "forced-primary" flag which can be used to indicate -that the partition should be put into the disk's MBR instead of creating -another logical partition. Validation ensures that this syntax allows to -create such partitions only after an existing logical partition, and -that the maximum number of MBR entries woudn't be exceeded by doing so. - -Test cases for valid and invalid configuiration has been added. Also -added few more details in the debug print to make it more obvious how -the MBR/EBR layout looks like. - -Signed-off-by: Jan Čermák -Upstream: https://github.com/pengutronix/genimage/pull/248 ---- - README.rst | 5 ++ - genimage.c | 2 + - genimage.h | 3 +- - image-hd.c | 116 +++++++++++++++++++---------- - test/hdimage-fail10.config | 33 ++++++++ - test/hdimage-fail11.config | 32 ++++++++ - test/hdimage-fail8.config | 28 +++++++ - test/hdimage-fail9.config | 27 +++++++ - test/hdimage-forced-primary.config | 47 ++++++++++++ - test/hdimage-forced-primary.fdisk | 10 +++ - test/hdimage.test | 14 +++- - 11 files changed, 275 insertions(+), 42 deletions(-) - create mode 100644 test/hdimage-fail10.config - create mode 100644 test/hdimage-fail11.config - create mode 100644 test/hdimage-fail8.config - create mode 100644 test/hdimage-fail9.config - create mode 100644 test/hdimage-forced-primary.config - create mode 100644 test/hdimage-forced-primary.fdisk - -diff --git a/README.rst b/README.rst -index d908ff5..7e2a0c5 100644 ---- a/README.rst -+++ b/README.rst -@@ -131,6 +131,11 @@ Partition options: - :bootable: Boolean specifying whether to set the bootable flag. - :in-partition-table: Boolean specifying whether to include this partition in - the partition table. Defaults to true. -+:forced-primary: Force this partition to be a primary partition in the -+ MBR partition table, useful when the extended partition should be -+ followed by primary partitions. If there are more partitions -+ defined after the first forced-primary, they must be also defined -+ as forced-primary. Defaults to false. - :partition-uuid: UUID string used by GPT partition tables to specify the partition - id. Defaults to a random value. - :partition-type-uuid: String used by GPT partition tables to specify the partition type. -diff --git a/genimage.c b/genimage.c -index 5bd235b..2fa9fa2 100644 ---- a/genimage.c -+++ b/genimage.c -@@ -96,6 +96,7 @@ static cfg_opt_t partition_opts[] = { - CFG_STR("align", NULL, CFGF_NONE), - CFG_INT("partition-type", 0, CFGF_NONE), - CFG_BOOL("bootable", cfg_false, CFGF_NONE), -+ CFG_BOOL("forced-primary", cfg_false, CFGF_NONE), - CFG_BOOL("read-only", cfg_false, CFGF_NONE), - CFG_BOOL("hidden", cfg_false, CFGF_NONE), - CFG_BOOL("no-automount", cfg_false, CFGF_NONE), -@@ -396,6 +397,7 @@ static int parse_partitions(struct image *image, cfg_t *imagesec) - part->align = cfg_getint_suffix(partsec, "align"); - part->partition_type = cfg_getint(partsec, "partition-type"); - part->bootable = cfg_getbool(partsec, "bootable"); -+ part->forced_primary = cfg_getbool(partsec, "forced-primary"); - part->read_only = cfg_getbool(partsec, "read-only"); - part->hidden = cfg_getbool(partsec, "hidden"); - part->no_automount = cfg_getbool(partsec, "no-automount"); -diff --git a/genimage.h b/genimage.h -index 8c86e77..b630984 100644 ---- a/genimage.h -+++ b/genimage.h -@@ -39,7 +39,8 @@ struct partition { - unsigned long long align; - unsigned char partition_type; - cfg_bool_t bootable; -- cfg_bool_t extended; -+ cfg_bool_t logical; -+ cfg_bool_t forced_primary; - cfg_bool_t read_only; - cfg_bool_t hidden; - cfg_bool_t no_automount; -diff --git a/image-hd.c b/image-hd.c -index 4ea55b6..6fb850f 100644 ---- a/image-hd.c -+++ b/image-hd.c -@@ -35,10 +35,12 @@ - #define TYPE_GPT 2 - #define TYPE_HYBRID (TYPE_MBR|TYPE_GPT) - -+#define PARTITION_TYPE_EXTENDED 0x0F -+ - struct hdimage { -- unsigned int extended_partition; -+ unsigned int extended_partition_index; -+ struct partition *extended_partition; - unsigned long long align; -- unsigned long long extended_lba; - uint32_t disksig; - const char *disk_uuid; - int table_type; -@@ -151,32 +153,24 @@ static int hdimage_insert_mbr(struct image *image, struct list_head *partitions) - list_for_each_entry(part, partitions, list) { - struct mbr_partition_entry *entry; - -- if (!part->in_partition_table) -+ if (!part->in_partition_table || part->logical) - continue; - - if (hd->table_type == TYPE_HYBRID && !part->partition_type) - continue; - -- if (hd->table_type == TYPE_HYBRID && part->extended) -- continue; -- - entry = &mbr.part_entry[i]; - - entry->boot = part->bootable ? 0x80 : 0x00; -- if (!part->extended) { -- entry->partition_type = part->partition_type; -- entry->relative_sectors = part->offset/512; -- entry->total_sectors = part->size/512; -- } -- else { -- entry->partition_type = 0x0F; -- entry->relative_sectors = (hd->extended_lba)/512; -- entry->total_sectors = (image->size - hd->extended_lba)/512; -- } -+ entry->partition_type = part->partition_type; -+ entry->relative_sectors = part->offset/512; -+ entry->total_sectors = part->size/512; - hdimage_setup_chs(entry); - -- if (part->extended) -- break; -+ image_debug(image, "[MBR entry %d]: type=%x start=%d size=%d\n", -+ i, entry->partition_type, -+ entry->relative_sectors, entry->total_sectors); -+ - i++; - } - -@@ -215,8 +209,9 @@ static int hdimage_insert_ebr(struct image *image, struct partition *part) - struct mbr_partition_entry *entry; - char ebr[4*sizeof(struct mbr_partition_entry)+2], *part_table; - int ret; -+ unsigned long long ebr_offset = part->offset - hd->align + 446; - -- image_info(image, "writing EBR\n"); -+ image_debug(image, "writing EBR to sector %llu\n", ebr_offset / 512); - - memset(ebr, 0, sizeof(ebr)); - part_table = ebr; -@@ -229,12 +224,12 @@ static int hdimage_insert_ebr(struct image *image, struct partition *part) - hdimage_setup_chs(entry); - struct partition *p = part; - list_for_each_entry_continue(p, &image->partitions, list) { -- if (!p->extended) -+ if (!p->logical) - continue; - ++entry; - entry->boot = 0x00; -- entry->partition_type = 0x0F; -- entry->relative_sectors = (p->offset - hd->align - hd->extended_lba)/512; -+ entry->partition_type = PARTITION_TYPE_EXTENDED; -+ entry->relative_sectors = (p->offset - hd->align - hd->extended_partition->offset)/512; - entry->total_sectors = (p->size + hd->align)/512; - hdimage_setup_chs(entry); - break; -@@ -245,7 +240,7 @@ static int hdimage_insert_ebr(struct image *image, struct partition *part) - part_table[1] = 0xaa; - - ret = insert_data(image, ebr, imageoutfile(image), sizeof(ebr), -- part->offset - hd->align + 446); -+ ebr_offset); - if (ret) { - image_error(image, "failed to write EBR\n"); - return ret; -@@ -577,13 +572,15 @@ static int hdimage_generate(struct image *image) - list_for_each_entry(part, &image->partitions, list) { - struct image *child; - -- image_info(image, "adding partition '%s'%s%s%s%s ...\n", part->name, -+ image_info(image, "adding %s partition '%s'%s%s%s%s ...\n", -+ part->logical ? "logical" : "primary", -+ part->name, - part->in_partition_table ? " (in MBR)" : "", - part->image ? " from '": "", - part->image ? part->image : "", - part->image ? "'" : ""); - -- if (part->extended) { -+ if (part->logical) { - ret = hdimage_insert_ebr(image, part); - if (ret) { - image_error(image, "failed to write EBR\n"); -@@ -756,13 +753,14 @@ static int hdimage_setup(struct image *image, cfg_t *cfg) - struct partition *autoresize_part = NULL; - int has_extended; - unsigned int partition_table_entries = 0, hybrid_entries = 0; -+ unsigned int mbr_entries = 0, forced_primary_entries = 0; - unsigned long long now = 0; - const char *disk_signature, *table_type; - struct hdimage *hd = xzalloc(sizeof(*hd)); - struct partition *gpt_backup = NULL; - - hd->align = cfg_getint_suffix(cfg, "align"); -- hd->extended_partition = cfg_getint(cfg, "extended-partition"); -+ hd->extended_partition_index = cfg_getint(cfg, "extended-partition"); - disk_signature = cfg_getstr(cfg, "disk-signature"); - table_type = cfg_getstr(cfg, "partition-table-type"); - hd->gpt_location = cfg_getint_suffix(cfg, "gpt-location"); -@@ -809,10 +807,10 @@ static int hdimage_setup(struct image *image, cfg_t *cfg) - if (!hd->align) - hd->align = hd->table_type == TYPE_NONE ? 1 : 512; - -- if (hd->extended_partition > 4) { -+ if (hd->extended_partition_index > 4) { - image_error(image, "invalid extended partition index (%i). must be " - "inferior or equal to 4 (0 for automatic)\n", -- hd->extended_partition); -+ hd->extended_partition_index); - return -EINVAL; - } - -@@ -821,11 +819,41 @@ static int hdimage_setup(struct image *image, cfg_t *cfg) - "multiple of 1 sector (512 bytes)\n", hd->align); - return -EINVAL; - } -+ if (hd->table_type == TYPE_MBR && hd->extended_partition_index) -+ mbr_entries = hd->extended_partition_index; -+ -+ has_extended = hd->extended_partition_index > 0; -+ - list_for_each_entry(part, &image->partitions, list) { - if (hd->table_type == TYPE_NONE) - part->in_partition_table = false; - if (part->in_partition_table) - ++partition_table_entries; -+ if (hd->table_type == TYPE_MBR && part->in_partition_table) { -+ if (!hd->extended_partition_index && partition_table_entries > 4) { -+ hd->extended_partition_index = mbr_entries = 4; -+ has_extended = true; -+ } -+ if (part->forced_primary) { -+ ++forced_primary_entries; -+ ++mbr_entries; -+ if (partition_table_entries <= hd->extended_partition_index) { -+ image_error(image, "partition %s: forced-primary can only be used for " -+ "partitions following the extended partition\n", -+ part->name); -+ return -EINVAL; -+ } -+ } else if (forced_primary_entries > 0) { -+ image_error(image, -+ "cannot create non-primary partition %s after forced-primary partition\n", -+ part->name); -+ return -EINVAL; -+ } -+ if (mbr_entries > 4) { -+ image_error(image, "too many primary partitions\n"); -+ return -EINVAL; -+ } -+ } - if (!part->align) - part->align = (part->in_partition_table || hd->table_type == TYPE_NONE) ? hd->align : 1; - if (part->in_partition_table && part->align % hd->align) { -@@ -834,10 +862,6 @@ static int hdimage_setup(struct image *image, cfg_t *cfg) - part->align, part->name, hd->align); - } - } -- if (hd->table_type == TYPE_MBR && !hd->extended_partition && -- partition_table_entries > 4) -- hd->extended_partition = 4; -- has_extended = hd->extended_partition > 0; - - if (hd->disk_uuid) { - if (!(hd->table_type & TYPE_GPT)) { -@@ -958,12 +982,12 @@ static int hdimage_setup(struct image *image, cfg_t *cfg) - if (part->partition_type) - ++hybrid_entries; - } -- /* reserve space for extended boot record if necessary */ - if (part->in_partition_table) - ++partition_table_entries; -- part->extended = has_extended && part->in_partition_table && -- (partition_table_entries >= hd->extended_partition); -- if (part->extended) { -+ part->logical = !part->forced_primary && has_extended && part->in_partition_table && -+ (partition_table_entries >= hd->extended_partition_index); -+ if (part->logical) { -+ /* reserve space for extended boot record */ - now += hd->align; - now = roundup(now, part->align); - } -@@ -978,8 +1002,6 @@ static int hdimage_setup(struct image *image, cfg_t *cfg) - if (!part->offset && (part->in_partition_table || hd->table_type == TYPE_NONE)) { - part->offset = roundup(now, part->align); - } -- if (part->extended && !hd->extended_lba) -- hd->extended_lba = part->offset - hd->align; - - if (part->offset % part->align) { - image_error(image, "part %s offset (%lld) must be a" -@@ -1027,7 +1049,7 @@ static int hdimage_setup(struct image *image, cfg_t *cfg) - part->name); - return -EINVAL; - } -- if (!part->extended) { -+ if (!part->logical) { - int ret = check_overlap(image, part); - if (ret) - return ret; -@@ -1051,8 +1073,22 @@ static int hdimage_setup(struct image *image, cfg_t *cfg) - hd->file_size = part->offset + child->size; - } - } -- else if (part->extended) -+ else if (part->logical) - hd->file_size = part->offset - hd->align + 512; -+ -+ if (has_extended && hd->extended_partition_index == partition_table_entries) { -+ struct partition *p = fake_partition("[Extended]", now - hd->align - part->size, -+ 0); -+ p->in_partition_table = true; -+ p->partition_type = PARTITION_TYPE_EXTENDED; -+ -+ hd->extended_partition = p; -+ list_add_tail(&p->list, &part->list); -+ } -+ -+ if (part->logical) { -+ hd->extended_partition->size = now - hd->extended_partition->offset; -+ } - } - - if (hybrid_entries > 3) { -diff --git a/test/hdimage-fail10.config b/test/hdimage-fail10.config -new file mode 100644 -index 0000000..782c090 ---- /dev/null -+++ b/test/hdimage-fail10.config -@@ -0,0 +1,33 @@ -+image test.hdimage { -+ hdimage { -+ align = 1M -+ extended-partition = 3 -+ } -+ partition primary1 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition primary2 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition extended1 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition extended2 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition primary3 { -+ image = "part1.img" -+ partition-type = 0x83 -+ forced-primary = "yes" -+ } -+ partition primary4 { -+ image = "part1.img" -+ partition-type = 0x83 -+ /* would be 5th primary partition */ -+ forced-primary = "yes" -+ } -+} -diff --git a/test/hdimage-fail11.config b/test/hdimage-fail11.config -new file mode 100644 -index 0000000..06bf64b ---- /dev/null -+++ b/test/hdimage-fail11.config -@@ -0,0 +1,32 @@ -+image test.hdimage { -+ hdimage { -+ align = 1M -+ extended-partition = 1 -+ } -+ partition extended1 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition extended2 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition extended3 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition extended4 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition primary2 { -+ image = "part1.img" -+ partition-type = 0x83 -+ forced-primary = "yes" -+ } -+ partition extended5 { -+ image = "part1.img" -+ partition-type = 0x83 -+ /* extended partition would overlap the forced-primary one */ -+ } -+} -diff --git a/test/hdimage-fail8.config b/test/hdimage-fail8.config -new file mode 100644 -index 0000000..8f55faa ---- /dev/null -+++ b/test/hdimage-fail8.config -@@ -0,0 +1,28 @@ -+image test.hdimage { -+ hdimage { -+ align = 1M -+ extended-partition = 1 -+ } -+ partition part1 { -+ image = "part1.img" -+ partition-type = 0x83 -+ forced-primary = "yes" -+ /* forced-primary can be only used for partitions defined after the extended partition */ -+ } -+ partition part2 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition part3 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition part4 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition part5 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+} -diff --git a/test/hdimage-fail9.config b/test/hdimage-fail9.config -new file mode 100644 -index 0000000..d811b7b ---- /dev/null -+++ b/test/hdimage-fail9.config -@@ -0,0 +1,27 @@ -+image test.hdimage { -+ hdimage { -+ align = 1M -+ } -+ partition primary1 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition primary2 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition primary3 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition primary4 { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition primary5 { -+ image = "part1.img" -+ partition-type = 0x83 -+ /* part4 is implicitly extended -> too many primary entries */ -+ forced-primary = "yes" -+ } -+} -diff --git a/test/hdimage-forced-primary.config b/test/hdimage-forced-primary.config -new file mode 100644 -index 0000000..c15b3a5 ---- /dev/null -+++ b/test/hdimage-forced-primary.config -@@ -0,0 +1,47 @@ -+image test.hdimage { -+ hdimage { -+ align = 1M -+ disk-signature = 0x12345678 -+ extended-partition = 2 -+ } -+ partition part1 { -+ image = "part1.img" -+ partition-type = 0xc -+ bootable = "yes" -+ } -+ /* -+ * partition 2 will be the extended partition entry -+ * partitions 3-4 will be primary partitions at the end -+ * partition 5 is first logical partition of the extended partition -+ */ -+ partition part5-logical { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition part6-logical { -+ image = "part2.img" -+ partition-type = 0x83 -+ } -+ partition part7-logical { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition part8-logical { -+ image = "part2.img" -+ partition-type = 0x83 -+ } -+ partition part9-logical { -+ image = "part1.img" -+ partition-type = 0x83 -+ } -+ partition part3 { -+ image = "part1.img" -+ partition-type = 0x83 -+ forced-primary = "yes" -+ } -+ partition part4 { -+ image = "part2.img" -+ partition-type = 0x82 -+ forced-primary = "yes" -+ } -+} -diff --git a/test/hdimage-forced-primary.fdisk b/test/hdimage-forced-primary.fdisk -new file mode 100644 -index 0000000..ff0e903 ---- /dev/null -+++ b/test/hdimage-forced-primary.fdisk -@@ -0,0 +1,10 @@ -+Disk identifier: 0x12345678 -+images/test.hdimage1:start=2048,size=2048,type=c,bootable -+images/test.hdimage2:start=4096,size=20480,type=f -+images/test.hdimage3:start=24576,size=2048,type=83 -+images/test.hdimage4:start=26624,size=2048,type=82 -+images/test.hdimage5:start=6144,size=2048,type=83 -+images/test.hdimage6:start=10240,size=2048,type=83 -+images/test.hdimage7:start=14336,size=2048,type=83 -+images/test.hdimage8:start=18432,size=2048,type=83 -+images/test.hdimage9:start=22528,size=2048,type=83 -diff --git a/test/hdimage.test b/test/hdimage.test -index c284613..a81c3f1 100755 ---- a/test/hdimage.test -+++ b/test/hdimage.test -@@ -96,7 +96,11 @@ test_expect_success "hdimage syntax" " - test_must_fail run_genimage hdimage-fail4.config && - test_must_fail run_genimage hdimage-fail5.config && - test_must_fail run_genimage hdimage-fail6.config && -- test_must_fail run_genimage hdimage-fail7.config -+ test_must_fail run_genimage hdimage-fail7.config && -+ test_must_fail run_genimage hdimage-fail8.config && -+ test_must_fail run_genimage hdimage-fail9.config && -+ test_must_fail run_genimage hdimage-fail10.config && -+ test_must_fail run_genimage hdimage-fail11.config - " - - setup_gpt_files() { -@@ -163,6 +167,14 @@ test_expect_success "hdimage no-partition" " - test_cmp 'hdimage-nopart.hexdump' '${testdir}/hdimage-nopart.hexdump' - " - -+test_expect_success "hdimage forced-primary" " -+ setup_test_images && -+ run_genimage hdimage-forced-primary.config && -+ sfdisk_validate images/test.hdimage && -+ sanitized_fdisk_sfdisk images/test.hdimage > hdimage.fdisk && -+ test_cmp '${testdir}/hdimage-forced-primary.fdisk' hdimage.fdisk -+" -+ - test_done - - # vim: syntax=sh diff --git a/buildroot-external/patches/genimage/0002-image-hd-do-not-use-first-partition-offset-for-GPT-s.patch b/buildroot-external/patches/genimage/0002-image-hd-do-not-use-first-partition-offset-for-GPT-s.patch deleted file mode 100644 index 540125719..000000000 --- a/buildroot-external/patches/genimage/0002-image-hd-do-not-use-first-partition-offset-for-GPT-s.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 9484103803a36783fe6f6a8ec762797cf962c9bf Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= -Date: Mon, 29 Jul 2024 17:00:31 +0200 -Subject: [PATCH] image-hd: do not use first partition offset for GPT's first - usable LBA -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Currently first usable LBA in the GPT header is pointing to offset of -the first partition, ignoring the gpt-location specified in the config. -This can lead to some issues as explained in [1]. Disabling this -behavior doesn't break any tests and allows for generating of images -that have same layout as those generated by sgdisk or other utilities. - -[1] https://github.com/pengutronix/genimage/issues/262 - -Signed-off-by: Jan Čermák ---- - image-hd.c | 10 +--------- - 1 file changed, 1 insertion(+), 9 deletions(-) - -diff --git a/image-hd.c b/image-hd.c -index 6fb850f..4f965db 100644 ---- a/image-hd.c -+++ b/image-hd.c -@@ -456,7 +456,6 @@ static int hdimage_insert_gpt(struct image *image, struct list_head *partitions) - const char *outfile = imageoutfile(image); - struct gpt_header header; - struct gpt_partition_entry table[GPT_ENTRIES]; -- unsigned long long smallest_offset = ~0ULL; - struct partition *part; - unsigned i, j; - int ret; -@@ -469,7 +468,7 @@ static int hdimage_insert_gpt(struct image *image, struct list_head *partitions) - header.header_size = htole32(sizeof(struct gpt_header)); - header.current_lba = htole64(1); - header.backup_lba = htole64(hd->gpt_no_backup ? 1 :image->size/512 - 1); -- header.first_usable_lba = htole64(~0ULL); -+ header.first_usable_lba = htole64(hd->gpt_location / 512 + GPT_SECTORS - 1); - header.last_usable_lba = htole64(image->size/512 - 1 - GPT_SECTORS); - uuid_parse(hd->disk_uuid, header.disk_uuid); - header.starting_lba = htole64(hd->gpt_location/512); -@@ -482,9 +481,6 @@ static int hdimage_insert_gpt(struct image *image, struct list_head *partitions) - if (!part->in_partition_table) - continue; - -- if (part->offset < smallest_offset) -- smallest_offset = part->offset; -- - uuid_parse(part->partition_type_uuid, table[i].type_uuid); - uuid_parse(part->partition_uuid, table[i].uuid); - table[i].first_lba = htole64(part->offset/512); -@@ -499,10 +495,6 @@ static int hdimage_insert_gpt(struct image *image, struct list_head *partitions) - - i++; - } -- if (smallest_offset == ~0ULL) -- smallest_offset = hd->gpt_location + (GPT_SECTORS - 1)*512; -- header.first_usable_lba = htole64(smallest_offset / 512); -- - - header.table_crc = htole32(crc32(table, sizeof(table))); - diff --git a/buildroot-external/patches/network-manager/0001-ndisc-support-multiple-gateways-for-a-single-network.patch b/buildroot-external/patches/network-manager/0001-ndisc-support-multiple-gateways-for-a-single-network.patch deleted file mode 100644 index a4303ccfe..000000000 --- a/buildroot-external/patches/network-manager/0001-ndisc-support-multiple-gateways-for-a-single-network.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 00592cc1e5f0a04b06a4aac33fd62d84650c9c3f Mon Sep 17 00:00:00 2001 -From: Stefan Agner -Date: Mon, 27 Mar 2023 17:48:34 +0200 -Subject: [PATCH] ndisc: support multiple gateways for a single network -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - ---- -[Jan: updated for NM 1.44] -Signed-off-by: Jan Čermák ---- - src/core/ndisc/nm-ndisc.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/core/ndisc/nm-ndisc.c b/src/core/ndisc/nm-ndisc.c -index 20dd21212d..e00bdac872 100644 ---- a/src/core/ndisc/nm-ndisc.c -+++ b/src/core/ndisc/nm-ndisc.c -@@ -705,6 +705,7 @@ nm_ndisc_add_route(NMNDisc *ndisc, const NMNDiscRoute *new_item, gint64 now_msec - * comparison is aborted, and both routes are added. - */ - if (IN6_ARE_ADDR_EQUAL(&item->network, &new_item->network) && item->plen == new_item->plen -+ && IN6_ARE_ADDR_EQUAL(&item->gateway, &new_item->gateway) - && item->on_link == new_item->on_link) { - if (new_item->expiry_msec <= now_msec) { - g_array_remove_index(rdata->routes, i); diff --git a/buildroot-external/patches/systemd/0004-detect-virt-detect-hyperv-enlightened-qemu-as-qemu-n.patch b/buildroot-external/patches/systemd/0004-detect-virt-detect-hyperv-enlightened-qemu-as-qemu-n.patch deleted file mode 100644 index a0ce1c1e5..000000000 --- a/buildroot-external/patches/systemd/0004-detect-virt-detect-hyperv-enlightened-qemu-as-qemu-n.patch +++ /dev/null @@ -1,59 +0,0 @@ -From f42a5b49e95a8deed0b8e6f1bea6679af7e908e4 Mon Sep 17 00:00:00 2001 -From: Lennart Poettering -Date: Fri, 19 Apr 2024 13:25:55 +0200 -Subject: [PATCH] detect-virt: detect hyperv-enlightened qemu as qemu, not as - hyperv - -CPUID reporting hyperv should be taken with a grain of salt, and we -should prefer other mechanisms then. - -Fixes: #28001 ---- - src/basic/virt.c | 20 ++++++++++++++++---- - 1 file changed, 16 insertions(+), 4 deletions(-) - -diff --git a/src/basic/virt.c b/src/basic/virt.c -index 88357a9..89abb53 100644 ---- a/src/basic/virt.c -+++ b/src/basic/virt.c -@@ -446,7 +446,7 @@ static Virtualization detect_vm_zvm(void) { - /* Returns a short identifier for the various VM implementations */ - Virtualization detect_vm(void) { - static thread_local Virtualization cached_found = _VIRTUALIZATION_INVALID; -- bool other = false; -+ bool other = false, hyperv = false; - int xen_dom0 = 0; - Virtualization v, dmi; - -@@ -503,7 +503,12 @@ Virtualization detect_vm(void) { - v = detect_vm_cpuid(); - if (v < 0) - return v; -- if (v == VIRTUALIZATION_VM_OTHER) -+ if (v == VIRTUALIZATION_MICROSOFT) -+ /* QEMU sets the CPUID string to hyperv's, in case it provides hyperv enlightenments. Let's -+ * hence not return Microsoft here but just use the other mechanisms first to make a better -+ * decision. */ -+ hyperv = true; -+ else if (v == VIRTUALIZATION_VM_OTHER) - other = true; - else if (v != VIRTUALIZATION_NONE) - goto finish; -@@ -544,8 +549,15 @@ Virtualization detect_vm(void) { - return v; - - finish: -- if (v == VIRTUALIZATION_NONE && other) -- v = VIRTUALIZATION_VM_OTHER; -+ /* None of the checks above gave us a clear answer, hence let's now use fallback logic: if hyperv -+ * enlightenments are available but the VMM wasn't recognized as anything yet, it's probably -+ * Microsoft. */ -+ if (v == VIRTUALIZATION_NONE) { -+ if (hyperv) -+ v = VIRTUALIZATION_MICROSOFT; -+ else if (other) -+ v = VIRTUALIZATION_VM_OTHER; -+ } - - cached_found = v; - log_debug("Found VM virtualization %s", virtualization_to_string(v));