From ca67b09c015d4af3ae3cce12aa72e60941dbb8b5 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 18:29:52 +0200 Subject: Adding debian version 2.06-13+deb12u1. Signed-off-by: Daniel Baumann --- debian/build-efi-images | 278 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 278 insertions(+) create mode 100755 debian/build-efi-images (limited to 'debian/build-efi-images') diff --git a/debian/build-efi-images b/debian/build-efi-images new file mode 100755 index 0000000..888f1ad --- /dev/null +++ b/debian/build-efi-images @@ -0,0 +1,278 @@ +#! /bin/sh +set -e + +# Copyright (C) 2010, 2011, 2012 Canonical Ltd. +# Author: Colin Watson +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2, or (at your option) any later +# version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +# Make EFI boot images for signing. + +if [ $# -lt 7 ]; then + echo "usage: $0 GRUB-MKIMAGE GRUB-CORE OUTPUT-DIRECTORY DEB-ARCH PLATFORM EFI-NAME SBAT-CSV [EFI-VENDOR]" +fi + +grub_mkimage="$1" +grub_core="$2" +outdir="$3" +deb_arch="$4" +platform="$5" +efi_name="$6" +sbat_csv="$7" +efi_vendor="${8:-$(dpkg-vendor --query vendor | tr '[:upper:]' '[:lower:]')}" + +# mkfs.msdos may not be on the default PATH. +export PATH="$PATH:/sbin:/usr/sbin" + +workdir= + +cleanup () { + [ -z "$workdir" ] || rm -rf "$workdir" +} +trap cleanup EXIT HUP INT QUIT TERM + +# Return the number of 1KiB blocks needed to store a file in the +# memdisk, with an extra block for the directory entry +rounded_size () { + BLOCK_SIZE=1024 + size=$(stat -c %s $1) + rounded=$(( ( ($size + $BLOCK_SIZE - 1) / $BLOCK_SIZE) + 1)) + echo "Adding $rounded blocks to memdisk for $1" >&2 + echo $rounded +} + +rm -rf "$outdir" +mkdir -p "$outdir" + +workdir="$(mktemp -d build-efi-images.XXXXXX)" + +# GRUB's rescue parser doesn't understand 'if'. +echo 'normal (memdisk)/grub.cfg' >"$workdir/grub-bootstrap.cfg" + +# Skeleton configuration file which finds the real boot disk. +cat >"$workdir/grub.cfg" <"$workdir/grub-netboot.cfg" <