Add 32-bit EFI binaries to all amd64 images too

so we no longer need a multi-arch image for Bay Trail etc.
This commit is contained in:
Steve McIntyre 2022-12-29 03:54:45 +00:00
parent 2ef9e57ec0
commit 8a8e623819
3 changed files with 105 additions and 38 deletions

2
debian/changelog vendored
View File

@ -16,6 +16,8 @@ debian-cd (3.1.36) UNRELEASED; urgency=medium
* Change how we find the installer when booting via grub-efi:
instead of looking for the .disk/info file, use .disk/id/$UUID
instead. Closes: #1024346, #1024720.
* Add 32-bit EFI binaries to all amd64 images too, so we no longer
need a multi-arch image for Bay Trail etc.
[ Cyril Brulebois ]
* generate_firmware_patterns: Drop support for the temporary --test

View File

@ -51,6 +51,8 @@ if [ "$DI_WWW_HOME" = "default" ]; then
else
DI_WWW_HOME=$(echo $DI_WWW_HOME | sed "s,%ARCH%,$ARCH,")
fi
DI_WWW_HOME_i386=$(echo $DI_WWW_HOME | sed 's/amd64/i386/g')
DI_WWW_HOME_amd64=$(echo $DI_WWW_HOME | sed 's/i386/amd64/g')
case "$MKISOFS" in
*xorriso*)
@ -77,23 +79,41 @@ else
INSTALLDIR="$INSTALLDIR_i386"
fi
BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/debian-cd_info.tar.gz"
if [ $ARCH = i386 ]; then
BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/cd_info_i386"
else
BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/cd_info_i386 cdrom/cd_info_amd64 "
fi
# 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"
case $image in
*cd_info_*)
THIS_ARCH=${image##cdrom/cd_info_}
image_in=cdrom/debian-cd_info.tar.gz
;;
*)
THIS_ARCH=$ARCH
image_in=$image
;;
esac
if [ -n "$LOCAL" -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$THIS_ARCH/current/images/$image_in" ]; then
cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$THIS_ARCH/current/images/$image_in" "$image"
elif [ ! "$DI_WWW_HOME" ];then
if [ ! "$DI_DIR" ];then
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images"
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$THIS_ARCH/current/images"
fi
# echo "Copying images from $DI_DIR"
cp "$DI_DIR/$image" "$image"
DI_DIR_i386=$(echo $DI_DIR | sed 's/amd64/i386/g')
DI_DIR_amd64=$(echo $DI_DIR | sed 's/i386/amd64/g')
THIS_DI_DIR=DI_DIR_${THIS_ARCH}
cp "${!THIS_DI_DIR}/$image_in" "$image"
else
$WGET "$DI_WWW_HOME/$image" -O "$image"
THIS_DI_WWW_HOME="DI_WWW_HOME_${THIS_ARCH}"
$WGET "${!THIS_DI_WWW_HOME}/$image_in" -O "$image"
fi
fi
done
@ -174,7 +194,13 @@ fi
mkdir -p boot$N/isolinux
# Isolinux setup including config and help files comes from d-i.
cat cdrom/debian-cd_info.tar.gz | (cd boot$N/isolinux/; tar zx)
cat cdrom/cd_info_$ARCH | (cd boot$N/isolinux/; tar zx)
mv boot$N/isolinux/grub boot$N/isolinux/grub-$ARCH
if [ $ARCH = amd64 ]; then
# Also extract i386 grub files, for Bay Trail etc.
cat cdrom/cd_info_i386 | (cd boot$N/isolinux/; tar zx ./grub)
mv boot$N/isolinux/grub boot$N/isolinux/grub-i386
fi
# Not everything in the tarball is isolinux stuff
if [ -e boot$N/isolinux/win32-loader.ini ] ; then
@ -279,7 +305,7 @@ if [ "$BOOT_BIOS" = 1 ] ; then
# If we don't have grub stuff from d-i, tell xorriso to add a
# partition offset for the isohybrid code
if [ ! -d boot$N/isolinux/grub ] || [ $BOOT_EFI = 0 ] ; then
if [ ! -d boot$N/isolinux/grub-$ARCH ] || [ $BOOT_EFI = 0 ] ; then
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-partition_offset 16"
fi
@ -431,15 +457,52 @@ fi
set_default_desktop
rm -rf cdrom
if [ -d boot$N/isolinux/grub ] && [ $BOOT_EFI -ne 0 ] ; then
if [ -d boot$N/isolinux/grub-$ARCH ] && [ $BOOT_EFI -ne 0 ] ; then
echo " Adding EFI boot code for $ARCH on CD$N"
# Move GRUB files to the right place.
# Move GRUB files to the right places
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/isolinux/grub/* $CDDIR/boot/grub/
rmdir boot$N/isolinux/grub
for grub_arch in amd64 i386; do
SB=0
dir=boot$N/isolinux/grub-${grub_arch}
if [ ! -f $dir/efi.img ]; then
continue
fi
mcopy -n -s -i $dir/efi.img '::efi/*' $CDDIR/EFI
# Save space. if we have both files, that means we have shim
# *and* grub and we're doing secure boot. Don't copy all the
# grub modules into place in that case, as we're never going
# to use them anyway.
case $grub_arch in
amd64)
if [ -f $CDDIR/EFI/boot/bootx64.efi ] \
&& [ -f $CDDIR/EFI/boot/grubx64.efi ]; then
SB=1
fi;;
i386)
if [ -f $CDDIR/EFI/boot/bootia32.efi ] \
&& [ -f $CDDIR/EFI/boot/grubia32.efi ]; then
SB=1
fi;;
esac
cp -av $dir/*-efi $dir/*.pf2 $dir/*.cfg $CDDIR/boot/grub
if [ $SB = 1 ]; then
echo " Removing non-SB grub files and config for $grub_arch"
rm -f $CDDIR/boot/grub/*-efi/*.mod $CDDIR/boot/grub/*-efi/*.lst
# Let's not have errors from trying to insmod modules that
# aren't there...
sed -i '/^insmod/d' $CDDIR/boot/grub/*-efi/*.cfg
fi
done
rm -rf boot$N/isolinux/grub*
# If we're only doing EFI, copy the splash file from the BIOS boot dir
if [ $BOOT_EFI = 1 ] ; then
@ -466,7 +529,7 @@ if [ -d boot$N/isolinux/grub ] && [ $BOOT_EFI -ne 0 ] ; then
blocks=$(calculate_efi_image_size $CDDIR)
# Now make a new image to contain the files
rm -f $CDDIR/boot/grub/efi.img
rm -f $CDDIR/boot/grub/efi*.img
mkfs.msdos --invariant -v -i deb00001 -C "$CDDIR/boot/grub/efi.img" $blocks >/dev/null
# And copy them into place

View File

@ -257,10 +257,12 @@ change_grub_cfg_uuid () {
# reliable - see #1024346 and #1024720 for examples where this
# fails. Instead, let's generate a UUID here and use that as a
# flag file.
if [ -f $CDDIR/EFI/debian/grub.cfg ]; then
FILE=$CDDIR/EFI/debian/grub.cfg
if [ -f $FILE ]; then
UUID=$(uuidgen)
mkdir -p $CDDIR/.disk/id
touch $CDDIR/.disk/id/$UUID
sed -i "/search --file --set=root/s,.disk/info,.disk/id/$UUID," $CDDIR/EFI/debian/grub.cfg
sed -i "/search --file --set=root/s,.disk/info,.disk/id/$UUID," $FILE
sed -i '/^source.*grub.cfg$/s,^.*$,source $prefix/${grub_cpu}-efi/grub.cfg,' $FILE
fi
}