summaryrefslogtreecommitdiff
path: root/sub/initramfs/Makefile
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-05-22 21:56:04 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-05-22 21:56:04 +0000
commit82d0f92ab8b84466ae20ab919c1f9c3577b5cecb (patch)
tree776015ae6c6a386125b2d39e13b62f91b99548f8 /sub/initramfs/Makefile
downloadlh-bootstrap-82d0f92ab8b84466ae20ab919c1f9c3577b5cecb.tar.xz
Initial commit
Diffstat (limited to 'sub/initramfs/Makefile')
-rw-r--r--sub/initramfs/Makefile21
1 files changed, 21 insertions, 0 deletions
diff --git a/sub/initramfs/Makefile b/sub/initramfs/Makefile
new file mode 100644
index 0000000..da83f35
--- /dev/null
+++ b/sub/initramfs/Makefile
@@ -0,0 +1,21 @@
+# The initramfs
+
+INITRAMFS_SKARNET_LIST := cd execlineb export if redirfd s6-echo s6-mount
+
+$(OUTPUT)/tmp/.lh_initramfs_installed: $(OUTPUT)/tmp/.lh_layout_copied $(OUTPUT)/build-host/.lh_skarnet_installed $(OUTPUT)/build-host/.lh_mdev_installed
+ for i in $(INITRAMFS_SKARNET_LIST) ; do cp -f -L $(OUTPUT)/rootfs/command/$$i $(OUTPUT)/initramfs/command/$$i ; done
+ exec setuidgid $(NORMALUSER) touch $@
+
+$(OUTPUT)/initramfs.img.gz: $(OUTPUT)/tmp/.lh_initramfs_installed
+ cd $(OUTPUT)/initramfs && find . | cpio -o --format=newc > ../initramfs.img && cd .. && rm -f $@ && gzip -9 initramfs.img
+
+$(OUTPUT)/rootfs/boot/initramfs.gz: $(OUTPUT)/initramfs.img.gz | $(OUTPUT)/build-build/.lh_skarnet_installed $(OUTPUT)/tmp/.lh_layout_copied
+ exec cp -f $(OUTPUT)/initramfs.img.gz $(OUTPUT)/rootfs/boot/initramfs-$(KERNEL_VERSION).gz
+ exec s6-ln -sf initramfs-$(KERNEL_VERSION).gz $@
+
+ifeq ($(KERNEL_GENERIC_ARCH),x86)
+$(OUTPUT)/tmp/.lh_initramfs_done: $(OUTPUT)/rootfs/boot/initramfs.gz
+else
+$(OUTPUT)/tmp/.lh_initramfs_done: $(OUTPUT)/initramfs.img.gz
+endif
+ exec setuidgid $(NORMALUSER) touch $@