commit: f090ddc5bbdbbd274b4517bb56dd8e6181aba157
parent 713fd9143f200bd5ef3b0f60ba1e9fee40955555
Author: Andrius Štikonas <andrius@stikonas.eu>
Date: Sat, 10 Apr 2021 12:38:37 +0100
Remove rootfs.sh
Diffstat:
4 files changed, 6 insertions(+), 399 deletions(-)
diff --git a/.cirrus.yml b/.cirrus.yml
@@ -23,7 +23,7 @@ shell_lint_task:
- apt-get -y install shellcheck
- apt-get -y clean
check_script:
- - shellcheck rootfs.sh sysa/run.sh sysa/helpers.sh
+ - shellcheck sysa/run.sh sysa/helpers.sh
reuse_lint_task:
container:
diff --git a/DEVEL.md b/DEVEL.md
@@ -59,7 +59,7 @@ Permissable folders/files:
- After `patch`, `sha-2` is built which contains an external implementation of
`sha256sum`. We then use that currently for all remaining software.
- To extract the binaries to get their checksums, use of chroot mode is
- recommended (i.e. `./rootfs.sh chroot`).
+ recommended (i.e. `./rootfs.py --chroot`).
Furthermore, there is a special top-level dir `dev-utils`. In here are
appropriate utilities that are often useful for development and not generally
diff --git a/README.rst b/README.rst
@@ -19,12 +19,12 @@ Get me started!
2. ``git submodule update --init --recursive``
3. Provide a kernel (vmlinuz file) as the name kernel in the root of the
repository.
-4. ``./rootfs.sh`` - ensure your account has kvm privileges and qemu
+4. ``./rootfs.py`` - ensure your account has kvm privileges and qemu
installed.
- a. Alternatively, run ``./rootfs.sh chroot`` to run it in a chroot.
- b. Alternatively, run ``./rootfs.sh`` but don’t run the actual
- virtualization and instead copy sysa/tmp/initramfs.igz to a USB or
+ a. Alternatively, run ``./rootfs.py --chroot`` to run it in a chroot.
+ b. Alternatively, run ``./rootfs.py`` but don’t run the actual
+ virtualization and instead copy sysa/tmp/initramfs to a USB or
some other device and boot from bare metal.
5. Wait.
diff --git a/rootfs.sh b/rootfs.sh
@@ -1,393 +0,0 @@
-#!/bin/bash
-
-# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
-# SPDX-FileCopyrightText: 2021 Bastian Bittorf <bb@npl.de>
-# SPDX-FileCopyrightText: 2020-2021 fosslinux <fosslinux@aussies.space>
-#
-# SPDX-License-Identifier: GPL-3.0-or-later
-
-set -ex
-
-QEMU_CMD="${1:-qemu-system-x86_64}" # or 'chroot' or 'minikernel'
-QEMU_RAM="${2:-8G}"
-
-GITDIR="$PWD/$(dirname "$0")"
-if [ ! -f 'rootfs.sh' ]; then
- echo 'must be run from base of repo'
- exit 1
-fi
-
-pushd sysa
-
-# SYSTEM A
-
-# Setup tmp
-mkdir -p tmp/
-sudo mount -t tmpfs -o size=8G tmpfs tmp
-
-LOGFILE="$PWD/tmp/bootstrap.log"
-
-_wget() {
- local url="$1"
- local dir="${CACHEDIR:-$GITDIR/sources}"
- local file="${2:-$(basename "${url}")}"
- mkdir -p "$dir"
- test -s "$dir/$file" || command wget -O "$dir/$file" "$url"
- cp -v "$dir/$file" .
- checksum_do "$dir" "$file"
-}
-
-checksum_do() {
- local dir="$1"
- local file="$2"
- local line
- local store="$GITDIR/SHA256SUMS.sources"
-
- if line=$(grep "[[:space:]][[:space:]]$file"$ "$store"); then
- (cd "$dir" && echo "$line" | sha256sum -c)
- else
- echo 'Checksum mismatch or not found!'
- exit 1
- fi
-}
-
-# base: mescc-tools-seed
-# copy in all the mescc-tools-seed stuff
-cp -r mescc-tools-seed/src/mescc-tools-seed/x86/* tmp
-cp -r mescc-tools-seed/src/mescc-tools-seed/{M2-Planet,mes-m2} tmp/
-cp -r mescc-tools-seed/src/mescc-tools-patched tmp/mescc-tools
-# and the kaem seed
-cp bootstrap-seeds/POSIX/x86/kaem-optional-seed tmp/init
-cp bootstrap-seeds/POSIX/x86/kaem-optional-seed tmp/
-cp -r bootstrap-seeds tmp/
-# replace the init kaem with our own custom one
-mv tmp/kaem.run tmp/mescc-tools-seed.kaem.run
-cp base.kaem.run tmp/kaem.run
-# create directories needed
-mkdir -p tmp/bin
-
-# after mescc-tools-seed we get into our own directory because
-# the mescc-tools-seed one is hella messy
-mkdir -p tmp/after/bin
-mkdir -p tmp/after/{lib,include}
-mkdir -p tmp/after/lib/{tcc,linux}
-ln -s . tmp/after/lib/x86-mes
-ln -s . tmp/after/lib/linux/x86-mes
-mkdir -p tmp/after/include/{mes,gnu,linux,sys,mach}
-mkdir -p tmp/after/include/linux/{x86,x86_64}
-mkdir -p tmp/tmp
-cp after.kaem tmp/
-cp after.kaem.run tmp/after/kaem.run
-cp mescc-tools-seed/checksums tmp/after/mescc-tools-seed-checksums
-cp helpers.sh run.sh run2.sh pre-sha.sha256sums tmp/after/
-
-# mescc-tools-extra
-cp -r mescc-tools-extra tmp/after/
-
-# mes
-cp -r mes tmp/after/
-#ln -s lib/x86-mes tmp/after/mes/src/mes/x86-mes
-mkdir -p tmp/after/mes/src/mes/{bin,m2}
-
-# tcc 0.9.26
-cp -r tcc-0.9.26 tmp/after/
-pushd tmp/after/tcc-0.9.26/src/tcc-0.9.26
-ln -s ../mes/module .
-ln -s ../mes/mes .
-ln -s /after/lib x86-mes
-ln -s /after/lib/linux .
-popd
-
-# tcc 0.9.27
-cp -r tcc-0.9.27 tmp/after/
-
-# tar 1.12
-url=https://ftp.gnu.org/gnu/tar/tar-1.12.tar.gz
-cp -r tar-1.12 tmp/after
-mkdir tmp/after/tar-1.12/{src,build}
-pushd tmp/after/tar-1.12/src
-if [ ! -f "$(basename $url)" ]; then
- _wget "$url"
-fi
-popd
-tar -C tmp/after/tar-1.12/src -xf "tmp/after/tar-1.12/src/$(basename $url)" --strip-components=1
-unset url
-
-_get_file() {
- local url="$1"
- local output="$2"
- local target="$3"
- # Get the actual file
- pushd "${target}/src"
- if [ ! -f "$(basename "$url")" ]; then
- _wget "$url" "${output:-${url##*/}}"
- fi
- popd
-}
-
-_get_target() {
- local url="$1"
- local output="$2"
- local ext="${url##*.}"
- if [ "$ext" = "tar" ]; then
- bname=$(basename "${output:-${url}}" ".tar")
- else
- bname=$(basename "${output:-${url}}" ".tar.${ext}")
- fi
- # this is the target
- echo "tmp/after/${bname}"
-}
-
-_get_main() {
- local url="$1"
- local output="$2"
- local make_build="$3"
- local target="$4"
- # Copy main files
- cp -r "$(basename "${target}")" tmp/after/
- # Make directories
- mkdir -p "${target}/src"
- if [ "${make_build}" -eq 1 ]; then
- mkdir -p "${target}/build"
- fi
- # Also get this file
- _get_file "${url}" "${output}" "${target}"
-}
-
-get_file() {
- # A mapping of URL to output filenames based on index (position-dependent)
- local outputs=()
- local urls=()
- # Argument parsing
- while [ $# -gt 0 ]; do
- case "$1" in
- --mkbuild=*) local make_build="${1#*=}" ;;
- --output=*) outputs+=("${1#*=}") ;;
- # It's just another URL to download
- *) urls+=("$1") ;;
- esac
- shift
- done
- if [ -z "${make_build}" ]; then
- make_build=0
- fi
- # Actual work
- # Loop over urls
- local url_length="${#urls[@]}"
- local target
- target="$(_get_target "${urls[0]}" "${outputs[0]}")"
- _get_main "${urls[0]}" "${outputs[0]}" "${make_build}" "${target}"
- if [ "${url_length}" -gt 1 ]; then
- url_length="$((url_length-1))"
- echo "${url_length}"
- for i in $(seq 1 "${url_length}"); do
- _get_file "${urls[${i}]}" "${outputs[${i}]}" "${target}"
- done
- fi
-}
-
-# gzip 1.2.4
-get_file https://ftp.gnu.org/gnu/gzip/gzip-1.2.4.tar --mkbuild=1
-
-# sed 4.0.9
-get_file https://ftp.gnu.org/gnu/sed/sed-4.0.9.tar.gz --mkbuild=1
-
-# patch 2.5.9
-get_file https://ftp.gnu.org/pub/gnu/patch/patch-2.5.9.tar.gz --mkbuild=1
-
-# sha-2 61555d
-get_file https://github.com/amosnier/sha-2/archive/61555d.tar.gz --mkbuild=1 --output=sha-2-61555d.tar.gz
-
-# make 3.80
-get_file https://ftp.gnu.org/gnu/make/make-3.80.tar.gz --mkbuild=1
-
-# bzip2 1.0.8
-get_file ftp://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz --mkbuild=1
-
-# coreutils 5.0
-get_file https://ftp.gnu.org/gnu/coreutils/coreutils-5.0.tar.bz2 --mkbuild=1
-
-# heirloom-devtools
-get_file http://downloads.sourceforge.net/project/heirloom/heirloom-devtools/070527/heirloom-devtools-070527.tar.bz2
-
-# bash 2.05b
-get_file https://ftp.gnu.org/pub/gnu/bash/bash-2.05b.tar.gz
-
-# flex 2.5.11
-get_file http://download.nust.na/pub2/openpkg1/sources/DST/flex/flex-2.5.11.tar.gz
-
-# musl 1.1.24
-get_file https://musl.libc.org/releases/musl-1.1.24.tar.gz
-
-# m4 1.4.7
-get_file https://ftp.gnu.org/gnu/m4/m4-1.4.7.tar.gz
-
-# flex 2.6.4
-get_file https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz
-
-# bison 3.4.1
-get_file https://ftp.gnu.org/gnu/bison/bison-3.4.1.tar.gz
-
-# grep 2.4
-get_file https://ftp.gnu.org/gnu/grep/grep-2.4.tar.gz
-
-# diffutils 2.7
-get_file https://ftp.gnu.org/gnu/diffutils/diffutils-2.7.tar.gz
-
-# coreutils 6.10
-get_file https://ftp.gnu.org/gnu/coreutils/coreutils-6.10.tar.gz
-
-# gawk 3.0.4
-get_file https://ftp.gnu.org/gnu/gawk/gawk-3.0.4.tar.gz
-
-# perl 5.000
-get_file https://github.com/Perl/perl5/archive/perl-5.000.tar.gz
-
-# perl 5.003
-get_file https://github.com/Perl/perl5/archive/perl-5.003.tar.gz
-
-# perl 5.004_05
-get_file https://www.cpan.org/src/5.0/perl5.004_05.tar.gz
-
-# perl 5.005_03
-get_file https://www.cpan.org/src/5.0/perl5.005_03.tar.gz
-
-# perl 5.6.2
-get_file https://www.cpan.org/src/5.0/perl-5.6.2.tar.gz
-
-# autoconf 2.52
-get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.52.tar.bz2
-
-# automake 1.6.3
-get_file https://ftp.gnu.org/gnu/automake/automake-1.6.3.tar.bz2
-
-# automake 1.4-p6
-get_file https://ftp.gnu.org/gnu/automake/automake-1.4-p6.tar.gz
-
-# autoconf 2.13
-get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.13.tar.gz
-
-# autoconf 2.12
-get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.12.tar.gz
-
-# libtool 1.4
-get_file https://ftp.gnu.org/gnu/libtool/libtool-1.4.tar.gz
-
-# binutils 2.14
-get_file https://ftp.gnu.org/gnu/binutils/binutils-2.14.tar.bz2
-
-# autoconf 2.53
-get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.53.tar.bz2
-
-# automake 1.7
-get_file https://ftp.gnu.org/gnu/automake/automake-1.7.tar.bz2
-
-# autoconf 2.54
-get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.54.tar.bz2
-
-# autoconf 2.55
-get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.55.tar.bz2
-
-# automake 1.7.8
-get_file https://ftp.gnu.org/gnu/automake/automake-1.7.8.tar.bz2
-
-# autoconf 2.57
-get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.57.tar.bz2
-
-# autoconf 2.59
-get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.59.tar.bz2
-
-# automake 1.8.5
-get_file https://ftp.gnu.org/gnu/automake/automake-1.8.5.tar.bz2
-
-# help2man 1.36.4
-get_file https://ftp.gnu.org/gnu/help2man/help2man-1.36.4.tar.gz
-
-# autoconf 2.61
-get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.61.tar.bz2
-
-# automake 1.9.6
-get_file https://ftp.gnu.org/gnu/automake/automake-1.9.6.tar.bz2
-
-# findutils 4.2.33
-get_file https://ftp.gnu.org/gnu/findutils/findutils-4.2.33.tar.gz \
- https://git.savannah.gnu.org/cgit/gnulib.git/snapshot/gnulib-8e128e.tar.gz
-
-# libtool 2.2.4
-get_file https://ftp.gnu.org/gnu/libtool/libtool-2.2.4.tar.bz2
-
-# automake 1.10.3
-get_file https://ftp.gnu.org/gnu/automake/automake-1.10.3.tar.bz2
-
-# autoconf 2.65
-get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.65.tar.bz2
-
-# gcc 4.0.4
-get_file https://ftp.gnu.org/gnu/gcc/gcc-4.0.4/gcc-core-4.0.4.tar.bz2 --output=gcc-4.0.4.tar.bz2
-
-# musl 1.2.2
-get_file https://musl.libc.org/releases/musl-1.2.2.tar.gz
-
-# bash 5.1
-get_file https://ftp.gnu.org/gnu/bash/bash-5.1.tar.gz
-
-# xz 5.0.5
-get_file https://tukaani.org/xz/xz-5.0.5.tar.bz2
-
-# automake 1.11.2
-get_file https://ftp.gnu.org/gnu/automake/automake-1.11.2.tar.bz2
-
-# autoconf 2.69
-get_file https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.xz
-
-# automake 1.12.6
-get_file https://ftp.gnu.org/gnu/automake/automake-1.12.6.tar.xz
-
-# automake 1.13.4
-get_file https://ftp.gnu.org/gnu/automake/automake-1.13.4.tar.xz
-
-# automake 1.15.1
-get_file https://ftp.gnu.org/gnu/automake/automake-1.15.1.tar.xz
-
-# tar 1.34
-get_file https://ftp.gnu.org/gnu/tar/tar-1.34.tar.xz \
- https://git.savannah.gnu.org/cgit/gnulib.git/snapshot/gnulib-30820c.tar.gz
-
-# gmp 6.2.1
-get_file https://ftp.gnu.org/gnu/gmp/gmp-6.2.1.tar.xz
-
-# General cleanup
-find tmp -name .git -exec rm -rf \;
-
-# initramfs
-cd tmp
-find . | cpio -H newc -o | gzip > initramfs.igz
-
-# Run
-case "${QEMU_CMD}" in
- chroot)
- sudo PATH="/after/bin:${PATH}" chroot . /init 2>&1 | tee "$LOGFILE"
- ;;
- minikernel)
- git clone --depth 1 --branch v0.4 https://github.com/bittorf/kritis-linux.git
-
- kritis-linux/ci_helper.sh \
- --arch x86_64 \
- --ramsize 4G \
- --kernel 5.10.8 \
- --initrd initramfs.igz \
- --log "$LOGFILE"
- ;;
- *)
- ${QEMU_CMD} -enable-kvm \
- -m "${QEMU_RAM:-8G}" \
- -nographic \
- -no-reboot \
- -kernel ../../kernel -initrd initramfs.igz -append console=ttyS0 | tee "$LOGFILE"
- ;;
-esac
-
-cd ../..
-
-# Cleanup
-sudo umount sysa/tmp