commit 0ea05f87551887f7a79e3f2917fc5b9a9908c63a
parent 49654d6260233b8e7e4bd25d64fa0f5c64be3c6d
Author: sin <sin@2f30.org>
Date: Wed, 4 Sep 2013 15:49:57 +0100
Move suckless-initramfs to suckless-img/create etc.
Diffstat:
3 files changed, 126 insertions(+), 120 deletions(-)
diff --git a/suckless-img/create b/suckless-img/create
@@ -0,0 +1,123 @@
+#!/bin/bash -x
+#
+# To build use: fakeroot ./create
+
+# Fetch sbase + ubase + smdev + mksh
+mkdir -p build
+cd build
+rm -rf sbase ubase smdev
+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
+cd sbase
+make clean
+make CC=musl-gcc LDFLAGS=-static
+cd -
+cd ubase
+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
+CC=musl-gcc LDFLAGS+=-static sh Build.sh
+strip mksh
+cd -
+
+# Create dir hierarchy
+rm -rf initramfs
+mkdir -p initramfs/{bin,etc,dev,proc,root,sys,tmp}
+cd initramfs
+ln -s /bin sbin
+cd -
+
+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:
+disk:x:6:root
+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 + smdev + mksh
+for i in $(find sbase/ -not -iwholename "*.git*" -perm 755); do
+ strip "$i"
+ cp "$i" initramfs/bin
+done
+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 smdev/simevent initramfs/bin/simevent
+cp mksh/mksh initramfs/bin/mksh
+
+wget -c http://www.landley.net/toybox/bin/toybox-x86_64 -O toybox
+chmod +x toybox
+mv toybox initramfs/bin
+cd initramfs/bin
+ln -s toybox ifconfig
+cd -
+
+wget -c http://amnezia.2f30.org/users/sin/src/sdhcp.tar.gz -O sdhcp.tar.gz
+tar xzf sdhcp.tar.gz
+cd sdhcp
+make debug && strip sdhcp
+cd -
+cp sdhcp/sdhcp initramfs/bin
+
+# Create symlink for /bin/sh -> mksh
+cd initramfs/bin
+ln -s /bin/mksh sh
+cd -
+
+cat << EOF > initramfs/bin/hotplug
+#!/bin/sh
+
+env >> /tmp/hotplug-events
+EOF
+
+chmod +x initramfs/bin/hotplug
+
+# Our init script
+cat << EOF > initramfs/init
+#!/bin/sh
+
+export PATH=/bin:/sbin
+
+mount -t sysfs sysfs /sys
+mount -t proc proc /proc
+echo /bin/smdev > /proc/sys/kernel/hotplug
+smdev -s
+hostname suckless
+
+while :; do
+ sh
+done
+EOF
+
+chmod +x initramfs/init
+
+cd initramfs
+find . | cpio --quiet -H newc -o | gzip -9 -n > ../initramfs.img
+rm -rf initramfs
+echo Done
diff --git a/suckless-img/qemu-run b/suckless-img/qemu-run
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+qemu-system-x86_64 -net nic,model=ne2k_pci -kernel /boot/vmlinuz-3.10.9 -initrd build/initramfs.img
diff --git a/suckless-initramfs b/suckless-initramfs
@@ -1,120 +0,0 @@
-#!/bin/bash -x
-#
-# To build use: fakeroot ./suckless-initramfs
-
-# Fetch sbase + ubase + smdev + mksh
-mkdir -p build
-cd build
-rm -rf sbase ubase smdev
-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
-cd sbase
-make clean
-make CC=musl-gcc LDFLAGS=-static
-cd -
-cd ubase
-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
-CC=musl-gcc LDFLAGS+=-static sh Build.sh
-strip mksh
-cd -
-
-# Create dir hierarchy
-rm -rf initramfs
-mkdir -p initramfs/{bin,etc,dev,proc,root,sys,tmp}
-cd initramfs
-ln -s /bin sbin
-cd -
-
-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:
-disk:x:6:root
-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 + smdev + mksh
-for i in $(find sbase/ -not -iwholename "*.git*" -perm 755); do
- strip "$i"
- cp "$i" initramfs/bin
-done
-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 smdev/simevent initramfs/bin/simevent
-cp mksh/mksh initramfs/bin/mksh
-
-# Create symlink for /bin/sh -> mksh
-cd initramfs/bin
-ln -s /bin/mksh sh
-cd -
-
-cat << EOF > initramfs/bin/hotplug
-#!/bin/sh
-
-env >> /tmp/hotplug-events
-EOF
-
-chmod +x initramfs/bin/hotplug
-
-# Our init script
-cat << EOF > initramfs/init
-#!/bin/sh
-
-export PATH=/bin:/sbin
-
-mount -t sysfs sysfs /sys
-mount -t proc proc /proc
-echo /bin/smdev > /proc/sys/kernel/hotplug
-smdev -s
-hostname suckless
-
-while :; do
- sh
-done
-EOF
-
-chmod +x initramfs/init
-
-wget -c http://www.landley.net/toybox/bin/toybox-x86_64 -O toybox
-chmod +x toybox
-mv toybox initramfs/bin
-cd initramfs/bin
-ln -s toybox ifconfig
-cd -
-
-wget -c http://amnezia.2f30.org/users/sin/sdhcp -O sdhcp
-chmod +x sdhcp
-mv sdhcp initramfs/bin
-
-cd initramfs
-find . | cpio --quiet -H newc -o | gzip -9 -n > ../initramfs.img
-rm -rf initramfs
-echo Done