logo

bootstrap-initrd

Linux initrd to bootstrap from a small binary seed git clone https://hacktivis.me/git/make-initrd.git
commit: 9c41a3445f66e8844788f4692c700380e2bbe4eb
parent 03fa9407aebeb8c60b6b50a1c4334a510961f536
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri,  3 May 2024 03:30:17 +0200

Get diff from heirloom

Diffstat:

MREADME.md3+++
Mdistfiles.SHA512SUM1+
Mfetch.sh1+
Minit.sh12++++++++++++
Mmake-root.sh17+++++++++++++++++
5 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -85,6 +85,9 @@ Meanwhile: - GNU m4: Not even close - OpenBSD m4 aka om4: Requires a more modern lex than heirloom-devtools provides +### Heirloom (toolchest) diff +Slighly messy Makefiles but only has few dependencies. + ## Launching in QEMU ``` $ qemu-system-x86_64 -enable-kvm -m 512 -kernel /boot/vmlinuz-6.6.21-gentoo -initrd /tmp/initramfs-tcc-x86_64.cpio.xz -append 'init=/init console=ttyS0 panic=1' -nographic -no-reboot diff --git a/distfiles.SHA512SUM b/distfiles.SHA512SUM @@ -1,6 +1,7 @@ 1e4ee462513eadd3c540e4782f9661df62ecbcd4d6297d61dcc0845ae7d30243c57571787706af3bb4d561e4350609d7057307290e81d76290a301f159a6abc5 distfiles/binutils-2.42.tar.gz 50622aee8024b3e0385974a8f446a4b5df0ba494b6133ab91ebbe63c408154b112f62c9df8521f4f1beaf28cdd6e7da178c3334337f6b14c8bced532029d8ba5 distfiles/bmake-20230909.tar.gz 083f5e675d73f3233c7930ebe20425a533feedeaaa9d8cc86831312a6581cefbe6ed0d08d2fa89be81082f2a5abdabca8b3c080bf97218a1bd59dc118a30b9f3 distfiles/bzip2-1.0.8.tar.gz +0b30b0f4c4c92a10ee2da263ea44666f445d96bac86ca4afb7bbb50d8278986e4145a7bcdf3ed9f75611bb956e93e16fc0e19874498ce3ae1a00e6fbb4f910c9 distfiles/heirloom-070715.tar.bz2 1f1f10a7b49402053172cc028bbd939a46fcf933994cb867fa40e8c5bbd7b1291575b3bac254cd79dc4fce3e3a2c88fe0f890449888fda16169c8e6a2540f055 distfiles/heirloom-devtools-070527.tar.bz2 3e23929f6ead271a8918224e7979d4168214d47603ef22d9b3391686b4de72a48b261632924a2b9f0c8c58da790401309dd5304c100d8bcbe4ec8c0a434b7d95 distfiles/loksh-7.3.tar.gz 5e812dcbfb5a1be294a3717ed54c5758c9836bd133e56ee59600f47531f1d8536c613b1548637620a4f4cc2761ba507fa541273d1f03108b60cb0c883c601891 distfiles/lolibc-f6e9da7.tar.gz diff --git a/fetch.sh b/fetch.sh @@ -8,6 +8,7 @@ URLS=" https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz https://zlib.net/zlib-1.3.1.tar.gz https://www.zlib.net/pigz/pigz-2.8.tar.gz + https://downloads.sourceforge.net/heirloom/heirloom/070715/heirloom-070715.tar.bz2 https://downloads.sourceforge.net/project/heirloom/heirloom-devtools/070527/heirloom-devtools-070527.tar.bz2 https://sourceware.org/pub/binutils/releases/binutils-2.42.tar.gz " diff --git a/init.sh b/init.sh @@ -87,6 +87,17 @@ build_hierloom_devtools() { done } +build_hierloom() { + cd /heirloom-0*/ + mkdir -p /usr/5bin /usr/5lib + for cmd in diff + do + bmake "$cmd/Makefile" + bmake CC=$CC -C "$cmd" + bmake CC=$CC -C "$cmd" install + done +} + set -ex -o pipefail export CC=tcc @@ -132,6 +143,7 @@ build_bzip2 || die build_zlib_libs || die build_pigz || die build_hierloom_devtools || die +build_hierloom || die cat /proc/uptime echo 'Done bootstrapping!' diff --git a/make-root.sh b/make-root.sh @@ -15,6 +15,7 @@ tarballs=" bzip2-1.0.8.tar.gz zlib-1.3.1.tar.gz pigz-2.8.tar.gz + heirloom-070715.tar.bz2 heirloom-devtools-070527.tar.bz2 " WORKDIR="$(dirname "$0")" @@ -121,6 +122,22 @@ sed -i \ sed -i -e '/$(LIBDIR)\/libl.a/d' heirloom-devtools-*/lex/Makefile.mk || die "Failed disabling static lib lex" +patch -p0 <"${WORKDIR}/heirloom-070715-diff-no-AR.patch" || die + +# - Replace LCOMMON as we don't have AR yet +# - maninst Fails to create parent dir, just noop it, we don't have man anyway +# -e 's;MANINST =.*;MANINST = $(SHELL) ../build/maninst.sh;' \ +sed -i \ + -e 's;STRIP =.*;STRIP = true;' \ + -e 's;SPELLHIST =.*;SPELLHIST = /dev/null;' \ + -e 's;UCBINST =.*;UCBINST = install;' \ + -e 's;MANINST =.*;MANINST = true;' \ + -e 's;LCOMMON =.*;LCOMMON = ../libcommon/*.c;' \ + heirloom-0*/build/mk.config \ + || die "Failed configuring heirloom (toolchest)" + +sed -i -e 's;__GLIBC__;__linux__;' heirloom-070715/libcommon/getdir.c || die "Failed fixing heirloom libcommon for musl" + deblob -n | tee /dev/stderr | awk '/detected: /{ print $2 }' | xargs du -bach | sort -h cd "${WORKDIR}"