Initial Commit
- initial default booting image
This commit is contained in:
51
boot/shim/0001-Fix-build-with-binutils-2.46.patch
Normal file
51
boot/shim/0001-Fix-build-with-binutils-2.46.patch
Normal file
@@ -0,0 +1,51 @@
|
||||
From c4665d282072df2ed8ab6ae1d5fa0de41e5db02f Mon Sep 17 00:00:00 2001
|
||||
From: Luca Boccassi <luca.boccassi@gmail.com>
|
||||
Date: Tue, 6 Jan 2026 11:48:13 +0100
|
||||
Subject: [PATCH] Fix build with binutils 2.46
|
||||
|
||||
With the new binutils which is in development and in Fedora Rawhide:
|
||||
|
||||
objcopy -D -j .text -j .sdata -j .data -j .data.ident \
|
||||
-j .dynamic -j .rodata -j .rel* \
|
||||
-j .rela* -j .dyn -j .reloc -j .eh_frame \
|
||||
-j .vendor_cert -j .sbat -j .sbatlevel \
|
||||
--file-alignment 0x1000 \
|
||||
--target efi-app-x86_64 fbx64.so fbx64.efi
|
||||
objcopy: fbx64.so: file format not recognized
|
||||
|
||||
It seems it was an intentional compat break, according to the upstream
|
||||
commit:
|
||||
|
||||
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=5e83077d552ed6f81dbc092eb3ccf827a43de42c
|
||||
|
||||
* Internal changes to plugin support, and stricter target checking may result
|
||||
in some errors being exposed in user options passed to the various binutils.
|
||||
For example objcopy --target=TARGET now will only work if the input file is
|
||||
for TARGET whereas prior versions of objcopy accepted other target input
|
||||
files and produced a TARGET output. If you do in fact want the old
|
||||
behaviour the correct usage is objcopy --output-target=TARGET.
|
||||
|
||||
Switch from --taget to --output-target as suggested.
|
||||
|
||||
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
|
||||
|
||||
Upstream: https://github.com/rhboot/shim/commit/c4665d282072df2ed8ab6ae1d5fa0de41e5db02f
|
||||
|
||||
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
|
||||
---
|
||||
Make.defaults | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Make.defaults b/Make.defaults
|
||||
index c5fa32bec..9b40b7f4a 100644
|
||||
--- a/Make.defaults
|
||||
+++ b/Make.defaults
|
||||
@@ -155,7 +155,7 @@ endif
|
||||
|
||||
LIB_GCC = $(shell $(CC) $(ARCH_CFLAGS) -print-libgcc-file-name)
|
||||
EFI_LIBS = -lefi -lgnuefi --start-group Cryptlib/libcryptlib.a Cryptlib/OpenSSL/libopenssl.a --end-group $(LIB_GCC)
|
||||
-FORMAT ?= --target efi-app-$(ARCH)
|
||||
+FORMAT ?= --output-target efi-app-$(ARCH)
|
||||
LOCAL_EFI_PATH = gnu-efi/$(ARCH_GNUEFI)/gnuefi
|
||||
LIBDIR = gnu-efi/$(ARCH_GNUEFI)/lib
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
From 7aee873d6f6b0737dfe566fc8c5cd4eaada9bd5e Mon Sep 17 00:00:00 2001
|
||||
From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
Date: Mon, 8 Apr 2024 11:56:06 +0200
|
||||
Subject: [PATCH] cmac.c: optimize make_kn and move zero_iv to const segment.
|
||||
|
||||
Backport
|
||||
https://github.com/openssl/openssl/commit/03cf7e784caa4c61febbf249be63cbae3e368ac9
|
||||
to fix the following k1 stringop-overflow:
|
||||
|
||||
In function 'make_kn',
|
||||
inlined from 'make_kn' at crypto/cmac/cmac.c:81:13,
|
||||
inlined from 'CMAC_Init' at crypto/cmac/cmac.c:205:9:
|
||||
crypto/cmac/cmac.c:92:20: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=]
|
||||
92 | k1[bl - 1] ^= bl == 16 ? 0x87 : 0x1b;
|
||||
| ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
crypto/cmac/cmac.c: In function 'CMAC_Init':
|
||||
crypto/cmac/cmac.c:69:19: note: at offset [-2147483649, -1] into destination object 'k1' of size 32
|
||||
69 | unsigned char k1[EVP_MAX_BLOCK_LENGTH];
|
||||
| ^~
|
||||
|
||||
Fixes:
|
||||
- http://autobuild.buildroot.org/results/97b6333cdc7bad24aba7af1b04890679e0058299
|
||||
|
||||
Upstream: https://github.com/rhboot/shim/pull/652
|
||||
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
|
||||
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
|
||||
---
|
||||
Cryptlib/OpenSSL/crypto/cmac/cmac.c | 17 ++++++++---------
|
||||
1 file changed, 8 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/Cryptlib/OpenSSL/crypto/cmac/cmac.c b/Cryptlib/OpenSSL/crypto/cmac/cmac.c
|
||||
index 2954b6eb..27dbfaac 100644
|
||||
--- a/Cryptlib/OpenSSL/crypto/cmac/cmac.c
|
||||
+++ b/Cryptlib/OpenSSL/crypto/cmac/cmac.c
|
||||
@@ -78,18 +78,17 @@ struct CMAC_CTX_st {
|
||||
|
||||
/* Make temporary keys K1 and K2 */
|
||||
|
||||
-static void make_kn(unsigned char *k1, unsigned char *l, int bl)
|
||||
+static void make_kn(unsigned char *k1, const unsigned char *l, int bl)
|
||||
{
|
||||
int i;
|
||||
+ unsigned char c = l[0], carry = c>>7, cnext;
|
||||
+
|
||||
/* Shift block to left, including carry */
|
||||
- for (i = 0; i < bl; i++) {
|
||||
- k1[i] = l[i] << 1;
|
||||
- if (i < bl - 1 && l[i + 1] & 0x80)
|
||||
- k1[i] |= 1;
|
||||
- }
|
||||
+ for (i = 0; i < bl-1; i++, c = cnext)
|
||||
+ k1[i] = (c << 1) | ((cnext=l[i+1]) >> 7);
|
||||
+
|
||||
/* If MSB set fixup with R */
|
||||
- if (l[0] & 0x80)
|
||||
- k1[bl - 1] ^= bl == 16 ? 0x87 : 0x1b;
|
||||
+ k1[i] = (c << 1) ^ ((0-carry)&(bl==16?0x87:0x1b));
|
||||
}
|
||||
|
||||
CMAC_CTX *CMAC_CTX_new(void)
|
||||
@@ -151,7 +150,7 @@ int CMAC_CTX_copy(CMAC_CTX *out, const CMAC_CTX *in)
|
||||
int CMAC_Init(CMAC_CTX *ctx, const void *key, size_t keylen,
|
||||
const EVP_CIPHER *cipher, ENGINE *impl)
|
||||
{
|
||||
- static unsigned char zero_iv[EVP_MAX_BLOCK_LENGTH];
|
||||
+ static const unsigned char zero_iv[EVP_MAX_BLOCK_LENGTH] = {0};
|
||||
#ifdef OPENSSL_FIPS
|
||||
if (FIPS_mode()) {
|
||||
/* If we have an ENGINE need to allow non FIPS */
|
||||
--
|
||||
2.47.3
|
||||
|
||||
25
boot/shim/Config.in
Normal file
25
boot/shim/Config.in
Normal file
@@ -0,0 +1,25 @@
|
||||
config BR2_PACKAGE_SHIM_ARCH_SUPPORTS
|
||||
bool
|
||||
default y if BR2_aarch64
|
||||
default y if BR2_arm
|
||||
default y if BR2_i386
|
||||
default y if BR2_x86_64
|
||||
# it includes gnu-efi
|
||||
depends on BR2_PACKAGE_GNU_EFI_ARCH_SUPPORTS
|
||||
|
||||
config BR2_TARGET_SHIM
|
||||
bool "shim"
|
||||
depends on BR2_PACKAGE_SHIM_ARCH_SUPPORTS
|
||||
help
|
||||
Boot loader to chain-load signed boot loaders under Secure
|
||||
Boot.
|
||||
|
||||
This package provides a minimalist boot loader which allows
|
||||
verifying signatures of other UEFI binaries against either
|
||||
the Secure Boot DB/DBX or against a built-in signature
|
||||
database. Its purpose is to allow a small,
|
||||
infrequently-changing binary to be signed by the UEFI CA,
|
||||
while allowing an OS distributor to revision their main
|
||||
bootloader independently of the CA.
|
||||
|
||||
https://github.com/rhboot/shim
|
||||
3
boot/shim/shim.hash
Normal file
3
boot/shim/shim.hash
Normal file
@@ -0,0 +1,3 @@
|
||||
# locally computed hash
|
||||
sha256 46319cd228d8f2c06c744241c0f342412329a7c630436fce7f82cf6936b1d603 shim-16.1.tar.bz2
|
||||
sha256 15edf527919ddcb2f514ab9d16ad07ef219e4bb490e0b79560be510f0c159cc2 COPYRIGHT
|
||||
38
boot/shim/shim.mk
Normal file
38
boot/shim/shim.mk
Normal file
@@ -0,0 +1,38 @@
|
||||
################################################################################
|
||||
#
|
||||
# shim
|
||||
#
|
||||
################################################################################
|
||||
|
||||
SHIM_VERSION = 16.1
|
||||
SHIM_SITE = https://github.com/rhboot/shim/releases/download/$(SHIM_VERSION)
|
||||
SHIM_SOURCE = shim-$(SHIM_VERSION).tar.bz2
|
||||
SHIM_LICENSE = BSD-2-Clause
|
||||
SHIM_LICENSE_FILES = COPYRIGHT
|
||||
SHIM_CPE_ID_VENDOR = redhat
|
||||
SHIM_INSTALL_TARGET = NO
|
||||
SHIM_INSTALL_IMAGES = YES
|
||||
|
||||
SHIM_CFLAGS = $(TARGET_CFLAGS)
|
||||
SHIM_MAKE_OPTS = \
|
||||
ARCH="$(GNU_EFI_PLATFORM)" \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
DASHJ="-j$(PARALLEL_JOBS)" \
|
||||
OPTIMIZATIONS="$(SHIM_CFLAGS)"
|
||||
|
||||
# shim has some assembly function that is not present in Thumb mode:
|
||||
# Error: selected processor does not support `mrc p15,0,r2,c9,c13,0' in Thumb mode
|
||||
# so, we deactivate Thumb mode
|
||||
ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
|
||||
SHIM_CFLAGS += -marm
|
||||
endif
|
||||
|
||||
define SHIM_BUILD_CMDS
|
||||
$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) $(SHIM_MAKE_OPTS)
|
||||
endef
|
||||
|
||||
define SHIM_INSTALL_IMAGES_CMDS
|
||||
$(INSTALL) -m 0755 -t $(BINARIES_DIR) $(@D)/*.efi
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
Reference in New Issue
Block a user