commit ad52680a0565c992d91aea1ee883a9e292f01d01
parent edf232c412167a5151105f645a76d6dfc24a1a16
Author: sin <sin@2f30.org>
Date: Tue, 20 Aug 2013 13:36:41 +0100
Add smdev
Diffstat:
1 file changed, 26 insertions(+), 8 deletions(-)
diff --git a/suckless-initramfs b/suckless-initramfs
@@ -2,11 +2,12 @@
#
# To build use: fakeroot ./suckless-initramfs
-# Fetch sbase + ubase + mksh
+# Fetch sbase + ubase + smdev + mksh
mkdir build
cd build
git clone git://git.2f30.org/sbase
git clone git://git.2f30.org/ubase
+git clone git://git.2f30.org/smdev
wget -O mksh-R47.tgz -c https://www.mirbsd.org/MirOS/dist/mir/mksh/mksh-R47.tgz
# Build statically linked sbase + ubase
@@ -19,6 +20,13 @@ make clean
make CC=musl-gcc LDFLAGS=-static
cd -
+# Build statically linked smdev
+cd smdev
+make clean
+make CC=musl-gcc LDFLAGS=-static
+strip smdev
+cd -
+
# Build statically linked mksh
tar xzf mksh-R47.tgz
cd mksh
@@ -33,10 +41,22 @@ cd initramfs
ln -s /bin sbin
cd -
-echo 'root:x:0:0:root:/root:/bin/mksh' > initramfs/etc/passwd
-echo 'root:x:0:root' > initramfs/etc/group
+cat <<EOF > initramfs/etc/group
+root:x:0:root
+bin:x:1:root,bin,daemon
+daemon:x:2:root,bin,daemon
+sys:x:3:root,bin
+adm:x:4:root,daemon
+tty:x:5:
+EOF
+
+cat <<EOF > initramfs/etc/passwd
+root:x:0:0:root:/root:/bin/mksh
+bin:x:1:1:bin:/bin:/bin/false
+daemon:x:2:2:daemon:/sbin:/bin/false
+EOF
-# Install sbase + ubase + mksh
+# Install sbase + ubase + smdev + mksh
for i in $(find sbase/ -not -iwholename "*.git*" -perm 755); do
strip "$i"
cp "$i" initramfs/bin
@@ -45,6 +65,7 @@ for i in $(find ubase/ -not -iwholename "*.git*" -perm 755); do
strip "$i"
cp "$i" initramfs/bin
done
+cp smdev/smdev initramfs/bin/smdev
cp mksh/mksh initramfs/bin/mksh
# Create symlink for /bin/sh -> mksh
@@ -60,12 +81,9 @@ export PATH=/sbin:/bin
mount -t sysfs sysfs /sys
mount -t proc proc /proc
-mknod /dev/null c 1 3
-mknod /dev/zero c 1 5
-mknod /dev/tty c 5 0
mkdir /dev/pts
mount -t devpts devpts /dev/pts
-
+smdev -s
hostname suckless
while :; do