From 8ed2e010203bb08081250ea1e0f6b5ae4432953c Mon Sep 17 00:00:00 2001 From: fosslinux Date: Sun, 26 Nov 2023 10:47:45 +1100 Subject: [PATCH] Move back to using initrd in Fiwix-era --- lib/generator.py | 28 +++--- steps/improve/populate_device_nodes.sh | 13 +++ steps/jump/move_disk.sh | 11 +-- .../early-artifacts-needed-after-fiwix.txt | 86 +++++++++++++++++++ steps/manifest | 2 +- steps/pre-network-sources | 1 - 6 files changed, 116 insertions(+), 25 deletions(-) diff --git a/lib/generator.py b/lib/generator.py index 93bfea2d..2578b616 100755 --- a/lib/generator.py +++ b/lib/generator.py @@ -142,35 +142,27 @@ def create_fiwix_file_list(self): def distfiles(self): """Copy in distfiles""" - # This is a list of distfiles that are required before we have access - # to the external filesystem - early_distfiles = [ - "mes-0.24.2.tar.gz", - "nyacc-1.00.2.tar.gz", - "tcc-0.9.26.tar.gz", - "tcc-0.9.27.tar.bz2", - "fiwix-1.4.0-lb3.tar.gz", - "lwext4-1.0.0-lb1.tar.gz" - ] + def copy_no_network_distfiles(out): + # Note that no network == no disk for kernel bootstrap mode + with open(os.path.join(self.git_dir, 'steps', 'pre-network-sources'), 'r') as source_list: + for file in source_list.readlines(): + file = file.strip() + shutil.copy2(os.path.join(self.distfiles_dir, file), + os.path.join(out, file)) + early_distfile_dir = os.path.join(self.tmp_dir, 'external', 'distfiles') main_distfile_dir = os.path.join(self.external_dir, 'distfiles') if early_distfile_dir != main_distfile_dir: os.makedirs(early_distfile_dir) - for distfile in early_distfiles: - shutil.copy2(os.path.join(self.distfiles_dir, distfile), - os.path.join(early_distfile_dir, distfile)) + copy_no_network_distfiles(early_distfile_dir) if self.external_sources: os.mkdir(main_distfile_dir) shutil.copytree(self.distfiles_dir, main_distfile_dir) else: os.mkdir(main_distfile_dir) - with open(os.path.join(self.git_dir, 'steps', 'pre-network-sources'), 'r') as source_list: - for file in source_list.readlines(): - file = file.strip() - shutil.copy2(os.path.join(self.distfiles_dir, file), - os.path.join(main_distfile_dir, file)) + copy_no_network_distfiles(main_distfile_dir) @staticmethod def output_dir(srcfs_file, dirpath): diff --git a/steps/improve/populate_device_nodes.sh b/steps/improve/populate_device_nodes.sh index 21dfca36..ef0cf45a 100755 --- a/steps/improve/populate_device_nodes.sh +++ b/steps/improve/populate_device_nodes.sh @@ -11,6 +11,19 @@ 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 + if mount --version >/dev/null 2>&1; then test -d "/dev/shm" || (mkdir /dev/shm && mount -t tmpfs tmpfs /dev/shm) fi diff --git a/steps/jump/move_disk.sh b/steps/jump/move_disk.sh index 423ff2fd..81a67e42 100755 --- a/steps/jump/move_disk.sh +++ b/steps/jump/move_disk.sh @@ -1,8 +1,9 @@ #!/bin/sh -mkdir -p /external/external -mv /external/* /external/external/ + +mkdir -p /newroot +mount -t ext3 "/dev/${DISK}" /newroot + mkdir -p /rootonly mount --bind / /rootonly -rm -r /rootonly/external -cp -ar /rootonly/* /external/ -switch_root /external /init +cp -ar /rootonly/* /newroot/ +switch_root /newroot /init diff --git a/steps/lwext4-1.0.0-lb1/files/early-artifacts-needed-after-fiwix.txt b/steps/lwext4-1.0.0-lb1/files/early-artifacts-needed-after-fiwix.txt index e8841347..da3e5f86 100644 --- a/steps/lwext4-1.0.0-lb1/files/early-artifacts-needed-after-fiwix.txt +++ b/steps/lwext4-1.0.0-lb1/files/early-artifacts-needed-after-fiwix.txt @@ -95,3 +95,89 @@ /usr/include/mes/sys/wait.h /init /kaem.run +/external/distfiles/mes-0.24.2.tar.gz +/external/distfiles/nyacc-1.00.2.tar.gz +/external/distfiles/tcc-0.9.26.tar.gz +/external/distfiles/tcc-0.9.27.tar.bz2 +/external/distfiles/fiwix-1.4.0-lb3.tar.gz +/external/distfiles/lwext4-1.0.0-lb1.tar.gz +/external/distfiles/make-3.82.tar.bz2 +/external/distfiles/patch-2.5.9.tar.gz +/external/distfiles/gzip-1.2.4.tar.gz +/external/distfiles/tar-1.12.tar.gz +/external/distfiles/sed-4.0.9.tar.gz +/external/distfiles/bzip2-1.0.8.tar.gz +/external/distfiles/coreutils-5.0.tar.bz2 +/external/distfiles/heirloom-devtools-070527.tar.bz2 +/external/distfiles/bash-2.05b.tar.gz +/external/distfiles/flex-2.5.11.tar.gz +/external/distfiles/tcc-0.9.27.tar.bz2 +/external/distfiles/musl-1.1.24.tar.gz +/external/distfiles/tcc-0.9.27.tar.bz2 +/external/distfiles/musl-1.1.24.tar.gz +/external/distfiles/tcc-0.9.27.tar.bz2 +/external/distfiles/sed-4.0.9.tar.gz +/external/distfiles/bzip2-1.0.8.tar.gz +/external/distfiles/m4-1.4.7.tar.gz +/external/distfiles/flex-2.6.4.tar.gz +/external/distfiles/bison-3.4.1.tar.gz +/external/distfiles/bison-3.4.1.tar.gz +/external/distfiles/bison-3.4.1.tar.gz +/external/distfiles/grep-2.4.tar.gz +/external/distfiles/diffutils-2.7.tar.gz +/external/distfiles/coreutils-5.0.tar.bz2 +/external/distfiles/coreutils-6.10.tar.gz +/external/distfiles/gawk-3.0.4.tar.gz +/external/distfiles/perl-5.000.tar.gz +/external/distfiles/perl-5.003.tar.gz +/external/distfiles/perl5.004_05.tar.gz +/external/distfiles/perl5.005_03.tar.gz +/external/distfiles/perl-5.6.2.tar.gz +/external/distfiles/autoconf-2.52.tar.bz2 +/external/distfiles/automake-1.6.3.tar.bz2 +/external/distfiles/automake-1.6.3.tar.bz2 +/external/distfiles/autoconf-2.53.tar.bz2 +/external/distfiles/automake-1.7.tar.bz2 +/external/distfiles/autoconf-2.54.tar.bz2 +/external/distfiles/autoconf-2.55.tar.bz2 +/external/distfiles/automake-1.7.8.tar.bz2 +/external/distfiles/autoconf-2.57.tar.bz2 +/external/distfiles/autoconf-2.59.tar.bz2 +/external/distfiles/automake-1.8.5.tar.bz2 +/external/distfiles/help2man-1.36.4.tar.gz +/external/distfiles/autoconf-2.61.tar.bz2 +/external/distfiles/automake-1.9.6.tar.bz2 +/external/distfiles/automake-1.10.3.tar.bz2 +/external/distfiles/autoconf-2.64.tar.bz2 +/external/distfiles/automake-1.11.2.tar.bz2 +/external/distfiles/autoconf-2.69.tar.gz +/external/distfiles/libtool-2.2.4.tar.bz2 +/external/distfiles/automake-1.15.1.tar.gz +/external/distfiles/binutils-2.30.tar.bz2 +/external/distfiles/musl-1.1.24.tar.gz +/external/distfiles/tcc-0.9.27.tar.bz2 +/external/distfiles/gcc-core-4.0.4.tar.bz2 +/external/distfiles/automake-1.16.3.tar.gz +/external/distfiles/findutils-4.2.33.tar.gz +/external/distfiles/gnulib-8e128e.tar.gz +/external/distfiles/musl-1.2.4.tar.gz +/external/distfiles/gcc-core-4.0.4.tar.bz2 +/external/distfiles/automake-1.16.3.tar.gz +/external/distfiles/util-linux-2.19.1.tar.gz +/external/distfiles/e2fsprogs-1.45.7.tar.gz +/external/distfiles/CaseFolding.txt +/external/distfiles/DerivedAge.txt +/external/distfiles/DerivedCombiningClass.txt +/external/distfiles/DerivedCoreProperties.txt +/external/distfiles/NormalizationCorrections.txt +/external/distfiles/NormalizationTest.txt +/external/distfiles/UnicodeData.txt +/external/distfiles/v10.0.1.tar.gz +/external/distfiles/kbd-1.15.tar.gz +/external/distfiles/make-3.82.tar.bz2 +/external/distfiles/ed-1.4.tar.gz +/external/distfiles/bc-1.07.1.tar.gz +/external/distfiles/v2.0.22.tar.gz +/external/distfiles/linux-4.9.10.tar.gz +/external/distfiles/deblob-4.9 +/external/distfiles/curl-7.88.1.tar.bz2 diff --git a/steps/manifest b/steps/manifest index 8128026a..03aff776 100644 --- a/steps/manifest +++ b/steps/manifest @@ -103,7 +103,6 @@ build: musl-1.2.4 build: linux-headers-4.9.10 build: gcc-4.0.4 #pass2.sh build: util-linux-2.19.1 -jump: move_disk ( KERNEL_BOOTSTRAP == True ) build: e2fsprogs-1.45.7 build: dhcpcd-10.0.1 build: kbd-1.15 @@ -117,6 +116,7 @@ build: linux-4.9.10 ( BUILD_LINUX == True ) jump: linux ( CHROOT == False ) improve: finalize_fhs build: curl-7.88.1 #pass1.sh +jump: move_disk ( KERNEL_BOOTSTRAP == True ) improve: get_network ( CHROOT == False ) build: musl-1.2.4 #'' no-patches build: bash-5.2.15 diff --git a/steps/pre-network-sources b/steps/pre-network-sources index 9ee0a698..61be92c0 100644 --- a/steps/pre-network-sources +++ b/steps/pre-network-sources @@ -64,7 +64,6 @@ automake-1.16.3.tar.gz findutils-4.2.33.tar.gz gnulib-8e128e.tar.gz musl-1.2.4.tar.gz -linux-5.10.41.tar.gz gcc-core-4.0.4.tar.bz2 automake-1.16.3.tar.gz util-linux-2.19.1.tar.gz