| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
With some versions of the compiler, the _cleanup_ attr makes it think
the variable might be freed/closed when uninitialized, even though it
cannot happen. The added cost is small enough to be worth the benefit,
and optimized builds will help reduce it even further.
(cherry picked from commit c2b2df604b845b4e1697d0911935e6644323c5a6)
|
|
|
|
| |
Follow-up for e39288193fcdf3a36dbc49b78e6c9bf86a764e31.
|
|
|
|
| |
an error message
|
|
|
|
|
|
| |
These were added to eficonex.h in gnu-efi 3.0.13. Let's move them
to missing_efi.h behind an appropriate guard to fix the build with
recent versions of gnu-efi.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
The firmware spec doesn't really say whether FilePath of the LoadedImage
protocol may be NULL or not. So far we assumed it to be non-NULL, but
apparently the FreeBSD UEFI chainloader sets it to NULL. Handle this
gracefully.
(Noticed and tracked down by Alexander Schreiber)
Fixes: #18733
|
|
|
|
|
|
|
|
|
| |
As suggested in https://github.com/systemd/systemd/pull/11484#issuecomment-775288617.
This does not touch anything exposed in src/systemd. Changing the defines there
would be a compatibility break.
Note that tests are broken after this commit. They will be fixed in the next one.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
sd-boot has a copy of a subset of codes from libbasic. This makes
sd-boot share the code with libbasic, and dedup the code.
Note, startswith_no_case() is dropped from sd-boot, as
- it is not used,
- the previous implementation is not correct,
- gnu-efi does not have StrniCmp() or so.
|
|
|
|
|
|
| |
To add secure-boot enrolling support, we need to be able to specify
the EFI_VARIABLE_APPEND_WRITE flag so let's make the efivar_set()
methods more generic so we can set that flag.
|
|
|
|
| |
Adapted from string-util
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
These are implemented as bit-shifting functions that allow reading
and writing UEFI variables stored as little endian 64-bit unsigned
values.
|
|
|
|
|
| |
Let's clearly indicate that these are used to set/get uints that
are stored as strings.
|
| |
|
| |
|
|
|
|
|
|
|
| |
Let's make these functions a little more generic so we can have
them work on more than one GUID. More specifically, this allows
using them with the global guid which will be used a bit more to
extend the secure boot support.
|
|
|
|
|
| |
Avoids having to use the address operator all the time and
avoids having to cast or do other unintuitive stuff.
|
|
|
|
|
|
|
|
|
| |
Instead of using -nostdinc, we use -nostdlib. This is necessary
to allow moving to C99 as efibind.h includes stdint.h when C99
is enabled. It isn't necessarily problematic to use some standard
library headers as long as they don't contain functions defined in
libc or another system library (or in other words, header only
headers are fine to use in sd-boot).
|
| |
|
|
|
|
|
| |
Let's make all headers self-sufficient by including the necessary
EFI headers in the headers themselves.
|
| |
|
|
|
|
|
|
| |
Even though many of those scripts are very simple, it is easier to include
the header than to try to say whether each of those files is trivial enough
not to require one.
|
|
|
|
| |
Closes CID#1438933.
|
|
|
|
| |
Support gcc 8 on arm
|
| |
|
|
|
|
|
|
|
|
| |
There is no spdx tag defined for those versions of "public domain", but we can
add a custom tag, see
https://spdx.github.io/spdx-spec/6-other-licensing-information-detected/.
crc32.h is updated to match crc32.c.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I added the header in the cases where the license text is present and it is
easy to find the appropriate SPDX header.
For "public domain" stuff: SDPX treats each "public domain" license as unique [1],
but luckily the one in siphash24.c is one of the identified variants. There are
some other cases which specify "public domain" but there doesn't seem to be a
SPDX identifier.
[1] https://wiki.spdx.org/view/Legal_Team/Decisions/Dealing_with_Public_Domain_within_SPDX_Files
gunicode.[ch] are imported from glib, which is licensed as LGPL2.1+,
see https://gitlab.gnome.org/GNOME/glib/-/blob/master/glib/gunicode.h.
|
| |
|
|
|
|
|
|
|
| |
Functions that accept no arguments should be
explicitly declared a void parameter in their parameter list.
Signed-off-by: Marco Wang <m.aesophor@gmail.com>
|
|
|
|
|
|
|
|
|
| |
The key macros added in commit 6fe95d3020 look strange at first sight.
Add a comment with just the tablet name after each line, so that it's
obvious that these lines address device-specific issues of the EFI
firmware, and not broken/old code.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a key is pressed, the EFI firmware gives us a 64-bit word that
contains the modifier key code in the upper 32 bits, the scan code in
the middle 16 bits, and a unicode character in the low 16 bits.
Some bogus EFI firmwares will put the unicode character in the scan code
area, for instance on the EZpad mini 4s tablet.
Others will even put the unicode character in both the scan code and
unicode areas. This is the case for instance on the Teclast X98+ II
tablet.
Add workarounds for these corner cases, only for the carriage return key
right now. Some more workarounds may be needed, e.g. for volume keys,
but I cannot test it.
Partially fixes #8466.
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
|
|
|
|
|
|
| |
systemd-boot selects the last valid entry by default, not the first.
Fixes: #15256
|
|
|
|
|
|
| |
Based on a report from Fossies.org using Codespell.
Followup to #15436
|
|
|
|
|
| |
This is sometimes slightly more convenient to use
and is also what GRUB supports.
|
|
|
|
|
|
| |
$ perl -i -0pe 's|\s+{\n([^\n]*;)\n\s+}\n|\n\1\n|gms' **/*.c
Inspired by ea7cbf5bdd68d7861ebf1570c439e8bbabd83f6c.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
ARM toolchains will sometimes optimize otherwise floating-point-free
code with floating point and SIMD instructions. This was happening with
systemd-bootarm.efi and it was causing U-Boot to crash and reset the
CPU. U-Boot does not support the ARM VFP floating point coprocessor,
which is an optional piece of hardware anyway [1].
Ensure the compiler does not generate FP/SIMD instructions by supplying
the `-mgeneral-regs-only` option when building for ARM [2].
The other option you often see to solve these problems is
`-msoft-float`, but that changes the ABI and prevents linking with
libgnuefi.
[1] https://lists.denx.de/pipermail/u-boot/2011-February/087736.html
[2] https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html#index-mgeneral-regs-only-1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fixes systemd build in Fedora rawhide.
The old ldsdir option is not useful, because both the directory and the
file name changed. Let's remove the option and try to autodetect the file
name. If this turns out to be not enough, a new option to simply specify
the full path to the file can be added.
F31:
efi arch: x86_64
EFI machine type: x64
EFI CC ccache cc
EFI lds: /usr/lib64/gnuefi/elf_x64_efi.lds
EFI crt0: /usr/lib64/gnuefi/crt0-efi-x64.o
EFI include directory: /usr/include/efi
F32:
efi arch: x86_64
EFI machine type: x64
EFI CC ccache cc
EFI lds: /usr/lib/gnuefi/x64/efi.lds
EFI crt0: /usr/lib/gnuefi/x64/crt0.o
EFI include directory: /usr/include/efi
|
| |
|
| |
|
|\
| |
| | |
boot: parse random-seed-mode
|
| |
| |
| |
| | |
Fixes #14657.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
```
ninja -C build
ninja: Entering directory `build'
[29/101] Generating systemd_boot.so with a custom command.
FAILED: src/boot/efi/systemd_boot.so
/usr/bin/ld -o src/boot/efi/systemd_boot.so -T /usr/lib64/gnuefi/elf_x64_efi.lds -shared -Bsymbolic -nostdlib -znocombreloc -L /usr/lib64 /usr/lib64/gnuefi/crt0-efi-x64.o src/boot/efi/disk.c.o src/boot/efi/graphics.c.o src/boot/efi/measure.c.o src/boot/efi/pe.c.o src/boot/efi/util.c.o src/boot/efi/boot.c.o src/boot/efi/console.c.o src/boot/efi/crc32.c.o src/boot/efi/random-seed.c.o src/boot/efi/sha256.c.o src/boot/efi/shim.c.o -lefi -lgnuefi /usr/lib/gcc/x86_64-redhat-linux/10/libgcc.a
/usr/bin/ld: src/boot/efi/graphics.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
/usr/bin/ld: src/boot/efi/pe.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
/usr/bin/ld: src/boot/efi/util.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
/usr/bin/ld: src/boot/efi/boot.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
/usr/bin/ld: src/boot/efi/console.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
/usr/bin/ld: src/boot/efi/random-seed.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
/usr/bin/ld: src/boot/efi/shim.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: multiple definition of `loader_guid'; src/boot/efi/disk.c.o:/home/sus/tt/systemd/build/../src/boot/efi/util.h:58: first defined here
[31/101] Generating stub.c.o with a custom command.
ninja: build stopped: subcommand failed.
make: *** [Makefile:2: all] Error 1
```
|
|
|
|
|
|
| |
let's check VERSION instead of VERSION_ID where appropriate.
Fixes: #14493
|
|\
| |
| | |
boot: Fix default/oneshot selection for EFISTUB entries
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Make two minor cosmetic changes to how config_entry_add_linux() extracts
OS information from the embedded /etc/os-release in EFISTUB binaries.
This increases the detail of information available to the user for
EFISTUB entries.
* entry->version, which was previously always null, is now set to the
value of VERSION, or VERSION_ID, or BUILD_ID (preferred in that order).
* entry->title, which was previously set to the value of PRETTY_NAME, can
now fall back to NAME or ID if PRETTY_NAME is not present. In that case,
NAME is preferred over ID.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Change config_entry_add_from_file() so that it does not remove the
`.conf` ending from the filename that it uses for entry->id. This is
necessary because otherwise an EFISTUB binary and a loader config entry
might end up with the same ID, as the loader config IDs previously
didn't include the config filename's .conf extension (see boot.c:1435).
Consider, for instance, an EFISTUB /EFI/Linux/linux.efi and a loader
config /loader/entries/linux.efi.conf; both would have the ID linux.efi.
In addition, update a comment that previously stated that IDs are
non-unique (which is no longer the case, as of this commit).
|
| |
| |
| |
| |
| | |
To further increase similarity with loader configs and provide global
uniqueness, ignore filenames starting with auto- (see boot.c:1512).
|