Bug#1033737: flash-kernel: Unable to run flash-kernel on EFI-based systems
Package: flash-kernel
Version: 3.106
Severity: normal
File: flash-kernel
X-Debbugs-Cc: isaac@is.having.coffee
Dear Maintainer,
As part of our CI/CD system, we are building images for target devices.
The images are set up in virtual machines which boot using EFI, but
flash-kernel installation always fails as it detects that the system is
running in EFI by checking for the existence of /sys/firmware/efi.
Being able to setup the image on these VMs is an important part of our
testing and validation workflow, so it would be very helpful to have an
option to skip this check and proceed regardless of whether the system
is currently running in EFI mode or not.
I've added a debdiff for a proposal for a new parameter --force-efi
which can be set to skip this check.
---
diff -Nru flash-kernel-3.106/debian/changelog flash-kernel-3.106+nmu1/debian/changelog
--- flash-kernel-3.106/debian/changelog 2022-04-22 23:55:41.000000000 +0000
+++ flash-kernel-3.106+nmu1/debian/changelog 2023-03-31 13:04:23.000000000 +0000
@@ -1,3 +1,10 @@
+flash-kernel (3.106+nmu1) UNRELEASED; urgency=medium
+
+ * Skip EFI detection mechanism when the --force-efi option
+ has been set.
+
+ -- Isaac True <isaac@is.having.coffee> Fri, 31 Mar 2023 13:04:23 +0000
+
flash-kernel (3.106) unstable; urgency=medium
* db/all.db: Move MNT Reform 2 boards later to fix sort order.
diff -Nru flash-kernel-3.106/flash-kernel.8 flash-kernel-3.106+nmu1/flash-kernel.8
--- flash-kernel-3.106/flash-kernel.8 2022-03-23 14:22:28.000000000 +0000
+++ flash-kernel-3.106+nmu1/flash-kernel.8 2023-03-31 13:04:23.000000000 +0000
@@ -3,7 +3,7 @@
.SH NAME
flash-kernel \- put kernel and initramfs in boot location
.SH SYNOPSIS
-.B flash-kernel [--supported] [--force] [kvers]
+.B flash-kernel [--supported] [--force] [--force-efi] [kvers]
.SH DESCRIPTION
flash-kernel is a script which will put the kernel and initramfs in
the boot location of embedded devices that don't load the kernel and
@@ -25,6 +25,11 @@
match. Valid filenames for images to flash are suffixed with the
subarchitecture.
.P
+Normally, flash\-\-kernel will abort the installation if it detects that
+it is running in an EFI-based environment. If the \-\-force\-efi option
+is used, flash\-kernel will skip this check and continue with the
+installation.
+.P
If the \-\-supported option is used, flash\-kernel will test to see if
the hardware is supported, and return a true or false value.
.SH ENVIRONMENT VARIABLES
diff -Nru flash-kernel-3.106/functions flash-kernel-3.106+nmu1/functions
--- flash-kernel-3.106/functions 2022-04-12 19:43:15.000000000 +0000
+++ flash-kernel-3.106+nmu1/functions 2023-03-31 13:04:23.000000000 +0000
@@ -679,6 +679,11 @@
force="yes"
shift
fi
+force_efi="no"
+if [ "x$1" = "x--force-efi" ]; then
+ force_efi="yes"
+ shift
+fi
if [ "x$1" = "x--machine" ]; then
machine="$2"
shift 2
@@ -789,9 +794,10 @@
kfile=$(readlink -e "$kfile")
fi
-if [ -d /sys/firmware/efi ]; then
+if [ -d /sys/firmware/efi ] && [ "x$force_efi" != "xyes" ]; then
# skipping when detect EFI
echo "System running in EFI mode, skipping."
+ echo "Use --force-efi if you want to skip this check."
exit 0
fi
Reply to: