2014-09-21 16:57:59 +00:00
|
|
|
#!/bin/bash
|
2014-09-27 01:40:05 +00:00
|
|
|
|
2014-10-04 15:21:51 +00:00
|
|
|
# Based on boot-x86
|
2014-09-27 01:40:05 +00:00
|
|
|
#
|
2014-10-05 08:14:24 +00:00
|
|
|
# Do install stuff for arm64, including making bootable CDs
|
2014-09-27 01:40:05 +00:00
|
|
|
# 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"
|
|
|
|
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
|
|
|
|
|
2014-11-05 12:58:04 -01:00
|
|
|
mkdir -p $CDDIR/$INSTALLDIR
|
|
|
|
cp -lf cdrom/vmlinuz $CDDIR/$INSTALLDIR/
|
|
|
|
cp -lf cdrom/initrd.gz $CDDIR/$INSTALLDIR/
|
|
|
|
|
2014-09-27 01:40:05 +00:00
|
|
|
# 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"
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
# 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
|
2014-10-04 15:20:37 +00:00
|
|
|
# the case of a multi-arch image
|
2014-09-27 01:40:05 +00:00
|
|
|
|
|
|
|
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
|
2015-01-31 09:55:23 -01:00
|
|
|
echo "ERROR: debian-cd depends on xorriso > 1.2.2 for making arm64 bootable CDs."
|
|
|
|
exit 1;
|
2014-09-27 01:40:05 +00:00
|
|
|
elif [ $XORRISO_VER -gt 10202 ] ; then
|
|
|
|
echo "Using newer EFI support in xorriso $XORRISO_VER"
|
2015-01-31 09:55:23 -01:00
|
|
|
|
|
|
|
# Location of the EFI boot image, and don't emulate a floppy or HD
|
|
|
|
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-e boot/grub/efi.img -no-emul-boot"
|
2015-04-16 14:24:01 +00:00
|
|
|
|
|
|
|
# Add an *extra* partition on the end for the EFI bits
|
|
|
|
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-append_partition 2 0xef $CDDIR/boot/grub/efi.img"
|
|
|
|
|
|
|
|
# And force alignment
|
|
|
|
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-partition_cyl_align all"
|
2014-09-27 01:40:05 +00:00
|
|
|
fi
|
2014-11-05 12:58:04 -01:00
|
|
|
|
|
|
|
# Finally, belt and braces - fix up the %install% entries in grub
|
|
|
|
# in case they're still there
|
|
|
|
sed -i "s,\%install\%,$INSTALLDIR,g" $CDDIR/boot/grub/grub.cfg
|
|
|
|
|
2014-11-05 13:18:53 -01:00
|
|
|
else
|
|
|
|
echo " No EFI boot code for $ARCH on CD$N"
|
2014-09-27 01:40:05 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# th,th, thats all
|