Add experimental support for arm64 booting via UEFI

This commit is contained in:
Steve McIntyre 2014-09-27 02:40:05 +01:00
parent 6d7bcaf0bb
commit e94ad0c760
3 changed files with 140 additions and 5 deletions

3
debian/changelog vendored
View File

@ -5,14 +5,13 @@ debian-cd (3.1.16) UNRELEASED; urgency=medium
* Fix up Gnome CD set installing xfce - logic in boot menu creation was
broken. Closes: #756774
* Update kernel flavours for armhf to just use armmp and armmp-lpae
* Add trivial initial (non-booting) support for arm64, by copying and
extending armhf for now.
* Update arch lists to match what's in Jessie: remove sparc and ia64,
add arm64.
* Add Debian-mate and Debian-cinnamon top-level tasks for new CD desktop
options
* Extend FORCE_SID_TASKSEL usage in update_tasks to also affect desktop
choice algorithm
* Add experimental support for arm64 booting via UEFI
[ Philipp Hahn ]
* Fix word-splitting regexp in generate_di_list. Closes: #758512.

View File

@ -23,8 +23,6 @@ if [ "$DI_WWW_HOME" = "default" ];then
DI_WWW_HOME="http://d-i.debian.org/daily-images/armel/daily"
elif [ "$ARCH" = armhf ]; then
DI_WWW_HOME="http://d-i.debian.org/daily-images/armhf/daily"
elif [ "$ARCH" = arm64 ]; then
DI_WWW_HOME="http://d-i.debian.org/daily-images/arm64/daily"
else
echo "$0: unknown arch $ARCH; abort"
exit 1

View File

@ -1,2 +1,140 @@
#!/bin/bash
. $BASEDIR/tools/boot/$DI_CODENAME/boot-arm
# This script gets sourced from boot-i386 and boot-amd64.
#
# Do install stuff for x86, including making bootable CDs
# Works with debian-installer
#
# $1 is the CD number
# $2 is the temporary CD build dir
. $BASEDIR/tools/boot/$DI_CODENAME/common.sh
set -e
#set -x
N=$1
CDDIR=$2
BOOTDIR=
INSTALLDIR="install.a64"
if [ "$DI_WWW_HOME" = "default" ];then
DI_WWW_HOME="http://d-i.debian.org/daily-images/arm64/daily"
DI_WWW_HOME="https://people.debian.org/~ijc/tmp/arm64-di-cdrom"
try_di_image_cache
fi
case "$MKISOFS" in
*xorriso*)
XORRISO_VER=$(xorriso_version)
;;
*)
echo "ERROR: debian-cd depends on xorriso for making arm64 bootable CDs."
exit 1;
;;
esac
cd $CDDIR/..
# This script is called with $1 (now $N) as the CD to make bootable.
# N may be in the form "n" or "n_NONUS" There may be more than 4
# disks...support extras.
# Strip NONUS part of disk number
# NN will be 1...N so it can be used as an index
NN=`echo $N | sed -e 's/_NONUS//'`
# Exit if this is not a boot disk
if [ $NN != 1 ] ; then exit 0; fi
BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/debian-cd_info.tar.gz"
# Download boot images.
for image in $BOOT_IMAGES; do
if [ ! -e "$image" ]; then
dir=$(dirname $image)
mkdir -p $dir
if [ -n "$LOCAL" -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then
cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image"
elif [ ! "$DI_WWW_HOME" ];then
if [ ! "$DI_DIR" ];then
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
fi
cp "$DI_DIR/$image" "$image"
else
wget "$DI_WWW_HOME/$image" -O "$image"
fi
fi
done
# Boot setup including config and help files comes from d-i.
mkdir -pv $PWD/boot$N
cat cdrom/debian-cd_info.tar.gz | (cd boot$N/; tar zx)
# Common mkisofs options when creating CDs
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J -joliet-long"
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-cache-inodes"
# We explicitly put the boot bits in boot$N (as opposed to CD$N) and
# list it first on the eventual mkisofs command line. That means
# they'll be placed nearer the front of the eventual image; some older
# BIOSes apparently have a limitation on what they'll boot here.
add_mkisofs_opt $CDDIR/../$N.mkisofs_dirs "boot$N"
if [ -d boot$N/grub ] ; then
echo " Adding EFI boot code for $ARCH on CD$N"
# Move GRUB files to the right place.
mkdir -p $CDDIR/efi/boot
mcopy -i boot$N/grub/efi.img ::efi/boot/bootaa64.efi $CDDIR/efi/boot/bootaa64.efi
mkdir -p $CDDIR/boot/grub
mv boot$N/grub/* $CDDIR/boot/grub/
rmdir boot$N/grub
# TODO: setup grub.cfg
# Create grub menu entries to match the isolinux ones
sed -i '/^menuentry/Q' $CDDIR/boot/grub/grub.cfg;
# $BASEDIR/tools/boot/$DI_CODENAME/parse_isolinux \
# boot$N/isolinux $CDDIR $BASEDIR/data/$DI_CODENAME/grub-theme.in "$DISKINFO_DISTRO" "$DEBIAN_KERNEL" "$DEBVERSION" \
# >> $CDDIR/boot/grub/grub.cfg
# Stuff the EFI boot files into a FAT filesystem, making it as
# small as possible. 24KiB headroom seems to be enough;
# (x+31)/32*32 rounds up to multiple of 32.
# This is the same as in efi-image, but we need to redo it here in
# the case of a multi-arch amd64/i386 image
size=0
for file in $CDDIR/efi/boot/boot*.efi; do
size=$(($size + $(stat -c %s "$file")))
done
blocks=$((($size / 1024 + 55) / 32 * 32 ))
rm -f $CDDIR/boot/grub/efi.img
mkfs.msdos -C "$CDDIR/boot/grub/efi.img" $blocks >/dev/null
mmd -i "$CDDIR/boot/grub/efi.img" ::efi
mmd -i "$CDDIR/boot/grub/efi.img" ::efi/boot
mcopy -i "$CDDIR/boot/grub/efi.img" $CDDIR/efi/boot/boot*.efi \
"::efi/boot"
# Ugh - different code here depending on the version of xorriso we've got
if [ $XORRISO_VER -le 10202 ] ; then
# 1.2.2 shipping in Wheezy
echo "Using older EFI command line for xorriso $XORRISO_VER"
# Tell xorriso to create a secondary ElTorito boot record for the
# EFI bootloader
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-eltorito-alt-boot --efi-boot boot/grub/efi.img"
# Add the efi image as a FAT partition too, so our CD image will
# also boot on a USB key (like isohybrid, just implemented
# differently)
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-append_partition 2 0x01 $CDDIR/boot/grub/efi.img"
elif [ $XORRISO_VER -gt 10202 ] ; then
echo "Using newer EFI support in xorriso $XORRISO_VER"
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-eltorito-alt-boot -e boot/grub/efi.img -no-emul-boot"
fi
else
echo " No EFI boot code for $ARCH on CD$N"
fi
# th,th, thats all