diff --git a/build-x86-images.sh.in b/build-x86-images.sh.in index 7bd84b1..e8d912a 100644 --- a/build-x86-images.sh.in +++ b/build-x86-images.sh.in @@ -25,10 +25,7 @@ readonly KDE_IMG=void-live-${ARCH}-${DATE}-kde.iso readonly LXDE_IMG=void-live-${ARCH}-${DATE}-lxde.iso readonly LXQT_IMG=void-live-${ARCH}-${DATE}-lxqt.iso -case "$ARCH" in - i686*) GRUB="grub";; - x86_64*) GRUB="grub-x86_64-efi";; -esac +readonly GRUB="grub-i386-efi grub-x86_64-efi" 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" diff --git a/installer.sh.in b/installer.sh.in index 3da5201..2458378 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -60,6 +60,12 @@ fi # Detect if this is an EFI system. if [ -e /sys/firmware/efi/systab ]; then 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 # dialog colors @@ -768,7 +774,7 @@ set_bootloader() { # Check if it's an EFI system via efivars module. 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 echo "Running grub-install $grub_args $dev..." >$LOG chroot $TARGETDIR grub-install $grub_args $dev >$LOG 2>&1 @@ -1137,7 +1143,11 @@ install_packages() { local _grub= _syspkg= 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 _grub="grub" fi diff --git a/mklive.sh.in b/mklive.sh.in index 9071f0f..5b5df67 100644 --- a/mklive.sh.in +++ b/mklive.sh.in @@ -210,7 +210,7 @@ generate_grub_efi_boot() { modprobe -q loop || : # 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 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 cp -a $IMAGEDIR/boot $VOIDHOSTDIR - if [ $BASE_ARCH = "i686" ]; then - xbps-uchroot $VOIDHOSTDIR grub-mkstandalone -- \ - --directory="/usr/lib/grub/i386-efi" \ - --format="i386-efi" \ - --output="/tmp/bootia32.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/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 + xbps-uchroot $VOIDHOSTDIR grub-mkstandalone -- \ + --directory="/usr/lib/grub/i386-efi" \ + --format="i386-efi" \ + --output="/tmp/bootia32.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/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" losetup --detach "${LOOP_DEVICE}" rm -rf $GRUB_EFI_TMPDIR