feat(image): add overlay to /etc and use busybox getty for login prompt
This commit is contained in:
parent
3374541b3a
commit
0ed83a6d27
2 changed files with 20 additions and 27 deletions
|
@ -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 <<EOF > 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 \
|
||||
|
|
|
@ -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 <<EOF > $out/etc/repart.d/10-esp.conf
|
||||
[Partition]
|
||||
|
@ -68,6 +71,21 @@ Options=defaults
|
|||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
cat <<EOF > $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/
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue