| 1 |
# This script gets sourced from boot-i386 and boot-amd64. |
| 2 |
# |
| 3 |
# Do install stuff for x86, including making bootable CDs |
| 4 |
# Works with debian-installer |
| 5 |
# |
| 6 |
# $1 is the CD number |
| 7 |
# $2 is the temporary CD build dir |
| 8 |
|
| 9 |
. $BASEDIR/tools/boot/$DI_CODENAME/common.sh |
| 10 |
. $BASEDIR/tools/boot/$DI_CODENAME/x86-desktop.sh |
| 11 |
|
| 12 |
set -e |
| 13 |
#set -x |
| 14 |
|
| 15 |
# Workaround for #823881: |
| 16 |
export MTOOLS_SKIP_CHECK=1 |
| 17 |
|
| 18 |
# Have we been told to use just one boot method? If none listed, |
| 19 |
# assume all are desired. Order also matters. Possible values are |
| 20 |
# "BIOS", "EFI" and "BIOS EFI". We'll also accept "EFI BIOS" for |
| 21 |
# completeness, but we will switch the order. |
| 22 |
if [ "$BOOT_METHODS"x = ""x ] \ |
| 23 |
|| [ "$BOOT_METHODS"x = "BIOS EFI"x ] \ |
| 24 |
|| [ "$BOOT_METHODS"x = "EFI BIOS"x ] ; then |
| 25 |
BOOT_BIOS=1 |
| 26 |
BOOT_EFI=2 |
| 27 |
elif [ "$BOOT_METHODS"x = "BIOS"x ] ; then |
| 28 |
BOOT_BIOS=1 |
| 29 |
BOOT_EFI=0 |
| 30 |
elif [ "$BOOT_METHODS"x = "EFI"x ] ; then |
| 31 |
BOOT_EFI=1 |
| 32 |
BOOT_BIOS=0 |
| 33 |
else |
| 34 |
echo "ERROR: Unrecognized boot method choice $BOOT_METHODS" |
| 35 |
exit 1 |
| 36 |
fi |
| 37 |
|
| 38 |
# amd64 builds will also include 32-bit UEFI files by default, to |
| 39 |
# allow for booting on weird machines with 64-bit CPUs but 32-bit |
| 40 |
# firmware like Baytrail or some models of Apple iMac. Set |
| 41 |
# DISABLE_UEFI_32=1 in your config to disable this. |
| 42 |
|
| 43 |
N=$1 |
| 44 |
CDDIR=$2 |
| 45 |
BOOTDIR= |
| 46 |
if [ "$DI_WWW_HOME" = "default" ]; then |
| 47 |
# Tempting as it might be to merge these two definitions using $ARCH, |
| 48 |
# do *not* do that - these defs are parsed out by other scripts that |
| 49 |
# won't cope with that |
| 50 |
if [ "$ARCH" = amd64 ]; then |
| 51 |
DI_WWW_HOME="https://d-i.debian.org/daily-images/amd64/daily" |
| 52 |
else |
| 53 |
DI_WWW_HOME="https://d-i.debian.org/daily-images/i386/daily" |
| 54 |
fi |
| 55 |
try_di_image_cache |
| 56 |
else |
| 57 |
DI_WWW_HOME=$(echo $DI_WWW_HOME | sed "s,%ARCH%,$ARCH,") |
| 58 |
fi |
| 59 |
DI_WWW_HOME_i386=$(echo $DI_WWW_HOME | sed 's/amd64/i386/g') |
| 60 |
DI_WWW_HOME_amd64=$(echo $DI_WWW_HOME | sed 's/i386/amd64/g') |
| 61 |
|
| 62 |
case "$MKISOFS" in |
| 63 |
*xorriso*) |
| 64 |
XORRISO_VER=$(xorriso_version) |
| 65 |
;; |
| 66 |
*) |
| 67 |
echo "ERROR: debian-cd now depends on xorriso for making x86 bootable CDs." |
| 68 |
exit 1; |
| 69 |
;; |
| 70 |
esac |
| 71 |
|
| 72 |
cd $CDDIR/.. |
| 73 |
|
| 74 |
# This script is called with $1 (now $N) as the CD to make bootable. |
| 75 |
# Exit if this is not a boot disk |
| 76 |
if [ $N != 1 ] ; then exit 0; fi |
| 77 |
|
| 78 |
INSTALLDIR_amd64="install.amd" |
| 79 |
INSTALLDIR_i386="install.386" |
| 80 |
|
| 81 |
if [ "$ARCH" = amd64 ]; then |
| 82 |
INSTALLDIR="$INSTALLDIR_amd64" |
| 83 |
else |
| 84 |
INSTALLDIR="$INSTALLDIR_i386" |
| 85 |
fi |
| 86 |
|
| 87 |
if [ $ARCH = amd64 ]; then |
| 88 |
BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/cd_info_amd64 " |
| 89 |
if [ "$DISABLE_UEFI_32"x = "1"x ]; then |
| 90 |
echo " NOT retrieving i386 EFI files" |
| 91 |
else |
| 92 |
echo " Retrieving i386 EFI files also on amd64 build" |
| 93 |
BOOT_IMAGES="$BOOT_IMAGES cdrom/cd_info_i386" |
| 94 |
fi |
| 95 |
else |
| 96 |
BOOT_IMAGES="cdrom/initrd.gz cdrom/vmlinuz cdrom/cd_info_i386" |
| 97 |
fi |
| 98 |
|
| 99 |
# Download boot images. |
| 100 |
for image in $BOOT_IMAGES; do |
| 101 |
if [ ! -e "$image" ]; then |
| 102 |
dir=$(dirname $image) |
| 103 |
mkdir -p $dir |
| 104 |
case $image in |
| 105 |
*cd_info_*) |
| 106 |
THIS_ARCH=${image##cdrom/cd_info_} |
| 107 |
image_in=cdrom/debian-cd_info.tar.gz |
| 108 |
;; |
| 109 |
*) |
| 110 |
THIS_ARCH=$ARCH |
| 111 |
image_in=$image |
| 112 |
;; |
| 113 |
esac |
| 114 |
|
| 115 |
if [ -n "$LOCAL" -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$THIS_ARCH/current/images/$image_in" ]; then |
| 116 |
cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$THIS_ARCH/current/images/$image_in" "$image" |
| 117 |
elif [ ! "$DI_WWW_HOME" ];then |
| 118 |
if [ ! "$DI_DIR" ];then |
| 119 |
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-%ARCH%/current/images" |
| 120 |
fi |
| 121 |
DI_DIR_i386=$(echo $DI_DIR | sed 's/%ARCH%/i386/g') |
| 122 |
DI_DIR_amd64=$(echo $DI_DIR | sed 's/%ARCH%/amd64/g') |
| 123 |
THIS_DI_DIR=DI_DIR_${THIS_ARCH} |
| 124 |
cp "${!THIS_DI_DIR}/$image_in" "$image" |
| 125 |
else |
| 126 |
THIS_DI_WWW_HOME="DI_WWW_HOME_${THIS_ARCH}" |
| 127 |
$WGET "${!THIS_DI_WWW_HOME}/$image_in" -O "$image" |
| 128 |
fi |
| 129 |
fi |
| 130 |
done |
| 131 |
|
| 132 |
# Reset this to a sane value |
| 133 |
if [ "$DI_DIR" = "$MIRROR/dists/$DI_DIST/main/installer-%ARCH%/current/images" ]; then |
| 134 |
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images" |
| 135 |
fi |
| 136 |
|
| 137 |
# Images that are not really required or may be unavailable. |
| 138 |
for image in $DISK_IMAGES $EXTRA_DISK_IMAGES; do |
| 139 |
if [ ! -e "$image" ]; then |
| 140 |
dir=$(dirname $image) |
| 141 |
mkdir -p $dir |
| 142 |
if [ -n "$LOCAL" -a -f "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" ]; then |
| 143 |
cp "${LOCALDEBS:-$MIRROR}/dists/$DI_DIST/local/installer-$ARCH/current/images/$image" "$image" |
| 144 |
elif [ ! "$DI_WWW_HOME" ];then |
| 145 |
if [ ! "$DI_DIR" ];then |
| 146 |
DI_DIR="$MIRROR/dists/$DI_DIST/main/installer-$ARCH/current/images" |
| 147 |
fi |
| 148 |
cp "$DI_DIR/$image" "$image" || true |
| 149 |
else |
| 150 |
$WGET "$DI_WWW_HOME/$image" -O "$image" || rm -f "$image" |
| 151 |
fi |
| 152 |
fi |
| 153 |
done |
| 154 |
|
| 155 |
# Only disk one gets the extra files installed |
| 156 |
if [ "$N" = "1" ]; then |
| 157 |
# populate the install directory as well |
| 158 |
for disk in $DISK_IMAGES $EXTRA_DISK_IMAGES; do |
| 159 |
if [ -e "$disk" ]; then |
| 160 |
dir=$(dirname $disk) |
| 161 |
mkdir -p $CDDIR/$INSTALLDIR/$dir |
| 162 |
cp -lf $disk $CDDIR/$INSTALLDIR/$dir |
| 163 |
fi |
| 164 |
done |
| 165 |
fi |
| 166 |
|
| 167 |
case "$DESKTOP" in |
| 168 |
$UNSPEC_DESKTOP_DEFAULT) |
| 169 |
# default from tasksel |
| 170 |
DESKTOP= |
| 171 |
;; |
| 172 |
all) |
| 173 |
# default from tasksel |
| 174 |
DESKTOP= |
| 175 |
;; |
| 176 |
light) |
| 177 |
DESKTOP=xfce |
| 178 |
;; |
| 179 |
esac |
| 180 |
# desktop boot parameter gets set separately through DESKTOP variable |
| 181 |
KERNEL_PARAMS="$(echo "$KERNEL_PARAMS" | sed -r "s/desktop=[^ ]* ?//")" |
| 182 |
|
| 183 |
mkdir -p $CDDIR/$INSTALLDIR |
| 184 |
cp -lf cdrom/vmlinuz $CDDIR/$INSTALLDIR/ |
| 185 |
cp -lf cdrom/initrd.gz $CDDIR/$INSTALLDIR/ |
| 186 |
|
| 187 |
# In case of a multi-arch CD the script will be called two times. The |
| 188 |
# first time the isolinux dir gets set up for single arch; if it is |
| 189 |
# called a second time the isolinux dir already exists and we know it |
| 190 |
# will be multi-arch. We then throw away the first version and just |
| 191 |
# configure things from scratch for multi-arch. |
| 192 |
|
| 193 |
MULTIARCH= |
| 194 |
if [ -e boot$N/isolinux/isolinux.cfg ]; then |
| 195 |
MULTIARCH=1 |
| 196 |
rm -r boot$N/isolinux |
| 197 |
fi |
| 198 |
|
| 199 |
mkdir -p boot$N/isolinux |
| 200 |
# Isolinux setup including config and help files comes from d-i. |
| 201 |
cat cdrom/cd_info_$ARCH | (cd boot$N/isolinux/; tar zx) |
| 202 |
mv boot$N/isolinux/grub boot$N/isolinux/grub-$ARCH |
| 203 |
if [ $ARCH = amd64 ] && [ "$DISABLE_UEFI_32"x != "1"x ]; then |
| 204 |
# Also extract i386 grub files, for Bay Trail etc. |
| 205 |
echo " Extracting i386 EFI files also on amd64 build" |
| 206 |
cat cdrom/cd_info_i386 | (cd boot$N/isolinux/; tar zx ./grub) |
| 207 |
mv boot$N/isolinux/grub boot$N/isolinux/grub-i386 |
| 208 |
fi |
| 209 |
|
| 210 |
# Common mkisofs options when creating CDs |
| 211 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-J -joliet-long" |
| 212 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-cache-inodes" |
| 213 |
|
| 214 |
# BIOS-boot specific stuff. Even when we're *not* doing BIOS boot, we |
| 215 |
# still create all the isolinux config files as they're parsed and |
| 216 |
# used later. We just don't grab all the syslinux files, then make |
| 217 |
# sure that we *don't* set up BIOS boot on the xorriso command line. |
| 218 |
if [ "$BOOT_BIOS" = 1 ] ; then |
| 219 |
echo " Adding BIOS boot code for $ARCH on CD$N" |
| 220 |
mkdir -p $CDDIR/../syslinux |
| 221 |
SYSLINUXDEB=$(find_pkg_file syslinux) |
| 222 |
if [ -z "$SYSLINUXDEB" ]; then |
| 223 |
echo "ERROR: syslinux package is required" >&2 |
| 224 |
exit 1 |
| 225 |
fi |
| 226 |
(dpkg --fsys-tarfile "$MIRROR/$SYSLINUXDEB" | \ |
| 227 |
tar xf - -C $CDDIR/../syslinux ./usr/lib) |
| 228 |
|
| 229 |
if [ -n "$ARCHIVE_EXTRACTED_SOURCES" ]; then |
| 230 |
echo $SYSLINUXDEB >> $CDDIR/../$N.pkgs_extracted |
| 231 |
find_pkg_file syslinux source >> $CDDIR/../$N.pkgs_extracted |
| 232 |
fi |
| 233 |
|
| 234 |
ISOLINUXDEB=$(find_pkg_file isolinux) |
| 235 |
if [ -z "$ISOLINUXDEB" ]; then |
| 236 |
echo "ERROR: isolinux package is required" >&2 |
| 237 |
exit 1 |
| 238 |
fi |
| 239 |
(dpkg --fsys-tarfile "$MIRROR/$ISOLINUXDEB" | \ |
| 240 |
tar xf - -C $CDDIR/../syslinux ./usr/lib) |
| 241 |
|
| 242 |
if [ -n "$ARCHIVE_EXTRACTED_SOURCES" ]; then |
| 243 |
echo $ISOLINUXDEB >> $CDDIR/../$N.pkgs_extracted |
| 244 |
find_pkg_file isolinux source >> $CDDIR/../$N.pkgs_extracted |
| 245 |
fi |
| 246 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-isohybrid-mbr syslinux/usr/lib/ISOLINUX/isohdpfx.bin" |
| 247 |
|
| 248 |
cp -f $CDDIR/../syslinux/usr/lib/ISOLINUX/isolinux.bin boot$N/isolinux/ |
| 249 |
cp -f $CDDIR/../syslinux/usr/lib/syslinux/modules/bios/vesamenu.c32 boot$N/isolinux/ |
| 250 |
cp -f $CDDIR/../syslinux/usr/lib/syslinux/modules/bios/ldlinux.c32 boot$N/isolinux/ |
| 251 |
cp -f $CDDIR/../syslinux/usr/lib/syslinux/modules/bios/libcom32.c32 boot$N/isolinux/ |
| 252 |
cp -f $CDDIR/../syslinux/usr/lib/syslinux/modules/bios/libutil.c32 boot$N/isolinux/ |
| 253 |
|
| 254 |
if [ ! -z "$MULTIARCH" ]; then |
| 255 |
# Mandatory for 64bits capability detection |
| 256 |
if [ -f $CDDIR/../syslinux/usr/lib/syslinux/modules/bios/ifcpu64.c32 ] ; then |
| 257 |
cp -f $CDDIR/../syslinux/usr/lib/syslinux/modules/bios/ifcpu64.c32 boot$N/isolinux/ |
| 258 |
else |
| 259 |
cp -f $CDDIR/../syslinux/usr/lib/syslinux/ifcpu64.c32 boot$N/isolinux/ |
| 260 |
fi |
| 261 |
fi |
| 262 |
|
| 263 |
# If we don't have grub stuff from d-i, tell xorriso to add a |
| 264 |
# partition offset for the isohybrid code |
| 265 |
if [ ! -d boot$N/isolinux/grub-$ARCH ] || [ $BOOT_EFI = 0 ] ; then |
| 266 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-partition_offset 16" |
| 267 |
fi |
| 268 |
|
| 269 |
# Add the normal options to make an ElTorito bootable CD/DVD using isolinux |
| 270 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-b isolinux/isolinux.bin" |
| 271 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-c isolinux/boot.cat" |
| 272 |
bls=4 # Specify 4 for BIOS boot, don't calculate it |
| 273 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-boot-load-size $bls" |
| 274 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-boot-info-table" |
| 275 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-no-emul-boot" |
| 276 |
|
| 277 |
# We explicitly put the boot bits in boot$N (as opposed to CD$N) |
| 278 |
# and list it first on the eventual mkisofs command line. That |
| 279 |
# means they'll be placed nearer the front of the eventual image; |
| 280 |
# some older BIOSes apparently have a limitation on what they'll |
| 281 |
# boot here. |
| 282 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_dirs "boot$N" |
| 283 |
else |
| 284 |
echo " No BIOS boot code for $ARCH on CD$N" |
| 285 |
fi |
| 286 |
|
| 287 |
di_syslinux_ver="$(di_syslinux_version)" |
| 288 |
case "$di_syslinux_ver" in |
| 289 |
2.0) |
| 290 |
: ;; |
| 291 |
1.*) |
| 292 |
echo "Error: syslinux config versions before 2.0 are not supported" |
| 293 |
exit 1 ;; |
| 294 |
*) |
| 295 |
echo "Error: unrecognized syslinux config version '$di_syslinux_ver'" |
| 296 |
exit 1 ;; |
| 297 |
esac |
| 298 |
|
| 299 |
if [ -e boot$N/isolinux/f3.txt.withgtk ]; then |
| 300 |
extra_image gtk/vmlinuz "../vmlinuz" |
| 301 |
extra_image gtk/initrd.gz "../initrd.gz" |
| 302 |
mv boot$N/isolinux/f3.txt.withgtk boot$N/isolinux/f3.txt |
| 303 |
mv boot$N/isolinux/f4.txt.withgtk boot$N/isolinux/f4.txt |
| 304 |
if [ -e boot$N/isolinux/isolinux.cfg.withgtk ]; then |
| 305 |
mv boot$N/isolinux/isolinux.cfg.withgtk boot$N/isolinux/isolinux.cfg |
| 306 |
fi |
| 307 |
if [ -e $CDDIR/tools/loadlin.exe ]; then |
| 308 |
echo "\\tools\\loadlin.exe \\$INSTALLDIR\\vmlinuz initrd=initrd.gz vga=788" | todos > $CDDIR/$INSTALLDIR/gtk/install.bat |
| 309 |
fi |
| 310 |
fi |
| 311 |
rm -f boot$N/isolinux/isolinux.cfg.with* |
| 312 |
|
| 313 |
if variant_enabled "xen" ; then |
| 314 |
extra_image xen/vmlinuz "../vmlinuz ../gtk/vmlinuz" |
| 315 |
extra_image xen/initrd.gz "../initrd.gz ../gtk/initrd.gz" |
| 316 |
extra_image xen/debian.cfg || extra_image xen/xm-debian.cfg |
| 317 |
fi |
| 318 |
|
| 319 |
if [ -z "$MULTIARCH" ]; then |
| 320 |
# Set up isolinux dir for only the current arch |
| 321 |
grep -lr '%install%' boot$N/isolinux/* | xargs -r sed -i "s|%install%|$INSTALLDIR|g" |
| 322 |
|
| 323 |
# Remove the x86*.cfg files to avoid them being loaded on a disc |
| 324 |
# that does not have both amd64 and i386 dirs. |
| 325 |
find boot$N/isolinux/ -name "x86*.cfg" -delete |
| 326 |
else |
| 327 |
# Use the syslinux.cfg with architecture detection |
| 328 |
mv boot$N/isolinux/x86syslinux.cfg boot$N/isolinux/isolinux.cfg |
| 329 |
|
| 330 |
# Set up isolinux dir for multi-arch |
| 331 |
grep -lr '%install[-x86]*%' boot$N/isolinux/* | \ |
| 332 |
xargs -r sed -i -e "s|%install%|$INSTALLDIR_amd64|g" \ |
| 333 |
-e "s|%install-x86%|$INSTALLDIR_i386|g" |
| 334 |
|
| 335 |
for file in boot$N/isolinux/f3.txt* boot$N/isolinux/f4.txt*; do |
| 336 |
sed -i "4 s/^$/(note: amd64 is default; prepend 'x86-' to use an i386 kernel instead)/" $file |
| 337 |
done |
| 338 |
|
| 339 |
if [ -e CD$N/win32-loader.ini ]; then |
| 340 |
# Modify win32-loader.ini to also cover the "other" arch |
| 341 |
if [ "$ARCH" = amd64 ]; then |
| 342 |
sed -i -e "/^arch=/d |
| 343 |
/^amd64\//p; s/^amd64/i386/; s/=$INSTALLDIR_amd64/=$INSTALLDIR_i386/g" \ |
| 344 |
CD$N/win32-loader.ini |
| 345 |
else |
| 346 |
sed -i -e "/^arch=/d |
| 347 |
/^i386\//p; s/^i386/amd64/; s/=$INSTALLDIR_i386/=$INSTALLDIR_amd64/g" \ |
| 348 |
CD$N/win32-loader.ini |
| 349 |
fi |
| 350 |
fi |
| 351 |
|
| 352 |
if [ "$BOOT_BIOS" = 1 ] ; then |
| 353 |
# Add another ifcpu64.c32 launch to let the 'enter' in help menus work correctly |
| 354 |
sed -i "/^include menu.cfg/ a\include instsel.cfg" \ |
| 355 |
boot$N/isolinux/prompt.cfg |
| 356 |
cat >boot$N/isolinux/instsel.cfg <<EOF |
| 357 |
default install-select |
| 358 |
label install-select |
| 359 |
kernel ifcpu64.c32 |
| 360 |
append installgui -- x86-installgui |
| 361 |
EOF |
| 362 |
fi |
| 363 |
fi |
| 364 |
|
| 365 |
if [ "$SPLASHPNG" ] ; then |
| 366 |
cp $SPLASHPNG boot$N/isolinux/splash.png |
| 367 |
fi |
| 368 |
|
| 369 |
# used by Debian Edu |
| 370 |
if [ "$LOGOPNG" ] ; then |
| 371 |
# Add custom logo to the initrd.gz file, replacing old image |
| 372 |
GTKINITRD=$CDDIR/$INSTALLDIR/gtk/initrd |
| 373 |
GTKINITRDGZ=$GTKINITRD.gz |
| 374 |
echo "info: Adding $LOGOPNG to $GTKINITRD" |
| 375 |
INITRDDIR=$TDIR/initrd-$$ |
| 376 |
# Repack initrd with new image |
| 377 |
mkdir -p $INITRDDIR |
| 378 |
( |
| 379 |
cd $INITRDDIR |
| 380 |
# There may be multiple hardlinks to the initrd.gz, so |
| 381 |
# explicitly break the links here |
| 382 |
zcat $GTKINITRDGZ > $GTKINITRD |
| 383 |
rm -f $GTKINITRDGZ |
| 384 |
mkdir -p $INITRDDIR/usr/share/graphics |
| 385 |
cp $LOGOPNG $INITRDDIR/usr/share/graphics/logo_debian.png |
| 386 |
echo usr/share/graphics/logo_debian.png | \ |
| 387 |
cpio -oA -H newc -F $GTKINITRD |
| 388 |
pigz -9nm $GTKINITRD |
| 389 |
) |
| 390 |
rm -rf $INITRDDIR |
| 391 |
fi |
| 392 |
|
| 393 |
# Include sound firmware in initrd so they can be loaded before espeakup starts |
| 394 |
if [ -e "boot$N/isolinux/spk.cfg" ]; then |
| 395 |
install_firmwares_initrd "$CDDIR/$INSTALLDIR/initrd" "firmware-sof-signed" |
| 396 |
elif [ -e "boot$N/isolinux/spkgtk.cfg" ]; then |
| 397 |
install_firmwares_initrd "$CDDIR/$INSTALLDIR/gtk/initrd" "firmware-sof-signed" |
| 398 |
fi |
| 399 |
|
| 400 |
sed -i "s|built on|built $BUILD_DATE; d-i|" boot$N/isolinux/f1.txt |
| 401 |
|
| 402 |
if [ -n "$KERNEL_PARAMS" ]; then |
| 403 |
# Substitute custom kernel params into the isolinux config file(s) |
| 404 |
for file in boot$N/isolinux/*.cfg; do |
| 405 |
case "$(basename $file)" in |
| 406 |
instsel.cfg) |
| 407 |
continue ;; |
| 408 |
esac |
| 409 |
sed -i "/^[[:space:]]\+append .*---/ s|append|append $KERNEL_PARAMS|" \ |
| 410 |
$file |
| 411 |
done |
| 412 |
fi |
| 413 |
|
| 414 |
set_default_desktop |
| 415 |
rm -rf cdrom |
| 416 |
|
| 417 |
if [ -d boot$N/isolinux/grub-$ARCH ] && [ $BOOT_EFI -ne 0 ] ; then |
| 418 |
|
| 419 |
# Move GRUB files to the right places |
| 420 |
mkdir -p $CDDIR/EFI/boot |
| 421 |
mkdir -p $CDDIR/boot/grub |
| 422 |
|
| 423 |
for grub_arch in amd64 i386; do |
| 424 |
SB=0 |
| 425 |
dir=boot$N/isolinux/grub-${grub_arch} |
| 426 |
|
| 427 |
if [ ! -f $dir/efi.img ]; then |
| 428 |
continue |
| 429 |
fi |
| 430 |
|
| 431 |
echo " Adding EFI boot code for $grub_arch on CD$N" |
| 432 |
|
| 433 |
mcopy -n -s -i $dir/efi.img '::efi/*' $CDDIR/EFI |
| 434 |
|
| 435 |
# Save space. if we have both files, that means we have shim |
| 436 |
# *and* grub and we're doing secure boot. Don't copy all the |
| 437 |
# grub modules into place in that case, as we're never going |
| 438 |
# to use them anyway. |
| 439 |
case $grub_arch in |
| 440 |
amd64) |
| 441 |
if [ -f $CDDIR/EFI/boot/bootx64.efi ] \ |
| 442 |
&& [ -f $CDDIR/EFI/boot/grubx64.efi ]; then |
| 443 |
SB=1 |
| 444 |
fi;; |
| 445 |
i386) |
| 446 |
if [ -f $CDDIR/EFI/boot/bootia32.efi ] \ |
| 447 |
&& [ -f $CDDIR/EFI/boot/grubia32.efi ]; then |
| 448 |
SB=1 |
| 449 |
fi;; |
| 450 |
esac |
| 451 |
|
| 452 |
cp -a $dir/*-efi $dir/*.pf2 $dir/*.cfg $CDDIR/boot/grub |
| 453 |
if [ $SB = 1 ]; then |
| 454 |
echo " Removing non-SB grub files and config for $grub_arch" |
| 455 |
rm -f $CDDIR/boot/grub/*-efi/*.mod $CDDIR/boot/grub/*-efi/*.lst |
| 456 |
# Let's not have errors from trying to insmod modules that |
| 457 |
# aren't there... |
| 458 |
sed -i '/^insmod/d' $CDDIR/boot/grub/*-efi/*.cfg |
| 459 |
fi |
| 460 |
|
| 461 |
done |
| 462 |
|
| 463 |
rm -rf boot$N/isolinux/grub* |
| 464 |
|
| 465 |
# If we're only doing EFI, copy the splash file from the BIOS boot dir |
| 466 |
if [ $BOOT_EFI = 1 ] ; then |
| 467 |
mkdir -p $CDDIR/isolinux |
| 468 |
cp boot$N/isolinux/splash.png $CDDIR/isolinux |
| 469 |
fi |
| 470 |
|
| 471 |
# Create grub menu entries to match the isolinux ones |
| 472 |
sed -i '/^menuentry/Q' $CDDIR/boot/grub/grub.cfg; |
| 473 |
$BASEDIR/tools/boot/$DI_CODENAME/parse_isolinux \ |
| 474 |
boot$N/isolinux $CDDIR $BASEDIR/data/$DI_CODENAME/grub-theme.in "$DISKINFO_DISTRO" "$DEBIAN_KERNEL" "$DEBVERSION" \ |
| 475 |
>> $CDDIR/boot/grub/grub.cfg |
| 476 |
cp $BASEDIR/data/$DI_CODENAME/hl*png $CDDIR/boot/grub/theme |
| 477 |
NUM_ENTRIES=$(grep menuentry $CDDIR/boot/grub/grub.cfg | wc -l) |
| 478 |
echo " CD$N/boot/grub/grub.cfg has $NUM_ENTRIES boot entries defined" |
| 479 |
|
| 480 |
change_grub_cfg_uuid $CDDIR |
| 481 |
|
| 482 |
# Stuff the EFI boot files into a FAT filesystem, making it as |
| 483 |
# small as possible. We end up re-packing like this in case we're |
| 484 |
# making a multi-arch image |
| 485 |
|
| 486 |
# First, work out how many blocks we need |
| 487 |
blocks=$(calculate_efi_image_size $CDDIR) |
| 488 |
|
| 489 |
# Now make a new image to contain the files |
| 490 |
rm -f $CDDIR/boot/grub/efi*.img |
| 491 |
mkfs.msdos --invariant -v -i deb00001 -C "$CDDIR/boot/grub/efi.img" $blocks >/dev/null |
| 492 |
|
| 493 |
# And copy them into place |
| 494 |
mmd -i "$CDDIR/boot/grub/efi.img" ::efi |
| 495 |
mcopy -o -s -i "$CDDIR/boot/grub/efi.img" $CDDIR/EFI/* \ |
| 496 |
"::efi" |
| 497 |
|
| 498 |
if [ $BOOT_EFI = 2 ] ; then |
| 499 |
# We're being added alongside (after) a BIOS boot record. Tell |
| 500 |
# xorriso to create a (secondary) ElTorito boot record for the |
| 501 |
# EFI bootloader. Otherwise, xorriso will create it as the |
| 502 |
# primary. |
| 503 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-eltorito-alt-boot" |
| 504 |
fi |
| 505 |
|
| 506 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-e boot/grub/efi.img -no-emul-boot" |
| 507 |
add_mkisofs_opt $CDDIR/../$N.mkisofs_opts "-isohybrid-gpt-basdat -isohybrid-apm-hfsplus" |
| 508 |
else |
| 509 |
echo " No EFI boot code for $ARCH on CD$N" |
| 510 |
fi |
| 511 |
|
| 512 |
# th,th, thats all |
| 513 |
|