* util/grub-install.in: Add GPT PReP support.
* util/grub-probe.c (probe): Support GPT partition type. (main): Support -t gpt_parttype.
This commit is contained in:
parent
7c680e1f17
commit
39cfdaa9a2
3 changed files with 49 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2013-09-23 Paulo Flabiano Smorigo <pfsmorigo@br.ibm.com>
|
||||
|
||||
* util/grub-install.in: Add GPT PReP support.
|
||||
* util/grub-probe.c (probe): Support GPT partition type.
|
||||
(main): Support -t gpt_parttype.
|
||||
|
||||
2013-09-23 Aleš Nesrsta <starous@volny.cz>
|
||||
|
||||
* grub-core/bus/usb/ehci.c: SMI disabled in all cases
|
||||
|
|
|
@ -686,10 +686,12 @@ elif [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "i386-ieee1275" ]
|
|||
|
||||
# If a install device is defined, copy the core.elf to PReP partition.
|
||||
if [ "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" = "powerpc-ieee1275" ] && [ -n "${install_device}" ]; then
|
||||
if [ "$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t msdos_parttype)" != "41" ]; then
|
||||
gettext "The chosen partition is not a PReP partition." 1>&2
|
||||
echo 1>&2
|
||||
exit 1
|
||||
|
||||
if [ "$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t msdos_parttype)" != "41" ] \
|
||||
&& [ "$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t gpt_parttype)" != "9e1a2d38-c612-4316-aa26-8b49521e5a8b" ]; then
|
||||
gettext "The chosen partition is not a PReP partition." 1>&2
|
||||
echo 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$(file -s -b -L "${install_device}" | awk '{ print $1 }')" = ELF ] || [ x$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t zero_check) = xtrue ]; then
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <grub/fs.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/msdos_partition.h>
|
||||
#include <grub/gpt_partition.h>
|
||||
#include <grub/emu/hostdisk.h>
|
||||
#include <grub/emu/getroot.h>
|
||||
#include <grub/term.h>
|
||||
|
@ -67,6 +68,7 @@ enum {
|
|||
PRINT_ARC_HINT,
|
||||
PRINT_COMPATIBILITY_HINT,
|
||||
PRINT_MSDOS_PARTTYPE,
|
||||
PRINT_GPT_PARTTYPE,
|
||||
PRINT_ZERO_CHECK,
|
||||
PRINT_DISK
|
||||
};
|
||||
|
@ -725,6 +727,39 @@ probe (const char *path, char **device_names, char delim)
|
|||
grub_device_close (dev);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (print == PRINT_GPT_PARTTYPE)
|
||||
{
|
||||
if (dev->disk->partition
|
||||
&& strcmp (dev->disk->partition->partmap->name, "gpt") == 0)
|
||||
{
|
||||
struct grub_gpt_partentry gptdata;
|
||||
grub_partition_t p = dev->disk->partition;
|
||||
dev->disk->partition = dev->disk->partition->parent;
|
||||
|
||||
if (grub_disk_read (dev->disk, p->offset, p->index,
|
||||
sizeof (gptdata), &gptdata) == 0)
|
||||
{
|
||||
grub_gpt_part_type_t gpttype;
|
||||
gpttype.data1 = grub_le_to_cpu32 (gptdata.type.data1);
|
||||
gpttype.data2 = grub_le_to_cpu16 (gptdata.type.data2);
|
||||
gpttype.data3 = grub_le_to_cpu16 (gptdata.type.data3);
|
||||
grub_memcpy (gpttype.data4, gptdata.type.data4, 8);
|
||||
|
||||
grub_printf ("%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
|
||||
gpttype.data1, gpttype.data2,
|
||||
gpttype.data3, gpttype.data4[0],
|
||||
gpttype.data4[1], gpttype.data4[2],
|
||||
gpttype.data4[3], gpttype.data4[4],
|
||||
gpttype.data4[5], gpttype.data4[6],
|
||||
gpttype.data4[7]);
|
||||
}
|
||||
dev->disk->partition = p;
|
||||
}
|
||||
putchar (delim);
|
||||
grub_device_close (dev);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
|
@ -805,6 +840,8 @@ argp_parser (int key, char *arg, struct argp_state *state)
|
|||
print = PRINT_CRYPTODISK_UUID;
|
||||
else if (!strcmp (arg, "msdos_parttype"))
|
||||
print = PRINT_MSDOS_PARTTYPE;
|
||||
else if (!strcmp (arg, "gpt_parttype"))
|
||||
print = PRINT_GPT_PARTTYPE;
|
||||
else if (!strcmp (arg, "hints_string"))
|
||||
print = PRINT_HINT_STR;
|
||||
else if (!strcmp (arg, "bios_hints"))
|
||||
|
|
Loading…
Reference in a new issue