Commit Diff


commit - ea4a917c47b70842d3568237008ef0cec17d7c57
commit + d59ba20c48720bc48af79190cf8a80c422087dcf
blob - 4ca1bf86796fcc3d381387c2eac86373a1238e46
blob + 9c8cb7919a03db0a1a2897184202a943760c3947
--- tools/Makefile
+++ tools/Makefile
@@ -19,13 +19,14 @@ MPC_VER = 1.3.1
 OKSH_VER = 7.5
 DESTRUCT_VER = 0.2
 RVFORTH_VER = 0.1
+MCU_VER = 1.2
 
 GMAKE = $U/gmake
 SUDO =
 
 all: build
 
-extra: rvforth oksh
+extra: rvforth oksh mcu
 
 build: ${STAMPS}/libgcc-install ${STAMPS}/destruct-install
 
@@ -38,8 +39,8 @@ clean:
 test:
 	${PREFIX}/bin/${TARGET}-gcc -o /dev/null $U/test.c
 
-download: src/binutils.tgz src/gcc.tgz src/musl.tgz src/linux.tgz src/gmp.tgz src/mpfr.tgz src/mpc.tgz src/destruct.tgz
-extract: ${STAMPS}/binutils-extract ${STAMPS}/gcc-extract ${STAMPS}/musl-extract ${STAMPS}/linux-extract ${STAMPS}/gmp ${STAMPS}/mpfr ${STAMPS}/mpc ${STAMPS}/destruct
+download: src/binutils.tgz src/gcc.tgz src/musl.tgz src/linux.tgz src/gmp.tgz src/mpfr.tgz src/mpc.tgz src/oksh.tgz src/destruct.tgz src/rvforth.tgz src/mcu.tgz
+extract: ${STAMPS}/binutils-extract ${STAMPS}/gcc-extract ${STAMPS}/musl-extract ${STAMPS}/linux-extract ${STAMPS}/gmp ${STAMPS}/mpfr ${STAMPS}/mpc ${STAMPS}/oksh ${STAMPS}/destruct ${STAMPS}/rvforth ${STAMPS}/mcu
 
 headers: ${STAMPS}/linux-headers
 install-headers: ${STAMPS}/linux-hdrinst
@@ -88,6 +89,10 @@ src/rvforth.tgz:
 	mkdir -p src
 	$U/download $@ https://got.stuerz.xyz/download/rvforth-${RVFORTH_VER}.tgz
 
+src/mcu.tgz:
+	mkdir -p src
+	$U/download $@ https://github.com/riscygeek/microcoreutils/archive/refs/tags/v${MCU_VER}.tar.gz
+
 # EXTRACT
 
 ${STAMPS}/binutils-extract: src/binutils.tgz
@@ -157,6 +162,12 @@ ${STAMPS}/rvforth: src/rvforth.tgz
 	mv build/rvforth-* build/rvforth
 	touch $@
 
+${STAMPS}/mcu: src/mcu.tgz
+	mkdir -p ${STAMPS}
+	tar -C build -xzf src/mcu.tgz
+	mv build/microcoreutils-* build/mcu
+	touch $@
+
 # KERNEL HEADERS
 
 ${STAMPS}/linux-headers: ${STAMPS}/linux-extract
@@ -314,3 +325,28 @@ ${TOP}/rootfs/bin/rvforth: ${STAMPS}/rvforth-build
 
 
 rvforth: ${TOP}/rootfs/bin/rvforth
+
+# MICROCOREUTILS
+
+${STAMPS}/mcu-configure: ${STAMPS}/mcu
+	cd ${TOOLS}/build/mcu &&			\
+	CC=${PREFIX}/bin/${TARGET}-gcc ./configure	\
+		--prefix=/mcu				\
+		--host=${TARGET}			\
+		--enable-extra-progs
+	touch $@
+
+${STAMPS}/mcu-fix: ${STAMPS}/mcu-configure
+	(cd ${TOOLS}/build/mcu && \
+		sed '/^#define malloc/d; /^#define realloc/d' config.h > config.h.new && \
+		mv config.h.new config.h)
+	touch $@
+
+${STAMPS}/mcu-build: ${STAMPS}/mcu-fix
+	(cd ${TOOLS}/build/mcu && ${MAKE})
+	touch $@
+
+${TOP}/rootfs/mcu/bin/ls: ${STAMPS}/mcu-build
+	(cd ${TOOLS}/build/mcu && ${MAKE} DESTDIR=${TOP}/rootfs install)
+
+mcu: ${TOP}/rootfs/mcu/bin/ls