summaryrefslogtreecommitdiff
path: root/sub/initramfs/Makefile
blob: f175735c4b127a816c965eb541b004ac2f1254a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# The initramfs

INITRAMFS_SKARNET_LIST := cd execlineb export if redirfd s6-echo s6-mount mdevd-coldplug mdevd

$(OUTPUT)/tmp/.lh_initramfs_installed: $(OUTPUT)/tmp/.lh_layout_copied $(OUTPUT)/build-host/.lh_skarnet_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 $@