From: Alyssa Ross <hi@alyssa.is>
To: Demi Marie Obenour <demiobenour@gmail.com>
Cc: Spectrum OS Development <devel@spectrum-os.org>
Subject: Re: [PATCH v3 1/2] Build verity images in rootfs Nix derivation
Date: Fri, 14 Nov 2025 12:53:52 +0100 [thread overview]
Message-ID: <87fragltin.fsf@alyssa.is> (raw)
In-Reply-To: <cd6d6211-b95d-4c17-8b44-53d79252a98a@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 5142 bytes --]
Demi Marie Obenour <demiobenour@gmail.com> writes:
> On 11/13/25 06:46, Alyssa Ross wrote:
>> Demi Marie Obenour <demiobenour@gmail.com> writes:
>>
>>> diff --git a/host/initramfs/Makefile b/host/initramfs/Makefile
>>> index cb13fbb35f065b67d291d4a35591d6f12720060c..102870ecba4456303414e2531ea592473ddfc1cf 100644
>>> --- a/host/initramfs/Makefile
>>> +++ b/host/initramfs/Makefile
>>> @@ -35,26 +35,10 @@ build/mountpoints:
>>> cd build/mountpoints && mkdir -p $(MOUNTPOINTS)
>>> find build/mountpoints -mindepth 1 -exec touch -d @0 {} ';'
>>>
>>> -# veritysetup format produces two files, but Make only (portably)
>>> -# supports one output per rule, so we combine the two outputs then
>>> -# define two more rules to separate them again.
>>> -build/rootfs.verity: $(ROOT_FS)
>>> - mkdir -p build
>>> - $(VERITYSETUP) format $(ROOT_FS) build/rootfs.verity.superblock.tmp \
>>> - | awk -F ':[[:blank:]]*' '$$1 == "Root hash" {print $$2; exit}' \
>>> - > build/rootfs.verity.roothash.tmp
>>> - cat build/rootfs.verity.roothash.tmp build/rootfs.verity.superblock.tmp \
>>> - > $@
>>> - rm build/rootfs.verity.roothash.tmp build/rootfs.verity.superblock.tmp
>>> -build/rootfs.verity.roothash: build/rootfs.verity
>>> - head -n 1 build/rootfs.verity > $@
>>> -build/rootfs.verity.superblock: build/rootfs.verity
>>> - tail -n +2 build/rootfs.verity > $@
>>> -
>>> -build/live.img: ../../scripts/format-uuid.sh ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk build/rootfs.verity.superblock build/rootfs.verity.roothash $(ROOT_FS)
>>> +build/live.img: ../../scripts/format-uuid.sh ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk $(ROOT_FS_VERITY) $(ROOT_FS_VERITY_ROOTHASH) $(ROOT_FS)
>>> ../../scripts/make-gpt.sh $@.tmp \
>>> - build/rootfs.verity.superblock:verity:$$(../../scripts/format-uuid.sh "$$(dd if=build/rootfs.verity.roothash bs=32 skip=1 count=1 status=none)") \
>>> - $(ROOT_FS):root:$$(../../scripts/format-uuid.sh "$$(head -c 32 build/rootfs.verity.roothash)")
>>> + "$$ROOT_FS_VERITY:verity:$$(../../scripts/format-uuid.sh "$$(dd "if=$$ROOT_FS_VERITY_ROOTHASH" bs=32 skip=1 count=1 status=none)")" \
>>
>> Indentation got messed up here.
>>
>> Given rootfs has a well-defined output structure, maybe we could just
>> write $(ROOT_FS)/rootfs.verity.roothash, so we don't need to define lots
>> of different environment variables in each component that uses the
>> verity data.
>>
>> I think we should consistently use Make variable expansion rather than
>> shell variable expansion when we're using the variable in a Make
>> dependency line too, to avoid the possibility of them being different.
>
> Make expansion followed by shell expansion and just Make expansion aren't
> even consistent with each other.
Can you elaborate?
> >> build/fifo:
>>> mkdir -p build
>>> @@ -83,25 +95,10 @@ clean:
>>> rm -rf build
>>> .PHONY: clean
>>>
>>> -# veritysetup format produces two files, but Make only (portably)
>>> -# supports one output per rule, so we combine the two outputs then
>>> -# define two more rules to separate them again.
>>> -build/rootfs.verity: $(dest)
>>> - $(VERITYSETUP) format $(dest) build/rootfs.verity.superblock.tmp \
>>> - | awk -F ':[[:blank:]]*' '$$1 == "Root hash" {print $$2; exit}' \
>>> - > build/rootfs.verity.roothash.tmp
>>> - cat build/rootfs.verity.roothash.tmp build/rootfs.verity.superblock.tmp \
>>> - > $@
>>> - rm build/rootfs.verity.roothash.tmp build/rootfs.verity.superblock.tmp
>>> -build/rootfs.verity.roothash: build/rootfs.verity
>>> - head -n 1 build/rootfs.verity > $@
>>> -build/rootfs.verity.superblock: build/rootfs.verity
>>> - tail -n +2 build/rootfs.verity > $@
>>> -
>>> -build/live.img: ../../scripts/format-uuid.sh ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk build/rootfs.verity.superblock build/rootfs.verity.roothash $(dest)
>>> +build/live.img: ../../scripts/format-uuid.sh ../../scripts/make-gpt.sh ../../scripts/sfdisk-field.awk $(dest)/timestamp
>>> ../../scripts/make-gpt.sh $@.tmp \
>>> - build/rootfs.verity.superblock:verity:$$(../../scripts/format-uuid.sh "$$(dd if=build/rootfs.verity.roothash bs=32 skip=1 count=1 status=none)") \
>>> - $(dest):root:$$(../../scripts/format-uuid.sh "$$(head -c 32 build/rootfs.verity.roothash)")
>>> + $(dest)/rootfs.verity.superblock:verity:$$(../../scripts/format-uuid.sh "$$(dd if=$(dest)/rootfs.verity.roothash bs=32 skip=1 count=1 status=none)") \
>>> + $(dest)/rootfs:root:$$(../../scripts/format-uuid.sh "$$(head -c 32 $(dest)/rootfs.verity.roothash)")
>>> mv $@.tmp $@
>>>
>>> debug:
>>> @@ -111,7 +108,7 @@ debug:
>>> $(VMLINUX)
>>> .PHONY: debug
>>>
>>> -run: build/live.img $(EXT_FS) build/rootfs.verity.roothash
>>> +run: build/live.img
>>
>> What happened to $(EXT_FS)?
>
> Since commit 12b64009d9cde56b5629a832086d2c2311908ebe
> ("host/initramfs/extfs.nix: remove") it has been unused.
> I deleted it while changing other stuff in this line.
Got it. I'll just push a drop of $(EXT_FS) now then.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
next prev parent reply other threads:[~2025-11-14 11:54 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-05 22:33 [PATCH 0/2] Move verity and EFI creation to separate Nix derivations Demi Marie Obenour
2025-11-05 22:33 ` [PATCH 1/2] Create Nix derivation for building verity images Demi Marie Obenour
2025-11-06 10:20 ` Alyssa Ross
2025-11-06 10:55 ` Demi Marie Obenour
2025-11-06 11:44 ` Alyssa Ross
2025-11-07 19:24 ` Demi Marie Obenour
2025-11-13 11:32 ` Alyssa Ross
2025-11-05 22:33 ` [PATCH 2/2] Move UKI creation to a separate derivation Demi Marie Obenour
2025-11-08 4:47 ` [PATCH v2 0/2] Move verity and EFI creation to separate Nix derivations Demi Marie Obenour
2025-11-08 4:47 ` [PATCH v2 1/2] Build verity images in rootfs Nix derivation Demi Marie Obenour
2025-11-08 4:47 ` [PATCH v2 2/2] Move UKI creation to a separate derivation Demi Marie Obenour
2025-11-12 0:59 ` [PATCH v3 0/2] Move verity and EFI creation to separate Nix derivations Demi Marie Obenour
2025-11-12 0:59 ` [PATCH v3 1/2] Build verity images in rootfs Nix derivation Demi Marie Obenour
2025-11-13 11:46 ` Alyssa Ross
2025-11-13 22:33 ` Demi Marie Obenour
2025-11-14 11:53 ` Alyssa Ross [this message]
2025-11-12 0:59 ` [PATCH v3 2/2] Move UKI creation to a separate derivation Demi Marie Obenour
2025-11-13 11:57 ` Alyssa Ross
2025-11-13 22:42 ` Demi Marie Obenour
2025-11-14 11:58 ` Alyssa Ross
2025-11-19 8:15 ` [PATCH v4 0/2] Move verity and EFI creation to separate Nix derivations Demi Marie Obenour
2025-11-19 8:15 ` [PATCH v4 1/2] Build verity images in rootfs Nix derivation Demi Marie Obenour
2025-11-25 12:27 ` Alyssa Ross
2025-11-25 12:31 ` Alyssa Ross
2025-11-19 8:15 ` [PATCH v4 2/2] Move UKI creation to a separate derivation Demi Marie Obenour
2025-11-22 1:21 ` [PATCH v5 0/2] Move verity and EFI creation to separate Nix derivations Demi Marie Obenour
2025-11-22 1:21 ` [PATCH v5 1/2] Build verity images in rootfs Nix derivation Demi Marie Obenour
2025-11-25 12:34 ` Alyssa Ross
2025-11-22 1:21 ` [PATCH v5 2/2] Move UKI creation to a separate derivation Demi Marie Obenour
2025-11-25 12:41 ` Alyssa Ross
2025-11-26 19:10 ` [PATCH v6 0/2] Move verity and EFI creation to separate Nix derivations Demi Marie Obenour
2025-11-26 19:10 ` [PATCH v6 1/2] Build verity images in rootfs Nix derivation Demi Marie Obenour
2025-11-27 19:23 ` Alyssa Ross
2025-11-26 19:10 ` [PATCH v6 2/2] Move UKI creation to a separate derivation Demi Marie Obenour
2025-11-28 10:47 ` Alyssa Ross
2025-11-28 19:27 ` Demi Marie Obenour
2025-11-28 11:02 ` Alyssa Ross
2025-11-28 19:25 ` Demi Marie Obenour
2025-11-28 20:12 ` Alyssa Ross
2025-11-26 18:58 ` [PATCH v5 0/2] Move verity and EFI creation to separate Nix derivations Demi Marie Obenour
2025-11-26 18:58 ` [PATCH v5 1/2] Build verity images in rootfs Nix derivation Demi Marie Obenour
2025-11-26 18:58 ` [PATCH v5 2/2] Move UKI creation to a separate derivation Demi Marie Obenour
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=87fragltin.fsf@alyssa.is \
--to=hi@alyssa.is \
--cc=demiobenour@gmail.com \
--cc=devel@spectrum-os.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.
Code repositories for project(s) associated with this public inbox
https://spectrum-os.org/git/crosvm
https://spectrum-os.org/git/doc
https://spectrum-os.org/git/mktuntap
https://spectrum-os.org/git/nixpkgs
https://spectrum-os.org/git/spectrum
https://spectrum-os.org/git/ucspi-vsock
https://spectrum-os.org/git/www
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).