Move bash rebuild to sysa.

This commit is contained in:
Andrius Štikonas 2023-02-26 17:00:15 +08:00
parent 58d1206c83
commit da9a2c6c50
10 changed files with 250 additions and 221 deletions

View File

@ -24,7 +24,7 @@ shell_lint_task:
- apt-get -y install shellcheck
- apt-get -y clean
check_script:
- shellcheck sysa/run.sh sysb/init sysb/run.sh sysc/init sysc/run.sh sysc/run2.sh sysa/helpers.sh download-distfiles.sh
- shellcheck sysa/run.sh sysa/run2.sh sysb/init sysb/run.sh sysc/init sysc/run.sh sysa/helpers.sh download-distfiles.sh
reuse_lint_task:
container:

View File

@ -539,6 +539,15 @@ libtool 2.2.4
GNU Libtool is the final part of GNU Autotools. It is a script used to hide away differences
when compiling shared libraries on different platforms.
bash 5.2.15
===========
Up to this point, our build of ``bash`` could run scripts but could not be used
interactively. This new version of ``bash`` compiles without any patches,
provides new features, and is built with GNU readline support so it can be used
as an interactive shell. ``autoconf-2.69`` is used to regenerate the configure
script and ``bison`` is used to recreate some included generated files.
binutils 2.24
=============
@ -683,15 +692,6 @@ sysb is purely a transition to sysc, allowing binaries from sysa to get onto a
disk (as sysa does not necessarily have hard disk support in the kernel).
It populates device nodes, mounts sysc, copies over data, and executes sysc.
bash 5.1
========
Up to this point, our build of ``bash`` could run scripts but could not be used
interactively. This new version of ``bash`` compiles without any patches,
provides new features, and is built with GNU readline support so it can be used
as an interactive shell. ``autoconf-2.61`` is used to regenerate the configure
script and ``bison`` is used to recreate some included generated files.
xz 5.0.5
========

View File

@ -20,7 +20,7 @@ ef08694bf8e78ffcf56f9c8a63b0f189e301c06f02ab240e15e4c7fe354c2a0d automake-1.7_0
e8ff13753943e43972a8cf1672819f001718ed38e5497cf7b554c21a507ba22b automake-1.7.8_0.tar.bz2
9922651b64ad2e29b944082f26db223008220155048f25d64df1f6d82071ff1c automake-1.8.5_0.tar.bz2
c5807850a377e4bb9aa4121d9781d145bdd80327626a9419630a75ce2c8d9c71 automake-1.9.6_0.tar.bz2
6e9f4263f8a938e2bf62ae1507092a7d3679a018c2037e2eac9cf424ca20c19c bash-5.1_0.tar.bz2
ca49c0338d6aed5131f907d375384bf42e70f2875f58973da0015b4fb73156cc bash-5.2.15_0.tar.bz2
78c5e718510fcf0ab4296d5cfac114abb31af4a30aa5c9f2c0844d7ee5bae5c5 bc-1.07.1_0.tar.bz2
b06a20417c7dadb007f3e6930b8385ad934651756a339d8a87e086b1139e62d8 binutils-2.24_0.tar.bz2
aa910ea75172041b9285436c148f81b3a9fb205f61b88b5e5bbaab2c1cee9484 binutils-2.38_0.tar.bz2

View File

@ -9,9 +9,17 @@ src_prepare() {
# Remove bison generated files
rm y.tab.c y.tab.h
# Remove prebuilt translation catalogs
rm po/*.gmo
# Skip documentation
mv doc/Makefile.in Makefile.in.doc
rm doc/*
mv Makefile.in.doc doc/Makefile.in
# Rebuild configure script
rm configure
autoconf-2.64
autoconf-2.69
# avoid non-deterministic build:
printf '%s\n%s\n' \
@ -25,7 +33,8 @@ src_configure() {
# improve reproducibility because they make configure
# skip checking for /dev/{fd,stdin,stdout,stderr} (build
# output is affected by their availability otherwise).
./configure --prefix="${PREFIX}" \
# size is part of binutils and is not yet available.
CC=tcc LD=tcc AR="tcc -ar" SIZE=true ./configure --prefix="${PREFIX}" \
--without-bash-malloc \
--disable-nls \
--build=i386-unknown-linux-musl \
@ -35,7 +44,6 @@ src_configure() {
}
src_install() {
# Do not install prebuilt .mo translation catalogs
install -D bash "${DESTDIR}${PREFIX}/bin/bash"
# Work around weird symlink bug
install bash "${DESTDIR}${PREFIX}/bin/sh"

1
sysa/bash-5.2.15/sources Normal file
View File

@ -0,0 +1 @@
https://mirrors.kernel.org/gnu/bash/bash-5.2.15.tar.gz 13720965b5f4fc3a0d4b61dd37e7565c741da9a5be24edc2ae00182fc1b3588c

View File

@ -193,62 +193,6 @@ build autoconf-2.69
build libtool-2.2.4
build binutils-2.24
build bash-5.2.15
# Build musl with fewer patches
build musl-1.1.24 binutils-rebuild.sh patches-pass3
# Rebuild tcc-musl using new musl
build tcc-0.9.27 tcc-musl-pass3.sh patches-musl-pass3
populate_device_nodes
build gcc-4.0.4 pass1.sh
build findutils-4.2.33
build musl-1.2.3
# This hack fixes a strange bug in mes libc bash
set -x
build linux-headers-5.10.41 '' '' linux-5.10.41
set +x
build gcc-4.0.4 pass2.sh
build util-linux-2.19.1
build e2fsprogs-1.45.7
build dhcpcd-9.4.1 '' '' dhcpcd-dhcpcd-9.4.1-1663155
build kbd-1.15
build make-3.82
build curl-7.83.0
build ed-1.4
build bc-1.07.1
# Clear up some RAM space
grep '^build' "${SOURCES}/run.sh" | sed "s/build //" | sed "s/ .*$//" | while read -r p ; do
rm -rf "${SOURCES:?}/${p:?}"
done
if [ "${CHROOT}" = False ]; then
build kexec-tools-2.0.22
build linux-4.9.10
create_sysb
go_sysb
fi
# In chroot mode transition directly into System C.
SYSC=/sysc_image
sys_transfer "${SYSC}" /sysc gzip patch
if [ "${CHROOT_ONLY_SYSA}" != True ]; then
exec chroot "${SYSC}" /init
fi
exec env -i PATH="${PATH}" PREFIX="${PREFIX}" LIBDIR="${LIBDIR}" SOURCES="${SOURCES}" DISTFILES="${DISTFILES}" DESTDIR="${DESTDIR}" SRCDIR="${SRCDIR}" bash run2.sh

95
sysa/run2.sh Executable file
View File

@ -0,0 +1,95 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -e
# shellcheck source=sysa/helpers.sh
. helpers.sh
create_sysb() {
# Copy everything in
echo "Creating sysb rootfs"
sys_transfer /sysb_image /sysb gzip patch
cp -rl /sysc /sysb_image/sysc_src
echo "Creating sysb initramfs"
gen_initramfs_list.sh -o "${PREFIX}/boot/initramfs-sysb.cpio.gz" /sysb_image
rm -rf /sysb /sysb_image # Cleanup
}
go_sysb() {
# Mount proc for kexec
mkdir /proc /etc
mount -t proc proc /proc
# kexec time
echo "Loading kernel + sysb initramfs using kexec"
kexec -l "${PREFIX}/boot/linux-4.9.10" --console-serial \
--initrd="${PREFIX}/boot/initramfs-sysb.cpio.gz" \
--append="init=/init console=ttyS0"
echo "kexecing into sysb"
kexec -e
}
build binutils-2.24
# Build musl with fewer patches
build musl-1.1.24 binutils-rebuild.sh patches-pass3
# Rebuild tcc-musl using new musl
build tcc-0.9.27 tcc-musl-pass3.sh patches-musl-pass3
populate_device_nodes
build gcc-4.0.4 pass1.sh
build findutils-4.2.33
build musl-1.2.3
# This hack fixes a strange bug in mes libc bash
set -x
build linux-headers-5.10.41 '' '' linux-5.10.41
set +x
build gcc-4.0.4 pass2.sh
build util-linux-2.19.1
build e2fsprogs-1.45.7
build dhcpcd-9.4.1 '' '' dhcpcd-dhcpcd-9.4.1-1663155
build kbd-1.15
build make-3.82
build curl-7.83.0
build ed-1.4
build bc-1.07.1
# Clear up some RAM space
grep '^build' "${SOURCES}/run.sh" | sed "s/build //" | sed "s/ .*$//" | while read -r p ; do
rm -rf "${SOURCES:?}/${p:?}"
done
if [ "${CHROOT}" = False ]; then
build kexec-tools-2.0.22
build linux-4.9.10
create_sysb
go_sysb
fi
# In chroot mode transition directly into System C.
SYSC=/sysc_image
sys_transfer "${SYSC}" /sysc gzip patch
if [ "${CHROOT_ONLY_SYSA}" != True ]; then
exec chroot "${SYSC}" /init
fi

View File

@ -1 +0,0 @@
http://mirrors.kernel.org/gnu/bash/bash-5.1.tar.gz cc012bc860406dcf42f64431bcd3d2fa7560c02915a601aba9cd597a39329baa

View File

@ -3,6 +3,7 @@
# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
# SPDX-FileCopyrightText: 2021 Melg Eight <public.melg8@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
@ -11,9 +12,16 @@ set -e
# shellcheck source=/dev/null
. .env
# shellcheck disable=SC2153
trap 'env - PATH=${PREFIX}/bin PS1="\w # " bash -i' EXIT
# shellcheck source=sysa/helpers.sh
. helpers.sh
trap bash EXIT
umask 0022
create_fhs() {
# Add the rest of the FHS that we will use and is not created pre-boot
rm -rf /sbin /usr/sbin
@ -56,6 +64,126 @@ else
mkdir -p "${DISTFILES}"
fi
build bash-5.1
build xz-5.0.5
build file-5.44
build libtool-2.4.7
build automake-1.15.1
build tar-1.34
build coreutils-8.32
build pkg-config-0.29.2
build make-4.2.1
build gmp-6.2.1
build autoconf-archive-2021.02.19
build mpfr-4.1.0
build mpc-1.2.1
build flex-2.5.33
build bison-2.3
build bison-3.4.2
build perl-5.10.1
build dist-3.5-236
build perl-5.32.1
build libarchive-3.5.2
build openssl-1.1.1l
build ca-certificates-3.86
build curl-7.83.0
build zlib-1.2.13
build automake-1.16.3
build autoconf-2.71
build patch-2.7.6
build gettext-0.21
build texinfo-6.7
build gcc-4.7.4
build binutils-2.38
build gperf-3.1
build libunistring-0.9.10
build libffi-3.3
build libatomic_ops-7.6.10
build gc-8.0.4
build guile-3.0.7
build which-2.21
build grep-3.7
build sed-4.8
build autogen-5.18.16 autogen-5.18.16.sh
build musl-1.2.3
build python-2.0.1 stage1.sh
build python-2.0.1 stage2.sh
build python-2.3.7 stage1.sh
build python-2.3.7 stage2.sh
build python-2.5.6
build python-3.1.5 stage1.sh
build python-3.1.5 stage2.sh
build python-3.3.7
build python-3.4.10
build python-3.8.16
build python-3.11.1
build gcc-10.4.0
if [ "$FORCE_TIMESTAMPS" = True ] ; then
echo 'Forcing all files timestamps to be 0 unix time.'
canonicalise_all_files_timestamp
fi
shopt -s extglob
if [ "$UPDATE_CHECKSUMS" = True ] ; then
pushd /usr/src/repo
sha256sum -- !(*-repodata) | tee "${SOURCES}/SHA256SUMS.pkgs"
popd
fi
echo "Bootstrapping completed."
cd "/"
exec env -i PATH="${PATH}" HOME="${HOME}" SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH}" bash "${SOURCES}/after.sh"
exec env -i PATH="${PATH}" HOME="${HOME}" SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH}" bash run2.sh

View File

@ -1,146 +0,0 @@
#!/bin/bash
# SPDX-FileCopyrightText: 2022 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021-23 fosslinux <fosslinux@aussies.space>
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
# SPDX-FileCopyrightText: 2021 Melg Eight <public.melg8@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -e
# shellcheck source=/dev/null
. .env
# shellcheck disable=SC2153
trap 'env - PATH=${PREFIX}/bin PS1="\w # " bash -i' EXIT
# shellcheck source=sysa/helpers.sh
. helpers.sh
trap bash EXIT
umask 0022
build xz-5.0.5
build file-5.44
build libtool-2.4.7
build automake-1.15.1
build tar-1.34
build coreutils-8.32
build pkg-config-0.29.2
build make-4.2.1
build gmp-6.2.1
build autoconf-archive-2021.02.19
build mpfr-4.1.0
build mpc-1.2.1
build flex-2.5.33
build bison-2.3
build bison-3.4.2
build perl-5.10.1
build dist-3.5-236
build perl-5.32.1
build libarchive-3.5.2
build openssl-1.1.1l
build ca-certificates-3.86
build curl-7.83.0
build zlib-1.2.13
build automake-1.16.3
build autoconf-2.71
build patch-2.7.6
build gettext-0.21
build texinfo-6.7
build gcc-4.7.4
build binutils-2.38
build gperf-3.1
build libunistring-0.9.10
build libffi-3.3
build libatomic_ops-7.6.10
build gc-8.0.4
build guile-3.0.7
build which-2.21
build grep-3.7
build sed-4.8
build autogen-5.18.16 autogen-5.18.16.sh
build musl-1.2.3
build python-2.0.1 stage1.sh
build python-2.0.1 stage2.sh
build python-2.3.7 stage1.sh
build python-2.3.7 stage2.sh
build python-2.5.6
build python-3.1.5 stage1.sh
build python-3.1.5 stage2.sh
build python-3.3.7
build python-3.4.10
build python-3.8.16
build python-3.11.1
build gcc-10.4.0
if [ "$FORCE_TIMESTAMPS" = True ] ; then
echo 'Forcing all files timestamps to be 0 unix time.'
canonicalise_all_files_timestamp
fi
shopt -s extglob
if [ "$UPDATE_CHECKSUMS" = True ] ; then
pushd /usr/src/repo
sha256sum -- !(*-repodata) | tee "${SOURCES}/SHA256SUMS.pkgs"
popd
fi
echo "Bootstrapping completed."
cd "/"
exec env -i PATH="${PATH}" HOME="${HOME}" SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH}" bash "${SOURCES}/after.sh"