commit b8f0633cf33cfa263fce991cfdd88c6b2ed7570d
parent c7adf20a7fdd23c5e7147923f927a63cfd88b2c8
Author: parazyd <parazyd@dyne.org>
Date: Fri, 27 Nov 2020 15:48:51 +0100
Build dash shell for initramfs.
Diffstat:
2 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
@@ -8,12 +8,14 @@ include config.mk
BINS = qemu-wrapper install.sh
BOOT_BINS = rpi-boot/upstream/kernel.img rpi-boot/upstream/bcm2835-rpi-zero.dtb
+INIT_BINS = initramfs/bin/sh
all: $(BINS) $(BOOT_BINS)
image: all $(IMAGE)
include alpine.mk
+include dash.mk
include kernel.mk
qemu-wrapper.c:
@@ -33,7 +35,10 @@ rpi-boot/upstream/kernel.img: $(KERNEL_BINS)
rpi-boot/upstream/bcm2835-rpi-zero.dtb: $(KERNEL_BINS)
cp -f $(KERNEL_SRC)/arch/arm/boot/dts/bcm2835-rpi-zero.dtb $@
-$(IMAGE): $(BINS) $(BOOT_BINS) $(ALPINE_BINS) ch
+initramfs/bin/sh: $(DASH_BINS)
+ cp -f $(DASH_SRC)/src/dash $@
+
+$(IMAGE): $(BINS) $(BOOT_BINS) $(ALPINE_BINS) $(INIT_BINS) ch
cp -f $(BINS) ./ch
sudo cp -f $(QEMU_ARM) ./ch/$(QEMU_ARM)
chmod 755 ./ch/qemu-wrapper
@@ -55,9 +60,9 @@ endif
( cd ch && sudo find . | sudo cpio -oa --reproducible --format=newc > ../$@)
clean:
- sudo rm -rf $(BINS) $(BOOT_BINS) qemu-wrapper.c $(IMAGE) ch
+ sudo rm -rf $(BINS) $(BOOT_BINS) $(INIT_BINS) qemu-wrapper.c $(IMAGE) ch
distclean: clean
- rm -rf $(KERNEL_BINS) $(ALPINE_BINS)
+ rm -rf $(KERNEL_BINS) $(ALPINE_BINS) $(DASH_BINS)
.PHONY: all image clean distclean
diff --git a/config.mk b/config.mk
@@ -14,6 +14,9 @@ QEMU_ARM = /usr/bin/qemu-arm
# Crosscompiler prefix used to compile the Linux kernel
CROSS_COMPILE = armv6j-unknown-linux-musleabihf-
+# Host compiler prefix (necessary to crosscompile dash)
+DASH_HOST_PREFIX = x86_64-pc-linux-gnu
+
# System credentials
USERCREDENTIALS = uwu:uwu
ROOTCREDENTIALS = root:uwu
@@ -28,3 +31,7 @@ KERNEL_PATCH =
# Alpine Linux version
ALPINE_MAJ = 3.12
ALPINE_VER = 3.12.1
+
+# Dash shell version
+DASH_SRC = dash-0.5.11.2
+DASH_SUM = 24b0bfea976df722bc360e782b683c0867f0513d2922fa3c002d8d47a20605ee