Comment 7 for bug 1369187

Revision history for this message
Jack Howarth (jwhowarth) wrote :

I have successfully installed Debian Jessie using the multi-arch netinst iso

https://cdimage.debian.org/debian-cd/current/multi-arch/iso-cd/debian-8.6.0-amd64-i386-netinst.iso

which leverages the new mixed mode support described in https://wiki.debian.org/UEFI

Support for mixed-mode systems: 64-bit system with 32-bit UEFI
Some systems have been released containing 64-bit Intel Atom CPUs (such as the Bay Trail), but unfortunately use 32-bit UEFI firmware with no BIOS compatibility mode. Using the 32-bit UEFI x86 support, an i386 installation should be possible on these machines but it won't make the most of the 64-bit hardware.

Debian Jessie (8.0) was the first Linux distribution to include full support for mixed-mode UEFI installation on these machines. The multi-arch installation media (available in netinst and DVD form) include the UEFI boot loaders necessary for both i386 and amd64 boot. By selecting "64-bit install" from the initial boot menu, debian-installer will install a 64-bit (amd64) version of Debian. The system will automatically detect that the underlying UEFI firmware is 32-bit and will install the appropriate version of grub-efi to work with it.

The resulting Debian Jessie install was transitioned to Ubuntu 16.10 by...

1) replacing the /etc directory with a copy from a fresh Ubuntu 16.10 x86_64 install while retaining copies of the fstab, shadow and passwd files generated by the Debian Jessie installation.
2) Using

apt-get -f update
apt-get clean
for pkg in `dpkg --get-selections | awk '{print $1}' | egrep -v '(dpkg|apt|mysql|mythtv)'` ; do apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" --force-yes install --reinstall $pkg ; done

At this point, the only problem remaining was that the boot selector doesn't detect the Ubuntu installation. I solved this by reformatting the /boot/efi partition as HFS+ with journaling disabled so that Linux could access it for writing. I then used the following script to generate the appropriate boot.ef in /tmp, depending on whether the machine has EFI-32 or EFI-64 firmware, and then installed in /boot/efi/System/Library/CoreServices along side the SystemVersions.plist installed from the current mactel-boot package files and a /boot/efi/mach_kernel file. Lastly the script blesses the newly installed boot.efi.

#!/bin/bash -ex
# update-efi-booter script
pushd /
grub-mkconfig -o /boot/grub/grub.cfg
efi_arch="x86_64"
coreservices_dir="/boot/efi/System/Library/CoreServices/"
boot_efi_dir="/boot/efi/"
mactel_boot_dir="/usr/share/mactel-boot/"
mactel_boot_logo_dir="/usr/share/mactel-boot-logo/"
grep -q "32" /sys/firmware/efi/fw_platform_size && efi_arch="i386"
echo 'Creating boot.efi for '$efi_arch
case "$efi_arch" in
x86_64)
  grub-mkstandalone -o /tmp/boot.efi -d usr/lib/grub/x86_64-efi -O x86_64-efi --compress=xz boot/grub/grub.cfg
  ;;
i386)
  grub-mkstandalone -o /tmp/boot.efi -d usr/lib/grub/i386-efi -O i386-efi --compress=xz boot/grub/grub.cfg
  ;;
esac
echo 'Installing boot.efi for '$efi_arch
mount -t hfsplus -o force,remount,rw $boot_efi_dir && sleep 1
test ! -d $coreservices_dir && install -d $coreservices_dir
install -m 644 /tmp/boot.efi $coreservices_dir
test ! -f $boot_efi_dir/.VolumeIcon.icns && -f $mactel_boot_logo_dir/ubuntu.icons && install -m 644 $mactel_boot_logo_dir/ubuntu.icns $boo
t_efi_dir/.VolumeIcon.icns
test ! -f $boot_efi_dir/mach_kernel && echo "This file is required for booting" > $boot_efi_dir/mach_kernel
test ! -f $coreservices_dir/SystemVersion.plist && -f $mactel_boot_dir/SysytemVersion.plist && install -m 644 $mactel_boot_dir/SystemVersi
on.plist $coreservices_dir
hfs-bless $coreservices_dir/boot.efi && sleep 1 && mount -t hfsplus -o remount $boot_efi_dir