diff options
author | Alyssa Ross <hi@alyssa.is> | 2023-03-12 19:47:43 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2023-03-12 19:47:43 +0000 |
commit | 4b67ce2d6571addfb6784bd461675da8deca954b (patch) | |
tree | 7fa1d6325335d8fe040cb6081a0afa1d004e3b84 /host/rootfs | |
parent | e2ca1a7994adffea835b3e4f90ba1caf4f64f816 (diff) | |
download | spectrum-4b67ce2d6571addfb6784bd461675da8deca954b.tar spectrum-4b67ce2d6571addfb6784bd461675da8deca954b.tar.gz spectrum-4b67ce2d6571addfb6784bd461675da8deca954b.tar.bz2 spectrum-4b67ce2d6571addfb6784bd461675da8deca954b.tar.lz spectrum-4b67ce2d6571addfb6784bd461675da8deca954b.tar.xz spectrum-4b67ce2d6571addfb6784bd461675da8deca954b.tar.zst spectrum-4b67ce2d6571addfb6784bd461675da8deca954b.zip |
Build make targets directly into destinations
Our image Makefiles are either used for interactive development in a nix-shell, or as part of a Nix build of Spectrum. In neither of these cases is the two step "make; make install" process useful like it is for packages, because one image from Spectrum somewhere on the development system isn't something it ever makes sense to do. By removing the separation between building and installing, and creating the final output directly in its destination, we can save some copies of very large files, which should save seconds in each build, even for the smaller components. Signed-off-by: Alyssa Ross <hi@alyssa.is>
Diffstat (limited to 'host/rootfs')
-rw-r--r-- | host/rootfs/Makefile | 15 | ||||
-rw-r--r-- | host/rootfs/default.nix | 6 |
2 files changed, 12 insertions, 9 deletions
diff --git a/host/rootfs/Makefile b/host/rootfs/Makefile index 39911eb..73ac361 100644 --- a/host/rootfs/Makefile +++ b/host/rootfs/Makefile @@ -1,8 +1,10 @@ # SPDX-License-Identifier: EUPL-1.2+ -# SPDX-FileCopyrightText: 2021-2022 Alyssa Ross <hi@alyssa.is> +# SPDX-FileCopyrightText: 2021-2023 Alyssa Ross <hi@alyssa.is> include ../../lib/common.mk +dest = build/rootfs.ext4 + FILES = \ etc/fonts/fonts.conf \ etc/fstab \ @@ -39,7 +41,8 @@ LINKS = bin sbin BUILD_FILES = build/etc/mdev/modalias.sh build/etc/s6-rc -build/rootfs.ext4: +$(dest): build/rootfs.tar + $(TAR2EXT4) -i build/rootfs.tar -o $@ build/empty: mkdir -p $@ @@ -115,8 +118,8 @@ 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: build/rootfs.ext4 - $(VERITYSETUP) format build/rootfs.ext4 build/rootfs.verity.superblock.tmp \ +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 \ @@ -127,10 +130,10 @@ build/rootfs.verity.roothash: 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 build/rootfs.verity.superblock build/rootfs.verity.roothash build/rootfs.ext4 +build/live.img: ../../scripts/format-uuid.sh ../../scripts/make-gpt.sh build/rootfs.verity.superblock build/rootfs.verity.roothash $(dest) ../../scripts/make-gpt.sh $@.tmp \ build/rootfs.verity.superblock:2c7357ed-ebd2-46d9-aec1-23d437ec2bf5:$$(../../scripts/format-uuid.sh "$$(dd if=build/rootfs.verity.roothash bs=32 skip=1 count=1 status=none)") \ - build/rootfs.ext4:4f68bce3-e8cd-4db1-96e7-fbcaf984b709:$$(../../scripts/format-uuid.sh "$$(head -c 32 build/rootfs.verity.roothash)") + $(dest):4f68bce3-e8cd-4db1-96e7-fbcaf984b709:$$(../../scripts/format-uuid.sh "$$(head -c 32 build/rootfs.verity.roothash)") mv $@.tmp $@ run: build/live.img $(EXT_FS) build/rootfs.verity.roothash diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix index 3ca2830..23e4b38 100644 --- a/host/rootfs/default.nix +++ b/host/rootfs/default.nix @@ -130,9 +130,9 @@ stdenvNoCC.mkDerivation { MODULES_ORDER = "${kernel}/lib/modules/${kernel.modDirVersion}/modules.order"; PACKAGES_TAR = packagesTar; - installPhase = '' - cp build/rootfs.ext4 $out - ''; + makeFlags = [ "dest=$(out)" ]; + + dontInstall = true; enableParallelBuilding = true; |