mirror of
https://gitlab.archlinux.org/tpowa/archboot.git
synced 2024-09-20 03:50:37 +02:00
more grub2 changes for beta0
This commit is contained in:
parent
620b9b8e35
commit
6edc93a3ea
8 changed files with 127 additions and 71 deletions
|
@ -2,15 +2,14 @@
|
|||
|
||||
build ()
|
||||
{
|
||||
BINARIES="/usr/bin/grub-editenv /usr/bin/grub-fstest /usr/bin/grub-menulst2cfg /usr/bin/grub-mkfont /usr/bin/grub-mkimage /usr/bin/grub-mklayout /usr/bin/grub-mkpasswd-pbkdf2 /usr/bin/grub-mkrelpath /usr/bin/grub-mount /usr/bin/grub-script-check /usr/sbin/grub-probe /usr/sbin/grub-setup"
|
||||
FILES="/usr/bin/grub-kbdcomp /usr/bin/grub-mkrescue /usr/bin/grub-mkstandalone /usr/sbin/grub_bios-install /usr/sbin/grub_efi_x86_64-install /usr/sbin/grub-install /usr/sbin/grub-mkconfig /usr/sbin/grub-mknetdir /usr/sbin/grub-reboot /usr/sbin/grub-set-default"
|
||||
BINARIES="/usr/bin/grub-editenv /usr/bin/grub-fstest /usr/bin/grub-menulst2cfg /usr/bin/grub-mkfont /usr/bin/grub-mkimage /usr/bin/grub-mklayout /usr/bin/grub-mkpasswd-pbkdf2 /usr/bin/grub-mkrelpath /usr/bin/grub-mount /usr/bin/grub-ntldr-img /usr/bin/grub-script-check /usr/sbin/grub-bios-setup /usr/sbin/grub-ofpathname /usr/sbin/grub-probe"
|
||||
FILES="/usr/bin/grub-kbdcomp /usr/bin/grub-mkrescue /usr/bin/grub-mkstandalone /usr/sbin/grub-install /usr/sbin/grub-mkconfig /usr/sbin/grub-mknetdir /usr/sbin/grub-reboot /usr/sbin/grub-set-default"
|
||||
|
||||
## add grub2 config file
|
||||
add_file "/boot/grub/grub.cfg"
|
||||
|
||||
## add grub-mkconfig helper scripts
|
||||
add_file "/usr/lib/grub/grub-mkconfig_lib"
|
||||
add_file "/usr/lib/grub/update-grub_lib"
|
||||
add_file "/usr/share/grub/grub-mkconfig_lib"
|
||||
add_file "/etc/default/grub"
|
||||
|
||||
for i in $(find /etc/grub.d/* ! -type d); do
|
||||
|
|
|
@ -283,7 +283,8 @@ _prepare_grub2_uefi_iso_files() {
|
|||
umount "${grub2_uefi_mp}"
|
||||
losetup --detach "${LOOP_DEVICE}"
|
||||
|
||||
cp "/usr/share/grub/unicode.pf2" "${ALLINONE}/efi/grub2/"
|
||||
mkdir -p "${ALLINONE}/efi/grub2/fonts"
|
||||
cp "/usr/share/grub/unicode.pf2" "${ALLINONE}/efi/grub2/fonts/"
|
||||
|
||||
mkdir -p "${ALLINONE}/efi/grub2/locale/"
|
||||
|
||||
|
@ -331,16 +332,20 @@ set pager="1"
|
|||
|
||||
set locale_dir="(\${archboot})/efi/grub2/locale"
|
||||
|
||||
if [ "\${grub_platform}" == "efi" ]; then
|
||||
if [ -e "\${prefix}/\${grub_cpu}-\${grub_platform}/all_video.mod" ]; then
|
||||
insmod all_video
|
||||
else
|
||||
insmod efi_gop
|
||||
insmod efi_uga
|
||||
# insmod vbe
|
||||
# insmod vga
|
||||
insmod video_bochs
|
||||
insmod video_cirrus
|
||||
fi
|
||||
|
||||
insmod font
|
||||
|
||||
if loadfont "(\${archboot})/efi/grub2/unicode.pf2" ; then
|
||||
if loadfont "(\${archboot})/efi/grub2/fonts/unicode.pf2" ; then
|
||||
insmod gfxterm
|
||||
set gfxmode="auto"
|
||||
|
||||
|
|
|
@ -368,7 +368,8 @@ _update_grub2_uefi_iso_files() {
|
|||
rm -f "${_ARCHBOOT_ISO_EXT_DIR}/efi/grub2//efi/grub2/grub_standalone_archboot.cfg" || true
|
||||
echo
|
||||
|
||||
cp "/usr/share/grub/unicode.pf2" "${_ARCHBOOT_ISO_EXT_DIR}/efi/grub2/"
|
||||
mkdir -p "${_ARCHBOOT_ISO_EXT_DIR}/efi/grub2/fonts/"
|
||||
cp "/usr/share/grub/unicode.pf2" "${_ARCHBOOT_ISO_EXT_DIR}/efi/grub2/fonts/"
|
||||
echo
|
||||
|
||||
rm -rf "${_ARCHBOOT_ISO_EXT_DIR}/efi/grub2/locale/" || true
|
||||
|
@ -418,16 +419,20 @@ set pager="1"
|
|||
|
||||
set locale_dir="(\${archboot})/efi/grub2/locale"
|
||||
|
||||
if [ "\${grub_platform}" == "efi" ]; then
|
||||
if [ -e "\${prefix}/\${grub_cpu}-\${grub_platform}/all_video.mod" ]; then
|
||||
insmod all_video
|
||||
else
|
||||
insmod efi_gop
|
||||
insmod efi_uga
|
||||
# insmod vbe
|
||||
# insmod vga
|
||||
insmod video_bochs
|
||||
insmod video_cirrus
|
||||
fi
|
||||
|
||||
insmod font
|
||||
|
||||
if loadfont "(\${archboot})/efi/grub2/unicode.pf2" ; then
|
||||
if loadfont "(\${archboot})/efi/grub2/fonts/unicode.pf2" ; then
|
||||
insmod gfxterm
|
||||
set gfxmode="auto"
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ GRUB_CMDLINE_LINUX=""
|
|||
GRUB_PRELOAD_MODULES="part_gpt part_msdos"
|
||||
|
||||
# Uncomment to enable Hidden Menu, and optionally hide the timeout count
|
||||
GRUB_HIDDEN_TIMEOUT=5
|
||||
#GRUB_HIDDEN_TIMEOUT=5
|
||||
#GRUB_HIDDEN_TIMEOUT_QUIET=true
|
||||
|
||||
# Uncomment to use basic console
|
||||
|
@ -34,8 +34,8 @@ GRUB_DISABLE_RECOVERY=true
|
|||
|
||||
# Uncomment and set to the desired menu colors. Used by normal and wallpaper
|
||||
# modes only. Entries specified as foreground/background.
|
||||
GRUB_COLOR_NORMAL="light-blue/black"
|
||||
GRUB_COLOR_HIGHLIGHT="light-cyan/blue"
|
||||
#GRUB_COLOR_NORMAL="light-blue/black"
|
||||
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"
|
||||
|
||||
# Uncomment one of them for the gfx desired, a image background or a gfxtheme
|
||||
#GRUB_BACKGROUND="/path/to/wallpaper"
|
||||
|
|
|
@ -22,7 +22,6 @@ transform="s&^&&"
|
|||
prefix="/usr"
|
||||
exec_prefix="${prefix}"
|
||||
datarootdir="/usr/share"
|
||||
locale_dir=`echo ${GRUB_PREFIX}/locale | sed ${transform}`
|
||||
grub_lang=`echo $LANG | cut -d . -f 1`
|
||||
|
||||
. "${datarootdir}/grub/grub-mkconfig_lib"
|
||||
|
@ -83,28 +82,21 @@ if [ -n "${GRUB_VIDEO_BACKEND}" ]; then
|
|||
insmod ${GRUB_VIDEO_BACKEND}
|
||||
EOF
|
||||
else
|
||||
# Insert all available backends; GRUB will use the most appropriate.
|
||||
have_video=0;
|
||||
for modinfo in $(ls "${GRUB_PREFIX}"/*/modinfo.sh) ; do
|
||||
. "${modinfo}"
|
||||
cat <<EOF
|
||||
if [ "\${grub_platform}" == "${grub_modinfo_platform}" ]; then
|
||||
EOF
|
||||
video_lst="$(echo ${modinfo} | sed 's|modinfo.sh||g')/video.lst"
|
||||
for backend in $(cat "${video_lst}"); do
|
||||
have_video=1;
|
||||
cat <<EOF
|
||||
insmod ${backend}
|
||||
EOF
|
||||
done
|
||||
# If all_video.mod isn't available load all modules available
|
||||
# with versions prior to introduction of all_video.mod
|
||||
cat <<EOF
|
||||
if [ x\$feature_all_video_module = xy ]; then
|
||||
insmod all_video
|
||||
else
|
||||
insmod efi_gop
|
||||
insmod efi_uga
|
||||
insmod ieee1275_fb
|
||||
insmod vbe
|
||||
insmod vga
|
||||
insmod video_bochs
|
||||
insmod video_cirrus
|
||||
fi
|
||||
|
||||
EOF
|
||||
done
|
||||
if [ x$have_video = x0 ]; then
|
||||
echo "true"
|
||||
fi
|
||||
fi
|
||||
cat <<EOF
|
||||
}
|
||||
|
@ -131,10 +123,6 @@ for x in ${GRUB_TERMINAL_INPUT} ${GRUB_TERMINAL_OUTPUT}; do
|
|||
done
|
||||
|
||||
if [ "x$serial" = x1 ]; then
|
||||
if ! test -e "${GRUB_PREFIX}/serial.mod" ; then
|
||||
gettext "Serial terminal not available on this platform." >&2 ; echo >&2; exit 1
|
||||
fi
|
||||
|
||||
if [ "x${GRUB_SERIAL_COMMAND}" = "x" ] ; then
|
||||
grub_warn "$(gettext "Requested serial terminal but GRUB_SERIAL_COMMAND is unspecified. Default parameters will be used.")"
|
||||
GRUB_SERIAL_COMMAND=serial
|
||||
|
@ -143,21 +131,55 @@ if [ "x$serial" = x1 ]; then
|
|||
fi
|
||||
|
||||
if [ "x$gfxterm" = x1 ]; then
|
||||
if [ -n "$GRUB_FONT" ] ; then
|
||||
# Make the font accessible
|
||||
prepare_grub_to_access_device `${grub_probe} --target=device "${GRUB_FONT_PATH}"`
|
||||
prepare_grub_to_access_device `${grub_probe} --target=device "${GRUB_FONT}"`
|
||||
cat << EOF
|
||||
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT}"` ; then
|
||||
EOF
|
||||
else
|
||||
for dir in "${pkgdatadir}" "`echo '//boot/grub' | sed "s,//*,/,g"`" /usr/share/grub ; do
|
||||
for basename in unicode unifont ascii; do
|
||||
path="${dir}/${basename}.pf2"
|
||||
if is_path_readable_by_grub "${path}" > /dev/null ; then
|
||||
font_path="${path}"
|
||||
else
|
||||
continue
|
||||
fi
|
||||
break 2
|
||||
done
|
||||
done
|
||||
if [ -n "${font_path}" ] ; then
|
||||
cat << EOF
|
||||
if [ x\$feature_default_font_path = xy ] ; then
|
||||
font=unicode
|
||||
else
|
||||
EOF
|
||||
# Make the font accessible
|
||||
prepare_grub_to_access_device `${grub_probe} --target=device "${font_path}"`
|
||||
cat << EOF
|
||||
font="`make_system_path_relative_to_its_root "${font_path}"`"
|
||||
fi
|
||||
|
||||
if loadfont \$font ; then
|
||||
EOF
|
||||
else
|
||||
cat << EOF
|
||||
if loadfont unicode ; then
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
cat << EOF
|
||||
if loadfont `make_system_path_relative_to_its_root "${GRUB_FONT_PATH}"` ; then
|
||||
set gfxmode=${GRUB_GFXMODE}
|
||||
load_video
|
||||
insmod gfxterm
|
||||
EOF
|
||||
|
||||
# Gettext variables and module
|
||||
if [ "x${LANG}" != "xC" ] && [ -d "${locale_dir}" ] ; then
|
||||
prepare_grub_to_access_device $(${grub_probe} --target=device ${locale_dir}) | sed -e "s/^/ /"
|
||||
if [ "x${LANG}" != "xC" ] ; then
|
||||
cat << EOF
|
||||
set locale_dir=(\$root)$(make_system_path_relative_to_its_root ${locale_dir})
|
||||
set locale_dir=\$prefix/locale
|
||||
set lang=${grub_lang}
|
||||
insmod gettext
|
||||
EOF
|
||||
|
@ -225,6 +247,7 @@ EOF
|
|||
|
||||
cat << EOF
|
||||
set theme=(\$root)`make_system_path_relative_to_its_root $GRUB_THEME`
|
||||
export theme
|
||||
EOF
|
||||
elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \
|
||||
&& is_path_readable_by_grub "$GRUB_BACKGROUND"; then
|
||||
|
|
|
@ -51,13 +51,20 @@ else
|
|||
LINUX_ROOT_DEVICE="/dev/disk/by-uuid/${GRUB_DEVICE_UUID}"
|
||||
fi
|
||||
|
||||
if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then
|
||||
GRUBFS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`"
|
||||
|
||||
case x"$GRUBFS" in
|
||||
xbtrfs)
|
||||
rootsubvol="`make_system_path_relative_to_its_root /`"
|
||||
rootsubvol="${rootsubvol#/}"
|
||||
if [ "x${rootsubvol}" != x ]; then
|
||||
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
|
||||
fi
|
||||
fi
|
||||
fi;;
|
||||
xzfs)
|
||||
bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
|
||||
LINUX_ROOT_DEVICE="ZFS=${RPOOL}${bootfs}"
|
||||
GRUB_CMDLINE_LINUX="boot=zfs rpool=${RPOOL} bootfs=${RPOOL}${bootfs} ${cmdline} ${GRUB_CMDLINE_LINUX}";;
|
||||
esac
|
||||
|
||||
linux_entry ()
|
||||
{
|
||||
|
@ -123,6 +130,7 @@ EOF
|
|||
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
|
||||
EOF
|
||||
if test -n "${initrd}" ; then
|
||||
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
|
||||
message="$(gettext_printf "Loading initial ramdisk ...")"
|
||||
cat << EOF
|
||||
echo '$message'
|
||||
|
@ -190,7 +198,7 @@ while [ "x$list" != "x" ] ; do
|
|||
if test -n "${initrd}" ; then
|
||||
gettext_printf "Found initrd image: %s\n" "${dirname}/${initrd}" >&2
|
||||
elif test -z "${initramfs}" ; then
|
||||
# "UUID=" magic is parsed by initrd or initramfs. Since there's
|
||||
# "UUID=" and "ZFS=" magic is parsed by initrd or initramfs. Since there's
|
||||
# no initrd or builtin initramfs, it can't work here.
|
||||
linux_root_device_thisversion=${GRUB_DEVICE}
|
||||
fi
|
||||
|
|
|
@ -59,13 +59,20 @@ if [ "${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}" ]; then
|
|||
GRUB_CMDLINE_LINUX_DEFAULT="${GRUB_CMDLINE_LINUX_XEN_REPLACE_DEFAULT}"
|
||||
fi
|
||||
|
||||
if [ "x`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`" = xbtrfs ]; then
|
||||
GRUBFS="`${grub_probe} --device ${GRUB_DEVICE} --target=fs 2>/dev/null || true`"
|
||||
|
||||
case x"$GRUBFS" in
|
||||
xbtrfs)
|
||||
rootsubvol="`make_system_path_relative_to_its_root /`"
|
||||
rootsubvol="${rootsubvol#/}"
|
||||
if [ "x${rootsubvol}" != x ]; then
|
||||
GRUB_CMDLINE_LINUX="rootflags=subvol=${rootsubvol} ${GRUB_CMDLINE_LINUX}"
|
||||
fi
|
||||
fi
|
||||
fi;;
|
||||
xzfs)
|
||||
bootfs="`make_system_path_relative_to_its_root / | sed -e "s,@$,,"`"
|
||||
LINUX_ROOT_DEVICE="ZFS=${RPOOL}${bootfs}"
|
||||
GRUB_CMDLINE_LINUX="boot=zfs rpool=${RPOOL} bootfs=${RPOOL}${bootfs} ${cmdline} ${GRUB_CMDLINE_LINUX}";;
|
||||
esac
|
||||
|
||||
linux_entry ()
|
||||
{
|
||||
|
@ -98,6 +105,7 @@ linux_entry ()
|
|||
module ${rel_dirname}/${basename} placeholder root=${linux_root_device_thisversion} ro ${args}
|
||||
EOF
|
||||
if test -n "${initrd}" ; then
|
||||
# TRANSLATORS: ramdisk isn't identifier. Should be translated.
|
||||
message="$(gettext_printf "Loading initial ramdisk ...")"
|
||||
cat << EOF
|
||||
echo '$message'
|
||||
|
|
|
@ -3950,14 +3950,11 @@ EOF
|
|||
|
||||
cat << EOF >> "${DESTDIR}/${GRUB2_PREFIX_DIR}/grub.cfg"
|
||||
|
||||
if [ "\${grub_platform}" == "efi" ]; then
|
||||
if [ -e "\${prefix}/\${grub_cpu}-\${grub_platform}/all_video.mod" ]; then
|
||||
insmod all_video
|
||||
else
|
||||
insmod efi_gop
|
||||
insmod efi_uga
|
||||
insmod video_bochs
|
||||
insmod video_cirrus
|
||||
fi
|
||||
|
||||
if [ "\${grub_platform}" == "pc" ]; then
|
||||
insmod vbe
|
||||
insmod vga
|
||||
insmod video_bochs
|
||||
|
@ -3976,7 +3973,7 @@ else
|
|||
set _fontfile="(\${root_part})/usr/share/grub/unicode.pf2"
|
||||
else
|
||||
if [ -e "\${prefix}/unicode.pf2" ]; then
|
||||
set _fontfile="\${prefix}/unicode.pf2"
|
||||
set _fontfile="\${prefix}/fonts/unicode.pf2"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
@ -4269,7 +4266,15 @@ dogrub2_bios() {
|
|||
# freeze and unfreeze xfs filesystems to enable grub2 installation on xfs filesystems
|
||||
freeze_xfs
|
||||
chroot_mount
|
||||
chroot "${DESTDIR}" /usr/sbin/grub_bios-install --boot-directory="/boot" --no-floppy --recheck "${bootdev}" >> /tmp/grub2.log
|
||||
|
||||
chroot "${DESTDIR}" "/usr/sbin/grub-install" \
|
||||
--directory="/usr/lib/grub/i386-pc" \
|
||||
--target="i386-pc" \
|
||||
--boot-directory="/boot" \
|
||||
--no-floppy \
|
||||
--recheck \
|
||||
"${bootdev}" >> "/tmp/grub2_bios.log"
|
||||
|
||||
chroot_umount
|
||||
cat /tmp/grub2.log > "${LOG}"
|
||||
|
||||
|
@ -4410,11 +4415,14 @@ dogrub2_uefi_common() {
|
|||
|
||||
chroot_mount
|
||||
|
||||
chroot "${DESTDIR}" "/usr/sbin/grub_efi_${UEFI_ARCH}-install" \
|
||||
chroot "${DESTDIR}" "/usr/sbin/grub-install" \
|
||||
--directory="/usr/lib/grub/${UEFI_ARCH}-efi" \
|
||||
--target="${UEFI_ARCH}-efi" \
|
||||
--root-directory="/boot/efi" \
|
||||
--bootloader-id="arch_grub" \
|
||||
--boot-directory="/boot" \
|
||||
--no-floppy --recheck >> "/tmp/grub2_${UEFI_ARCH}_uefi.log"
|
||||
--no-floppy \
|
||||
--recheck >> "/tmp/grub2_uefi_${UEFI_ARCH}.log"
|
||||
|
||||
chroot_umount
|
||||
|
||||
|
@ -4483,9 +4491,9 @@ EOF
|
|||
|
||||
[[ -e "${DESTDIR}/boot/grub/grub.cfg.save" ]] && mv "${DESTDIR}/boot/grub/grub.cfg.save" "${DESTDIR}/boot/grub/grub.cfg"
|
||||
|
||||
cat "/tmp/grub2_${UEFI_ARCH}_uefi.log" > "${LOG}"
|
||||
cat "/tmp/grub2_uefi_${UEFI_ARCH}.log" > "${LOG}"
|
||||
|
||||
if ! [[ -s "/tmp/grub2_${UEFI_ARCH}_uefi.log" ]]; then
|
||||
if ! [[ -s "/tmp/grub2_uefi_${UEFI_ARCH}.log" ]]; then
|
||||
DIALOG --msgbox "Error installing GRUB2.\n\nYou probably need to install it manually by chrooting into ${DESTDIR}.\nDon't forget to bind /dev, /sys and /proc into ${DESTDIR} before chrooting." 0 0
|
||||
return 1
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue