Source: edk2
Version: 2023.02-2
Severity: wishlist
Tags: patch

Dear Maintainer,

On installation of an architecture-appropriate efi-shell-XXX package,
please copy the shell into the EFI partition and configure grub2 to
have a boot menu entry to enter that shell.

I attach an example grup config file for aarch64, which works if
dropped into /etc/grub.d/35_efi-shell-aarch64 and the shell has been
installed as /boot/efi/EFI/tianocore/shellaa64.efi

The architecture test in the grub config file is probably not exactly
the best one; feel free to improve so that it works when running e.g.
an armfh or 32-bit arm Debian port on an aarch64-able machine.

For other architectures, adapt the architecture test. Maybe you can
generate the file for each architecture from a template where the only
change is the architecture test.

-- System Information:
Debian Release: 12.0
  APT prefers testing-security
  APT policy: (600, 'testing-security'), (600, 'testing'), (500, 'unstable'), 
(1, 'experimental')
Architecture: arm64 (aarch64)

Kernel: Linux 6.2.0 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
#! /bin/sh
set -e

# grub-mkconfig helper script.
# Copyright (C) 2020  Free Software Foundation, Inc.
#
# GRUB 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 3 of the License, or
# (at your option) any later version.
#
# GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.

prefix="/usr"
exec_prefix="/usr"
datarootdir="/usr/share"

export TEXTDOMAIN=grub
export TEXTDOMAINDIR="${datarootdir}/locale"

. "$pkgdatadir/grub-mkconfig_lib"

EFI_MNTPNT=/boot/efi
EFI_DEV="`"${grub_probe}" -t device \"${EFI_MNTPNT}\"`"
EFI_PATH=EFI/tianocore
SHELL_FNAME=shellaa64.efi
EFI_VARS_DIR=/sys/firmware/efi/efivars
EFI_GLOBAL_VARIABLE=8be4df61-93ca-11d2-aa0d-00e098032b8c
OS_INDICATIONS="$EFI_VARS_DIR/OsIndicationsSupported-$EFI_GLOBAL_VARIABLE"

if [ "`arch`" = aarch64 ] && \
   [ -f "${EFI_MNTPNT}/${EFI_PATH}/${SHELL_FNAME}" ]; then

  LABEL="TianoCore EFI shell"

  gettext_printf "Adding boot menu entry for TianoCore EFI shell ...\n" >&2

  cat << EOF
menuentry '$LABEL' \$menuentry_id_option 'tianocore-efishell' {
`prepare_grub_to_access_device "${EFI_DEV}" | grub_add_tab`
        chainloader /${EFI_PATH}/${SHELL_FNAME}
        boot
}
EOF
fi

Reply via email to