Created
February 5, 2024 03:59
-
-
Save Googulator/300fa8845cb12731d3d02f905802f7c8 to your computer and use it in GitHub Desktop.
live-bootstrap-nofilelist.patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/builder-hex0 b/builder-hex0 | |
--- a/builder-hex0 | |
+++ b/builder-hex0 | |
@@ -1 +1 @@ | |
-Subproject commit d49733d3e89538b2845f2be90ca6839deabf0042 | |
+Subproject commit d49733d3e89538b2845f2be90ca6839deabf0042-dirty | |
diff --git a/lib/generator.py b/lib/generator.py | |
index 272f89f..1828fc6 100755 | |
--- a/lib/generator.py | |
+++ b/lib/generator.py | |
@@ -85,8 +85,6 @@ class Generator(): | |
self.distfiles() | |
- self.create_fiwix_file_list() | |
- | |
if self.repo_path: | |
repo_dir = os.path.join(self.external_dir, 'repo-preseeded') | |
shutil.copytree(self.repo_path, repo_dir) | |
@@ -134,30 +132,6 @@ class Generator(): | |
if os.path.isfile(os.path.join(seed_dir, entry)): | |
shutil.copy2(os.path.join(seed_dir, entry), os.path.join(self.target_dir, entry)) | |
- @staticmethod | |
- def add_fiwix_files(file_list_path, dirpath): | |
- """Add files to the list to populate Fiwix file system""" | |
- for root, _, filepaths in os.walk(dirpath): | |
- if 'stage0-posix' in root: | |
- continue | |
- with open(file_list_path, 'a', encoding="utf-8") as file_list: | |
- for filepath in filepaths: | |
- file_list.write(f"/{os.path.join(root, filepath)}\n") | |
- | |
- def create_fiwix_file_list(self): | |
- """Create a list of files to populate Fiwix file system""" | |
- file_list_path = os.path.join(self.target_dir, 'steps', 'lwext4-1.0.0-lb1', | |
- 'files', 'fiwix-file-list.txt') | |
- shutil.copyfile(os.path.join(self.target_dir, 'steps', 'lwext4-1.0.0-lb1', | |
- 'files', 'early-artifacts-needed-after-fiwix.txt'), | |
- file_list_path) | |
- | |
- save_cwd = os.getcwd() | |
- os.chdir(self.target_dir) | |
- self.add_fiwix_files(file_list_path, 'steps') | |
- self.add_fiwix_files(file_list_path, 'distfiles') | |
- os.chdir(save_cwd) | |
- | |
def distfiles(self): | |
"""Copy in distfiles""" | |
def copy_no_network_distfiles(out, early): | |
diff --git a/seed/script-generator.c b/seed/script-generator.c | |
index 9c9f819..f1ab999 100644 | |
--- a/seed/script-generator.c | |
+++ b/seed/script-generator.c | |
@@ -451,8 +451,8 @@ FILE *start_script(int id, int bash_build) { | |
if (bash_build != 1) { | |
fputs("set -E\ntrap 'env PS1=\"[TRAP] \\w # \" bash -i' ERR\n", out); | |
} else { | |
- fputs("set -E\ntrap 'bash -c '\"'\"'while true; do printf \"" | |
- "[TRAP - use Ctrl+D] $(pwd) # \"; $(cat); done'\"'\"'' ERR\n", | |
+ fputs("set -e\ntrap 'bash -c '\"'\"'while true; do printf \"" | |
+ "[TRAP - use Ctrl+D] $(pwd) # \"; eval \"$(cat)\"; done'\"'\"'' ERR\n", | |
out); | |
} | |
} else { | |
diff --git a/steps/improve/open_console.sh b/steps/improve/open_console.sh | |
index 33cc402..4af4e78 100644 | |
--- a/steps/improve/open_console.sh | |
+++ b/steps/improve/open_console.sh | |
@@ -7,5 +7,5 @@ | |
if bash --version | grep -q 'GPLv3'; then | |
env - PATH=${PREFIX}/bin PS1="\w # " openvt -- bash -i | |
else | |
- bash -c 'while true; do printf "[early Bash - use Ctrl+D] $(pwd) # "; $(cat /dev/tty2); done' &> /dev/tty2 & | |
+ bash -c 'while true; do printf "[early Bash - use Ctrl+D] $(pwd) # "; eval "$(cat /dev/tty2)"; done' &> /dev/tty2 & | |
fi | |
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 | |
deleted file mode 100644 | |
index 925e3c9..0000000 | |
--- a/steps/lwext4-1.0.0-lb1/files/early-artifacts-needed-after-fiwix.txt | |
+++ /dev/null | |
@@ -1,177 +0,0 @@ | |
-# SPDX-FileCopyrightText: 2023 Richard Masters <[email protected]> | |
-# SPDX-License-Identifier: MIT | |
-/usr/bin/blood-elf | |
-/usr/bin/catm | |
-/usr/bin/chmod | |
-/usr/bin/get_machine | |
-/usr/bin/hex2 | |
-/usr/bin/kaem | |
-/usr/bin/match | |
-/usr/bin/M1 | |
-/usr/bin/M2-Mesoplanet | |
-/usr/bin/M2-Planet | |
-/usr/bin/mkdir | |
-/usr/bin/sha256sum | |
-/usr/bin/unbz2 | |
-/usr/bin/ungz | |
-/usr/bin/untar | |
-/usr/bin/cp | |
-/usr/bin/replace | |
-/usr/bin/rm | |
-/usr/bin/checksum-transcriber | |
-/usr/bin/tcc | |
-/usr/bin/tcc-0.9.26 | |
-/usr/bin/kexec-linux | |
-/usr/lib/mes/libc.a | |
-/usr/lib/mes/libgetopt.a | |
-/usr/lib/mes/crt1.o | |
-/usr/lib/mes/crti.o | |
-/usr/lib/mes/crtn.o | |
-/usr/lib/mes/tcc/libtcc1.a | |
-/usr/include/mes/alloca.h | |
-/usr/include/mes/argz.h | |
-/usr/include/mes/ar.h | |
-/usr/include/mes/assert.h | |
-/usr/include/mes/ctype.h | |
-/usr/include/mes/dirent.h | |
-/usr/include/mes/dirstream.h | |
-/usr/include/mes/dlfcn.h | |
-/usr/include/mes/endian.h | |
-/usr/include/mes/errno.h | |
-/usr/include/mes/fcntl.h | |
-/usr/include/mes/features.h | |
-/usr/include/mes/float.h | |
-/usr/include/mes/getopt.h | |
-/usr/include/mes/grp.h | |
-/usr/include/mes/inttypes.h | |
-/usr/include/mes/libgen.h | |
-/usr/include/mes/limits.h | |
-/usr/include/mes/locale.h | |
-/usr/include/mes/math.h | |
-/usr/include/mes/memory.h | |
-/usr/include/mes/pwd.h | |
-/usr/include/mes/setjmp.h | |
-/usr/include/mes/signal.h | |
-/usr/include/mes/stdarg.h | |
-/usr/include/mes/stdbool.h | |
-/usr/include/mes/stddef.h | |
-/usr/include/mes/stdint.h | |
-/usr/include/mes/stdio.h | |
-/usr/include/mes/stdlib.h | |
-/usr/include/mes/stdnoreturn.h | |
-/usr/include/mes/string.h | |
-/usr/include/mes/strings.h | |
-/usr/include/mes/termio.h | |
-/usr/include/mes/time.h | |
-/usr/include/mes/unistd.h | |
-/usr/include/mes/arch/kernel-stat.h | |
-/usr/include/mes/arch/syscall.h | |
-/usr/include/mes/linux/syscall.h | |
-/usr/include/mes/linux/x86/syscall.h | |
-/usr/include/mes/mes/builtins.h | |
-/usr/include/mes/mes/cc.h | |
-/usr/include/mes/mes/config.h | |
-/usr/include/mes/mes/constants.h | |
-/usr/include/mes/mes/lib.h | |
-/usr/include/mes/mes/lib-cc.h | |
-/usr/include/mes/mes/lib-mini.h | |
-/usr/include/mes/mes/mes.h | |
-/usr/include/mes/mes/symbols.h | |
-/usr/include/mes/sys/cdefs.h | |
-/usr/include/mes/sys/dir.h | |
-/usr/include/mes/sys/file.h | |
-/usr/include/mes/sys/ioctl.h | |
-/usr/include/mes/sys/mman.h | |
-/usr/include/mes/sys/param.h | |
-/usr/include/mes/sys/resource.h | |
-/usr/include/mes/sys/select.h | |
-/usr/include/mes/sys/stat.h | |
-/usr/include/mes/sys/timeb.h | |
-/usr/include/mes/sys/time.h | |
-/usr/include/mes/sys/times.h | |
-/usr/include/mes/sys/types.h | |
-/usr/include/mes/sys/ucontext.h | |
-/usr/include/mes/sys/user.h | |
-/usr/include/mes/sys/wait.h | |
-/init | |
-/kaem.run | |
-/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-8.5.0.tar.bz2 | |
diff --git a/steps/lwext4-1.0.0-lb1/files/make_fiwix_initrd.c b/steps/lwext4-1.0.0-lb1/files/make_fiwix_initrd.c | |
index e37556e..39058ba 100644 | |
--- a/steps/lwext4-1.0.0-lb1/files/make_fiwix_initrd.c | |
+++ b/steps/lwext4-1.0.0-lb1/files/make_fiwix_initrd.c | |
@@ -47,7 +47,7 @@ | |
#include "../blockdev/windows/file_windows.h" | |
#define BLOCK_SIZE 1024 | |
-#define FILENAME_LENGTH 256 | |
+#define FILENAME_LENGTH 1024 | |
#define INITRD_MB 1280 | |
const char *input_name = NULL; | |
@@ -131,29 +131,35 @@ bool lwext4_umount(void) | |
bool copy_file(char *src_path, char *dest_path) | |
{ | |
- | |
- printf("copy_file: %s\n", src_path); | |
ext4_file dest_file; | |
FILE *src_file = fopen(src_path, "rb"); | |
if (!src_file) { | |
- printf("fopen '%s' error.\n", src_path); | |
- return EXIT_FAILURE; | |
+ printf("fopen '%s' error.\n", src_path); | |
+ return EXIT_FAILURE; | |
+ } | |
+ fseek(src_file, 0, SEEK_END); | |
+ int src_len = ftell(src_file); | |
+ | |
+ fseek(src_file, 0, SEEK_SET); | |
+ if (src_len <= 0) { | |
+ printf("copy_file: %s is a directory, skipping\n", src_path); | |
+ fclose(src_file); | |
+ return EXIT_SUCCESS; | |
} | |
- fseek(src_file, 0, SEEK_END); | |
- int src_len = ftell(src_file); | |
- char * src_mem = malloc(src_len); | |
- int err; | |
- fseek(src_file, 0, SEEK_SET); | |
- if (src_len > 0) { | |
- int read_len = fread(src_mem, src_len, 1, src_file); | |
- fclose(src_file); | |
- if (read_len < 1) { | |
- printf("src fread error file: '%s' read count: %d\n", src_path, read_len); | |
- } | |
+ printf("copy_file: %s\n", src_path); | |
+ char * src_mem = malloc(src_len); | |
+ int err; | |
+ int read_len = fread(src_mem, src_len, 1, src_file); | |
+ fclose(src_file); | |
+ if (read_len < 1) { | |
+ printf("src fread error file: '%s' read count: %d\n", src_path, read_len); | |
} | |
- err = ext4_fopen(&dest_file, dest_path, "wb"); | |
+ /* remove any stale file, intentionally ignoring errors */ | |
+ ext4_fremove(dest_path); | |
+ | |
+ err = ext4_fopen(&dest_file, dest_path, "wb"); | |
if (err != EOK) { | |
printf("ext4_open error: %d\n", err); | |
return EXIT_FAILURE; | |
@@ -176,23 +182,22 @@ bool copy_file(char *src_path, char *dest_path) | |
free(src_mem); | |
} | |
-bool copy_file_list(char *file_list_path) | |
+bool copy_file_system() | |
{ | |
- char src_filename[FILENAME_LENGTH]; | |
+ int filenum; | |
+ unsigned int filename_addr; | |
char dst_filename[FILENAME_LENGTH]; | |
- | |
- FILE *file_list = fopen(file_list_path, "r"); | |
- while(fgets(src_filename, FILENAME_LENGTH, file_list)) { | |
- /* Skip comments */ | |
- if (src_filename[0] == '#') { | |
+ for (filenum = 4, filename_addr = 0x201000; filenum <= 14335; filenum++, filename_addr += 1024) { | |
+ /* Avoid including fiwix.ext2 in itself */ | |
+ if (((char *) filename_addr)[0] != '/' || | |
+ !strcmp((char *) filename_addr, "/") || | |
+ !strcmp((char *) filename_addr, "/boot/fiwix.ext2")) { | |
continue; | |
} | |
- src_filename[strlen(src_filename) - 1] = 0; /* strip newline */ | |
strcpy(dst_filename, "/mp"); | |
- strcat(dst_filename, src_filename); | |
- copy_file(src_filename, dst_filename); | |
+ strcat(dst_filename, (char *) filename_addr); | |
+ copy_file((char *) filename_addr, dst_filename); | |
} | |
- fclose(file_list); | |
} | |
int main(int argc, char **argv) | |
@@ -202,8 +207,20 @@ int main(int argc, char **argv) | |
char zeros[BLOCK_SIZE]; | |
unsigned int next_file_address; | |
- | |
- next_file_address = *((unsigned int *) 0x7F8D); | |
+ int filenum; | |
+ unsigned int filename_addr; | |
+ unsigned int file_addr; | |
+ | |
+ next_file_address = 0; | |
+ for (filenum = 14335, filename_addr = 0xfff000, file_addr = 0x1038004; | |
+ filenum >= 4; | |
+ filenum--, filename_addr -= 1024, file_addr -= 16) { | |
+ if (((char *) filename_addr)[0] == '/') { | |
+ next_file_address = *((unsigned int *) file_addr); | |
+ next_file_address += *((unsigned int *) (file_addr + 4)); | |
+ break; | |
+ } | |
+ } | |
printf("Starting fiwix.ext2 at addr 0x%08x\n", next_file_address); | |
@@ -285,7 +302,7 @@ int main(int argc, char **argv) | |
return EXIT_FAILURE; | |
} | |
- copy_file_list("/steps/lwext4-1.0.0-lb1/files/fiwix-file-list.txt"); | |
+ copy_file_system(); | |
if (!lwext4_umount()) | |
return EXIT_FAILURE; | |
diff --git a/steps/manifest b/steps/manifest | |
index 0765079..8fd7e91 100644 | |
--- a/steps/manifest | |
+++ b/steps/manifest | |
@@ -42,6 +42,7 @@ build: lwext4-1.0.0-lb1 ( BUILD_FIWIX == True ) | |
build: kexec-fiwix-1.0 ( BUILD_FIWIX == True ) | |
jump: fiwix ( KERNEL_BOOTSTRAP == True ) | |
define: JOBS = 1 ( KERNEL_BOOTSTRAP == True ) | |
+improve: create_mes_config | |
build: make-3.82 | |
build: patch-2.5.9 | |
build: gzip-1.2.4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment