summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-12-02 21:02:35 +0000
committerAlyssa Ross <hi@alyssa.is>2021-12-12 00:36:48 +0000
commit3dca8185e1438be1e09d24ee7e3460d0ab59c680 (patch)
treeae55e0e79d33398dac6992afeef5ff70e12fbc62 /Makefile
parent1e52865156768d13387951df3afece9c16546478 (diff)
downloadspectrum-3dca8185e1438be1e09d24ee7e3460d0ab59c680.tar
spectrum-3dca8185e1438be1e09d24ee7e3460d0ab59c680.tar.gz
spectrum-3dca8185e1438be1e09d24ee7e3460d0ab59c680.tar.bz2
spectrum-3dca8185e1438be1e09d24ee7e3460d0ab59c680.tar.lz
spectrum-3dca8185e1438be1e09d24ee7e3460d0ab59c680.tar.xz
spectrum-3dca8185e1438be1e09d24ee7e3460d0ab59c680.tar.zst
spectrum-3dca8185e1438be1e09d24ee7e3460d0ab59c680.zip
Makefile: make build/local.cpio more structured
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 13 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 58c8a70..7f8aedb 100644
--- a/Makefile
+++ b/Makefile
@@ -1,18 +1,24 @@
 # SPDX-License-Identifier: EUPL-1.2
 # SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
 
+CPIO = cpio
+CPIOFLAGS = --reproducible -R +0:+0 -H newc
+
 build/initramfs: build/local.cpio $(PACKAGES_CPIO)
 	cat build/local.cpio $(PACKAGES_CPIO) | gzip -9n > $@
 
-build/local.cpio: etc/init etc/mdev.conf
-	rm -rf build/root
+MOUNTPOINTS = dev mnt proc sys tmp
 
-	mkdir -p build/root/{dev,etc,mnt,proc,sys,tmp}
-	install etc/init build/root/init
-	cp etc/mdev.conf build/root/etc/mdev.conf
+build/local.cpio: etc/init etc/mdev.conf build/mountpoints
+	printf "%s\n" etc etc/mdev.conf | $(CPIO) -o $(CPIOFLAGS) > $@
+	cd etc && echo init | $(CPIO) -o $(CPIOFLAGS) -AF ../$@
+	cd build/mountpoints && \
+	    printf "%s\n" $(MOUNTPOINTS) | $(CPIO) -o $(CPIOFLAGS) -AF ../../$@
 
-	find build/root -print0 | xargs -0r touch -h -d '@1'
-	(cd build/root; find . -print0 | sort -z | cpio -o -H newc -R +0:+0 --reproducible --null) > $@
+build/mountpoints:
+	rm -rf build/mountpoints
+	mkdir -p build/mountpoints
+	cd build/mountpoints && mkdir -p $(MOUNTPOINTS)
 
 clean:
 	rm -rf build