From: "Quirin Gylstorff" <quirin.gylstorff@siemens.com>
To: Jan.Kiszka@siemens.com, cip-dev@lists.cip-project.org
Cc: Quirin Gylstorff <quirin.gylstorff@siemens.com>
Subject: [cip-dev][isar-cip-core][PATCH 2/2] secure-boot: Move image-uuid to own file
Date: Mon, 1 Feb 2021 17:24:25 +0100 [thread overview]
Message-ID: <20210201162425.31726-3-Quirin.Gylstorff@siemens.com> (raw)
In-Reply-To: <20210201162425.31726-1-Quirin.Gylstorff@siemens.com>
[-- Attachment #1: Type: text/plain, Size: 2995 bytes --]
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
/etc/os-release is controlled by the Debian Package base-files
and will be silently overwritten if the package updates the file.
Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
classes/image_uuid.bbclass | 4 +---
.../initramfs-config/files/initramfs.image_uuid.hook | 6 +++---
.../initramfs-config/files/secure-boot-debian-local-patch | 4 ++--
3 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/classes/image_uuid.bbclass b/classes/image_uuid.bbclass
index 2813ed9..a0ab202 100644
--- a/classes/image_uuid.bbclass
+++ b/classes/image_uuid.bbclass
@@ -22,9 +22,7 @@ IMAGE_UUID ?= "${@generate_image_uuid(d)}"
do_generate_image_uuid[vardeps] += "IMAGE_UUID"
do_generate_image_uuid[depends] = "buildchroot-target:do_build"
do_generate_image_uuid() {
- sudo sed -i '/^IMAGE_UUID=.*/d' '${IMAGE_ROOTFS}/etc/os-release'
- echo "IMAGE_UUID=\"${IMAGE_UUID}\"" | \
- sudo tee -a '${IMAGE_ROOTFS}/etc/os-release'
+ sudo sh -c 'echo "IMAGE_UUID=\"${IMAGE_UUID}\"" > "${IMAGE_ROOTFS}/etc/secureboot-image-uuid"'
image_do_mounts
# update initramfs to add uuid
diff --git a/recipes-support/initramfs-config/files/initramfs.image_uuid.hook b/recipes-support/initramfs-config/files/initramfs.image_uuid.hook
index 910ce84..bf39abb 100644
--- a/recipes-support/initramfs-config/files/initramfs.image_uuid.hook
+++ b/recipes-support/initramfs-config/files/initramfs.image_uuid.hook
@@ -22,12 +22,12 @@ esac
. /usr/share/initramfs-tools/scripts/functions
. /usr/share/initramfs-tools/hook-functions
-if [ ! -e /etc/os-release ]; then
- echo "Warning: couldn't find /etc/os-release!"
+if [ ! -e /etc/secureboot-image-uuid ]; then
+ echo "Warning: couldn't find /etc/secureboot-image-uuid!"
exit 0
fi
-IMAGE_UUID=$(sed -n 's/^IMAGE_UUID="\(.*\)"/\1/p' /etc/os-release)
+IMAGE_UUID=$(sed -n 's/^IMAGE_UUID="\(.*\)"/\1/p' /etc/secureboot-image-uuid)
echo "${IMAGE_UUID}" > "${DESTDIR}/conf/image_uuid"
exit 0
\ No newline at end of file
diff --git a/recipes-support/initramfs-config/files/secure-boot-debian-local-patch b/recipes-support/initramfs-config/files/secure-boot-debian-local-patch
index cd2d271..82d325a 100644
--- a/recipes-support/initramfs-config/files/secure-boot-debian-local-patch
+++ b/recipes-support/initramfs-config/files/secure-boot-debian-local-patch
@@ -58,8 +58,8 @@
+ # Mount root
+ # shellcheck disable=SC2086
+ if mount ${roflag} ${FSTYPE:+-t "${FSTYPE}"} ${ROOTFLAGS} "${ROOT}" "${rootmnt?}"; then
-+ if [ -e "${rootmnt?}"/etc/os-release ]; then
-+ image_uuid=$(sed -n 's/^IMAGE_UUID=//p' "${rootmnt?}"/etc/os-release | tr -d '"' )
++ if [ -e "${rootmnt?}"/etc/secureboot-image-uuid ]; then
++ image_uuid=$(sed -n 's/^IMAGE_UUID=//p' "${rootmnt?}"/etc/secureboot-image-uuid | tr -d '"' )
+ if [ "${INITRAMFS_IMAGE_UUID}" = "${image_uuid}" ]; then
+ return 0
+ fi
--
2.20.1
[-- Attachment #2: Type: text/plain, Size: 420 bytes --]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6157): https://lists.cip-project.org/g/cip-dev/message/6157
Mute This Topic: https://lists.cip-project.org/mt/80289768/4520388
Group Owner: cip-dev+owner@lists.cip-project.org
Unsubscribe: https://lists.cip-project.org/g/cip-dev/leave/8129055/727948398/xyzzy [cip-dev@archiver.kernel.org]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2021-02-01 16:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 16:24 [cip-dev][isar-cip-core][PATCH 0/2] Secureboot fixes Quirin Gylstorff
2021-02-01 16:24 ` [cip-dev][isar-cip-core][PATCH 1/2] swupdate: Secure-boot fix paths Quirin Gylstorff
2021-02-01 16:24 ` Quirin Gylstorff [this message]
2021-02-01 16:47 ` [cip-dev][isar-cip-core][PATCH 2/2] secure-boot: Move image-uuid to own file Jan Kiszka
2021-02-03 8:13 ` Quirin Gylstorff
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210201162425.31726-3-Quirin.Gylstorff@siemens.com \
--to=quirin.gylstorff@siemens.com \
--cc=Jan.Kiszka@siemens.com \
--cc=cip-dev@lists.cip-project.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).