* util/grub-install.in: Support dd'in into PreP partition.
* util/grub-probe.c (probe): Support discovering partition type. (main): Support -t msdos_parttype. Also-By: Vladimir Serbinenko <phcoder@gmail.com> Also-By: pfsmorigo <>
This commit is contained in:
parent
7816a17ed1
commit
668327923f
3 changed files with 48 additions and 3 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2012-01-23 Paulo de Rezende Pinatti <ppinatti@linux.vnet.ibm.com>
|
||||||
|
2012-01-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
2012-01-23 pfsmorigo
|
||||||
|
|
||||||
|
* util/grub-install.in: Support dd'in into PreP partition.
|
||||||
|
* util/grub-probe.c (probe): Support discovering partition type.
|
||||||
|
(main): Support -t msdos_parttype.
|
||||||
|
|
||||||
2012-01-23 Vladimir Serbinenko <phcoder@gmail.com>
|
2012-01-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/normal/crypto.c (grub_crypto_autoload): Prevent
|
* grub-core/normal/crypto.c (grub_crypto_autoload): Prevent
|
||||||
|
|
|
@ -274,7 +274,8 @@ if test "x$install_device" = x && ([ "${target_cpu}-${platform}" = "i386-pc" ] \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! ([ "${target_cpu}-${platform}" = "i386-pc" ] \
|
if ! ([ "${target_cpu}-${platform}" = "i386-pc" ] \
|
||||||
|| [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ]); then
|
|| [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] \
|
||||||
|
|| [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]); then
|
||||||
install_device=
|
install_device=
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -653,6 +654,29 @@ elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${pla
|
||||||
|
|
||||||
# Point boot-device at the new grub install
|
# Point boot-device at the new grub install
|
||||||
boot_device="$ofpath:$partno,"`"$grub_mkrelpath" "${grubdir}/core.${imgext}" | sed 's,/,\\\\,g'`
|
boot_device="$ofpath:$partno,"`"$grub_mkrelpath" "${grubdir}/core.${imgext}" | sed 's,/,\\\\,g'`
|
||||||
|
|
||||||
|
# If a install device is defined, copy the core.elf to PReP partition.
|
||||||
|
if [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ] \
|
||||||
|
&& [ -n "${install_device}" ]; then
|
||||||
|
if [ "$("${grub_probe}" -m "${device_map}" -d "${install_device}" -t msdos_parttype)" != "41" ]; then
|
||||||
|
echo "The chosen partition is not a PReP partition."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$(file -s "${install_device}" -b | awk '{ print $1 }')" = ELF ] || [ $(cmp /dev/zero "${install_device}" &>/dev/null) ]; then
|
||||||
|
# Change boot device to the harddisk root
|
||||||
|
boot_device="$ofpath"
|
||||||
|
dd if="${grubdir}/core.${imgext}" of="${install_device}" status=noxfer || {
|
||||||
|
echo "Failed to copy Grub to the PReP partition."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
else
|
||||||
|
echo "The PReP partition is not empty. If you are sure you want to use it, run dd to clear it:"
|
||||||
|
echo " dd if=/dev/zero of=${install_device}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
"$nvsetenv" boot-device "$boot_device" || {
|
"$nvsetenv" boot-device "$boot_device" || {
|
||||||
echo "$nvsetenv failed."
|
echo "$nvsetenv failed."
|
||||||
echo "You will have to set boot-device manually. At the Open Firmware prompt, type:"
|
echo "You will have to set boot-device manually. At the Open Firmware prompt, type:"
|
||||||
|
|
|
@ -64,7 +64,8 @@ enum {
|
||||||
PRINT_BAREMETAL_HINT,
|
PRINT_BAREMETAL_HINT,
|
||||||
PRINT_EFI_HINT,
|
PRINT_EFI_HINT,
|
||||||
PRINT_ARC_HINT,
|
PRINT_ARC_HINT,
|
||||||
PRINT_COMPATIBILITY_HINT
|
PRINT_COMPATIBILITY_HINT,
|
||||||
|
PRINT_MSDOS_PARTTYPE
|
||||||
};
|
};
|
||||||
|
|
||||||
static int print = PRINT_FS;
|
static int print = PRINT_FS;
|
||||||
|
@ -544,6 +545,16 @@ probe (const char *path, char *device_name)
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (print == PRINT_MSDOS_PARTTYPE)
|
||||||
|
{
|
||||||
|
if (dev->disk->partition
|
||||||
|
&& strcmp(dev->disk->partition->partmap->name, "msdos") == 0)
|
||||||
|
printf ("%02x", dev->disk->partition->msdostype);
|
||||||
|
|
||||||
|
printf ("\n");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
fs = grub_fs_probe (dev);
|
fs = grub_fs_probe (dev);
|
||||||
if (! fs)
|
if (! fs)
|
||||||
grub_util_error ("%s", _(grub_errmsg));
|
grub_util_error ("%s", _(grub_errmsg));
|
||||||
|
@ -609,7 +620,7 @@ Probe device information for a given path (or device, if the -d option is given)
|
||||||
\n\
|
\n\
|
||||||
-d, --device given argument is a system device, not a path\n\
|
-d, --device given argument is a system device, not a path\n\
|
||||||
-m, --device-map=FILE use FILE as the device map [default=%s]\n\
|
-m, --device-map=FILE use FILE as the device map [default=%s]\n\
|
||||||
-t, --target=(fs|fs_uuid|fs_label|drive|device|partmap|abstraction|cryptodisk_uuid)\n\
|
-t, --target=(fs|fs_uuid|fs_label|drive|device|partmap|abstraction|cryptodisk_uuid|msdos_parttype)\n\
|
||||||
print filesystem module, GRUB drive, system device, partition map module, abstraction module or CRYPTO UUID [default=fs]\n\
|
print filesystem module, GRUB drive, system device, partition map module, abstraction module or CRYPTO UUID [default=fs]\n\
|
||||||
-h, --help display this message and exit\n\
|
-h, --help display this message and exit\n\
|
||||||
-V, --version print version information and exit\n\
|
-V, --version print version information and exit\n\
|
||||||
|
@ -670,6 +681,8 @@ main (int argc, char *argv[])
|
||||||
print = PRINT_ABSTRACTION;
|
print = PRINT_ABSTRACTION;
|
||||||
else if (!strcmp (optarg, "cryptodisk_uuid"))
|
else if (!strcmp (optarg, "cryptodisk_uuid"))
|
||||||
print = PRINT_CRYPTODISK_UUID;
|
print = PRINT_CRYPTODISK_UUID;
|
||||||
|
else if (!strcmp (optarg, "msdos_parttype"))
|
||||||
|
print = PRINT_MSDOS_PARTTYPE;
|
||||||
else if (!strcmp (optarg, "hints_string"))
|
else if (!strcmp (optarg, "hints_string"))
|
||||||
print = PRINT_HINT_STR;
|
print = PRINT_HINT_STR;
|
||||||
else if (!strcmp (optarg, "bios_hints"))
|
else if (!strcmp (optarg, "bios_hints"))
|
||||||
|
|
Loading…
Reference in a new issue