sys-kernel/gentoo-kernel-bin: set SECUREBOOT_SIGN_CERT to used cert

For these builds we use the same key for modules, kernel image and
UKI. Therefore, certs/signing_key.x509 is the certificate that was
used for secureboot signing and we can thus use it to verify in
kernel-install.eclass that the signing was successful and to remove
padding if required.

Signed-off-by: Nowa Ammerlaan <nowa@gentoo.org>
This commit is contained in:
Nowa Ammerlaan
2025-09-11 22:06:24 +02:00
parent d7cab7329f
commit c8860a2542
21 changed files with 168 additions and 0 deletions

View File

@@ -152,6 +152,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -152,6 +152,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -152,6 +152,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -152,6 +152,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -157,6 +157,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -157,6 +157,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -157,6 +157,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -157,6 +157,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -152,6 +152,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -152,6 +152,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -157,6 +157,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -157,6 +157,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -157,6 +157,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -157,6 +157,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -157,6 +157,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -152,6 +152,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -152,6 +152,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -152,6 +152,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -157,6 +157,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -157,6 +157,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.

View File

@@ -157,6 +157,14 @@ src_configure() {
local image="${kernel_dir}/$(dist-kernel_get_image_path)"
local uki="${image%/*}/uki.efi"
# Override user variable with the cert used during build
openssl x509 \
-inform DER -in "${kernel_dir}/certs/signing_key.x509" \
-outform PEM -out "${T}/cert.pem" ||
die "Failed to convert pcrpkey to PEM format"
export SECUREBOOT_SIGN_CERT=${T}/cert.pem
if [[ -s ${uki} ]]; then
# We need to extract the plain image for the test phase
# and USE=-generic-uki.