summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2019-09-21 07:16:51 +0000
committerGitHub <noreply@github.com>2019-09-21 07:16:51 +0000
commit3300b46aeb61d8eb0a723b7a3947ae4d95ba3666 (patch)
treed2081def0c41f1a47359edf2466e716789c9e395
parentd752bc843baa02870be2b11baca09e7e7917aec7 (diff)
parentc33962e0de664bb977d234f7b31ebd00823b139d (diff)
downloadgenimage-3300b46aeb61d8eb0a723b7a3947ae4d95ba3666.tar.gz
genimage-3300b46aeb61d8eb0a723b7a3947ae4d95ba3666.tar.xz
Merge pull request #72 from michaelolbrich/gpt-secondary
image-hd: the secondary GPT header should point to the secondary GPT table
-rw-r--r--image-hd.c1
-rwxr-xr-xtest/basic-images.test10
2 files changed, 11 insertions, 0 deletions
diff --git a/image-hd.c b/image-hd.c
index 9764529..fcb05d3 100644
--- a/image-hd.c
+++ b/image-hd.c
@@ -308,6 +308,7 @@ static int hdimage_insert_gpt(struct image *image, struct list_head *partitions)
header.header_crc = 0;
header.current_lba = htole64(image->size/512 - 1);
header.backup_lba = htole64(1);
+ header.starting_lba = htole64(image->size/512 - GPT_SECTORS);
header.header_crc = htole32(crc32(&header, sizeof(header)));
ret = insert_data(image, (char *)&table, outfile, sizeof(table),
image->size - GPT_SECTORS*512);
diff --git a/test/basic-images.test b/test/basic-images.test
index 4554b7a..52e2f22 100755
--- a/test/basic-images.test
+++ b/test/basic-images.test
@@ -89,6 +89,14 @@ check_size() {
fi
}
+sfdisk_validate() {
+ if [ -n "$(sfdisk -q -V "${1}" 2>&1 | grep -v unallocated)" ]; then
+ echo "'sfdisk -V' failed with:"
+ sfdisk -V "${1}" 2>&1
+ return 1
+ fi
+}
+
exec_test_set_prereq() {
command -v "${1}" > /dev/null && test_set_prereq "${1/./_}"
}
@@ -199,6 +207,7 @@ test_expect_success fdisk,sfdisk "hdimage" "
setup_test_images &&
run_genimage hdimage.config test.hdimage &&
check_size images/test.hdimage 10485760 &&
+ sfdisk_validate images/test.hdimage &&
# check the this identifier
fdisk -l images/test.hdimage | grep identifier: > hdimage.fdisk &&
# check partitions; filter output to handle different sfdisk versions
@@ -225,6 +234,7 @@ test_expect_success fdisk-gpt,sfdisk-gpt "hdimage4" "
setup_test_images &&
run_genimage hdimage4.config test.hdimage &&
check_size images/test.hdimage 7356928 &&
+ sfdisk_validate images/test.hdimage &&
# check the this identifier
fdisk -l images/test.hdimage | grep identifier: > hdimage4.fdisk &&
# check partitions; filter output to handle different sfdisk versions