mirror of
https://github.com/u-boot/u-boot.git
synced 2025-05-02 01:26:32 +00:00
cmd: gpt: Preserve bootable flag
Sets the bootable flag when constructing the partition string from the current partition configuration. This ensures that when the partitions are written back (for example, when renaming a partition), the flag is preserved. Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
This commit is contained in:
parent
368beaf7bb
commit
648140f77a
2 changed files with 4 additions and 0 deletions
|
@ -176,6 +176,7 @@ static int calc_parts_list_len(int numparts)
|
||||||
#ifdef CONFIG_PARTITION_TYPE_GUID
|
#ifdef CONFIG_PARTITION_TYPE_GUID
|
||||||
partlistlen += numparts * (strlen("type=,") + UUID_STR_LEN + 1);
|
partlistlen += numparts * (strlen("type=,") + UUID_STR_LEN + 1);
|
||||||
#endif
|
#endif
|
||||||
|
partlistlen += numparts * strlen("bootable,");
|
||||||
partlistlen += numparts * (strlen("uuid=;") + UUID_STR_LEN + 1);
|
partlistlen += numparts * (strlen("uuid=;") + UUID_STR_LEN + 1);
|
||||||
/* for the terminating null */
|
/* for the terminating null */
|
||||||
partlistlen++;
|
partlistlen++;
|
||||||
|
@ -316,6 +317,8 @@ static int create_gpt_partitions_list(int numparts, const char *guid,
|
||||||
strcat(partitions_list, ",uuid=");
|
strcat(partitions_list, ",uuid=");
|
||||||
strncat(partitions_list, curr->gpt_part_info.uuid,
|
strncat(partitions_list, curr->gpt_part_info.uuid,
|
||||||
UUID_STR_LEN + 1);
|
UUID_STR_LEN + 1);
|
||||||
|
if (curr->gpt_part_info.bootable & PART_BOOTABLE)
|
||||||
|
strcat(partitions_list, ",bootable");
|
||||||
strcat(partitions_list, ";");
|
strcat(partitions_list, ";");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -143,6 +143,7 @@ def test_gpt_read_var(state_disk_image, u_boot_console):
|
||||||
"size": "0x100000",
|
"size": "0x100000",
|
||||||
"type": "0fc63daf-8483-4772-8e79-3d69d8477de4",
|
"type": "0fc63daf-8483-4772-8e79-3d69d8477de4",
|
||||||
"uuid": "33194895-67f6-4561-8457-6fdeed4f50a3",
|
"uuid": "33194895-67f6-4561-8457-6fdeed4f50a3",
|
||||||
|
"bootable": True,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "part2",
|
"name": "part2",
|
||||||
|
|
Loading…
Add table
Reference in a new issue