diff --git a/image/mkimage.sh b/image/mkimage.sh index 721c26e..7a76dd9 100644 --- a/image/mkimage.sh +++ b/image/mkimage.sh @@ -13,6 +13,7 @@ find rootfs/ -type d -exec chmod 755 {} \; ln -sf multi-user.target rootfs/usr/lib/systemd/system/default.target # mount patos state +ln -sf ../etc.mount rootfs/usr/lib/systemd/system/local-fs.target.wants/etc.mount ln -sf ../var.mount rootfs/usr/lib/systemd/system/sysinit.target.wants/var.mount # enable dbus @@ -25,32 +26,6 @@ ln -sf ../systemd-networkd.service rootfs/usr/lib/systemd/system/sysinit.target. # generate a temporary machine id $systemd/usr/bin/systemd-machine-id-setup --root=rootfs/ -# FIXME: remove this later (just to get a shell in the initramfs) -cat < rootfs/usr/lib/systemd/system/demo.service -[Unit] -Description=Debug Shell (/bin/sulogin) -Conflicts=shutdown.target -Before=shutdown.target - -[Service] -Environment=HOME=/root -WorkingDirectory=/root -ExecStart=/bin/sulogin -Type=idle -StandardInput=tty-force -StandardOutput=inherit -StandardError=inherit -KillMode=process -IgnoreSIGPIPE=no -SendSIGHUP=yes -Restart=always - -[Install] -WantedBy=multi-user.target -EOF -ln -sf ../demo.service rootfs/usr/lib/systemd/system/multi-user.target.wants/demo.service - - $systemd/usr/bin/ukify build \ --linux $kernel/bzImage \ --initrd $initrd/initrd.xz \ diff --git a/rootfs/mkrootfs.sh b/rootfs/mkrootfs.sh index c7460e6..75ba2a6 100644 --- a/rootfs/mkrootfs.sh +++ b/rootfs/mkrootfs.sh @@ -1,7 +1,7 @@ set -ex -o pipefail mkdir -p $out -mkdir -p $out/etc/repart.d $out/dev $out/proc $out/sys $out/tmp $out/root $out/run $out/boot $out/mnt +mkdir -p $out/etc/repart.d $out/dev $out/proc $out/sys $out/tmp $out/root $out/run $out/boot $out/mnt $out/home $out/srv ln -sf ../usr/bin $out/bin ln -sf ../usr/bin $out/sbin ln -sf ../usr/lib $out/lib @@ -29,6 +29,9 @@ VERSION_ID={version} BUILD_ID={version} EOF +# replace agetty with busybox getty +sed -i 's#ExecStart=.*#ExecStart=-/sbin/getty -L %I 115200 vt100#' $out/usr/lib/systemd/system/serial-getty@.service + sed -i 's#After=\(.*\)#After=sysroot.mount \1#' $out/usr/lib/systemd/system/systemd-repart.service cat < $out/etc/repart.d/10-esp.conf [Partition] @@ -68,6 +71,21 @@ Options=defaults WantedBy=multi-user.target EOF +cat < $out/usr/lib/systemd/system/etc.mount +[Unit] +Description=Overlay mount for /etc +Before=local-fs.target + +[Mount] +What=overlay +Where=/etc +Type=overlay +Options=lowerdir=/etc,upperdir=/run/.rw-etc/upper,workdir=/run/.rw-etc/work + +[Install] +WantedBy=local-fs.target +EOF + ### install PatOS glibc cp -P $glibcPatos/lib/*.so* $out/usr/lib/