From 21e223c5639d48730c1725beab64f6a3d6cd09c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Thu, 11 Oct 2018 00:00:00 +0000 Subject: [PATCH] TODO document minimal init --- rootfs_overlay/init_lkmc.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100755 rootfs_overlay/init_lkmc.sh diff --git a/rootfs_overlay/init_lkmc.sh b/rootfs_overlay/init_lkmc.sh new file mode 100755 index 0000000..1d18626 --- /dev/null +++ b/rootfs_overlay/init_lkmc.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +# This is an attempt to replace /etc/inittab with a single shell file, +# in order to to make everything explicit and sane. +# +# The rationale is that it will make it easier to port our setup to any image +# if our minimal init is contained in a single portable file. +# +# Of course, packages that rely on extra init may start failing at any +# point with this minimized setup, but this is a risk worth taking, especially +# because gem5 is slow and basically mandates a minimal init. +# +# Here we try to some basic common init tasks that will cover what the large +# majority of software will need. +# +# We don't care about shutdown commands since we focus on stateless disks. + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +mount -t proc proc /proc +mkdir -p /dev/pts +mkdir -p /dev/shm +# TODO do mounts direclty here. fstab only adds the fschk as extra functionality, +# but we don't care since our disks are stateless. +mount -a +login=/tmp/login +printf '#!/bin/sh +exec /bin/login root +' > "$login" +chmod +x "$login" +exec /sbin/getty -n -L -l "$login" console 0 vt100