This reverts commit 8064baed0009c9418b298518f5ae210151455db3.
After upgrading swupdate from 2021.04 to 2022.05 in kirkstone, the eMMC
partitioning no longer works:
[ERROR] : SWUPDATE failed [0] ERROR : Partition table cannot be applied: -22
The original sw-description passed the partition type as "type=Linux":
partitions: (
{
type = "diskpart";
device = "/dev/mmcblk0";
properties: {
labeltype = "gpt";
partition-1 = ["size=2G", "start=2048", "name=root1", "type=Linux"];
Linux is not a valid GUID string, so the original behavior was to fallback
to GPT_DEFAULT_ENTRY_TYPE.
After such commit, the unsupported "Linux" GUID string is passed to
libfdisk causing fdisk_apply_table() to fail.
To avoid regressions, revert the commit so that the original behavior
can be preserved.
Thanks to Stefano for his help in debugging the failure.
Signed-off-by: Fabio Estevam <
fest...@denx.de>
---
handlers/diskpart_handler.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/handlers/diskpart_handler.c b/handlers/diskpart_handler.c
index 27534f6..7ba1fb0 100644
--- a/handlers/diskpart_handler.c
+++ b/handlers/diskpart_handler.c
@@ -636,13 +636,9 @@ static int diskpart_fill_table(struct fdisk_context *cxt, struct diskpart_table
* GPT uses strings instead of hex code for partition type
*/
if (fdisk_is_label(PARENT(cxt), GPT)) {
- if (part->type[0]) {
- parttype = fdisk_label_get_parttype_from_string(lb, part->type);
- if (!parttype)
- parttype = fdisk_new_unknown_parttype(0, part->type);
- } else {
+ parttype = fdisk_label_get_parttype_from_string(lb, part->type);
+ if (!parttype)
parttype = fdisk_label_get_parttype_from_string(lb, GPT_DEFAULT_ENTRY_TYPE);
- }
} else {
parttype = fdisk_label_get_parttype_from_code(lb, ustrtoull(part->type, NULL, 16));
}
--
2.25.1