diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-01-29 15:00:01 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-01-29 15:00:01 +0000 |
commit | 3dcb6c6a73cd16acc7bcae9e54cda16fed89f35b (patch) | |
tree | e2b2b231622470ddc95a74f62b3cebcdcc492914 | |
parent | 5809b2dc1536794cff7df2ab4f79d2fe7b6720bc (diff) | |
download | lh-bootstrap-3dcb6c6a73cd16acc7bcae9e54cda16fed89f35b.tar.xz |
Reimport userfs, rwfs and s6-rc from master
77 files changed, 188 insertions, 50 deletions
@@ -20,12 +20,15 @@ NORMALUSER_GID := $(shell id -g $(NORMALUSER)) it: all -.PHONY: it all rootfs kernel qemu-boot clean distclean +.PHONY: it all kernel rootfs rwfs userfs images qemu-boot clean distclean -all: $(OUTPUT)/tmp/.lh_rootfs_installed $(OUTPUT)/build-host/kernel/.lh_installed -rootfs: $(OUTPUT)/tmp/.lh_rootfs_installed +all: kernel rootfs rwfs userfs images kernel: $(OUTPUT)/build-host/kernel/.lh_installed +rootfs: $(OUTPUT)/tmp/.lh_rootfs_installed +rwfs: $(OUTPUT)/tmp/.lh_rwfs_installed +userfs: $(OUTPUT)/tmp/.lh_userfs_installed +images: $(OUTPUT)/tmp/.lh_diskimages_done # clean everything @@ -40,7 +43,7 @@ clean: # Prepare the output directory. This is at the bottom of the dependency tree. $(OUTPUT)/tmp/.lh_prepared: lh-config - exec mkdir -p -m 0755 -- $(OUTPUT)/tmp $(OUTPUT)/rootfs $(OUTPUT)/build-build/bin $(OUTPUT)/build-build/opt $(OUTPUT)/build-build/tmp $(OUTPUT)/build-host/bin $(OUTPUT)/build-host/opt $(OUTPUT)/build-host/tmp $(OUTPUT)/host-host $(OUTPUT)/sources + exec mkdir -p -m 0755 -- $(OUTPUT)/tmp $(OUTPUT)/rootfs $(OUTPUT)/rwfs $(OUTPUT)/userfs $(OUTPUT)/build-build/bin $(OUTPUT)/build-build/opt $(OUTPUT)/build-build/tmp $(OUTPUT)/build-host/bin $(OUTPUT)/build-host/opt $(OUTPUT)/build-host/tmp $(OUTPUT)/host-host $(OUTPUT)/sources exec chown -R -- $(NORMALUSER_UID):$(NORMALUSER_GID) $(OUTPUT)/tmp $(OUTPUT)/build-build $(OUTPUT)/build-host $(OUTPUT)/host-host exec chown -- $(NORMALUSER_UID):$(NORMALUSER_GID) $(OUTPUT)/sources $(OUTPUT) exec setuidgid $(NORMALUSER) touch $@ @@ -52,20 +55,27 @@ $(OUTPUT)/build-build/.lh_done: $(OUTPUT)/build-build/.lh_skarnet_installed $(OU exec setuidgid $(NORMALUSER) touch $@ -# The rootfs +# The filesystems $(OUTPUT)/tmp/.lh_rootfs_installed: $(OUTPUT)/tmp/.lh_layout_installed $(OUTPUT)/build-host/.lh_skarnet_installed $(OUTPUT)/build-host/.lh_bb_installed $(OUTPUT)/build-host/.lh_dropbear_installed exec setuidgid $(NORMALUSER) touch $@ +$(OUTPUT)/tmp/.lh_rwfs_installed: $(OUTPUT)/tmp/.lh_layout_installed + exec setuidgid $(NORMALUSER) touch $@ + +$(OUTPUT)/tmp/.lh_userfs_installed: $(OUTPUT)/tmp/.lh_layout_installed + exec setuidgid $(NORMALUSER) touch $@ + -# The qemu disk image (requires qemu and libguestfs-tools) +# The qemu disk images (requires qemu and libguestfs-tools) -$(OUTPUT)/tmp/.lh_diskimage_done: $(OUTPUT)/tmp/.lh_rootfs_installed - exec setuidgid $(NORMALUSER) qemu-img create -f qcow2 $(OUTPUT)/disk-image.qcow2 1G - exec virt-make-fs --format=qcow2 --size=2G --type=ext4 $(OUTPUT)/rootfs $(OUTPUT)/disk-image.qcow2 +$(OUTPUT)/tmp/.lh_diskimages_done: $(OUTPUT)/tmp/.lh_rootfs_installed $(OUTPUT)/tmp/.lh_rwfs_installed $(OUTPUT)/tmp/.lh_userfs_installed + exec virt-make-fs --format=qcow2 --size=1G --type=ext4 $(OUTPUT)/rootfs $(OUTPUT)/rootfs.qcow2 + exec virt-make-fs --format=qcow2 --size=512M --type=ext4 $(OUTPUT)/rwfs $(OUTPUT)/rwfs.qcow2 + exec virt-make-fs --format=qcow2 --size=512M --type=ext4 $(OUTPUT)/userfs $(OUTPUT)/userfs.qcow2 exec setuidgid $(NORMALUSER) touch $@ -qemu-boot: $(OUTPUT)/build-host/kernel/.lh_installed $(OUTPUT)/tmp/.lh_diskimage_done run-qemu +qemu-boot: $(OUTPUT)/build-host/kernel/.lh_installed $(OUTPUT)/tmp/.lh_diskimages_done run-qemu exec ./run-qemu @@ -74,7 +84,6 @@ qemu-boot: $(OUTPUT)/build-host/kernel/.lh_installed $(OUTPUT)/tmp/.lh_diskimage ## libc, toolchains, utilities, for the build itself, or for building the host include sub/kernel/Makefile -# include sub/util-linux/Makefile include sub/xz/Makefile include sub/kmod/Makefile diff --git a/layout/rootfs/etc/dropbear/dropbear_ecdsa_host_key b/layout/rootfs/etc/dropbear/dropbear_ecdsa_host_key Binary files differdeleted file mode 100644 index 949717e..0000000 --- a/layout/rootfs/etc/dropbear/dropbear_ecdsa_host_key +++ /dev/null diff --git a/layout/rootfs/etc/dropbear/dropbear_rsa_host_key b/layout/rootfs/etc/dropbear/dropbear_rsa_host_key Binary files differdeleted file mode 100644 index a62ef0c..0000000 --- a/layout/rootfs/etc/dropbear/dropbear_rsa_host_key +++ /dev/null diff --git a/layout/rootfs/etc/init b/layout/rootfs/etc/init deleted file mode 100755 index 619561d..0000000 --- a/layout/rootfs/etc/init +++ /dev/null @@ -1,21 +0,0 @@ -#!/command/execlineb -P - -/command/export PATH /command:/bin -/command/cd / -s6-setsid -qb -- -umask 022 - -s6-envdir -I -- /etc/s6-linux-init/current/env -redirfd -r 0 /dev/null -redirfd -wnb 1 /run/service/s6-svscan-log/fifo -background -{ - s6-setsid -- - redirfd -w 1 /run/service/s6-svscan-log/fifo - fdmove -c 2 1 - /etc/s6-linux-init/current/rc.init -} -unexport ! -cd /run/service -fdmove -c 2 1 -s6-svscan -st0 diff --git a/layout/rootfs/etc/s6-rc/source-base/00/down b/layout/rootfs/etc/s6-rc/source-base/00/down new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/00/down @@ -0,0 +1 @@ + diff --git a/layout/rootfs/etc/s6-rc/source-base/00/type b/layout/rootfs/etc/s6-rc/source-base/00/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/00/type @@ -0,0 +1 @@ +oneshot diff --git a/layout/rootfs/etc/s6-rc/source-base/00/up b/layout/rootfs/etc/s6-rc/source-base/00/up new file mode 100644 index 0000000..5ca67e1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/00/up @@ -0,0 +1,2 @@ +if { s6-echo "init stage2 starting" } +s6-hostname %%HOSTNAME%% diff --git a/layout/rootfs/etc/s6-rc/source-base/default/contents b/layout/rootfs/etc/s6-rc/source-base/default/contents new file mode 100644 index 0000000..0882c2e --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/default/contents @@ -0,0 +1,5 @@ +mdevd +klogd-pipeline +mount-disks +mount-virtual +fifodir-cleanup diff --git a/layout/rootfs/etc/s6-rc/source-base/default/type b/layout/rootfs/etc/s6-rc/source-base/default/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/default/type @@ -0,0 +1 @@ +bundle diff --git a/layout/rootfs/etc/s6-rc/source-base/fifodir-cleanup/dependencies b/layout/rootfs/etc/s6-rc/source-base/fifodir-cleanup/dependencies new file mode 100644 index 0000000..4daddb7 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/fifodir-cleanup/dependencies @@ -0,0 +1 @@ +00 diff --git a/layout/rootfs/etc/s6-rc/source-base/fifodir-cleanup/run b/layout/rootfs/etc/s6-rc/source-base/fifodir-cleanup/run new file mode 100755 index 0000000..a2c371b --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/fifodir-cleanup/run @@ -0,0 +1,10 @@ +#!/command/execlineb -P +fdmove -c 2 1 +if +{ + forbacktickx -p -0 i { s6-ls -0 /run/service } + importas -u i + s6-cleanfifodir /run/service/${i}/event +} +s6-setuidgid nobody +s6-sleep 86400 diff --git a/layout/rootfs/etc/s6-rc/source-base/fifodir-cleanup/type b/layout/rootfs/etc/s6-rc/source-base/fifodir-cleanup/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/fifodir-cleanup/type @@ -0,0 +1 @@ +longrun diff --git a/layout/rootfs/etc/s6-rc/source-base/init-coldplug/dependencies b/layout/rootfs/etc/s6-rc/source-base/init-coldplug/dependencies new file mode 100644 index 0000000..18fefaa --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/init-coldplug/dependencies @@ -0,0 +1,2 @@ +init-dev +mdevd diff --git a/layout/rootfs/etc/s6-rc/source-base/init-coldplug/type b/layout/rootfs/etc/s6-rc/source-base/init-coldplug/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/init-coldplug/type @@ -0,0 +1 @@ +oneshot diff --git a/layout/rootfs/etc/s6-rc/source-base/init-coldplug/up b/layout/rootfs/etc/s6-rc/source-base/init-coldplug/up new file mode 100644 index 0000000..edc5c1b --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/init-coldplug/up @@ -0,0 +1 @@ +mdevd-coldplug diff --git a/layout/rootfs/etc/s6-rc/source-base/init-dev/dependencies b/layout/rootfs/etc/s6-rc/source-base/init-dev/dependencies new file mode 100644 index 0000000..0df58a3 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/init-dev/dependencies @@ -0,0 +1 @@ +mount-proc diff --git a/layout/rootfs/etc/s6-rc/source-base/init-dev/type b/layout/rootfs/etc/s6-rc/source-base/init-dev/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/init-dev/type @@ -0,0 +1 @@ +oneshot diff --git a/layout/rootfs/etc/s6-rc/source-base/init-dev/up b/layout/rootfs/etc/s6-rc/source-base/init-dev/up new file mode 100644 index 0000000..75c622a --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/init-dev/up @@ -0,0 +1,8 @@ +foreground { s6-ln -sf /proc/self/fd /dev } +foreground { s6-ln -sf /proc/kcore /dev/core } +foreground { s6-ln -sf loop0 /dev/loop } +foreground { s6-ln -sf /run/shm /dev } +foreground { s6-ln -sf fd/0 /dev/stdin } +foreground { s6-ln -sf fd/1 /dev/stdout } +foreground { s6-ln -sf fd/2 /dev/stderr } +exit 0 diff --git a/layout/rootfs/etc/s6-rc/source-base/init-lo/dependencies b/layout/rootfs/etc/s6-rc/source-base/init-lo/dependencies new file mode 100644 index 0000000..f4c707c --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/init-lo/dependencies @@ -0,0 +1 @@ +init-sysctl diff --git a/layout/rootfs/etc/s6-rc/source-base/init-lo/type b/layout/rootfs/etc/s6-rc/source-base/init-lo/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/init-lo/type @@ -0,0 +1 @@ +oneshot diff --git a/layout/rootfs/etc/s6-rc/source-base/init-lo/up b/layout/rootfs/etc/s6-rc/source-base/init-lo/up new file mode 100644 index 0000000..1a1beea --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/init-lo/up @@ -0,0 +1,2 @@ +if { ip addr add 127.0.0.1/8 dev lo } +ip link set dev lo up diff --git a/layout/rootfs/etc/s6-rc/source-base/init-sysctl/dependencies b/layout/rootfs/etc/s6-rc/source-base/init-sysctl/dependencies new file mode 100644 index 0000000..0df58a3 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/init-sysctl/dependencies @@ -0,0 +1 @@ +mount-proc diff --git a/layout/rootfs/etc/s6-rc/source-base/init-sysctl/type b/layout/rootfs/etc/s6-rc/source-base/init-sysctl/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/init-sysctl/type @@ -0,0 +1 @@ +oneshot diff --git a/layout/rootfs/etc/s6-rc/source-base/init-sysctl/up b/layout/rootfs/etc/s6-rc/source-base/init-sysctl/up new file mode 100644 index 0000000..9e846f8 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/init-sysctl/up @@ -0,0 +1,6 @@ +redirfd -r 0 /etc/sysctl.conf +forstdin -nCd"\n" -- LINE +importas -u LINE LINE +multidefine -C $LINE { CTL VALUE } +redirfd -w 1 /proc/sys/$CTL +s6-echo -- $VALUE diff --git a/layout/rootfs/etc/s6-rc/source-base/klogd-log/consumer-for b/layout/rootfs/etc/s6-rc/source-base/klogd-log/consumer-for new file mode 100644 index 0000000..fd64770 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/klogd-log/consumer-for @@ -0,0 +1 @@ +klogd diff --git a/layout/rootfs/etc/s6-rc/source-base/klogd-log/dependencies b/layout/rootfs/etc/s6-rc/source-base/klogd-log/dependencies new file mode 100644 index 0000000..7c63988 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/klogd-log/dependencies @@ -0,0 +1 @@ +mount-rwfs diff --git a/layout/rootfs/etc/s6-rc/source-base/klogd-log/pipeline-name b/layout/rootfs/etc/s6-rc/source-base/klogd-log/pipeline-name new file mode 100644 index 0000000..cb7ca7b --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/klogd-log/pipeline-name @@ -0,0 +1 @@ +klogd-pipeline diff --git a/layout/rootfs/etc/s6-rc/source-base/klogd-log/run b/layout/rootfs/etc/s6-rc/source-base/klogd-log/run new file mode 100755 index 0000000..90e474b --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/klogd-log/run @@ -0,0 +1,4 @@ +#!/command/execlineb -P +s6-setuidgid kllog +exec -c +s6-log t s1000000 n20 /var/log/klogd diff --git a/layout/rootfs/etc/s6-rc/source-base/klogd-log/type b/layout/rootfs/etc/s6-rc/source-base/klogd-log/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/klogd-log/type @@ -0,0 +1 @@ +longrun diff --git a/layout/rootfs/etc/s6-rc/source-base/klogd/dependencies b/layout/rootfs/etc/s6-rc/source-base/klogd/dependencies new file mode 100644 index 0000000..0df58a3 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/klogd/dependencies @@ -0,0 +1 @@ +mount-proc diff --git a/layout/rootfs/etc/s6-rc/source-base/klogd/producer-for b/layout/rootfs/etc/s6-rc/source-base/klogd/producer-for new file mode 100644 index 0000000..2f21a8f --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/klogd/producer-for @@ -0,0 +1 @@ +klogd-log diff --git a/layout/rootfs/etc/s6-rc/source-base/klogd/run b/layout/rootfs/etc/s6-rc/source-base/klogd/run new file mode 100755 index 0000000..95dc7e8 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/klogd/run @@ -0,0 +1,6 @@ +#!/command/execlineb -P +fdmove -c 2 1 +redirfd -r 0 /proc/kmsg +# s6-setuidgid klog +exec -c +ucspilogd diff --git a/layout/rootfs/etc/s6-rc/source-base/klogd/type b/layout/rootfs/etc/s6-rc/source-base/klogd/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/klogd/type @@ -0,0 +1 @@ +longrun diff --git a/layout/rootfs/etc/s6-rc/source-base/mdevd/dependencies b/layout/rootfs/etc/s6-rc/source-base/mdevd/dependencies new file mode 100644 index 0000000..690f6cf --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mdevd/dependencies @@ -0,0 +1,2 @@ +mount-sys +init-dev diff --git a/layout/rootfs/etc/s6-rc/source-base/mdevd/notification-fd b/layout/rootfs/etc/s6-rc/source-base/mdevd/notification-fd new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mdevd/notification-fd @@ -0,0 +1 @@ +3 diff --git a/layout/rootfs/etc/s6-rc/source-base/mdevd/run b/layout/rootfs/etc/s6-rc/source-base/mdevd/run new file mode 100755 index 0000000..1d4e4e3 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mdevd/run @@ -0,0 +1,3 @@ +#!/command/execlineb -P +exec -c +mdevd -D 3 -b 200000 diff --git a/layout/rootfs/etc/s6-rc/source-base/mdevd/type b/layout/rootfs/etc/s6-rc/source-base/mdevd/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mdevd/type @@ -0,0 +1 @@ +longrun diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-devpts/dependencies b/layout/rootfs/etc/s6-rc/source-base/mount-devpts/dependencies new file mode 100644 index 0000000..c1ee812 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-devpts/dependencies @@ -0,0 +1 @@ +init-dev diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-devpts/type b/layout/rootfs/etc/s6-rc/source-base/mount-devpts/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-devpts/type @@ -0,0 +1 @@ +oneshot diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-devpts/up b/layout/rootfs/etc/s6-rc/source-base/mount-devpts/up new file mode 100644 index 0000000..8c5da6d --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-devpts/up @@ -0,0 +1,4 @@ +if { s6-mkdir -p -m 0755 -- /dev/pts } +foreground { s6-mount -wt devpts -o noexec,nosuid,gid=0,mode=0600 devpts /dev/pts } +importas ? ? +s6-test $? -le 1 diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-disks/contents b/layout/rootfs/etc/s6-rc/source-base/mount-disks/contents new file mode 100644 index 0000000..9c13766 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-disks/contents @@ -0,0 +1,2 @@ +mount-rwfs +mount-userfs diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-disks/type b/layout/rootfs/etc/s6-rc/source-base/mount-disks/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-disks/type @@ -0,0 +1 @@ +bundle diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-proc/dependencies b/layout/rootfs/etc/s6-rc/source-base/mount-proc/dependencies new file mode 100644 index 0000000..4daddb7 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-proc/dependencies @@ -0,0 +1 @@ +00 diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-proc/type b/layout/rootfs/etc/s6-rc/source-base/mount-proc/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-proc/type @@ -0,0 +1 @@ +oneshot diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-proc/up b/layout/rootfs/etc/s6-rc/source-base/mount-proc/up new file mode 100644 index 0000000..1eeaa8a --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-proc/up @@ -0,0 +1,3 @@ +foreground { s6-mount -wt proc proc /proc } +importas ? ? +s6-test $? -le 1 diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-rwfs/dependencies b/layout/rootfs/etc/s6-rc/source-base/mount-rwfs/dependencies new file mode 100644 index 0000000..bee63cb --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-rwfs/dependencies @@ -0,0 +1 @@ +init-coldplug diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-rwfs/down b/layout/rootfs/etc/s6-rc/source-base/mount-rwfs/down new file mode 100644 index 0000000..00b6eb1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-rwfs/down @@ -0,0 +1 @@ +s6-umount /mnt/rwfs diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-rwfs/type b/layout/rootfs/etc/s6-rc/source-base/mount-rwfs/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-rwfs/type @@ -0,0 +1 @@ +oneshot diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-rwfs/up b/layout/rootfs/etc/s6-rc/source-base/mount-rwfs/up new file mode 100644 index 0000000..f5bee4c --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-rwfs/up @@ -0,0 +1 @@ +s6-mount -wt ext4 /dev/vdb /mnt/rwfs diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-sys/dependencies b/layout/rootfs/etc/s6-rc/source-base/mount-sys/dependencies new file mode 100644 index 0000000..4daddb7 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-sys/dependencies @@ -0,0 +1 @@ +00 diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-sys/type b/layout/rootfs/etc/s6-rc/source-base/mount-sys/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-sys/type @@ -0,0 +1 @@ +oneshot diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-sys/up b/layout/rootfs/etc/s6-rc/source-base/mount-sys/up new file mode 100644 index 0000000..9573fe4 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-sys/up @@ -0,0 +1,3 @@ +foreground { s6-mount -wt sysfs sys /sys } +importas ? ? +s6-test $? -le 1 diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-tmp/dependencies b/layout/rootfs/etc/s6-rc/source-base/mount-tmp/dependencies new file mode 100644 index 0000000..4daddb7 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-tmp/dependencies @@ -0,0 +1 @@ +00 diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-tmp/down b/layout/rootfs/etc/s6-rc/source-base/mount-tmp/down new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-tmp/down @@ -0,0 +1 @@ + diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-tmp/type b/layout/rootfs/etc/s6-rc/source-base/mount-tmp/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-tmp/type @@ -0,0 +1 @@ +oneshot diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-tmp/up b/layout/rootfs/etc/s6-rc/source-base/mount-tmp/up new file mode 100644 index 0000000..2f0e1e1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-tmp/up @@ -0,0 +1,3 @@ +foreground { s6-mount -wt tmpfs -o nodev,mode=1777 tmpfs /tmp } +importas ? ? +s6-test $? -le 1 diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-userfs/dependencies b/layout/rootfs/etc/s6-rc/source-base/mount-userfs/dependencies new file mode 100644 index 0000000..bee63cb --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-userfs/dependencies @@ -0,0 +1 @@ +init-coldplug diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-userfs/down b/layout/rootfs/etc/s6-rc/source-base/mount-userfs/down new file mode 100644 index 0000000..2583c7d --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-userfs/down @@ -0,0 +1 @@ +s6-umount /mnt/userfs diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-userfs/type b/layout/rootfs/etc/s6-rc/source-base/mount-userfs/type new file mode 100644 index 0000000..bdd22a1 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-userfs/type @@ -0,0 +1 @@ +oneshot diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-userfs/up b/layout/rootfs/etc/s6-rc/source-base/mount-userfs/up new file mode 100644 index 0000000..5ccc55e --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-userfs/up @@ -0,0 +1 @@ +s6-mount -wt ext4 /dev/vdc /mnt/userfs diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-virtual/contents b/layout/rootfs/etc/s6-rc/source-base/mount-virtual/contents new file mode 100644 index 0000000..c9d2af7 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-virtual/contents @@ -0,0 +1,4 @@ +mount-proc +mount-sys +mount-devpts +mount-tmp diff --git a/layout/rootfs/etc/s6-rc/source-base/mount-virtual/type b/layout/rootfs/etc/s6-rc/source-base/mount-virtual/type new file mode 100644 index 0000000..757b422 --- /dev/null +++ b/layout/rootfs/etc/s6-rc/source-base/mount-virtual/type @@ -0,0 +1 @@ +bundle diff --git a/layout/rootfs/home b/layout/rootfs/home new file mode 120000 index 0000000..48b7bfd --- /dev/null +++ b/layout/rootfs/home @@ -0,0 +1 @@ +mnt/userfs/home
\ No newline at end of file diff --git a/layout/rootfs/var b/layout/rootfs/var new file mode 120000 index 0000000..a492c97 --- /dev/null +++ b/layout/rootfs/var @@ -0,0 +1 @@ +mnt/rwfs/var
\ No newline at end of file diff --git a/layout/rootfs/var/log/sshd-4/.empty b/layout/rootfs/var/log/sshd-4/.empty deleted file mode 100644 index e69de29..0000000 --- a/layout/rootfs/var/log/sshd-4/.empty +++ /dev/null diff --git a/layout/rootfs/etc/ssl/.empty b/layout/rwfs/var/etc/.empty index e69de29..e69de29 100644 --- a/layout/rootfs/etc/ssl/.empty +++ b/layout/rwfs/var/etc/.empty diff --git a/layout/rootfs/mnt/stagingfs/.empty b/layout/rwfs/var/log/klogd/.empty index e69de29..e69de29 100644 --- a/layout/rootfs/mnt/stagingfs/.empty +++ b/layout/rwfs/var/log/klogd/.empty diff --git a/layout/rootfs/mnt/syncfs/.empty b/layout/rwfs/var/run/.empty index e69de29..e69de29 100644 --- a/layout/rootfs/mnt/syncfs/.empty +++ b/layout/rwfs/var/run/.empty diff --git a/layout/rootfs/var/log/klogd/.empty b/layout/rwfs/var/tmp/.empty index e69de29..e69de29 100644 --- a/layout/rootfs/var/log/klogd/.empty +++ b/layout/rwfs/var/tmp/.empty diff --git a/layout/userfs/home/guest/.execline-loginshell b/layout/userfs/home/guest/.execline-loginshell new file mode 100755 index 0000000..9339af0 --- /dev/null +++ b/layout/userfs/home/guest/.execline-loginshell @@ -0,0 +1,3 @@ +#!/command/execlineb -S0 +/command/importas -D /etc/execline-shell SHELL SHELL +$SHELL $@ diff --git a/layout/userfs/home/guest/.execline-shell b/layout/userfs/home/guest/.execline-shell new file mode 100755 index 0000000..f28df30 --- /dev/null +++ b/layout/userfs/home/guest/.execline-shell @@ -0,0 +1,3 @@ +#!/command/execlineb -S0 +export PS1 "${USER}@%%HOSTNAME%%:${PWD} $ " +/bin/ash $@ diff --git a/layout/rootfs/var/log/ntpclient/.empty b/layout/userfs/home/guest/.ssh/.empty index e69de29..e69de29 100644 --- a/layout/rootfs/var/log/ntpclient/.empty +++ b/layout/userfs/home/guest/.ssh/.empty @@ -1,15 +1,18 @@ #!/bin/sh -e +if test -n "$CONSOLE" ; then + consoleoption="console=$CONSOLE" +fi + case "$QEMU_ARCH" in - aarch64) - qemucpu=cortex-a57 - qemuconsole=ttyAMA0 ;; + aarch64) cpuoption="-cpu cortex-a57" ;; esac -exec qemu-system-${QEMU_ARCH} -nographic -M virt -cpu $qemucpu -smp 4 -m 2G -nodefaults -display none -serial mon:stdio \ +exec qemu-system-${QEMU_ARCH} -nographic -M virt $cpuoption -smp 4 -m 2G -nodefaults -display none -serial mon:stdio \ -kernel "$OUTPUT/kernel" \ - -append "root=/dev/vda console=$qemuconsole" \ - -drive if=none,file=$OUTPUT/disk-image.qcow2,format=qcow2,id=disk \ - -netdev user,id=network,hostfwd=tcp:127.0.0.1:2222-:22 \ - -device virtio-blk-pci,drive=disk \ - -device virtio-net-device,netdev=network + -append "root=/dev/vda $consoleoption" \ + -drive if=virtio,file=$OUTPUT/rootfs.qcow2,format=qcow2,media=disk,index=1 \ + -drive if=virtio,file=$OUTPUT/rwfs.qcow2,format=qcow2,media=disk,index=2 \ + -drive if=virtio,file=$OUTPUT/userfs.qcow2,format=qcow2,media=disk,index=3 \ + -netdev user,id=eth0,hostfwd=tcp:127.0.0.1:2222-:22 \ + -device virtio-net-device,netdev=eth0 diff --git a/sub/layout/Makefile b/sub/layout/Makefile index ed63328..85ac809 100644 --- a/sub/layout/Makefile +++ b/sub/layout/Makefile @@ -3,5 +3,9 @@ $(OUTPUT)/tmp/.lh_layout_copied: $(OUTPUT)/tmp/.lh_prepared layout | $(OUTPUT)/b exec sub/layout/copylayout $(OUTPUT) exec setuidgid $(NORMALUSER) s6-touch $@ -$(OUTPUT)/tmp/.lh_layout_installed: $(OUTPUT)/tmp/.lh_layout_copied | $(OUTPUT)/build-build/.lh_skarnet_installed +$(OUTPUT)/tmp/.lh_layout_s6rcdb_made: $(OUTPUT)/tmp/.lh_layout_copied | $(OUTPUT)/build-build/.lh_skarnet_installed + stamp=$$(s6-clock) && s6-rc-compile -v2 -h sysfdh $(OUTPUT)/rootfs/etc/s6-rc/compiled-$$stamp $(OUTPUT)/rootfs/etc/s6-rc/source-base && s6-ln -s compiled-$$stamp $(OUTPUT)/rootfs/etc/s6-rc/compiled.new && s6-rename $(OUTPUT)/rootfs/etc/s6-rc/compiled.new $(OUTPUT)/rootfs/etc/s6-rc/compiled + exec setuidgid $(NORMALUSER) s6-touch $@ + +$(OUTPUT)/tmp/.lh_layout_installed: $(OUTPUT)/tmp/.lh_layout_copied $(OUTPUT)/tmp/.lh_layout_s6rcdb_made | $(OUTPUT)/build-build/.lh_skarnet_installed exec setuidgid $(NORMALUSER) s6-touch $@ diff --git a/sub/layout/copylayout b/sub/layout/copylayout index 96dad43..01e1574 100755 --- a/sub/layout/copylayout +++ b/sub/layout/copylayout @@ -3,13 +3,17 @@ output="$1" s6-hiercopy layout/rootfs $output/rootfs -chown -R 0:0 $output/rootfs +chown -R 0:0 $output/rootfs $output/rwfs $output/userfs find "$output/rootfs" -type f -name .empty -size 0c -exec s6-rmrf {} \; +s6-hiercopy layout/rwfs $output/rwfs +find "$output/rwfs" -type f -name .empty -size 0c -exec s6-rmrf {} \; +s6-hiercopy layout/userfs $output/userfs +find "$output/userfs" -type f -name .empty -size 0c -exec s6-rmrf {} \; buildtime=$(s6-clock) hostarch=$(s6-echo -- $TRIPLE | cut -f1 -d-) -sed -i -e "s/%%HOSTNAME%%/lh-$hostarch/g" $output/rootfs/etc/motd $output/rootfs/etc/issue.net $output/rootfs/root/.execline-shell +sed -i -e "s/%%HOSTNAME%%/lh-$hostarch/g" $output/rootfs/etc/motd $output/rootfs/etc/issue.net $output/rootfs/root/.execline-shell $output/rootfs/etc/s6-rc/source-base/00/up while read file user group perms ; do if s6-test -n "$file" -a "$file" != "#" ; then @@ -18,7 +22,6 @@ while read file user group perms ; do fi done < sub/layout/permissions - # If dynamic: copy shared libs from the toolchain into the target if ! ${BUILD_HOST_STATIC} ; then diff --git a/sub/layout/permissions b/sub/layout/permissions index 76f737e..7f3102f 100644 --- a/sub/layout/permissions +++ b/sub/layout/permissions @@ -1,5 +1,9 @@ rootfs/etc/shadow 0 0 0600 -rootfs/tmp 0 0 1777 -rootfs/var/log/klogd 102 61 2700 -rootfs/var/log/ntpclient 106 62 2700 -rootfs/var/log/sshd-4 138 61 2700 + +rwfs/var/tmp 0 0 1777 +rwfs/var/log/klogd 102 61 2700 + +userfs/home/guest 1000 100 2755 +userfs/home/guest/.execline-shell 1000 100 0755 +userfs/home/guest/.execline-loginshell 1000 100 0755 +userfs/home/guest/.ssh 1000 100 2700 diff --git a/sub/skarnet.org/Makefile b/sub/skarnet.org/Makefile index 4eee9bb..4401128 100644 --- a/sub/skarnet.org/Makefile +++ b/sub/skarnet.org/Makefile @@ -190,7 +190,24 @@ $(OUTPUT)/build-build/.lh_s6dns_installed: $(OUTPUT)/build-build/.lh_s6dns_built exec setuidgid $(NORMALUSER) touch $@ -$(OUTPUT)/build-build/.lh_skarnet_installed: $(OUTPUT)/build-build/.lh_skalibs_installed $(OUTPUT)/build-build/.lh_execline_installed $(OUTPUT)/build-build/.lh_s6pu_installed $(OUTPUT)/build-build/.lh_s6_installed $(OUTPUT)/build-build/.lh_s6li_installed $(OUTPUT)/build-build/.lh_s6dns_installed +$(OUTPUT)/build-build/.lh_s6rc_copied: $(OUTPUT)/sources/.lh_s6rc_cloned + exec setuidgid $(NORMALUSER) rm -rf $(OUTPUT)/build-build/tmp/s6-rc + exec setuidgid $(NORMALUSER) cp -a $(OUTPUT)/sources/s6-rc $(OUTPUT)/build-build/tmp/s6-rc + exec setuidgid $(NORMALUSER) touch $@ + +$(OUTPUT)/build-build/.lh_s6rc_configured: $(OUTPUT)/build-build/.lh_s6rc_copied $(OUTPUT)/build-build/.lh_skalibs_installed $(OUTPUT)/build-build/.lh_execline_installed $(OUTPUT)/build-build/.lh_s6_installed $(OUTPUT)/build-build/.lh_gcc $(OUTPUT)/build-build/.lh_s6_installed + cd $(OUTPUT)/build-build/tmp/s6-rc && setuidgid $(NORMALUSER) env CC="$(BUILD_BUILD_CC)" ./configure --enable-slashpackage --disable-shared --with-sysdeps=$(OUTPUT)/build-build/package/prog/skalibs/sysdeps --with-include=$(OUTPUT)/build-build/package/prog/skalibs/include --with-lib=$(OUTPUT)/build-build/package/prog/skalibs/library --with-include=$(OUTPUT)/build-build/package/admin/execline/include --with-lib=$(OUTPUT)/build-build/package/admin/execline/library --with-include=$(OUTPUT)/build-build/package/admin/s6/include --with-lib=$(OUTPUT)/build-build/package/admin/s6/library + exec setuidgid $(NORMALUSER) touch $@ + +$(OUTPUT)/build-build/.lh_s6rc_built: $(OUTPUT)/build-build/.lh_s6rc_configured $(OUTPUT)/build-build/.lh_skalibs_installed $(OUTPUT)/build-build/.lh_execline_installed $(OUTPUT)/build-build/.lh_s6_installed + cd $(OUTPUT)/build-build/tmp/s6-rc && setuidgid $(NORMALUSER) $(MAKE) all strip + exec setuidgid $(NORMALUSER) touch $@ + +$(OUTPUT)/build-build/.lh_s6rc_installed: $(OUTPUT)/build-build/.lh_s6rc_built + cd $(OUTPUT)/build-build/tmp/s6-rc && setuidgid $(NORMALUSER) $(MAKE) install update global-links DESTDIR=$(OUTPUT)/build-build + exec setuidgid $(NORMALUSER) touch $@ + +$(OUTPUT)/build-build/.lh_skarnet_installed: $(OUTPUT)/build-build/.lh_skalibs_installed $(OUTPUT)/build-build/.lh_execline_installed $(OUTPUT)/build-build/.lh_s6pu_installed $(OUTPUT)/build-build/.lh_s6_installed $(OUTPUT)/build-build/.lh_s6li_installed $(OUTPUT)/build-build/.lh_s6dns_installed $(OUTPUT)/build-build/.lh_s6rc_installed exec setuidgid $(NORMALUSER) touch $@ @@ -314,6 +331,7 @@ $(OUTPUT)/build-host/.lh_s6li_laidout: $(OUTPUT)/build-host/.lh_s6li_installed | exec chmod 02750 $(OUTPUT)/rootfs/etc/s6-linux-init/s6lidir/run-image/uncaught-logs exec rm -rf $(OUTPUT)/rootfs/etc/s6-linux-init/current exec mv -f $(OUTPUT)/rootfs/etc/s6-linux-init/s6lidir $(OUTPUT)/rootfs/etc/s6-linux-init/current + for i in `ls -1 $(OUTPUT)/rootfs/etc/s6-linux-init/current/bin` ; do ln -s ../etc/s6-linux-init/current/bin/$$i /bin/$$i ; done exec setuidgid $(NORMALUSER) s6-touch $@ $(OUTPUT)/build-host/.lh_mdevd_copied: $(OUTPUT)/sources/.lh_mdevd_cloned | $(OUTPUT)/build-build/.lh_skarnet_installed |