[scripts] move GRUB2 Live directory from /boot/grub to /boot/sabayon

This is not /boot/grub for a very good reason:
 Our Live media uses /boot/sabayon instead of /boot/grub
 and this has also the side effect that we can put
 /boot/sabayon into the EFI Boot Partition avoiding
 name clashing. Our /boot/sabayon inside that partition
 will contain a simple grub.cfg doing two things:

 1. set the correct prefix to the real grub boot partition
    (via set prefix=(hdX,X)/boot/grub
 2. load the real grub.cfg file (via configfile (hdX,X)/...)

 In this way, we can ship a SecureBoot signed grubx64.efi
 file and have it working with all the partition layouts.
 The "bootstrap" grub.cfg file is created by our scripts
 that are sourced by grub-mkconfig.
This commit is contained in:
Fabio Erculiani
2012-12-03 23:18:27 +01:00
parent 7d8622a10d
commit 392149d9c4
11 changed files with 57 additions and 38 deletions
@@ -3,7 +3,7 @@ set default=0
set fallback=2
set pager=1
if loadfont /boot/grub/unicode.pf2 ; then
if loadfont /boot/sabayon/unicode.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
@@ -12,9 +12,9 @@ if loadfont /boot/grub/unicode.pf2 ; then
insmod gettext
fi
if [ -f /boot/grub/default-splash.png ]; then
if [ -f /boot/sabayon/default-splash.png ]; then
insmod png
background_image -m stretch /boot/grub/default-splash.png
background_image -m stretch /boot/sabayon/default-splash.png
fi
if [ x$bootlang = x ]; then
@@ -72,14 +72,14 @@ submenu "Advanced Options" {
echo "Disabling Kernel Mode Setting..."
set modeset_opt="nomodeset"
export modeset_opt
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
menuentry "Disable ACPI" {
echo "Disabling ACPI..."
set acpi_opt="nomodeset"
export acpi_opt
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
menuentry "Debug mode" {
+5 -5
View File
@@ -3,7 +3,7 @@ set default=0
set fallback=2
set pager=1
if loadfont /boot/grub/unicode.pf2 ; then
if loadfont /boot/sabayon/unicode.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
@@ -12,9 +12,9 @@ if loadfont /boot/grub/unicode.pf2 ; then
insmod gettext
fi
if [ -f /boot/grub/default-splash.png ]; then
if [ -f /boot/sabayon/default-splash.png ]; then
insmod png
background_image -m stretch /boot/grub/default-splash.png
background_image -m stretch /boot/sabayon/default-splash.png
fi
if [ x$bootlang = x ]; then
@@ -82,14 +82,14 @@ submenu "Advanced Options" {
echo "Disabling Kernel Mode Setting..."
set modeset_opt="nomodeset"
export modeset_opt
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
menuentry "Disable ACPI" {
echo "Disabling ACPI..."
set acpi_opt="nomodeset"
export acpi_opt
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
menuentry "Debug mode" {
+5 -5
View File
@@ -3,7 +3,7 @@ set default=0
set fallback=2
set pager=1
if loadfont /boot/grub/unicode.pf2 ; then
if loadfont /boot/sabayon/unicode.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
@@ -12,9 +12,9 @@ if loadfont /boot/grub/unicode.pf2 ; then
insmod gettext
fi
if [ -f /boot/grub/default-splash.png ]; then
if [ -f /boot/sabayon/default-splash.png ]; then
insmod png
background_image -m stretch /boot/grub/default-splash.png
background_image -m stretch /boot/sabayon/default-splash.png
fi
if [ x$bootlang = x ]; then
@@ -142,14 +142,14 @@ submenu "Advanced Options" {
echo "Disabling Kernel Mode Setting..."
set modeset_opt="nomodeset"
export modeset_opt
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
menuentry "Disable ACPI" {
echo "Disabling ACPI..."
set acpi_opt="nomodeset"
export acpi_opt
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
menuentry "Debug mode (x86_64)" {
+5 -5
View File
@@ -3,7 +3,7 @@ set default=0
set fallback=2
set pager=1
if loadfont /boot/grub/unicode.pf2 ; then
if loadfont /boot/sabayon/unicode.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
@@ -12,9 +12,9 @@ if loadfont /boot/grub/unicode.pf2 ; then
insmod gettext
fi
if [ -f /boot/grub/default-splash.png ]; then
if [ -f /boot/sabayon/default-splash.png ]; then
insmod png
background_image -m stretch /boot/grub/default-splash.png
background_image -m stretch /boot/sabayon/default-splash.png
fi
if [ x$bootlang = x ]; then
@@ -83,14 +83,14 @@ submenu "Advanced Options" {
echo "Disabling Kernel Mode Setting..."
set modeset_opt="nomodeset"
export modeset_opt
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
menuentry "Disable ACPI" {
echo "Disabling ACPI..."
set acpi_opt="nomodeset"
export acpi_opt
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
menuentry "Debug mode" {
+5 -5
View File
@@ -3,7 +3,7 @@ set default=0
set fallback=2
set pager=1
if loadfont /boot/grub/unicode.pf2 ; then
if loadfont /boot/sabayon/unicode.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
@@ -12,9 +12,9 @@ if loadfont /boot/grub/unicode.pf2 ; then
insmod gettext
fi
if [ -f /boot/grub/default-splash.png ]; then
if [ -f /boot/sabayon/default-splash.png ]; then
insmod png
background_image -m stretch /boot/grub/default-splash.png
background_image -m stretch /boot/sabayon/default-splash.png
fi
if [ x$bootlang = x ]; then
@@ -71,14 +71,14 @@ submenu "Advanced Options" {
echo "Disabling Kernel Mode Setting..."
set modeset_opt="nomodeset"
export modeset_opt
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
menuentry "Disable ACPI" {
echo "Disabling ACPI..."
set acpi_opt="nomodeset"
export acpi_opt
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
menuentry "Debug mode" {
+5 -5
View File
@@ -3,7 +3,7 @@ set default=0
set fallback=2
set pager=1
if loadfont /boot/grub/unicode.pf2 ; then
if loadfont /boot/sabayon/unicode.pf2 ; then
set gfxmode=auto
insmod efi_gop
insmod efi_uga
@@ -12,9 +12,9 @@ if loadfont /boot/grub/unicode.pf2 ; then
insmod gettext
fi
if [ -f /boot/grub/default-splash.png ]; then
if [ -f /boot/sabayon/default-splash.png ]; then
insmod png
background_image -m stretch /boot/grub/default-splash.png
background_image -m stretch /boot/sabayon/default-splash.png
fi
if [ x$bootlang = x ]; then
@@ -101,14 +101,14 @@ submenu "Advanced Options" {
echo "Disabling Kernel Mode Setting..."
set modeset_opt="nomodeset"
export modeset_opt
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
menuentry "Disable ACPI" {
echo "Disabling ACPI..."
set acpi_opt="nomodeset"
export acpi_opt
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
menuentry "Debug mode" {
+2 -2
View File
@@ -84,7 +84,7 @@ for keymap, lang, name in langs:
set bootlang=%(lang)s
export bootlang
export lang
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
""" % {'name': name, 'lang': lang,})
@@ -102,7 +102,7 @@ for keymap, lang, name in langs:
echo "Switching to: $chosen"
set bootkeymap=%(keymap)s
export bootkeymap
configfile /boot/grub/grub.cfg
configfile /boot/sabayon/grub.cfg
}
""" % {'name': name, 'keymap': keymap,})
+1 -1
View File
@@ -32,7 +32,7 @@ if [ ! -f "${other_iso_path}" ]; then
fi
isolinux_destination="${CDROOT_DIR}/isolinux/txt.cfg"
grub_destination="${CDROOT_DIR}/boot/grub/grub.cfg"
grub_destination="${CDROOT_DIR}/boot/sabayon/grub.cfg"
isolinux_source="${SABAYON_MOLECULE_HOME}/remaster/minimal_amd64_x86_isolinux.cfg"
grub_source="${SABAYON_MOLECULE_HOME}/remaster/minimal_amd64_x86_grub.cfg"
cp "${isolinux_source}" "${isolinux_destination}" || exit 1
+1 -1
View File
@@ -14,7 +14,7 @@ remaster_type="${1}"
isolinux_source="${SABAYON_MOLECULE_HOME}/remaster/minimal_isolinux.cfg"
grub_source="${SABAYON_MOLECULE_HOME}/remaster/minimal_grub.cfg"
isolinux_destination="${CDROOT_DIR}/isolinux/txt.cfg"
grub_destination="${CDROOT_DIR}/boot/grub/grub.cfg"
grub_destination="${CDROOT_DIR}/boot/sabayon/grub.cfg"
if [ "${remaster_type}" = "KDE" ] || [ "${remaster_type}" = "GNOME" ]; then
isolinux_source="${SABAYON_MOLECULE_HOME}/remaster/standard_isolinux.cfg"
+22 -3
View File
@@ -11,7 +11,22 @@ export SABAYON_MOLECULE_HOME
MOUNT_DIRS=()
EFI_BOOT_DIR="${CDROOT_DIR}/efi/boot"
GRUB_BOOT_DIR_PREFIX="/boot/grub"
# This is not /boot/grub for a very good reason:
# Our Live media uses /boot/sabayon instead of /boot/grub
# and this has also the side effect that we can put
# /boot/sabayon into the EFI Boot Partition avoiding
# name clashing. Our /boot/sabayon inside that partition
# will contain a simple grub.cfg doing two things:
#
# 1. set the correct prefix to the real grub boot partition
# (via set prefix=(hdX,X)/boot/grub
# 2. load the real grub.cfg file (via configfile (hdX,X)/...)
#
# In this way, we can ship a SecureBoot signed grubx64.efi
# file and have it working with all the partition layouts.
# The "bootstrap" grub.cfg file is created by our scripts
# that are sourced by grub-mkconfig.
GRUB_BOOT_DIR_PREFIX="/boot/sabayon"
GRUB_LOCALE_DIR_PREFIX="${GRUB_BOOT_DIR_PREFIX}/locale"
GRUB_BOOT_DIR="${CDROOT_DIR}${GRUB_BOOT_DIR_PREFIX}"
GRUB_LOCALE_DIR="${CDROOT_DIR}${GRUB_LOCALE_DIR_PREFIX}"
@@ -41,7 +56,9 @@ if [ -d "${x86_64_EFI_DIR}" ]; then
-p "${GRUB_BOOT_DIR_PREFIX}" \
-d "${x86_64_EFI_DIR_PREFIX}" \
-o /bootx64.efi \
-O x86_64-efi ext2 fat lvm part_msdos part_gpt search_fs_uuid normal chain iso9660 \
-O x86_64-efi ext2 fat lvm part_msdos \
part_gpt search_fs_uuid normal \
chain iso9660 configfile loadenv \
|| exit 1
mv "${CHROOT_DIR}"/bootx64.efi "${EFI_BOOT_DIR}/" || exit 1
cp -Rp "${x86_64_EFI_DIR}" "${GRUB_BOOT_DIR}/" || exit 1
@@ -52,7 +69,9 @@ if [ -d "${i386_EFI_DIR}" ]; then
-p "${GRUB_BOOT_DIR_PREFIX}" \
-d "${i386_EFI_DIR_PREFIX}" \
-o /boota32.efi \
-O i386-efi ext2 fat lvm part_msdos part_gpt search_fs_uuid normal chain iso9660 \
-O i386-efi ext2 fat lvm part_msdos \
part_gpt search_fs_uuid normal \
chain iso9660 configfile loadenv \
|| exit 1
mv "${CHROOT_DIR}"/boota32.efi "${EFI_BOOT_DIR}/" || exit 1
cp -Rp "${i386_EFI_DIR}" "${GRUB_BOOT_DIR}/" || exit 1
+1 -1
View File
@@ -42,7 +42,7 @@ ver=${RELEASE_VERSION}
isolinux_dest="${CDROOT_DIR}/isolinux/txt.cfg"
isolinux_dest_txt="${CDROOT_DIR}/isolinux/isolinux.txt"
grub_dest="${CDROOT_DIR}/boot/grub/grub.cfg"
grub_dest="${CDROOT_DIR}/boot/sabayon/grub.cfg"
for path in "${isolinux_dest}" "${isolinux_dest_txt}" "${grub_dest}"; do
sed -i "s/__VERSION__/${ver}/g" "${path}" || exit 1