Move platform-dependent files from $prefix to $prefix/$platform.
* config.h.in (GRUB_TARGET_CPU): New definition. (GRUB_PLATFORM): Likewise. * configure.ac: Define GRUB_TARGET_CPU and GRUB_PLATFORM. * grub-core/commands/parttool.c (grub_cmd_parttool): Update dir. * grub-core/efiemu/main.c (grub_efiemu_autocore): Likewise. * grub-core/kern/dl.c (grub_dl_load): Likewise. * grub-core/normal/autofs.c (read_fs_list): Likewise. * grub-core/normal/crypto.c (read_crypto_list): Likewise. * grub-core/normal/dyncmd.c (read_command_list): Likewise. * grub-core/normal/term.c (read_terminal_list): Likewise. * grub-core/gettext/gettext.c (grub_mofile_open_lang): Use $prefix/locale. (grub_gettext_init_ext): Likewise. * grub-core/normal/main.c (GRUB_MOD_INIT): Define grub_cpu and grub_platform. * util/grub-install.in: Update directories. * util/grub-mknetdir.in: Likewise. * util/grub-mkrescue.in: Likewise.
This commit is contained in:
parent
db606889a9
commit
92cd0f6e45
15 changed files with 118 additions and 73 deletions
23
ChangeLog
23
ChangeLog
|
@ -1,3 +1,26 @@
|
||||||
|
2012-02-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Move platform-dependent files from $prefix to $prefix/$platform.
|
||||||
|
|
||||||
|
* config.h.in (GRUB_TARGET_CPU): New definition.
|
||||||
|
(GRUB_PLATFORM): Likewise.
|
||||||
|
* configure.ac: Define GRUB_TARGET_CPU and GRUB_PLATFORM.
|
||||||
|
* grub-core/commands/parttool.c (grub_cmd_parttool): Update dir.
|
||||||
|
* grub-core/efiemu/main.c (grub_efiemu_autocore): Likewise.
|
||||||
|
* grub-core/kern/dl.c (grub_dl_load): Likewise.
|
||||||
|
* grub-core/normal/autofs.c (read_fs_list): Likewise.
|
||||||
|
* grub-core/normal/crypto.c (read_crypto_list): Likewise.
|
||||||
|
* grub-core/normal/dyncmd.c (read_command_list): Likewise.
|
||||||
|
* grub-core/normal/term.c (read_terminal_list): Likewise.
|
||||||
|
* grub-core/gettext/gettext.c (grub_mofile_open_lang): Use
|
||||||
|
$prefix/locale.
|
||||||
|
(grub_gettext_init_ext): Likewise.
|
||||||
|
* grub-core/normal/main.c (GRUB_MOD_INIT): Define grub_cpu and
|
||||||
|
grub_platform.
|
||||||
|
* util/grub-install.in: Update directories.
|
||||||
|
* util/grub-mknetdir.in: Likewise.
|
||||||
|
* util/grub-mkrescue.in: Likewise.
|
||||||
|
|
||||||
2012-02-04 Vladimir Serbinenko <phcoder@gmail.com>
|
2012-02-04 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
* grub-core/kern/ieee1275/openfw.c (grub_claimmap): Change to
|
* grub-core/kern/ieee1275/openfw.c (grub_claimmap): Change to
|
||||||
|
|
|
@ -42,6 +42,9 @@
|
||||||
/* Define to 1 to enable disk cache statistics. */
|
/* Define to 1 to enable disk cache statistics. */
|
||||||
#define DISK_CACHE_STATS @DISK_CACHE_STATS@
|
#define DISK_CACHE_STATS @DISK_CACHE_STATS@
|
||||||
|
|
||||||
|
#define GRUB_TARGET_CPU "@GRUB_TARGET_CPU@"
|
||||||
|
#define GRUB_PLATFORM "@GRUB_PLATFORM@"
|
||||||
|
|
||||||
#define RE_ENABLE_I18N 1
|
#define RE_ENABLE_I18N 1
|
||||||
|
|
||||||
#if defined(__i386__)
|
#if defined(__i386__)
|
||||||
|
|
|
@ -597,6 +597,12 @@ fi
|
||||||
TARGET_CPP="$TARGET_CC -E"
|
TARGET_CPP="$TARGET_CC -E"
|
||||||
TARGET_CCAS=$TARGET_CC
|
TARGET_CCAS=$TARGET_CC
|
||||||
|
|
||||||
|
GRUB_TARGET_CPU="${target_cpu}"
|
||||||
|
GRUB_PLATFORM="${platform}"
|
||||||
|
|
||||||
|
AC_SUBST(GRUB_TARGET_CPU)
|
||||||
|
AC_SUBST(GRUB_PLATFORM)
|
||||||
|
|
||||||
AC_SUBST(OBJCONV)
|
AC_SUBST(OBJCONV)
|
||||||
AC_SUBST(TARGET_CPP)
|
AC_SUBST(TARGET_CPP)
|
||||||
AC_SUBST(TARGET_CCAS)
|
AC_SUBST(TARGET_CCAS)
|
||||||
|
|
|
@ -185,7 +185,8 @@ grub_cmd_parttool (grub_command_t cmd __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
filename = grub_xasprintf ("%s/parttool.lst", prefix);
|
filename = grub_xasprintf ("%s/" GRUB_TARGET_CPU "-" GRUB_PLATFORM
|
||||||
|
"/parttool.lst", prefix);
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
|
|
|
@ -242,12 +242,12 @@ grub_efiemu_autocore (void)
|
||||||
|
|
||||||
suffix = grub_efiemu_get_default_core_name ();
|
suffix = grub_efiemu_get_default_core_name ();
|
||||||
|
|
||||||
filename = grub_xasprintf ("%s/%s", prefix, suffix);
|
filename = grub_xasprintf ("%s/" GRUB_TARGET_CPU "-" GRUB_PLATFORM "/%s",
|
||||||
|
prefix, suffix);
|
||||||
if (! filename)
|
if (! filename)
|
||||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||||
"couldn't allocate temporary space");
|
"couldn't allocate temporary space");
|
||||||
|
|
||||||
|
|
||||||
err = grub_efiemu_load_file (filename);
|
err = grub_efiemu_load_file (filename);
|
||||||
grub_free (filename);
|
grub_free (filename);
|
||||||
if (err)
|
if (err)
|
||||||
|
|
|
@ -286,14 +286,14 @@ grub_mofile_open (const char *filename)
|
||||||
/* Returning grub_file_t would be more natural, but grub_mofile_open assigns
|
/* Returning grub_file_t would be more natural, but grub_mofile_open assigns
|
||||||
to fd_mo anyway ... */
|
to fd_mo anyway ... */
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_mofile_open_lang (const char *locale_dir, const char *locale)
|
grub_mofile_open_lang (const char *part1, const char *part2, const char *locale)
|
||||||
{
|
{
|
||||||
char *mo_file;
|
char *mo_file;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
|
||||||
/* mo_file e.g.: /boot/grub/locale/ca.mo */
|
/* mo_file e.g.: /boot/grub/locale/ca.mo */
|
||||||
|
|
||||||
mo_file = grub_xasprintf ("%s/%s.mo", locale_dir, locale);
|
mo_file = grub_xasprintf ("%s%s/%s.mo", part1, part2, locale);
|
||||||
if (!mo_file)
|
if (!mo_file)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
|
@ -317,20 +317,23 @@ grub_mofile_open_lang (const char *locale_dir, const char *locale)
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_gettext_init_ext (const char *locale)
|
grub_gettext_init_ext (const char *locale)
|
||||||
{
|
{
|
||||||
const char *locale_dir;
|
const char *part1, *part2;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
|
||||||
if (!locale)
|
if (!locale)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
locale_dir = grub_env_get ("locale_dir");
|
part1 = grub_env_get ("locale_dir");
|
||||||
if (locale_dir == NULL)
|
part2 = "";
|
||||||
|
if (!part1)
|
||||||
{
|
{
|
||||||
grub_dprintf ("gettext", "locale_dir variable is not set up.\n");
|
part1 = grub_env_get ("prefix");
|
||||||
return 0;
|
if (!part1)
|
||||||
|
return 0;
|
||||||
|
part2 = "/locale";
|
||||||
}
|
}
|
||||||
|
|
||||||
err = grub_mofile_open_lang (locale_dir, locale);
|
err = grub_mofile_open_lang (part1, part2, locale);
|
||||||
|
|
||||||
/* ll_CC didn't work, so try ll. */
|
/* ll_CC didn't work, so try ll. */
|
||||||
if (err)
|
if (err)
|
||||||
|
@ -342,7 +345,7 @@ grub_gettext_init_ext (const char *locale)
|
||||||
{
|
{
|
||||||
*underscore = '\0';
|
*underscore = '\0';
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
err = grub_mofile_open_lang (locale_dir, lang);
|
err = grub_mofile_open_lang (part1, part2, lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_free (lang);
|
grub_free (lang);
|
||||||
|
|
|
@ -708,7 +708,8 @@ grub_dl_load (const char *name)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = grub_xasprintf ("%s/%s.mod", grub_dl_dir, name);
|
filename = grub_xasprintf ("%s/" GRUB_TARGET_CPU "-" GRUB_PLATFORM "/%s.mod",
|
||||||
|
grub_dl_dir, name);
|
||||||
if (! filename)
|
if (! filename)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,8 @@ read_fs_list (const char *prefix)
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
filename = grub_xasprintf ("%s/fs.lst", prefix);
|
filename = grub_xasprintf ("%s/" GRUB_TARGET_CPU "-" GRUB_PLATFORM
|
||||||
|
"/fs.lst", prefix);
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
|
|
|
@ -86,7 +86,8 @@ read_crypto_list (const char *prefix)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = grub_xasprintf ("%s/crypto.lst", prefix);
|
filename = grub_xasprintf ("%s/" GRUB_TARGET_CPU "-" GRUB_PLATFORM
|
||||||
|
"/crypto.lst", prefix);
|
||||||
if (!filename)
|
if (!filename)
|
||||||
{
|
{
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
|
|
@ -77,7 +77,8 @@ read_command_list (const char *prefix)
|
||||||
{
|
{
|
||||||
char *filename;
|
char *filename;
|
||||||
|
|
||||||
filename = grub_xasprintf ("%s/command.lst", prefix);
|
filename = grub_xasprintf ("%s/" GRUB_TARGET_CPU "-" GRUB_PLATFORM
|
||||||
|
"/command.lst", prefix);
|
||||||
if (filename)
|
if (filename)
|
||||||
{
|
{
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
|
|
|
@ -527,6 +527,10 @@ GRUB_MOD_INIT(normal)
|
||||||
grub_env_set (features[i], "y");
|
grub_env_set (features[i], "y");
|
||||||
grub_env_export (features[i]);
|
grub_env_export (features[i]);
|
||||||
}
|
}
|
||||||
|
grub_env_set ("grub_cpu", GRUB_TARGET_CPU);
|
||||||
|
grub_env_export ("grub_cpu");
|
||||||
|
grub_env_set ("grub_platform", GRUB_PLATFORM);
|
||||||
|
grub_env_export ("grub_platform");
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(normal)
|
GRUB_MOD_FINI(normal)
|
||||||
|
|
|
@ -308,7 +308,8 @@ read_terminal_list (const char *prefix)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
filename = grub_xasprintf ("%s/terminal.lst", prefix);
|
filename = grub_xasprintf ("%s/" GRUB_TARGET_CPU "-" GRUB_PLATFORM
|
||||||
|
"/terminal.lst", prefix);
|
||||||
if (!filename)
|
if (!filename)
|
||||||
{
|
{
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
|
|
@ -400,6 +400,7 @@ fi
|
||||||
|
|
||||||
# Create the GRUB directory if it is not present.
|
# Create the GRUB directory if it is not present.
|
||||||
mkdir -p "$grubdir" || exit 1
|
mkdir -p "$grubdir" || exit 1
|
||||||
|
mkdir -p "$grubdir/${target_cpu}-$platform" || exit 1
|
||||||
|
|
||||||
# If --recheck is specified, remove the device map, if present.
|
# If --recheck is specified, remove the device map, if present.
|
||||||
if test $recheck = yes; then
|
if test $recheck = yes; then
|
||||||
|
@ -420,18 +421,18 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy the GRUB images to the GRUB directory.
|
# Copy the GRUB images to the GRUB directory.
|
||||||
for file in "${grubdir}"/*.mod "${grubdir}"/*.lst "${grubdir}"/*.img "${grubdir}"/efiemu??.o; do
|
for file in "${grubdir}"/*.mod "${grubdir}"/*.lst "${grubdir}"/*.img "${grubdir}"/efiemu??.o "${grubdir}"/${target_cpu}-$platform/*.mod "${grubdir}"/${target_cpu}-$platform/*.lst "${grubdir}"/${target_cpu}-$platform/*.img "${grubdir}"/${target_cpu}-$platform/efiemu??.o; do
|
||||||
if test -f "$file" && [ "`basename $file`" != menu.lst ]; then
|
if test -f "$file" && [ "`basename $file`" != menu.lst ]; then
|
||||||
rm -f "$file" || exit 1
|
rm -f "$file" || exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
for file in "${pkglibdir}"/*.mod "${pkglibdir}"/*.lst; do
|
for file in "${pkglibdir}"/*.mod "${pkglibdir}"/*.lst; do
|
||||||
cp -f "$file" "${grubdir}" || exit 1
|
cp -f "$file" "${grubdir}/${target_cpu}-$platform" || exit 1
|
||||||
done
|
done
|
||||||
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
|
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
|
||||||
for file in "${pkglibdir}"/*.img "${pkglibdir}"/efiemu??.o; do
|
for file in "${pkglibdir}"/*.img "${pkglibdir}"/efiemu??.o; do
|
||||||
if test -f "$file"; then
|
if test -f "$file"; then
|
||||||
cp -f "$file" "${grubdir}" || exit 1
|
cp -f "$file" "${grubdir}/${target_cpu}-$platform" || exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -444,7 +445,7 @@ for dir in "${localedir}"/*; do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
is_path_readable_by_grub "${grubdir}" || (echo "${grubdir}" not readable 1>&2 ; exit 1)
|
is_path_readable_by_grub "${grubdir}/${target_cpu}-$platform" || (echo "${grubdir}" not readable 1>&2 ; exit 1)
|
||||||
|
|
||||||
# Write device to a variable so we don't have to traverse /dev every time.
|
# Write device to a variable so we don't have to traverse /dev every time.
|
||||||
grub_device="`"$grub_probe" --device-map="${device_map}" --target=device "${grubdir}"`" || exit 1
|
grub_device="`"$grub_probe" --device-map="${device_map}" --target=device "${grubdir}"`" || exit 1
|
||||||
|
@ -504,11 +505,11 @@ fi
|
||||||
prefix_drive=
|
prefix_drive=
|
||||||
config_opt=
|
config_opt=
|
||||||
|
|
||||||
rm -f "${grubdir}/load.cfg"
|
rm -f "${grubdir}/${target_cpu}-$platform/load.cfg"
|
||||||
|
|
||||||
if [ "x${debug_image}" != x ]; then
|
if [ "x${debug_image}" != x ]; then
|
||||||
echo "set debug='${debug_image}'" >> "${grubdir}/load.cfg"
|
echo "set debug='${debug_image}'" >> "${grubdir}/${target_cpu}-$platform/load.cfg"
|
||||||
config_opt="-c ${grubdir}/load.cfg "
|
config_opt="-c ${grubdir}/${target_cpu}-$platform/load.cfg "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "x${devabstraction_module}" = "x" ] ; then
|
if [ "x${devabstraction_module}" = "x" ] ; then
|
||||||
|
@ -555,9 +556,9 @@ if [ "x${devabstraction_module}" = "x" ] ; then
|
||||||
echo 1>&2
|
echo 1>&2
|
||||||
hints=
|
hints=
|
||||||
fi
|
fi
|
||||||
echo "search.fs_uuid ${uuid} root $hints " >> "${grubdir}/load.cfg"
|
echo "search.fs_uuid ${uuid} root $hints " >> "${grubdir}/${target_cpu}-$platform/load.cfg"
|
||||||
echo 'set prefix=($root)'"${relative_grubdir}" >> "${grubdir}/load.cfg"
|
echo 'set prefix=($root)'"${relative_grubdir}" >> "${grubdir}/${target_cpu}-$platform/load.cfg"
|
||||||
config_opt="-c ${grubdir}/load.cfg "
|
config_opt="-c ${grubdir}/${target_cpu}-$platform/load.cfg "
|
||||||
modules="$modules search_fs_uuid"
|
modules="$modules search_fs_uuid"
|
||||||
else
|
else
|
||||||
# we need to hardcode the partition number in the core image's prefix.
|
# we need to hardcode the partition number in the core image's prefix.
|
||||||
|
@ -571,9 +572,9 @@ if [ "x${devabstraction_module}" = "x" ] ; then
|
||||||
else
|
else
|
||||||
if [ x$GRUB_CRYPTODISK_ENABLE = xy ]; then
|
if [ x$GRUB_CRYPTODISK_ENABLE = xy ]; then
|
||||||
for uuid in "`echo "${grub_device}" | xargs "${grub_probe}" --target=cryptodisk_uuid --device`"; do
|
for uuid in "`echo "${grub_device}" | xargs "${grub_probe}" --target=cryptodisk_uuid --device`"; do
|
||||||
echo "cryptomount -u $uuid" >> "${grubdir}/load.cfg"
|
echo "cryptomount -u $uuid" >> "${grubdir}/${target_cpu}-$platform/load.cfg"
|
||||||
done
|
done
|
||||||
config_opt="-c ${grubdir}/load.cfg "
|
config_opt="-c ${grubdir}/${target_cpu}-$platform/load.cfg "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
prefix_drive=`"$grub_probe" --device-map="${device_map}" --target=drive --device "${grub_device}"` || exit 1
|
prefix_drive=`"$grub_probe" --device-map="${device_map}" --target=drive --device "${grub_device}"` || exit 1
|
||||||
|
@ -593,22 +594,22 @@ case "${target_cpu}-${platform}" in
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
"$grub_mkimage" ${config_opt} -d "${pkglibdir}" -O ${mkimage_target} --output="${grubdir}/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $modules || exit 1
|
"$grub_mkimage" ${config_opt} -d "${pkglibdir}" -O ${mkimage_target} --output="${grubdir}/${target_cpu}-$platform/core.${imgext}" --prefix="${prefix_drive}${relative_grubdir}" $modules || exit 1
|
||||||
|
|
||||||
# Backward-compatibility kludges
|
# Backward-compatibility kludges
|
||||||
if [ "${target_cpu}-${platform}" = "mipsel-loongson" ]; then
|
if [ "${target_cpu}-${platform}" = "mipsel-loongson" ]; then
|
||||||
cp "${grubdir}/core.${imgext}" "${bootdir}"/grub.elf
|
cp "${grubdir}/${target_cpu}-$platform/core.${imgext}" "${bootdir}"/grub.elf
|
||||||
elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
|
elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
|
||||||
cp "${grubdir}/core.${imgext}" "${grubdir}/grub"
|
cp "${grubdir}/${target_cpu}-$platform/core.${imgext}" "${grubdir}/grub"
|
||||||
elif [ "${target_cpu}-${platform}" = "i386-efi" ] || [ "${target_cpu}-${platform}" = "x86_64-efi" ]; then
|
elif [ "${target_cpu}-${platform}" = "i386-efi" ] || [ "${target_cpu}-${platform}" = "x86_64-efi" ]; then
|
||||||
"$grub_mkimage" ${config_opt} -d "${pkglibdir}" -O ${mkimage_target} --output="${grubdir}/grub.efi" --prefix="" $modules || exit 1
|
"$grub_mkimage" ${config_opt} -d "${pkglibdir}" -O ${mkimage_target} --output="${grubdir}/${target_cpu}-$platform/grub.efi" --prefix="" $modules || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Perform the platform-dependent install
|
# Perform the platform-dependent install
|
||||||
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
|
if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}" = "sparc64-ieee1275" ] ; then
|
||||||
# Now perform the installation.
|
# Now perform the installation.
|
||||||
"$grub_setup" ${allow_floppy} ${setup_verbose} ${setup_force} --directory="${grubdir}" \
|
"$grub_setup" ${allow_floppy} ${setup_verbose} ${setup_force} --directory="${grubdir}/${target_cpu}-$platform" \
|
||||||
--device-map="${device_map}" "${install_device}" || exit 1
|
--device-map="${device_map}" "${install_device}" || exit 1
|
||||||
elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
|
elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ]; then
|
||||||
if [ x"$update_nvram" = xyes ]; then
|
if [ x"$update_nvram" = xyes ]; then
|
||||||
|
@ -637,7 +638,7 @@ 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}/${target_cpu}-$platform/core.${imgext}" | sed 's,/,\\\\,g'`
|
||||||
|
|
||||||
# If a install device is defined, copy the core.elf to PReP partition.
|
# If a install device is defined, copy the core.elf to PReP partition.
|
||||||
if [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ] \
|
if [ "${target_cpu}-${platform}" = "powerpc-ieee1275" ] \
|
||||||
|
@ -651,7 +652,7 @@ elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${pla
|
||||||
if [ "$(file -s "${install_device}" -b | awk '{ print $1 }')" = ELF ] || [ $(cmp /dev/zero "${install_device}" &>/dev/null) ]; then
|
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
|
# Change boot device to the harddisk root
|
||||||
boot_device="$ofpath"
|
boot_device="$ofpath"
|
||||||
dd if="${grubdir}/core.${imgext}" of="${install_device}" status=noxfer || {
|
dd if="${grubdir}/${target_cpu}-$platform/core.${imgext}" of="${install_device}" status=noxfer || {
|
||||||
gettext "Failed to copy Grub to the PReP partition." 1>&2
|
gettext "Failed to copy Grub to the PReP partition." 1>&2
|
||||||
echo 1>&2
|
echo 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -673,14 +674,14 @@ elif [ "${target_cpu}-${platform}" = "i386-ieee1275" ] || [ "${target_cpu}-${pla
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
elif [ x"${target_cpu}-${platform}" = xmips-arc ]; then
|
elif [ x"${target_cpu}-${platform}" = xmips-arc ]; then
|
||||||
dvhtool -d "${install_device}" --unix-to-vh "{grubdir}/core.${imgext}" grub
|
dvhtool -d "${install_device}" --unix-to-vh "{grubdir}/${target_cpu}-$platform/core.${imgext}" grub
|
||||||
gettext "You will have to set SystemPartition and OSLoader manually." 1>&2
|
gettext "You will have to set SystemPartition and OSLoader manually." 1>&2
|
||||||
echo 1>&2
|
echo 1>&2
|
||||||
elif [ x"$platform" = xefi ]; then
|
elif [ x"$platform" = xefi ]; then
|
||||||
cp "${grubdir}/core.${imgext}" "${efidir}/${efi_file}"
|
cp "${grubdir}/${target_cpu}-$platform/core.${imgext}" "${efidir}/${efi_file}"
|
||||||
# For old macs. Suggested by Peter Jones.
|
# For old macs. Suggested by Peter Jones.
|
||||||
if [ x$target_cpu = xi386 ]; then
|
if [ x$target_cpu = xi386 ]; then
|
||||||
cp "${grubdir}/core.${imgext}" "${efidir}/boot.efi"
|
cp "${grubdir}/${target_cpu}-$platform/core.${imgext}" "${efidir}/boot.efi"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Try to make this image bootable using the EFI Boot Manager, if available.
|
# Try to make this image bootable using the EFI Boot Manager, if available.
|
||||||
|
|
|
@ -202,7 +202,7 @@ process_input_dir ()
|
||||||
config_opt="-c ${grubdir}/load.cfg "
|
config_opt="-c ${grubdir}/load.cfg "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
prefix="/${subdir}/${platform}";
|
prefix="/${subdir}";
|
||||||
case "${platform}" in
|
case "${platform}" in
|
||||||
i386-pc) mkimage_target=i386-pc-pxe;
|
i386-pc) mkimage_target=i386-pc-pxe;
|
||||||
netmodules="pxe";
|
netmodules="pxe";
|
||||||
|
|
|
@ -160,20 +160,20 @@ process_input_dir ()
|
||||||
{
|
{
|
||||||
input_dir="$1"
|
input_dir="$1"
|
||||||
platform="$2"
|
platform="$2"
|
||||||
mkdir -p ${iso9660_dir}/boot/grub/${platform}
|
mkdir -p "${iso9660_dir}/boot/grub/${platform}"
|
||||||
for file in "${input_dir}/"*.mod "${input_dir}/"efiemu32.o "${input_dir}/"efiemu64.o; do
|
for file in "${input_dir}/"*.mod "${input_dir}/"efiemu32.o "${input_dir}/"efiemu64.o; do
|
||||||
if test -f "$file"; then
|
if test -f "$file"; then
|
||||||
cp -f "$file" ${iso9660_dir}/boot/grub/${platform}/
|
cp -f "$file" "${iso9660_dir}/boot/grub/${platform}/"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
for file in ${pkglib_DATA}; do
|
for file in ${pkglib_DATA}; do
|
||||||
if test -f "${input_dir}/${file}"; then
|
if test -f "${input_dir}/${file}"; then
|
||||||
cp -f "${input_dir}/${file}" ${iso9660_dir}/boot/grub/${platform}/
|
cp -f "${input_dir}/${file}" "${iso9660_dir}/boot/grub/${platform}/"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
mkdir -p ${iso9660_dir}/boot/grub/locale
|
mkdir -p "${iso9660_dir}/boot/grub/locale"
|
||||||
for file in ${input_dir}/po/*.mo; do
|
for file in "${input_dir}"/po/*.mo; do
|
||||||
if test -f "$file"; then
|
if test -f "$file"; then
|
||||||
cp -f "$file" ${iso9660_dir}/boot/grub/locale/
|
cp -f "$file" ${iso9660_dir}/boot/grub/locale/
|
||||||
fi
|
fi
|
||||||
|
@ -190,26 +190,25 @@ make_image ()
|
||||||
|
|
||||||
gettext_printf "Enabling %s support ...\n" "$2"
|
gettext_printf "Enabling %s support ...\n" "$2"
|
||||||
|
|
||||||
memdisk_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
memdisk_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
||||||
memdisk_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
memdisk_dir="`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
||||||
mkdir -p ${memdisk_dir}/boot/grub
|
mkdir -p "${memdisk_dir}/boot/grub"
|
||||||
|
|
||||||
cat << EOF > ${memdisk_dir}/boot/grub/grub.cfg
|
(cat << EOF
|
||||||
search --fs-uuid --set=root ${iso_uuid}
|
search --fs-uuid --set=root ${iso_uuid}
|
||||||
set prefix=(\${root})/boot/grub/${platform}
|
set prefix=(\${root})/boot/grub
|
||||||
source \$prefix/grub.cfg
|
|
||||||
EOF
|
EOF
|
||||||
(for i in $(cat ${source_directory}/partmap.lst) ${modules} ; do
|
for i in $(cat "${source_directory}/partmap.lst") ${modules} ; do
|
||||||
echo "insmod $i"
|
echo "insmod $i"
|
||||||
done ; \
|
done ; \
|
||||||
echo "source /boot/grub/grub.cfg") \
|
echo "source \$prefix/grub.cfg") \
|
||||||
> ${iso9660_dir}/boot/grub/${platform}/grub.cfg
|
> "${memdisk_dir}/boot/grub/grub.cfg"
|
||||||
|
|
||||||
(cd "${memdisk_dir}"; tar -cf - boot) > "${memdisk_img}"
|
(cd "${memdisk_dir}"; tar -cf - boot) > "${memdisk_img}"
|
||||||
rm -rf ${memdisk_dir}
|
rm -rf "${memdisk_dir}"
|
||||||
$grub_mkimage -O ${platform} -d "${source_directory}" -m "${memdisk_img}" -o "$3" --prefix='(memdisk)/boot/grub' \
|
"$grub_mkimage" -O ${platform} -d "${source_directory}" -m "${memdisk_img}" -o "$3" --prefix='(memdisk)/boot/grub' \
|
||||||
search iso9660 configfile normal memdisk tar $4
|
search iso9660 configfile normal memdisk tar $4
|
||||||
rm -rf ${memdisk_img}
|
rm -rf "${memdisk_img}"
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "${override_dir}" = "" ] ; then
|
if [ "${override_dir}" = "" ] ; then
|
||||||
|
@ -257,21 +256,21 @@ grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${i
|
||||||
# build BIOS core.img
|
# build BIOS core.img
|
||||||
if test -e "${pc_dir}" ; then
|
if test -e "${pc_dir}" ; then
|
||||||
gettext_printf "Enabling %s support ...\n" "BIOS"
|
gettext_printf "Enabling %s support ...\n" "BIOS"
|
||||||
core_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
load_cfg="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`"
|
||||||
$grub_mkimage -O i386-pc -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \
|
core_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
||||||
iso9660 biosdisk
|
|
||||||
cat ${pc_dir}/cdboot.img ${core_img} > ${iso9660_dir}/boot/grub/i386-pc/eltorito.img
|
|
||||||
|
|
||||||
embed_img=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
(for i in $(cat "${pc_dir}/partmap.lst") ${modules} ; do
|
||||||
cat ${pc_dir}/boot.img ${core_img} > ${embed_img}
|
|
||||||
|
|
||||||
rm -f ${core_img}
|
|
||||||
|
|
||||||
(for i in $(cat ${pc_dir}/partmap.lst) ${modules} ; do
|
|
||||||
echo "insmod $i"
|
echo "insmod $i"
|
||||||
done ; \
|
done ;) > "${load_cfg}"
|
||||||
echo "source /boot/grub/grub.cfg") \
|
|
||||||
> ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
|
"$grub_mkimage" -O i386-pc -d "${pc_dir}/" -o "${core_img}" -c "$load_cfg" --prefix=/boot/grub \
|
||||||
|
iso9660 biosdisk
|
||||||
|
cat "${pc_dir}/cdboot.img" "${core_img}" > "${iso9660_dir}/boot/grub/i386-pc/eltorito.img"
|
||||||
|
|
||||||
|
embed_img="`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"`" || exit 1
|
||||||
|
cat "${pc_dir}/boot.img" "${core_img}" > "${embed_img}"
|
||||||
|
|
||||||
|
rm -f $"{core_img}"
|
||||||
|
|
||||||
grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-info-table \
|
grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -no-emul-boot -boot-info-table \
|
||||||
--embedded-boot ${embed_img}"
|
--embedded-boot ${embed_img}"
|
||||||
|
@ -309,9 +308,9 @@ if [ -e "${iso9660_dir}/boot/coreboot.elf" ] && [ -d "${rom_directory}" ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# build iso image
|
# build iso image
|
||||||
"${xorriso}" -as mkisofs -graft-points ${grub_mkisofs_arguments} --protective-msdos-label -o ${output_image} -r ${iso9660_dir} --sort-weight 0 / --sort-weight 1 /boot ${source}
|
"${xorriso}" -as mkisofs -graft-points ${grub_mkisofs_arguments} --protective-msdos-label -o "${output_image}" -r "${iso9660_dir}" --sort-weight 0 / --sort-weight 1 /boot ${source}
|
||||||
rm -rf ${iso9660_dir}
|
rm -rf "${iso9660_dir}"
|
||||||
|
|
||||||
rm -f ${embed_img}
|
rm -f "${embed_img}"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in a new issue