logo

bootstrap-initrd

Linux initrd to bootstrap from a small binary seed git clone https://hacktivis.me/git/make-initrd.git
commit: acfd3a127bfcac8d23408c0787255f8f79cbea5e
parent 6050892a9c6a395658495a89280d9d99af2996f7
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Wed,  1 May 2024 03:27:10 +0200

Build lex from heirloom-devtools

Diffstat:

MREADME.md5+++++
Minit.sh14++++++++++++++
Mmake-root.sh13+++++++++++++
3 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/README.md b/README.md @@ -68,6 +68,11 @@ Note: Might be worth it to de-vendor zopfli. Meanwhile: - GNU gzip: ./configure script which requires diff(1) for it's grep sanity check +### Heirloom-devtools lex +Slighly messy Makefiles but only has few dependencies. +Meanwhile: +- flex: ./configure script which requires diff(1) for it's grep sanity check + ## Launching in QEMU ``` $ qemu-system-x86_64 -enable-kvm -m 512 -kernel /boot/vmlinuz-6.6.21-gentoo -initrd /tmp/initramfs-tcc.cpio.xz -append 'init=/init console=ttyS0 panic=1' -nographic -no-reboot diff --git a/init.sh b/init.sh @@ -77,6 +77,16 @@ build_pigz() { ln -s pigz /bin/ungzip } +build_hierloom_devtools() { + cd /heirloom-devtools-*/ + for cmd in lex + do + bmake "$cmd/Makefile" + bmake AR=true RANLIB=true -C "$cmd" + bmake AR=true RANLIB=true -C "$cmd" install + done +} + set -ex -o pipefail export CC=tcc @@ -91,6 +101,7 @@ M4="true" loksh ./makeless.sh profile_export PATH="$PATH:$PWD/cmd/" profile_export YACC="yacc" +profile_export STRIP="true" # re-export due to prior lack of echo profile_export CC="$CC" profile_export CFLAGS="$CFLAGS" @@ -115,9 +126,12 @@ EOF chmod +x /bin/hostname build_bmake || die +profile_export MAKE="bmake" + build_bzip2 || die build_zlib_libs || die build_pigz || die +build_hierloom_devtools || die cat /proc/uptime echo 'Done bootstrapping!' diff --git a/make-root.sh b/make-root.sh @@ -89,6 +89,19 @@ patch -p0 <"${WORKDIR}/zlib-1.3.1_no_staticlib.patch" patch -p0 <"${WORKDIR}/zlib-1.3.1-use-LDFLAGS-in-configure.patch" patch -p0 <"${WORKDIR}/zlib-1.3.1-use-LDFLAGS-in-configure_no_gcc.patch" +sed -i \ + -e 's;INSTALL=.*;INSTALL=install;' \ + -e 's;PREFIX=.*;PREFIX=/usr;;' \ + -e 's;SUSBIN=.*;SUSBIN=$(BINDIR);' \ + -e 's;STRIP=.*;STRIP=true;' \ + -e 's;#?AR=.*;AR ?= ar;' \ + -e 's;RANLIB=.*;RANLIB ?= ranlib;' \ + -e 's;YACC=.*;YACC ?= yacc;' \ + heirloom-devtools-*/mk.config \ + || die "Failed configuring heirloom-devtools" + +sed -i -e '/$(LIBDIR)\/libl.a/d' heirloom-devtools-*/lex/Makefile.mk || die "Failed disabling static lib lex" + deblob -n cd "${WORKDIR}"