commit 4cacaca052951bbd3cc6ba82afab1327cbab38d8
parent a2e4e93a1d41af43009c069e44d109b95b56c19f
Author: parazyd <parazyd@dyne.org>
Date: Fri, 27 Nov 2020 15:58:53 +0100
Add sbase and ubase makefiles.
Diffstat:
4 files changed, 78 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
@@ -8,7 +8,7 @@ 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
+INIT_BINS = initramfs/bin/sh initramfs/bin/basename initramfs/bin/mount
all: $(BINS) $(BOOT_BINS) $(INIT_BINS)
@@ -17,6 +17,8 @@ image: all $(IMAGE)
include alpine.mk
include dash.mk
include kernel.mk
+include sbase.mk
+include ubase.mk
qemu-wrapper.c:
sed -e 's,@QEMU_ARM@,$(QEMU_ARM),g' < $@.in > $@
@@ -38,6 +40,12 @@ rpi-boot/upstream/bcm2835-rpi-zero.dtb: $(KERNEL_BINS)
initramfs/bin/sh: $(DASH_BINS)
cp -f $(DASH_SRC)/src/dash $@
+initramfs/bin/basename: $(SBASE_BINS)
+ cp -f $(SBASE_B) initramfs/bin
+
+initramfs/bin/mount: $(UBASE_BINS)
+ cp -f $(UBASE_B) initramfs/bin
+
$(IMAGE): $(BINS) $(BOOT_BINS) $(ALPINE_BINS) $(INIT_BINS) ch
cp -f $(BINS) ./ch
sudo cp -f $(QEMU_ARM) ./ch/$(QEMU_ARM)
@@ -63,6 +71,6 @@ clean:
sudo rm -rf $(BINS) $(BOOT_BINS) $(INIT_BINS) qemu-wrapper.c $(IMAGE) ch
distclean: clean
- rm -rf $(KERNEL_BINS) $(ALPINE_BINS) $(DASH_BINS)
+ rm -rf $(KERNEL_BINS) $(ALPINE_BINS) $(DASH_BINS) $(SBASE_BINS) $(UBASE_BINS)
.PHONY: all image clean distclean
diff --git a/config.mk b/config.mk
@@ -35,3 +35,9 @@ ALPINE_VER = 3.12.1
# Dash shell version
DASH_SRC = dash-0.5.11.2
DASH_SUM = 24b0bfea976df722bc360e782b683c0867f0513d2922fa3c002d8d47a20605ee
+
+# ubase
+UBASE_SRC = ubase
+
+# sbase
+SBASE_SRC = sbase
diff --git a/sbase.mk b/sbase.mk
@@ -0,0 +1,40 @@
+# Copyright (c) 2020 Ivan J. <parazyd@dyne.org>
+# This file is part of uwu.
+# See LICENSE file for copyright and license details.
+
+SBASE_B = \
+ $(SBASE_SRC)/basename \
+ $(SBASE_SRC)/cat \
+ $(SBASE_SRC)/cp \
+ $(SBASE_SRC)/cut \
+ $(SBASE_SRC)/dirname \
+ $(SBASE_SRC)/env \
+ $(SBASE_SRC)/grep \
+ $(SBASE_SRC)/ls \
+ $(SBASE_SRC)/mkdir \
+ $(SBASE_SRC)/mktemp \
+ $(SBASE_SRC)/printf \
+ $(SBASE_SRC)/pwd \
+ $(SBASE_SRC)/rm \
+ $(SBASE_SRC)/rmdir \
+ $(SBASE_SRC)/sed \
+ $(SBASE_SRC)/sleep \
+ $(SBASE_SRC)/sync \
+ $(SBASE_SRC)/touch \
+ $(SBASE_SRC)/true \
+ $(SBASE_SRC)/xargs \
+ $(SBASE_SRC)/yes \
+
+SBASE_BINS = $(SBASE_SRC) $(SBASE_B)
+
+$(SBASE_SRC):
+ git clone https://git.suckless.org/sbase
+
+$(SBASE_B): $(SBASE_SRC)
+ $(MAKE) -C $(SBASE_SRC) \
+ CC=$(CROSS_COMPILE)gcc \
+ AR=$(CROSS_COMPILE)ar \
+ RANLIB=$(CROSS_COMPILE)ranlib \
+ CFLAGS="-Os -static -std=c99 -Wall -pedantic" \
+ LDFLAGS="-s -static" \
+ -e $(shell basename $@)
diff --git a/ubase.mk b/ubase.mk
@@ -0,0 +1,22 @@
+# Copyright (c) 2020 Ivan J. <parazyd@dyne.org>
+# This file is part of uwu.
+# See LICENSE file for copyright and license details.
+
+UBASE_B = \
+ $(UBASE_SRC)/mount \
+ $(UBASE_SRC)/umount \
+ $(UBASE_SRC)/switch_root
+
+UBASE_BINS = $(UBASE_SRC) $(UBASE_B)
+
+$(UBASE_SRC):
+ git clone https://git.suckless.org/ubase
+
+$(UBASE_B): $(UBASE_SRC)
+ $(MAKE) -C $(UBASE_SRC) \
+ CC=$(CROSS_COMPILE)gcc \
+ AR=$(CROSS_COMPILE)ar \
+ RANLIB=$(CROSS_COMPILE)ranlib \
+ CFLAGS="-Os -static -std=c99 -Wall -Wextra" \
+ LDFLAGS="-s -static" \
+ -e $(shell basename $@)