diff --git a/debian/changelog b/debian/changelog index a082563a..98c50a25 100644 --- a/debian/changelog +++ b/debian/changelog @@ -21,6 +21,8 @@ debian-cd (3.1.23) unstable; urgency=medium [ Steve McIntyre ] * Add grub-efi packages to armhf media. + * Add EFI boot support for armhf media + * Factor ESP size calculation for the various platforms [ Samuel Thibault ] * Support dark theme boot entries. diff --git a/tools/boot/buster/boot-arm-common b/tools/boot/buster/boot-arm-common deleted file mode 100644 index 0b4681fb..00000000 --- a/tools/boot/buster/boot-arm-common +++ /dev/null @@ -1,46 +0,0 @@ -# Do common install stuff for armel/armhf, including making bootable CDs -# Works with debian-installer -# -# $1 is the CD number -# $2 is the temporary CD build dir -# -# This is copied from the old arm script and it is currently disabled as there -# don't seem to be any CD-bootable armel/armhf machines. - -. $BASEDIR/tools/boot/$DI_CODENAME/common.sh - -N=$1 -CDDIR=$2 -INSTALLDIR="install" - -# Common options for all disks -add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J -joliet-long" -add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-cache-inodes" -add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-l" - -# Exit if this is not CD#1/DVD#1 -if [ $N != "1" ]; then - exit 0 -fi - -if [ "$DI_WWW_HOME" = "default" ]; then - # Tempting as it might be to merge these definitions using $ARCH, - # do *not* do that - these defs are parsed out by other scripts - # that won't cope with that - if [ "$ARCH" = armel ]; then - DI_WWW_HOME="https://d-i.debian.org/daily-images/armel/daily" - elif [ "$ARCH" = armhf ]; then - DI_WWW_HOME="https://d-i.debian.org/daily-images/armhf/daily" - else - echo "$0: unknown arch $ARCH; abort" - exit 1 - fi - try_di_image_cache -else - DI_WWW_HOME=$(echo $DI_WWW_HOME | sed "s,%ARCH%,$ARCH,") -fi - -# This arch is currently not bootable directly from CD, and there's -# not a lot we can do about that. But add the needed files in the -# right place so that users can find them, at least -copy_arch_images diff --git a/tools/boot/buster/boot-arm64 b/tools/boot/buster/boot-arm64 index 29ea651d..45d7c683 100755 --- a/tools/boot/buster/boot-arm64 +++ b/tools/boot/buster/boot-arm64 @@ -42,7 +42,7 @@ case "$MKISOFS" in XORRISO_VER=$(xorriso_version) ;; *) - echo "ERROR: debian-cd depends on xorriso for making arm64 bootable CDs." + echo "ERROR: debian-cd depends on xorriso for making $ARCH bootable CDs." exit 1; ;; esac @@ -104,7 +104,7 @@ if [ -d boot$N/grub ] ; then # Ugh - different code here depending on the version of xorriso we've got if [ $XORRISO_VER -le 10202 ] ; then - echo "ERROR: debian-cd depends on xorriso > 1.2.2 for making arm64 bootable CDs." + echo "ERROR: debian-cd depends on xorriso > 1.2.2 for making $ARCH bootable CDs." exit 1; elif [ $XORRISO_VER -gt 10202 ] ; then echo "Using newer EFI support in xorriso $XORRISO_VER" @@ -117,7 +117,7 @@ if [ -d boot$N/grub ] ; then # And force alignment add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-partition_cyl_align all" - fi + fi # Finally, belt and braces - fix up the %install% entries in grub # in case they're still there diff --git a/tools/boot/buster/boot-armel b/tools/boot/buster/boot-armel index 0808e78b..5737eed1 100755 --- a/tools/boot/buster/boot-armel +++ b/tools/boot/buster/boot-armel @@ -1,2 +1,37 @@ #!/bin/bash -. $BASEDIR/tools/boot/$DI_CODENAME/boot-arm-common +# Do install stuff for armel +# Works with debian-installer +# +# $1 is the CD number +# $2 is the temporary CD build dir +# +# This is copied from the old arm script and it is currently disabled as there +# don't seem to be any CD-bootable armel/armhf machines. + +. $BASEDIR/tools/boot/$DI_CODENAME/common.sh + +N=$1 +CDDIR=$2 +INSTALLDIR="install" + +# Common options for all disks +add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J -joliet-long" +add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-cache-inodes" +add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-l" + +# Exit if this is not CD#1/DVD#1 +if [ $N != "1" ]; then + exit 0 +fi + +if [ "$DI_WWW_HOME" = "default" ]; then + DI_WWW_HOME="https://d-i.debian.org/daily-images/armel/daily" + try_di_image_cache +else + DI_WWW_HOME=$(echo $DI_WWW_HOME | sed "s,%ARCH%,$ARCH,") +fi + +# armel is currently not bootable directly from CD/DVD/USB, and +# there's not a lot we can do about that. But add the needed files in +# the right place so that users can find them, at least +copy_arch_images diff --git a/tools/boot/buster/boot-armhf b/tools/boot/buster/boot-armhf index 0808e78b..b8145fca 100755 --- a/tools/boot/buster/boot-armhf +++ b/tools/boot/buster/boot-armhf @@ -1,2 +1,134 @@ #!/bin/bash -. $BASEDIR/tools/boot/$DI_CODENAME/boot-arm-common +# Do install stuff for armhf +# Sets up a grub-efi installer +# +# $1 is the CD number +# $2 is the temporary CD build dir + +. $BASEDIR/tools/boot/$DI_CODENAME/common.sh + +N=$1 +CDDIR=$2 +INSTALLDIR="install.ahf" + +# Workaround for #823881: +export MTOOLS_SKIP_CHECK=1 + +# Common options for all disks +add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J -joliet-long" +add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-cache-inodes" +add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-l" + +# Exit if this is not CD#1/DVD#1 +if [ $N != "1" ]; then + exit 0 +fi + +if [ "$DI_WWW_HOME" = "default" ]; then + DI_WWW_HOME="https://d-i.debian.org/daily-images/armhf/daily" + try_di_image_cache +else + DI_WWW_HOME=$(echo $DI_WWW_HOME | sed "s,%ARCH%,$ARCH,") +fi + +# armhf is not bootable directly from CD/DVD/USB for all plaforms. For +# those that are not, add the needed files in the right place so that +# users can find them, at least +copy_arch_images + +# Now for the more clever stuff - for U-Boot EFI support or a direct +# qemu etc. we can boot using EFI! +case "$MKISOFS" in + *xorriso*) + XORRISO_VER=$(xorriso_version) + ;; + *) + echo "ERROR: debian-cd depends on xorriso for making $ARCH bootable CDs." + exit 1; + ;; +esac + +cd $CDDIR/.. + +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 + +mkdir -p $CDDIR/$INSTALLDIR +cp -lf cdrom/vmlinuz $CDDIR/$INSTALLDIR/ +cp -lf cdrom/initrd.gz $CDDIR/$INSTALLDIR/ + +# 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) + +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 -n -s -i boot$N/isolinux/grub/efi.img '::efi/*' $CDDIR/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. + + # First, work out how many blocks we need + blocks=$(calculate_efi_image_size $CDDIR) + + # Now make a new image to contain the files + rm -f $CDDIR/boot/grub/efi.img + mkfs.msdos -v -C "$CDDIR/boot/grub/efi.img" $blocks >/dev/null + + # And copy them into place + mmd -i "$CDDIR/boot/grub/efi.img" ::efi + mcopy -o -s -i "$CDDIR/boot/grub/efi.img" $CDDIR/EFI/* \ + "::efi" + + # Ugh - different code here depending on the version of xorriso we've got + if [ $XORRISO_VER -le 10202 ] ; then + echo "ERROR: debian-cd depends on xorriso > 1.2.2 for making $ARCH bootable CDs." + exit 1; + elif [ $XORRISO_VER -gt 10202 ] ; then + echo "Using newer EFI support in xorriso $XORRISO_VER" + + # 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" + + # 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" + fi + + # 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 + + # Substitute custom KERNEL_PARAMS into grub.cfg + sed -i "s,/vmlinuz ,/vmlinuz $KERNEL_PARAMS ,g" $CDDIR/boot/grub/grub.cfg + +else + echo " No EFI boot code for $ARCH on CD$N" +fi + +# th,th, thats all