--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
- Subject: [PATCH] flash-kernel: Provide hook to start EFI application
- From: Heinrich Schuchardt <xypron.glpk@gmx.de>
- Date: Sun, 27 Aug 2017 13:52:43 +0200
- Message-id: <20170827115243.12326-1-xypron.glpk@gmx.de>
Package: flash-kernel
Version: 3.84
Severity: wishlist
Instead of starting the Linux kernel from U-Boot we may want to
start an EFI application like grub or iPXE. Let us use a new
hook @@UBOOT_PREBOOT_EXTRA@@ in the boot.scr generation for this
purpose. The related hook files are to be placed in
/etc/flash-kernel/preboot.d or /usr/share/flash-kernel/preboot.d.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
README | 19 +++++++++++--------
bootscript/all/bootscr.uboot-generic | 2 ++
bootscript/arm64/bootscr.uboot-generic | 2 ++
debian/dirs | 2 ++
functions | 19 +++++++++++++++++++
5 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/README b/README
index 555adaf..1348ccf 100644
--- a/README
+++ b/README
@@ -200,9 +200,9 @@ Configuration files currently supported:
* /etc/flash-kernels/bootscript (directory). The files referenced via
the Boot-Script-Name field are installed here.
-* /etc/flash-kernel/ubootenv.d can be used to add or override u-boot
- script snippets. See "Adding U-Boot Commands for Pre-Boot Execution"
- below for more details.
+* /etc/flash-kernel/ubootenv.d and /etc/flash-kernel/preboot.d can be used to
+ add or override u-boot script snippets. See "Adding U-Boot Commands for
+ Pre-Boot Execution" below for more details.
* /etc/default/flash-kernel currently contains the following variables:
- LINUX_KERNEL_CMDLINE, which should be used by bootscripts to set kernel
@@ -229,10 +229,13 @@ Adding U-Boot Commands for Pre-Boot Execution
Packages can drop in files containing U-Boot commands to be executed by a
platform's bootscript before starting the OS. These files should be
-dropped in /usr/share/flash-kernel/ubootenv.d. Users can add additional
+dropped in /usr/share/flash-kernel/ubootenv.d and
+/usr/share/flash-kernel/preboot.d. Users can add additional
stubs, or override stubs provided by packages, by adding files to
-/etc/flash-kernel/ubootenv.d. Files in the /etc path that have the same
-name as files in the /usr path will override the /usr counterparts.
+/etc/flash-kernel/ubootenv.d and /etc/flash-kernel/preboot.d. Files in the
+/etc path that have the same name as files in the /usr path will override the
+/usr counterparts.
-Platform bootscripts must contain the @@UBOOT_ENV_EXTRA@@ macro for the
-contents of these stubs to be incorporated.
+Platform bootscripts must contain the @@UBOOT_ENV_EXTRA@@ and
+@@UBOOT_PREBOOT_EXTRA@@ macros for the contents of these stubs to be
+incorporated.
diff --git a/bootscript/all/bootscr.uboot-generic b/bootscript/all/bootscr.uboot-generic
index db4066a..abbeeb8 100644
--- a/bootscript/all/bootscr.uboot-generic
+++ b/bootscript/all/bootscr.uboot-generic
@@ -48,6 +48,8 @@ else
setenv partition ${distro_bootpart}
fi
+@@UBOOT_PREBOOT_EXTRA@@
+
load ${devtype} ${devnum}:${partition} ${kernel_addr_r} ${prefix}vmlinuz-${fk_kvers} \
&& load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}${fdtpath} \
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initrd.img-${fk_kvers} \
diff --git a/bootscript/arm64/bootscr.uboot-generic b/bootscript/arm64/bootscr.uboot-generic
index 568b3b5..33f90d2 100644
--- a/bootscript/arm64/bootscr.uboot-generic
+++ b/bootscript/arm64/bootscr.uboot-generic
@@ -41,6 +41,8 @@ else
setenv partition ${distro_bootpart}
fi
+@@UBOOT_PREBOOT_EXTRA@@
+
load ${devtype} ${devnum}:${partition} ${kernel_addr_r} ${prefix}vmlinuz-${fk_kvers} \
&& load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}${fdtpath} \
&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initrd.img-${fk_kvers} \
diff --git a/debian/dirs b/debian/dirs
index 2788a14..6293c8f 100644
--- a/debian/dirs
+++ b/debian/dirs
@@ -1,3 +1,5 @@
usr/sbin
+etc/flash-kernel/preboot.d
+usr/share/flash-kernel/preboot.d
etc/flash-kernel/ubootenv.d
usr/share/flash-kernel/ubootenv.d
diff --git a/functions b/functions
index b2ae5be..f1e17a6 100644
--- a/functions
+++ b/functions
@@ -304,6 +304,19 @@ gen_kernel() {
} >"$output"
}
+gen_preboot() {
+ PRESTUBDIRS="/etc/flash-kernel/preboot.d /usr/share/flash-kernel/preboot.d"
+ PRESTUBS="$(find $PRESTUBDIRS -type f -regex '.*/[0-9a-zA-Z_-]+' -printf '%f\n' | LC_ALL=C sort -u)"
+ for file in $PRESTUBS; do
+ for dir in $PRESTUBDIRS; do
+ if [ -f $dir/$file ]; then
+ cat $dir/$file
+ break
+ fi
+ done
+ done
+}
+
gen_ubootenv() {
ENVSTUBDIRS="/etc/flash-kernel/ubootenv.d /usr/share/flash-kernel/ubootenv.d"
ENVSTUBS="$(find $ENVSTUBDIRS -type f -regex '.*/[0-9a-zA-Z_-]+' -printf '%f\n' | LC_ALL=C sort -u)"
@@ -460,6 +473,8 @@ mkimage_script() {
local ubootenv="$(mktemp --tmpdir=$tmpdir)"
gen_ubootenv > $ubootenv
+ local preboot="$(mktemp --tmpdir=$tmpdir)"
+ gen_preboot > $preboot
printf "Generating boot script u-boot image... " >&2
sed -e "s/@@KERNEL_VERSION@@/$kvers/g" \
@@ -468,6 +483,10 @@ mkimage_script() {
-e "/@@UBOOT_ENV_EXTRA@@/{
s/@@UBOOT_ENV_EXTRA@@//g
r $ubootenv
+ }" < $sdata > $tdata \
+ -e "/@@UBOOT_PREBOOT_EXTRA@@/{
+ s/@@UBOOT_PREBOOT_EXTRA@@//g
+ r $preboot
}" < $sdata > $tdata
mkimage -A "$mkarch" -O linux -T script -C none -a "$saddr" -e "$saddr" \
-n "$sdesc" -d "$tdata" "$script" >&2 1>/dev/null
--
2.14.1
--- End Message ---
--- Begin Message ---
Source: flash-kernel
Source-Version: 3.91
We believe that the bug you reported is fixed in the latest version of
flash-kernel, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 873390@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Christian Perrier <bubulle@debian.org> (supplier of updated flash-kernel package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Format: 1.8
Date: Thu, 01 Feb 2018 06:32:56 +0100
Source: flash-kernel
Binary: flash-kernel flash-kernel-installer
Architecture: source
Version: 3.91
Distribution: unstable
Urgency: medium
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Changed-By: Christian Perrier <bubulle@debian.org>
Description:
flash-kernel - utility to make certain embedded devices bootable
flash-kernel-installer - Make the system bootable (udeb)
Closes: 839595 860304 873390 876773 887803
Changes:
flash-kernel (3.91) unstable; urgency=medium
.
[ Vagrant Cascadian ]
* Make ubootenv.d work on CuBox-i. Thanks to Rainer Dorsch.
* Do not install flash-kernel.in.
.
[ Heinrich Schuchardt ]
* flash-kernel: Provide hook to start EFI application (Closes: #873390).
.
[ Vagrant Cascadian ]
* Add support for SolidRun Clearfog Boards (Closes: #839595). Thanks to
Christoph Egger and Joshua Mayer.
* Add support for SolidRun CuBox (dove) (Closes: #876773). Thanks to
Josua Mayer.
* Fix when no Kernel-Flavors are defined (Closes: #887803).
* Add Boot-Kernel-Path-Version and Boot-Initrd-Path-Version to be used
to append the version to the generated kernel/initrd images.
* debian/control: Set Rules-Requires-Root: no.
.
[ Heinrich Schuchardt ]
* flash-kernel: support relative paths for DTB-Id (Closes: #860304).
.
[ Vagrant Cascadian ]
* Add compatibility symlink to dtb in vendor sub-directory.
* Add support for root device specified by PARTLABEL.
.
[ Andre Heider ]
* Add support for multiple scripts sources
.
[ Vagrant Cascadian ]
* Convert Wandboard and CuBox-i to use a shared imx-base plus
uboot-generic boot script.
* Adjust sunxi boot script to prefer prefix variable if defined to set
the locations to search for boot files.
.
[ Updated translations ]
* Tajik (tg.po) by Victor Ibragimov
Checksums-Sha1:
4be42438dd306e0415ef3cf04fad9bbb68f48e5f 1854 flash-kernel_3.91.dsc
6148176507ad6257a4732050f82686f4df0dbc46 71028 flash-kernel_3.91.tar.xz
Checksums-Sha256:
4e2244a6307e720d27bd1ab7a8e553cce981d1e6e7d9162ef293af11ab605562 1854 flash-kernel_3.91.dsc
8a3fa0b0b1476050e60b9cee5b4f4cf36b0d33dd80714e6cf9334ae290df6be1 71028 flash-kernel_3.91.tar.xz
Files:
609ae88d3e66a981f4322bcd59862545 1854 utils optional flash-kernel_3.91.dsc
cc46de9fdf9ad9ed787a4f07bbb59a79 71028 utils optional flash-kernel_3.91.tar.xz
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEE1cL5v8oSi7oip3IYhy9wLE1uJagFAlpyqX8ACgkQhy9wLE1u
JahfZhAAg5EBp596FJjBJ/0Of4sMx8aN8on9VZu7Bw9EZEkWyWirYT+Z1a2vEKTX
ct54ARkC3RhZrfLywf69UJWHwlx8zBwsD0o3SQdu30I3cqdsRIix8JDiQH73rmX/
Yr1suDnE/KxywOzUyosXlYs4sbQNLrklRsrh8zA3zz1uWjDYr5NQVcpvxV/Q1l3H
uLv2E8HK/00WCCQWIn85uZk/0q6smBw/9YJKXJuXlEwv9YzMeA9fqAOjtAhgRTY2
waXM4zzRNCcYMqdPRkJ9M9vP2+hXu0ipjKHlw0SMcxi2vYYiaNt3sr2aBxI4QoKb
2Dy2uGDT6FJ2HarA0qkD0bJX8FCYDixj1jdKDi6tMTidIOzrKkwpfQ9j1hYuWpPq
ehM6A7HLoyhMekU4sqd9PqMHW/OJz1mZ3UiHES8TxWxVfQCwq2nQrgsNPBcZjkP9
CZilNtyLYVW7J8JMlGWTcTuJzRwy34hFUe4lv9MET2GYEtJJ0f7sw/qnhRhTolN5
BDdd96HU2SkZwWdktnEGDLPZaCTcHnNL1lQWyFbTr/cfTA+Oc9PGXmAdNNuBEQaO
SN4kwBQJAOxQxsIRQcJ5zwwGa/Gt1NygLPBH1pDOsfcZpuQKCW/DMTpa3R2JsTKm
dN9XC685Gut+5SJRin3beT4m7xXNmpSKTzMdYob3WE/I7iNBB0s=
=xYZo
-----END PGP SIGNATURE-----
--- End Message ---