Skip to content

Commit

Permalink
scripts: package: adapt to UOS/deepin Secure Boot signing routine
Browse files Browse the repository at this point in the history
Connect to our signing server during build time and sign the kernel image as
it gets installed to the temporary Debian packaging directory.

Co-authored-by: 李成刚 <[email protected]>
Signed-off-by: Mingcong Bai <[email protected]>
Signed-off-by: 李成刚 <[email protected]>
Signed-off-by: Meng Tang <[email protected]>
  • Loading branch information
MingcongBai and Zeno-sole committed Jun 20, 2024
1 parent 1e23d8c commit ac75506
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
38 changes: 38 additions & 0 deletions scripts/package/UEFI-CA-CERT/DEEPIN-UEFI-RSA.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
-----BEGIN CERTIFICATE-----
MIIGtDCCBJygAwIBAgIUDFaHlSuPfmjO99P5tuVXUFTY+6QwDQYJKoZIhvcNAQEL
BQAwgacxCzAJBgNVBAYTAkNOMQ4wDAYDVQQIDAVIdWJlaTEOMAwGA1UEBwwFV3Vo
YW4xKjAoBgNVBAoMIVd1aGFuIERlZXBpbiBUZWNobm9sb2d5IENvLiwgTHRkLjEs
MCoGA1UECwwjU2VjdXJlIEJvb3QgTWFpbnRlbmFuY2UgRGVwYXJ0bWVudC4xHjAc
BgNVBAMMFURlZXBpbiBTZWN1cmUgQm9vdCBDQTAgFw0yMDA2MTAxMjQyNTZaGA8y
MDUwMDYwMzEyNDI1NlowgacxCzAJBgNVBAYTAkNOMQ4wDAYDVQQIDAVIdWJlaTEO
MAwGA1UEBwwFV3VoYW4xKjAoBgNVBAoMIVd1aGFuIERlZXBpbiBUZWNobm9sb2d5
IENvLiwgTHRkLjEsMCoGA1UECwwjU2VjdXJlIEJvb3QgTWFpbnRlbmFuY2UgRGVw
YXJ0bWVudC4xHjAcBgNVBAMMFURlZXBpbiBTZWN1cmUgQm9vdCBDQTCCAiIwDQYJ
KoZIhvcNAQEBBQADggIPADCCAgoCggIBALbB/SCDzsADjCzQ6dRc8AnhS9Th7qNb
Ld3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Qmc/Cdp7IXQGxgPkxyExg9tNGA70uV+S4
xe2ro9qTNjfy0wgMWtLO+WmdVT7OBseAf5e83YU4uB2lH/dyGodyinV58n/QjdSt
DZIuJCLLqKxo168NTY+dyvbcWz/NN6vAZjsx6R/Uhqsh/fCzhy+G7Ay7qJD8s23e
GCy0W6Gb7HQ5+xgChAPWJrfoVXNxPL2AZP4B7SdD3+LbonXB5U5Oh9PGZeTIBEYe
Ypq9YEcG2Gh++hiSAJDkLP0PImh5lk7JRe6DhrbQ+yNTV5hcnsV1YsoGwfqe3nqr
pe3e5PwPrtaOO5Z6F9O4Vir4nnrv5woZjPkSPgRUBbWAjoleWtQ8QsVfo7rcgBJn
o44c7AbLgI2jH7OglI2hlDEtflipJ1GL2aqQlHfgnJF08wEW/fnsbmgL67ULlPdT
9KBNrP/KBynQ0hDpxFWfuAHrUCIznNpUkdajhagv+Bw4kxrbV+wpjxtidZsJGkOr
3W3nN8FG7NyDNPp9PWW773A9J0on0mXZYkpzwQt1GG5iFyxGhEzcyawTeWy6bKNo
DidxLyvBA/ai5GVlvaB7pGbuypTxEUbdOpoRF8j7wwlAOuxT8UGiEQ==
-----END CERTIFICATE-----
26 changes: 26 additions & 0 deletions scripts/package/UEFI-CA-CERT/UOS-UEFI-RSA.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
-----BEGIN CERTIFICATE-----
MIIEbDCCA1SgAwIBAgIQSoLQeFszpJx5UcVgfaWU7zANBgkqhkiG9w0BAQsFADA4
MQswCQYDVQQGEwJDTjEMMAoGA1UECgwDVU9TMRswGQYDVQQDDBJVT1MgQVBQIFNp
Z25pbmcgQ0EwHhcNMjAwMTA4MTEyMzExWhcNMjMwMTA4MTEyMzExWjBfMQswCQYD
VQQGEwJDTjEnMCUGA1UECgwe57uf5L+h6L2v5Lu25oqA5pyv5pyJ6ZmQ5YWs5Y+4
MScwJQYDVQQDDB7nu5/kv6Hova/ku7bmioDmnK/mnInpmZDlhazlj7gwggEiMA0G
CSqG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bP9zlDmnZesYaDtXq/P1zqx85yr
PXIzyqcPm5URsmHlUAhfospvtNSVKNuNiLu2Fdg15jEJU8H/9uyYTOCg2sIZ+qY6
jFLRwq0BLRSSOyJwsWA6RExbLzVQdAQhpEDqtQOxAiw=
-----END CERTIFICATE-----
23 changes: 23 additions & 0 deletions scripts/package/builddeb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,29 @@ install_linux_image () {
esac
cp "$(${MAKE} -s -f ${srctree}/Makefile image_name)" "${pdir}/${installed_image_path}"

# UEFI Secure Boot CA paths.
deepin_uefi_ca="${srctree}/scripts/package/UEFI-CA-CERT/DEEPIN-UEFI-RSA.pem"
uos_uefi_ca="${srctree}/scripts/package/UEFI-CA-CERT/UOS-UEFI-RSA.pem"

# Sign the kernel image.
if [ -f "${srctree}/auto_deepin_sign_kernel" ];then
sbsign \
--swkey \
--ip 10.0.32.114 \
--port 9090 \
--cert "$deepin_uefi_ca" \
--output "${pdir}/${installed_image_path}" \
"${pdir}/${installed_image_path}"
elif [ -f "${srctree}/auto_sign_kernel" ];then
sbsign \
--hwkey 1 \
--ip 10.0.32.114 \
--port 8080 \
--cert "$uos_uefi_ca" \
--output "${pdir}/${installed_image_path}" \
"${pdir}/${installed_image_path}"
fi

# Install the maintainer scripts
# Note: hook scripts under /etc/kernel are also executed by official Debian
# kernel packages, as well as kernel packages built using make-kpkg.
Expand Down

0 comments on commit ac75506

Please sign in to comment.