logo

bootstrap-initrd

Linux initrd to bootstrap from a small binary seed git clone https://hacktivis.me/git/make-initrd.git
commit: eded0722d0d6309be817dcd8920ab1aa12d4ca28
parent 995b0f6f39c541000eaa9f9d6d93647760e41050
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri,  3 May 2024 19:16:23 +0200

Add bootstrap-bash script for gentoo prefix

Diffstat:

MREADME.md3+++
Abootstrap-bash.sh14++++++++++++++
Mdistfiles.SHA512SUM1+
Mfetch.sh1+
Mmake-root.sh22++++++++++++++++++----
5 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md @@ -108,6 +108,9 @@ Meanwhile: - libarchive aka bsdtar: `./configure` script doesn't likes minised - GNU tar: [No.](https://www.roguelazer.com/blog/surprising-behavior-in-gnu-tar/) +### extras as packed tarballs +- bash: for gentoo's bootstrap-prefix.sh + ## 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/bootstrap-bash.sh b/bootstrap-bash.sh @@ -0,0 +1,14 @@ +#!/bin/sh +set -ex + +gzip -d -k /bash-5.1.tar.gz +tar xf /bash-5.1.tar +cd bash-5.1 + +export LD="tcc" +./configure --prefix=/usr --disable-nls --without-bash-malloc --disable-profiling +bmake clean +bmake SIZE=true +bmake install MAKEINFO=true INSTALL=install +cd .. +rm -r bash-5.1 /bash-5.1.tar diff --git a/distfiles.SHA512SUM b/distfiles.SHA512SUM @@ -1,3 +1,4 @@ +c44a0ce381469219548a3a27589af3fea4f22eda1ca4e9434b59fc16da81b471c29ce18e31590e0860a6a251a664b68c2b45e3a17d22cfc02799ffd9a208390c distfiles/bash-5.1.tar.gz 50622aee8024b3e0385974a8f446a4b5df0ba494b6133ab91ebbe63c408154b112f62c9df8521f4f1beaf28cdd6e7da178c3334337f6b14c8bced532029d8ba5 distfiles/bmake-20230909.tar.gz 083f5e675d73f3233c7930ebe20425a533feedeaaa9d8cc86831312a6581cefbe6ed0d08d2fa89be81082f2a5abdabca8b3c080bf97218a1bd59dc118a30b9f3 distfiles/bzip2-1.0.8.tar.gz 0b30b0f4c4c92a10ee2da263ea44666f445d96bac86ca4afb7bbb50d8278986e4145a7bcdf3ed9f75611bb956e93e16fc0e19874498ce3ae1a00e6fbb4f910c9 distfiles/heirloom-070715.tar.bz2 diff --git a/fetch.sh b/fetch.sh @@ -9,6 +9,7 @@ URLS=" 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://ftp.gnu.org/gnu/bash/bash-5.1.tar.gz " WORKDIR="$(dirname "$0")" diff --git a/make-root.sh b/make-root.sh @@ -18,6 +18,17 @@ tarballs=" heirloom-devtools-070527.tar.bz2 sbase-b30fb568.tar.gz " +distfiles=" + bash-5.1.tar.gz +" +local_files=" + init.sh + ls-stub.c + mv-stub.c + grep-stub.c + cp-stub.c + bootstrap-bash.sh +" WORKDIR="$(dirname "$0")" WORKDIR="$(realpath "$WORKDIR")" @@ -55,6 +66,13 @@ for i in $tarballs; do done rm yacc-1.9.1/yacc || die +for i in $distfiles; do + cp "${WORKDIR}/distfiles/$i" ./ || die "Failed copying $i" +done + +for i in $local_files; do + cp "${WORKDIR}/$i" ./ || die "Failed copying $i" +done deblob @@ -71,10 +89,6 @@ cp "${WORKDIR}/init.c" ./init || die "copying init" sed -i '1i#!/usr/bin/tcc -run' ./init || die "failed adding tcc shebang to init" chmod 755 init || die "init chmod" -for i in init.sh ls-stub.c mv-stub.c grep-stub.c cp-stub.c -do - cp -p "${WORKDIR}/$i" ./ || die "failed copying $i" -done cp -p "${WORKDIR}/ar-stub.sh" ./bin/ar for apk in $APKS_main $APKS_testing