Improve support for 32-bit EFI firmware in ISOs and installer
mklive: - include support for booting both 32- and 64-bit UEFI firmware with 32- and 64-bit images. - require grub packages for both firmware bitness types (build-x86-images) Installer: - include support for installing both 32- and 64-bit UEFI grub loaders - detect UEFI platform (firmware) bitness at install time Closes: #102 [via git-merge-pr]
This commit is contained in:
parent
fe57bb4b06
commit
a4b3dd36c9
@ -25,10 +25,7 @@ readonly KDE_IMG=void-live-${ARCH}-${DATE}-kde.iso
|
|||||||
readonly LXDE_IMG=void-live-${ARCH}-${DATE}-lxde.iso
|
readonly LXDE_IMG=void-live-${ARCH}-${DATE}-lxde.iso
|
||||||
readonly LXQT_IMG=void-live-${ARCH}-${DATE}-lxqt.iso
|
readonly LXQT_IMG=void-live-${ARCH}-${DATE}-lxqt.iso
|
||||||
|
|
||||||
case "$ARCH" in
|
readonly GRUB="grub-i386-efi grub-x86_64-efi"
|
||||||
i686*) GRUB="grub";;
|
|
||||||
x86_64*) GRUB="grub-x86_64-efi";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
readonly BASE_PKGS="dialog cryptsetup lvm2 mdadm $GRUB"
|
readonly BASE_PKGS="dialog cryptsetup lvm2 mdadm $GRUB"
|
||||||
readonly X_PKGS="$BASE_PKGS xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf alsa-plugins-pulseaudio"
|
readonly X_PKGS="$BASE_PKGS xorg-minimal xorg-input-drivers xorg-video-drivers setxkbmap xauth font-misc-misc terminus-font dejavu-fonts-ttf alsa-plugins-pulseaudio"
|
||||||
|
@ -60,6 +60,12 @@ fi
|
|||||||
# Detect if this is an EFI system.
|
# Detect if this is an EFI system.
|
||||||
if [ -e /sys/firmware/efi/systab ]; then
|
if [ -e /sys/firmware/efi/systab ]; then
|
||||||
EFI_SYSTEM=1
|
EFI_SYSTEM=1
|
||||||
|
EFI_FW_BITS=$(cat /sys/firmware/efi/fw_platform_size)
|
||||||
|
if [ $EFI_FW_BITS -eq 32 ]; then
|
||||||
|
EFI_TARGET=i386-efi
|
||||||
|
else
|
||||||
|
EFI_TARGET=x86_64-efi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# dialog colors
|
# dialog colors
|
||||||
@ -768,7 +774,7 @@ set_bootloader() {
|
|||||||
|
|
||||||
# Check if it's an EFI system via efivars module.
|
# Check if it's an EFI system via efivars module.
|
||||||
if [ -n "$EFI_SYSTEM" ]; then
|
if [ -n "$EFI_SYSTEM" ]; then
|
||||||
grub_args="--target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=void_grub --recheck"
|
grub_args="--target=$EFI_TARGET --efi-directory=/boot/efi --bootloader-id=void_grub --recheck"
|
||||||
fi
|
fi
|
||||||
echo "Running grub-install $grub_args $dev..." >$LOG
|
echo "Running grub-install $grub_args $dev..." >$LOG
|
||||||
chroot $TARGETDIR grub-install $grub_args $dev >$LOG 2>&1
|
chroot $TARGETDIR grub-install $grub_args $dev >$LOG 2>&1
|
||||||
@ -1137,7 +1143,11 @@ install_packages() {
|
|||||||
local _grub= _syspkg=
|
local _grub= _syspkg=
|
||||||
|
|
||||||
if [ -n "$EFI_SYSTEM" ]; then
|
if [ -n "$EFI_SYSTEM" ]; then
|
||||||
_grub="grub-x86_64-efi"
|
if [ $EFI_FW_BITS -eq 32 ]; then
|
||||||
|
_grub="grub-i386-efi"
|
||||||
|
else
|
||||||
|
_grub="grub-x86_64-efi"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
_grub="grub"
|
_grub="grub"
|
||||||
fi
|
fi
|
||||||
|
50
mklive.sh.in
50
mklive.sh.in
@ -210,7 +210,7 @@ generate_grub_efi_boot() {
|
|||||||
modprobe -q loop || :
|
modprobe -q loop || :
|
||||||
|
|
||||||
# Create EFI vfat image.
|
# Create EFI vfat image.
|
||||||
truncate -s 16M $GRUB_DIR/efiboot.img >/dev/null 2>&1
|
truncate -s 32M $GRUB_DIR/efiboot.img >/dev/null 2>&1
|
||||||
mkfs.vfat -F12 -S 512 -n "grub_uefi" "$GRUB_DIR/efiboot.img" >/dev/null 2>&1
|
mkfs.vfat -F12 -S 512 -n "grub_uefi" "$GRUB_DIR/efiboot.img" >/dev/null 2>&1
|
||||||
|
|
||||||
GRUB_EFI_TMPDIR="$(mktemp --tmpdir=$HOME -d)"
|
GRUB_EFI_TMPDIR="$(mktemp --tmpdir=$HOME -d)"
|
||||||
@ -218,33 +218,29 @@ generate_grub_efi_boot() {
|
|||||||
mount -o rw,flush -t vfat "${LOOP_DEVICE}" "${GRUB_EFI_TMPDIR}" >/dev/null 2>&1
|
mount -o rw,flush -t vfat "${LOOP_DEVICE}" "${GRUB_EFI_TMPDIR}" >/dev/null 2>&1
|
||||||
|
|
||||||
cp -a $IMAGEDIR/boot $VOIDHOSTDIR
|
cp -a $IMAGEDIR/boot $VOIDHOSTDIR
|
||||||
if [ $BASE_ARCH = "i686" ]; then
|
xbps-uchroot $VOIDHOSTDIR grub-mkstandalone -- \
|
||||||
xbps-uchroot $VOIDHOSTDIR grub-mkstandalone -- \
|
--directory="/usr/lib/grub/i386-efi" \
|
||||||
--directory="/usr/lib/grub/i386-efi" \
|
--format="i386-efi" \
|
||||||
--format="i386-efi" \
|
--output="/tmp/bootia32.efi" \
|
||||||
--output="/tmp/bootia32.efi" \
|
"boot/grub/grub.cfg"
|
||||||
"boot/grub/grub.cfg"
|
if [ $? -ne 0 ]; then
|
||||||
if [ $? -ne 0 ]; then
|
umount "$GRUB_EFI_TMPDIR"
|
||||||
umount "$GRUB_EFI_TMPDIR"
|
losetup --detach "${LOOP_DEVICE}"
|
||||||
losetup --detach "${LOOP_DEVICE}"
|
die "Failed to generate EFI loader"
|
||||||
die "Failed to generate EFI loader"
|
|
||||||
fi
|
|
||||||
mkdir -p ${GRUB_EFI_TMPDIR}/EFI/BOOT
|
|
||||||
cp -f $VOIDHOSTDIR/tmp/bootia32.efi ${GRUB_EFI_TMPDIR}/EFI/BOOT/BOOTIA32.EFI
|
|
||||||
else
|
|
||||||
xbps-uchroot $VOIDHOSTDIR grub-mkstandalone -- \
|
|
||||||
--directory="/usr/lib/grub/x86_64-efi" \
|
|
||||||
--format="x86_64-efi" \
|
|
||||||
--output="/tmp/bootx64.efi" \
|
|
||||||
"boot/grub/grub.cfg"
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
umount "$GRUB_EFI_TMPDIR"
|
|
||||||
losetup --detach "${LOOP_DEVICE}"
|
|
||||||
die "Failed to generate EFI loader"
|
|
||||||
fi
|
|
||||||
mkdir -p ${GRUB_EFI_TMPDIR}/EFI/BOOT
|
|
||||||
cp -f $VOIDHOSTDIR/tmp/bootx64.efi ${GRUB_EFI_TMPDIR}/EFI/BOOT/BOOTX64.EFI
|
|
||||||
fi
|
fi
|
||||||
|
mkdir -p ${GRUB_EFI_TMPDIR}/EFI/BOOT
|
||||||
|
cp -f $VOIDHOSTDIR/tmp/bootia32.efi ${GRUB_EFI_TMPDIR}/EFI/BOOT/BOOTIA32.EFI
|
||||||
|
xbps-uchroot $VOIDHOSTDIR grub-mkstandalone -- \
|
||||||
|
--directory="/usr/lib/grub/x86_64-efi" \
|
||||||
|
--format="x86_64-efi" \
|
||||||
|
--output="/tmp/bootx64.efi" \
|
||||||
|
"boot/grub/grub.cfg"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
umount "$GRUB_EFI_TMPDIR"
|
||||||
|
losetup --detach "${LOOP_DEVICE}"
|
||||||
|
die "Failed to generate EFI loader"
|
||||||
|
fi
|
||||||
|
cp -f $VOIDHOSTDIR/tmp/bootx64.efi ${GRUB_EFI_TMPDIR}/EFI/BOOT/BOOTX64.EFI
|
||||||
umount "$GRUB_EFI_TMPDIR"
|
umount "$GRUB_EFI_TMPDIR"
|
||||||
losetup --detach "${LOOP_DEVICE}"
|
losetup --detach "${LOOP_DEVICE}"
|
||||||
rm -rf $GRUB_EFI_TMPDIR
|
rm -rf $GRUB_EFI_TMPDIR
|
||||||
|
Loading…
x
Reference in New Issue
Block a user