From: "Quirin Gylstorff" <quirin.gylstorff@siemens.com>
To: Jan Kiszka <jan.kiszka@siemens.com>, cip-dev@lists.cip-project.org
Subject: Re: [cip-dev][isar-cip-core][PATCH 2/2] secure-boot: Move image-uuid to own file
Date: Wed, 3 Feb 2021 09:13:57 +0100 [thread overview]
Message-ID: <12726656-327d-0891-c04b-1fae5e1e1951@siemens.com> (raw)
In-Reply-To: <9c928bf2-092b-a032-d981-b84850ce4249@siemens.com>
[-- Attachment #1: Type: text/plain, Size: 3570 bytes --]
On 2/1/21 5:47 PM, Jan Kiszka wrote:
> On 01.02.21 17:24, Q. Gylstorff wrote:
>> 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
>>
>
> This one would work, though, if we fixed
> https://groups.google.com/d/msgid/isar-users/67e1fac9-5af5-29aa-de57-9a0de0cdd165%40siemens.com
> in Isar, right? Should we rather wait for that?
At the moment I would say yes, wait for it.
Quirin
>
> Applied patch 1 for now.
>
> Jan
>
[-- Attachment #2: Type: text/plain, Size: 420 bytes --]
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#6160): https://lists.cip-project.org/g/cip-dev/message/6160
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]
-=-=-=-=-=-=-=-=-=-=-=-
prev parent reply other threads:[~2021-02-03 8:14 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 ` [cip-dev][isar-cip-core][PATCH 2/2] secure-boot: Move image-uuid to own file Quirin Gylstorff
2021-02-01 16:47 ` Jan Kiszka
2021-02-03 8:13 ` Quirin Gylstorff [this message]
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=12726656-327d-0891-c04b-1fae5e1e1951@siemens.com \
--to=quirin.gylstorff@siemens.com \
--cc=cip-dev@lists.cip-project.org \
--cc=jan.kiszka@siemens.com \
/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).