Commit f932630e authored by anonym's avatar anonym
Browse files

Merge remote-tracking branch 'origin/feature/8471-32-bit-UEFI' into devel

Fix-committed: #8471
parents 0525d220 7c38f9fc
#! /bin/sh
# Some of this file was adapted from the Debian Installer's
# build/util/efi-image, which is:
#
# Copyright (C) 2010, 2011 Canonical Ltd.
# Author: Colin Watson <cjwatson@ubuntu.com>
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
set -e
set -x
platform="i386-efi"
outdir="binary/EFI/BOOT/grub/$platform"
efi_name="ia32"
grub_cpmodules () {
if [ -z "$1" ] || [ -z "$2" ]; then
echo "usage: $0 OUTPUT-DIRECTORY GRUB-PLATFORM"
return 1
fi
outdir="$1"
platform="$2"
# Copy over GRUB modules, except for those already built in.
cp -a "chroot/usr/lib/grub/$platform"/*.lst "$outdir/"
for x in "chroot/usr/lib/grub/$platform"/*.mod; do
# Some of these exclusions are based on knowledge of module
# dependencies.
case $(basename "$x" .mod) in
configfile|search|search_fs_file|search_fs_uuid|search_label|tar|part_gpt|linux|gzio)
# included in boot image
;;
affs|afs|afs_be|befs|befs_be|minix|nilfs2|sfs|zfs|zfsinfo)
# unnecessary filesystem modules
;;
example_functional_test|functional_test|hello)
# other cruft
;;
*)
cp -a "$x" "$outdir/"
;;
esac
done
}
# Including common functions
. "${LB_BASE:-/usr/share/live/build}"/scripts/build.sh
# Setting static variables
DESCRIPTION="$(Echo 'including GRUB EFI for ia32 in the ISO filesystem')"
HELP=""
USAGE="${PROGRAM}"
# Reading configuration files
Read_conffiles config/all config/bootstrap config/common config/binary
Set_defaults
# Safeguards
[ "${LB_ARCHITECTURE}" = "i386" ] || exit 0
# Seems like we'll have work to do
Echo_message 'including GRUB EFI for ia32 in the ISO filesystem'
# Build the core image
Chroot chroot grub-mkimage -O "$platform" \
-o "/tmp/boot$efi_name.efi" -p "/efi/boot/grub" \
search configfile normal tar fat part_gpt linux \
gzio
mv "chroot/tmp/boot$efi_name.efi" "binary/EFI/BOOT/boot$efi_name.efi"
mkdir -p "$outdir"
grub_cpmodules "$outdir" "$platform"
function load_video {
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
}
set linux_gfx_mode=
export linux_gfx_mode
load_video
insmod syslinuxcfg
insmod cpuid
echo "Loading syslinux configuration..."
syslinux_configfile /efi/boot/syslinux.cfg
......@@ -124,6 +124,7 @@ gobby-0.5
## breaks lb because of desktop-base.postinst (see Debian bug #467620)
#if ARCHITECTURE i386 amd64
# grub
grub-efi-ia32
#endif
gstreamer0.10-ffmpeg
gstreamer0.10-plugins-base
......
......@@ -19,11 +19,6 @@ Testing results
Ideas for future work
=====================
32-bit UEFI
-----------
See [[blueprint/UEFI/32-bit]].
Other ideas
-----------
......
......@@ -14,6 +14,7 @@ Goals
that only supports UEFI boot for GPT devices (e.g. ThinkPad X220)
* Legacy BIOS boot support should be left unaffected (modulo a tiny
amount of really crazy firmware bugs, probably)
* minimal support for 32-bit UEFI boot
<a id="non-goals"></a>
......@@ -30,8 +31,6 @@ Non-goals
in Legacy BIOS boot mode from hybrid ISO cat'd on a USB device.
If the firmware supports it, this can be done on the same computer;
else, from another computer.
* 32-bit UEFI boot: this hardware is rare; we have [[!tails_ticket
8471 desc="plans to reconsider this decision"]], though.
* [[blueprint/UEFI Secure boot]] is not part of this plan.
Picking technical solutions that leave room for it would be a great
bonus, though.
......@@ -300,6 +299,56 @@ in the `EFI/BOOT` directory.
A backport of syslinux 6.x is installed from our APT repository.
32-bit UEFI
===========
Chosen path
-----------
A 32-bit UEFI GRUB2 bootloader is installed in the fallback location.
It is configured to load our existing syslinux configuration, and
to convert it on the fly to GRUB's format:
* [[!tails_gitweb config/binary_local-hooks/50-grub-efi-ia32]]
* [[!tails_gitweb config/binary_local-includes/EFI/BOOT/grub/grub.cfg]]]
Support for `{vesa,}menu.c32` was added in GRUB upstream, but didn't
make it into Debian yet as of 2.02~beta2-22, so we have backported
these patches and are shipping a custom GRUB2 package. Note that this
source package doesn't build on Wheezy, so the binary package we're
including was built with pbuilder in a Debian sid chroot.
Discarded implementation ideas
------------------------------
### syslinux
It's currently
[impossible](http://www.syslinux.org/archives/2015-May/023469.html)
with upstream syslinux to have both 32-bit and 64-bit UEFI boot
loaders installed in the fallback path, without forcing the user to
manually choose between them, which would degrade UX substantially for
users who have 64-bit UEFI working fine already.
Once the proposed patches have been merged upstream, we may want to
replace our current implementation with a syslinux-based one, for
greater UX consistency.
### 32-bit GRUB2 EFI chainloading 32-bit syslinux EFI
* syslinux 32-bit EFI installed in `EFI/TAILS32`
* GRUB 32-bit EFI installed in `EFI/BOOT/bootia32.efi`
=> did not manage to chainload 32-bit syslinux EFI from GRUB.
On Tails/Jessie (GRUB 2.02~beta2-22), I get `error: unknown error.`
after typing `boot`. This likely comes from
`grub-core/loader/efi/chainloader.c`.
### 32-bit GRUB2 EFI with native configuration
This requires to write/generate and maintain a GRUB2 configuration,
either semi-automatically (e.g. with `grub-syslinux2cfg`) or by hand.
Future work
===========
......
......@@ -192,7 +192,7 @@ Mac
* Some Mac need [rEFInd](http://sourceforge.net/projects/refind/)
installed to boot Tails from a USB stick.
* Any Mac with 32-bit EFI won't succeed in booting Tails USB stick
* Any Mac with 32-bit EFI may not succeed in booting Tails USB stick
created by Tails Installer. You can check if a given Mac is 32-bit
or 64-bit EFI on that list:
<http://www.everymac.com/mac-answers/snow-leopard-mac-os-x-faq/mac-os-x-snow-leopard-64-bit-macs-64-bit-efi-boot-in-64-bit-mode.html>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment