Remove the notion of "sys*"

- This idea originates from very early in the project and was, at the
  time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
  occuring when there is a change in kernel, but not from builder-hex0
  to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
  more difficult to understand.
- This puts everything down into one folder and has a manifest file that
  is used to generate the build scripts on the fly rather than using
  coded scripts.
- This is created in the "seed" stage.

stage0-posix -- (calls) --> seed -- (generates) --> main steps

Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.

- Creating a rootfs has become much simpler and is defined as code in
  go.sh. The new structure, for an about-to-be booted system, is

/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*

- There is no longer such a thing as /usr/include/musl, this didn't
  really make any sense, as musl is the final libc used. Rather, to
  separate musl and mes, we have /usr/include/mes, which is much easier
  to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
  checksum-transcriber, simple-patch, kexec-fiwix have all been given
  fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
  but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
  etc. This avoids manual definition of passes.
  - Ditto with patches; default directory is patches, but then any patch
    series specific to a pass are named patches-passX.
This commit is contained in:
fosslinux 2023-11-07 10:51:23 +11:00
parent 0907cfd073
commit 6ed2e09f3a
546 changed files with 700 additions and 1299 deletions

11
steps/improve/clean_ram.sh Executable file
View file

@ -0,0 +1,11 @@
# Save because linux deletes all distfiles to save space
cp "${DISTFILES}"/musl-1.2.4.tar.gz /tmp
cp "${DISTFILES}"/curl-7.88.1.tar.bz2 /tmp
# Clear up some RAM space
grep --no-filename '^build' "${SOURCES}"/run*.sh | grep -v musl-1.2.4 | sed "s/build //" | sed "s/ .*$//" | while read -r p ; do
rm -rf "${SOURCES:?}/${p:?}"
done
mv /tmp/musl-1.2.4.tar.gz "${DISTFILES}"
mv /tmp/curl-7.88.1.tar.bz2 "${DISTFILES}"

13
steps/improve/finalize_fhs.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
# Add the rest of the FHS that we will use and is not created pre-boot
rm -rf /sbin /usr/sbin
for d in bin lib sbin; do
ln -s "usr/${d}" "/${d}"
done
mkdir -p /etc /run /var
test -d /proc || (mkdir /proc && mount -t proc proc /proc)
test -d /sys || (mkdir /sys && mount -t sysfs sysfs /sys)
# Make /tmp a ramdisk (speeds up configure etc significantly)
test -d /tmp || (mkdir /tmp && mount -t tmpfs tmpfs /tmp)
# Add /etc/resolv.conf
echo 'nameserver 1.1.1.1' > /etc/resolv.conf

13
steps/improve/get_network.sh Executable file
View file

@ -0,0 +1,13 @@
#!/bin/sh
dhcpcd --waitip=4
# Ensure network accessible
timeout=120
while ! curl example.com >/dev/null 2>&1; do
sleep 1
# shellcheck disable=SC2219
let timeout--
if [ "${timeout}" -le 0 ]; then
echo "Timeout reached for internet to become accessible"
false
fi
done

5
steps/improve/musl_libdir.sh Executable file
View file

@ -0,0 +1,5 @@
#!/bin/sh
sed -i "/^LIBDIR/d" /steps/env
LIBDIR=${PREFIX}/lib/i386-unknown-linux-musl
echo "LIBDIR=${LIBDIR}" >> /steps/env

6
steps/improve/null_time.sh Executable file
View file

@ -0,0 +1,6 @@
#!/bin/sh
# Set modified dates of all files to be 0 unix time.
# This function needs `touch` that supports --no-dereference
# (at least coreutils 8.1).
find / -xdev -exec touch --no-dereference -t 197001010000.00 {} +

View file

@ -0,0 +1,36 @@
#!/bin/sh
# http://www.linuxfromscratch.org/lfs/view/6.1/chapter06/devices.html
mkdir -p "/dev"
test -c "/dev/null" || (rm -f "/dev/null" &&
mknod -m 666 "/dev/null" c 1 3)
test -c "/dev/zero" || mknod -m 666 "/dev/zero" c 1 5
test -c "/dev/random" || mknod -m 444 "/dev/random" c 1 8
test -c "/dev/urandom" || mknod -m 444 "/dev/urandom" c 1 9
test -c "/dev/ptmx" || mknod -m 666 "/dev/ptmx" c 5 2
test -c "/dev/tty" || mknod -m 666 "/dev/tty" c 5 0
test -b "/dev/sda" || mknod -m 600 "/dev/sda" b 8 0
test -b "/dev/sda1" || mknod -m 600 "/dev/sda1" b 8 1
test -b "/dev/sda2" || mknod -m 600 "/dev/sda2" b 8 2
test -b "/dev/sda3" || mknod -m 600 "/dev/sda3" b 8 3
test -b "/dev/sdb" || mknod -m 600 "/dev/sdb" b 8 16
test -b "/dev/sdb1" || mknod -m 600 "/dev/sdb1" b 8 17
test -b "/dev/sdb2" || mknod -m 600 "/dev/sdb2" b 8 18
test -b "/dev/sdb2" || mknod -m 600 "/dev/sdb3" b 8 19
test -b "/dev/sdc" || mknod -m 600 "/dev/sdc" b 8 32
test -b "/dev/sdc1" || mknod -m 600 "/dev/sdc1" b 8 33
test -b "/dev/sdc2" || mknod -m 600 "/dev/sdc2" b 8 34
test -b "/dev/sdc3" || mknod -m 600 "/dev/sdc3" b 8 35
test -e "/dev/stdout" || ln -s "/proc/self/fd/1" "/dev/stdout"
if mount --version >/dev/null 2>&1; then
test -d "/dev/shm" || (mkdir /dev/shm && mount -t tmpfs tmpfs /dev/shm)
test -d "/proc" || (mkdir /proc && mount -t proc proc /proc)
fi
if [ "${CHROOT}" = False ]; then
test -c "/dev/console" || mknod -m 666 "/dev/console" c 5 1
fi

2
steps/improve/setup_repo.sh Executable file
View file

@ -0,0 +1,2 @@
#!/bin/sh
mkdir -p /external/repo

19
steps/improve/update_env.sh Executable file
View file

@ -0,0 +1,19 @@
#!/bin/sh
unset GUILE_LOAD_PATH
cat > /steps/env <<- EOF
export PATH=${PREFIX}/bin
PREFIX=${PREFIX}
LIBDIR=${LIBDIR}
DESTDIR=${DESTDIR}
DISTFILES=${DISTFILES}
SRCDIR=${SRCDIR}
MAKEJOBS=-j${JOBS}
export HOME=/tmp
export SOURCE_DATE_EPOCH=0
export SHELL=/usr/bin/bash
DESTDIR=/tmp/destdir
EOF
. /steps/env