[CORE][SECO-MODULE] Add commands to search TYPEGUID/PARTUUID from disk and viceversa
- Added commands allow to search disks by type GUID and partition UUID.
Test example:
- debug prints ON
- two partitions with the same typeguid
a. Test searching for the first partition encountered with the selected typeguid:
grub> get_disk_by_typeguid 5b193300-fc78-40cd-8002-e86c45580b47 --max-disks 1 --setenv typeguid_disks
Searching for TYPEGUID: 5b193300-fc78-40cd-8002-e86c45580b47
Argument 1. Parsed maximum number of disks: (1)
Processing the device: hd0
error: this is not a GPT partition table: hd0.
Processing the device: hd0,gpt3
Found TYPEGUID: 5b193300-fc78-40cd-8002-e86c45580b47
Found matching device: hd0,gpt3.
Matched devices count: 1.
Found disks: hd0,gpt3
Found disks count: 1
grub> echo $typeguid_disks
hd0,gpt3
b. Test searching for the maximmum number of partitions with the selected typeguid (the maximum is 2 partitions se by MAX_SLOTS
in the code):
grub> get_disk_by_typeguid 5b193300-fc78-40cd-8002-e86c45580b47 --setenv typeguid_disks
Searching for TYPEGUID: 5b193300-fc78-40cd-8002-e86c45580b47
Processing the device: hd0
error: this is not a GPT partition table: hd0.
Processing the device: hd0,gpt3
Found TYPEGUID: 5b193300-fc78-40cd-8002-e86c45580b47
Found matching device: hd0,gpt3.
Matched devices count: 1.
Processing the device: hd0,gpt2
Found TYPEGUID: 5b193300-fc78-40cd-8002-e86c45580b47
Found matching device: hd0,gpt3 hd0,gpt2.
Matched devices count: 2.
Found disks: hd0,gpt3 hd0,gpt2
Found disks count: 2
The resulting list can be processed with a for loop in the bootscript as such:
for disk in ${typeguid_disks}; do
echo "Disk found: ${disk}"
done
obtaining:
Disk found: hd0,gpt3
Disk found: hd0,gpt2
- Add the option to sort from the lowest GPT number to the higher
- Add the option to filter by device (i.e. search only in hd0)
- Add commands to retrieve the PARTUUID/TYPEGUID from disk name.
- Add
basic_setexpr
command to evaluate simple math operations without using LUA scripting. For complex math LUA is still required.
- Add
get_disk_name
command to get the device from (device,partition). For example:
get_disk_name (hd0,gpt1) --setenv output.
echo $output
hd0
Signed-off-by: Nicola Sparnacci nicola.sparnacci@seco.com
Edited by Nicola Sparnacci