Vendor the Gummiboot UEFI stub loader

This commit is contained in:
Andrew J. Hesford 2023-10-22 08:58:22 -04:00
parent 88ed75a419
commit 7b350454a9
11 changed files with 639 additions and 629 deletions

View File

@ -1,94 +1,94 @@
Copyright (C) 2020 Dimitar Toshkov Zhekov,
with Reserved Font Name "Terminus Font".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Copyright (C) 2020 Dimitar Toshkov Zhekov,
with Reserved Font Name "Terminus Font".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@ -16,6 +16,8 @@ use File::Path qw(make_path remove_tree);
use File::Glob qw(:globally :nocase);
use Sort::Versions;
use Cwd qw(getcwd abs_path);
use Pod::Usage qw(pod2usage);
use Data::Dumper;
@ -734,13 +736,23 @@ sub createUEFIBundle {
exit 1;
}
} else {
# For now, default stub locations are x86_64 only
my @uefi_stub_defaults = qw(
/usr/lib/gummiboot/linuxx64.efi.stub
/usr/lib/systemd/boot/efi/linuxx64.efi.stub
);
my @uefi_stub_locations;
foreach my $stubloc (@uefi_stub_defaults) {
# Default stub locations come from ZFSBootMenu module root
foreach my $bpath ( ( getcwd, dirname(__FILE__) ) ) {
foreach my $broot (qw(. .. ../share)) {
my $rpath = join( '/', $bpath, $broot, 'zfsbootmenu', 'stub' );
my $apath = abs_path( $rpath );
push( @uefi_stub_locations, $apath ) if ( defined $apath and -d $apath );
}
}
# Fallback stub locations come from gummiboot or systemd-boot
push( @uefi_stub_locations, qw(/usr/lib/gummiboot /usr/lib/systemd/boot/efi) );
# For now, default stub locations are x86_64 only
foreach my $stubdir (@uefi_stub_locations) {
my $stubloc = join( '/', $stubdir, 'linuxx64.efi.stub' );
if ( -f $stubloc ) {
$uefi_stub = $stubloc;
last;
@ -749,7 +761,7 @@ sub createUEFIBundle {
unless ( defined $uefi_stub and -f $uefi_stub ) {
print "Unable to find UEFI stub loader at default locations:\n";
foreach my $stubloc (@uefi_stub_defaults) {
foreach my $stubloc (@uefi_stub_locations) {
print " $stubloc\n";
}
exit 1;

View File

@ -120,9 +120,10 @@ The remaining keys in the ``EFI`` section allow control over where and how UEFI
replacing its ``.EFI`` extension with ``-backup.EFI`` to provide a fallback.
* ``Stub`` specifies the location of the UEFI stub loader required when creating a bundled executable. Both ``gummiboot``
and its descendant ``systemd-boot`` provide stub loaders; ``gummiboot``, for example, tends to store the loader at
``/usr/lib/gummiboot/linuxx64.efi.stub``. If this key is omitted (as it is by default), ``dracut`` will attempt to
find either the ``systemd-boot`` or ``gummiboot`` version at their expected locations. This key is useful when
automatic detection fails.
``/usr/lib/gummiboot/linuxx64.efi.stub``. If this key is omitted (as it is by default), ``generate-zbm`` will attempt
to first find a copy of the stub loader shipped and installed with ZFSBootMenu, falling back to either of the
``systemd-boot`` or ``gummiboot`` versions at their expected locations. This key is useful when automatic detection
fails.
In addition, two options in the ``Kernel`` section of the configuration file are used during bundle creation:

View File

@ -13,10 +13,6 @@ Install ZFSBootMenu
.. group-tab:: Package
.. code-block::
xbps-install -S zfsbootmenu gummiboot-efistub
.. include:: ../_include/configure-gen-zbm.rst
.. include:: ../_include/gen-initramfs.rst

View File

@ -181,9 +181,9 @@ In addition, ``generate-zbm`` requires a few Perl modules:
* `perl boolean <https://metacpan.org/pod/boolean>`_
If you will create unified EFI executables (which bundles the kernel, initramfs and command line), you will also need a
an EFI stub loader, which is typically included with
`systemd-boot <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`_ or
`gummiboot <https://pkgs.alpinelinux.org/package/edge/main/x86/gummiboot>`_.
an EFI stub loader. ZFSBootMenu includes a version of the stub loader from
`gummiboot <https://pkgs.alpinelinux.org/package/edge/main/x86/gummiboot>`_, but other loaders may be used (for example,
the stub included with `systemd-boot <https://www.freedesktop.org/wiki/Software/systemd/systemd-boot/>`_).
Most or all of these software components may be available as packages in your distribution.

View File

@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
.TH "GENERATE-ZBM" "5" "2023-10-13" "" "ZFSBootMenu"
.TH "GENERATE-ZBM" "5" "2023-10-22" "" "ZFSBootMenu"
.SH NAME
generate-zbm \- configuration file for generate-zbm
.SH SYNOPSIS
@ -211,7 +211,7 @@ Behaves similarly to \fIComponents.Versions\fP, but acts on files matching the U
\fBStub\fP
.INDENT 0.0
.INDENT 3.5
The path to the EFI stub loader used to boot the unified bundle. If not set, a default of \fB/usr/lib/gummiboot/linuxx64.efi.stub\fP is assumed.
The path to the EFI stub loader used to boot the unified bundle. If not set, \fBgenerate\-zbm\fP will try to find the stub loader included with ZFSBootMenu or provided by either gummiboot or systemd\-boot.
.UNINDENT
.UNINDENT
.SH EXAMPLE

View File

@ -131,7 +131,7 @@ EFI
**Stub**
The path to the EFI stub loader used to boot the unified bundle. If not set, a default of ``/usr/lib/gummiboot/linuxx64.efi.stub`` is assumed.
The path to the EFI stub loader used to boot the unified bundle. If not set, **generate-zbm** will try to find the stub loader included with ZFSBootMenu or provided by either gummiboot or systemd-boot.
EXAMPLE
=======

View File

@ -108,7 +108,7 @@ EFI=0
SERDEV_COUNT=0
GENZBM_FLAGS=()
MISER=0
EFISTUB="$( realpath -e stubs/linuxx64.efi.stub )"
EFISTUB="$( realpath -e ../zfsbootmenu/stub/linuxx64.efi.stub )"
# Defer a choice on initramfs generator until options are parsed
DRACUT=0

View File

@ -265,13 +265,13 @@ fi
if ((YAML)) ; then
echo "Configuring local.yaml"
yamlconf="${TESTDIR}/local.yaml"
STUBS="$(realpath -e stubs)"
STUBDIR="$(realpath -e ../zfsbootmenu/stub)"
cp ../etc/zfsbootmenu/config.yaml "${yamlconf}"
yq-go eval ".Components.ImageDir = \"${TESTDIR}\"" -i "${yamlconf}"
yq-go eval ".Components.Versions = false" -i "${yamlconf}"
yq-go eval ".EFI.ImageDir = \"${TESTDIR}\"" -i "${yamlconf}"
yq-go eval ".EFI.Versions = false" -i "${yamlconf}"
yq-go eval ".EFI.Stub = \"${STUBS}/linuxx64.efi.stub\"" -i "${yamlconf}"
yq-go eval ".EFI.Stub = \"${STUBDIR}/linuxx64.efi.stub\"" -i "${yamlconf}"
yq-go eval ".Global.ManageImages = true" -i "${yamlconf}"
yq-go eval ".Global.DracutConfDir = \"${TESTDIR}/dracut.conf.d\"" -i "${yamlconf}"
yq-go eval ".Global.PreHooksDir = \"${TESTDIR}/generate-zbm.pre.d\"" -i "${yamlconf}"