From 71505bc8b94796f473b79fc3ef2f5c9250c0bed4 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Fri, 12 Feb 2021 17:56:32 +1100 Subject: [PATCH 01/10] Add fletcher16 impl to mescc-tools-extra --- sysa/mescc-tools-extra/mescc-tools-extra.kaem | 37 +++++++ sysa/mescc-tools-extra/src/fletcher16.c | 103 ++++++++++++++++++ 2 files changed, 140 insertions(+) create mode 100644 sysa/mescc-tools-extra/src/fletcher16.c diff --git a/sysa/mescc-tools-extra/mescc-tools-extra.kaem b/sysa/mescc-tools-extra/mescc-tools-extra.kaem index 56165872..e2a0727b 100755 --- a/sysa/mescc-tools-extra/mescc-tools-extra.kaem +++ b/sysa/mescc-tools-extra/mescc-tools-extra.kaem @@ -87,4 +87,41 @@ hex2 \ -o ${bindir}/chmod \ --exec_enable +# fletcher16 command +M2-Planet \ + -f /M2-Planet/test/common_x86/functions/file.c \ + -f /M2-Planet/test/common_x86/functions/exit.c \ + -f functions/numerate_number.c \ + -f functions/string.c \ + -f functions/file_print.c \ + -f functions/match.c \ + -f functions/require.c \ + -f functions/in_set.c \ + -f /M2-Planet/functions/calloc.c \ + -f /M2-Planet/test/common_x86/functions/malloc.c \ + -f fletcher16.c \ + --architecture x86 \ + --debug \ + -o fletcher16.M1 + +blood-elf -f fletcher16.M1 -o fletcher16-footer.M1 + +M1 \ + -f /M2-Planet/test/common_x86/x86_defs.M1 \ + -f /M2-Planet/test/common_x86/libc-core.M1 \ + -f fletcher16.M1 \ + -f fletcher16-footer.M1 \ + --LittleEndian \ + --architecture x86 \ + -o hold + +hex2 \ + -f /M2-Planet/test/common_x86/ELF-i386-debug.hex2 \ + -f hold \ + --LittleEndian \ + --architecture x86 \ + --BaseAddress 0x8048000 \ + -o ${bindir}/fletcher16 \ + --exec_enable + cd .. diff --git a/sysa/mescc-tools-extra/src/fletcher16.c b/sysa/mescc-tools-extra/src/fletcher16.c new file mode 100644 index 00000000..35237c5f --- /dev/null +++ b/sysa/mescc-tools-extra/src/fletcher16.c @@ -0,0 +1,103 @@ +/* + * SPDX-FileCopyrightText: 2021 fosslinux + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include +#include + +#define BUF_SIZE 1024 +// CONSTANT BUF_SIZE 1024 +#define PATH_MAX 512 +// CONSTANT PATH_MAX 512 + +int fletch16(FILE* fp) +{ + long sum1 = 0; + long sum2 = 0; + int index; + int c = fgetc(fp); + while(c != EOF) + { + sum1 = (sum1 + c) % 255; + sum2 = (sum2 + sum1) % 255; + c = fgetc(fp); + } + + return (sum2 << 8) | sum1; +} + +int main(int argc, char** argv) +{ + /* Open the file containing the checksums */ + FILE* check_fp = fopen(argv[1], "r"); + require(check_fp != NULL, prepend_string( + prepend_string("Error opening checksum file ", argv[1]), "\n")); + int rc = 0; + + /* Now loop over each one */ + FILE* fp; + char c; + char* filename; + char* s_rchecksum; + char* file; + int rchecksum; + int i; + int csum; + /* It's much easier to just break; out of the loop */ + while(1) + { + filename = calloc(PATH_MAX, sizeof(char)); + require(filename != NULL, "Failed to allocate filename\n"); + s_rchecksum = calloc(16, sizeof(char)); + require(s_rchecksum != NULL, "Failed to allocate filename\n"); + /* Read the checksum */ + c = fgetc(check_fp); + i = 0; + while (c != ' ' && c != EOF) + { + require(in_set(c, "0123456789"), "Invalid checksum file\n"); + s_rchecksum[i] = c; + c = fgetc(check_fp); + i = i + 1; + } + if(c == EOF) break; + /* Skip the space */ + c = fgetc(check_fp); + /* Read the filename */ + i = 0; + while(c != '\n' && c != EOF) + { + filename[i] = c; + c = fgetc(check_fp); + i = i + 1; + } + /* If we got here and it is EOF, we probably have all the needed data */ + /* Convert s_rchecksum -> int */ + rchecksum = numerate_string(s_rchecksum); + + /* Now let's actually calculate the real checksum */ + /* Read the file into a char* array */ + fp = fopen(filename, "r"); + /* Calculate the checksum! */ + csum = fletch16(fp); + + /* Compare */ + if(csum == rchecksum) + { + file_print(prepend_string(filename, ": OK\n"), stdout); + } + else + { + /* We failed.. we should fail at the end */ + rc = 1; + file_print(prepend_string(filename, ": FAILED\n"), stdout); + } + + /* Now if we finished the last one, leave */ + if(c == EOF) break; + } + + return rc; +} From 192221af22b0112a36b361a048a725809f458145 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Fri, 12 Feb 2021 18:20:18 +1100 Subject: [PATCH 02/10] Add fletcher16-gen developer util 1. I'm not convinced our fletcher16 implementation is proper 2. It is not in coreutils So we add some basic code to do that. This is also the first dev-util, so add some documentation to DEVEL.md. --- DEVEL.md | 10 ++ dev-utils/fletcher16-gen/.gitignore | 8 + .../fletcher16-gen/compile-fletcher16-gen.sh | 42 +++++ dev-utils/fletcher16-gen/fletcher16-gen.c | 40 +++++ dev-utils/m2-functions/file_print.c | 17 ++ dev-utils/m2-functions/in_set.c | 21 +++ dev-utils/m2-functions/match.c | 24 +++ dev-utils/m2-functions/numerate_number.c | 159 ++++++++++++++++++ dev-utils/m2-functions/require.c | 20 +++ dev-utils/m2-functions/string.c | 59 +++++++ 10 files changed, 400 insertions(+) create mode 100644 dev-utils/fletcher16-gen/.gitignore create mode 100755 dev-utils/fletcher16-gen/compile-fletcher16-gen.sh create mode 100644 dev-utils/fletcher16-gen/fletcher16-gen.c create mode 100644 dev-utils/m2-functions/file_print.c create mode 100644 dev-utils/m2-functions/in_set.c create mode 100644 dev-utils/m2-functions/match.c create mode 100644 dev-utils/m2-functions/numerate_number.c create mode 100644 dev-utils/m2-functions/require.c create mode 100644 dev-utils/m2-functions/string.c diff --git a/DEVEL.md b/DEVEL.md index de2ba820..5b16fc33 100644 --- a/DEVEL.md +++ b/DEVEL.md @@ -49,6 +49,16 @@ Permissable folders: - `src`: the upstream unmodified source code. This may be either a submodule or nonexistant. +Furthermore, there is a special top-level dir `dev-utils`. In here are +appropriate utilities that are often useful for development and not generally +included on normal systems, or are specific to live-bootstrap. Each program +should be contained within its own directory and include: + +- source code +- compilation script + +The directory m2-functions is used for M2-Planet functions (currently). + ## Conventions - **Patches:** diff --git a/dev-utils/fletcher16-gen/.gitignore b/dev-utils/fletcher16-gen/.gitignore new file mode 100644 index 00000000..935df1dc --- /dev/null +++ b/dev-utils/fletcher16-gen/.gitignore @@ -0,0 +1,8 @@ +# SPDX-FileCopyrightText: 2021 fosslinux +# +# SPDX-License-Identifier: MIT + +fletcher16.M1 +fletcher16-footer.M1 +fletcher16.hex2 +fletcher16-gen diff --git a/dev-utils/fletcher16-gen/compile-fletcher16-gen.sh b/dev-utils/fletcher16-gen/compile-fletcher16-gen.sh new file mode 100755 index 00000000..6c6d5324 --- /dev/null +++ b/dev-utils/fletcher16-gen/compile-fletcher16-gen.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2021 fosslinux +# +# SPDX-License-Identifier: GPL-3.0-or-later + +set -ex + +M2-Planet \ + --architecture x86 \ + -f ../m2-functions/in_set.c \ + -f ../m2-functions/file_print.c \ + -f ../m2-functions/numerate_number.c \ + -f ../m2-functions/string.c \ + -f ../../sysa/mescc-tools-seed/src/mescc-tools-seed/M2-Planet/test/common_x86/functions/file.c \ + -f ../../sysa/mescc-tools-seed/src/mescc-tools-seed/M2-Planet/test/common_x86/functions/exit.c \ + -f ../m2-functions/require.c \ + -f ../../sysa/mescc-tools-seed/src/mescc-tools-seed/M2-Planet/test/common_x86/functions/malloc.c \ + -f ../../sysa/mescc-tools-seed/src/mescc-tools-seed/M2-Planet/functions/calloc.c \ + -f fletcher16-gen.c \ + -o fletcher16.M1 \ + --debug + +blood-elf -f fletcher16.M1 -o fletcher16-footer.M1 + +M1 \ + -f ../../sysa/mescc-tools-seed/src/mescc-tools-seed/M2-Planet/test/common_x86/x86_defs.M1 \ + -f ../../sysa/mescc-tools-seed/src/mescc-tools-seed/M2-Planet/test/common_x86/libc-core.M1 \ + -f fletcher16.M1 \ + -f fletcher16-footer.M1 \ + --LittleEndian \ + --architecture x86 \ + -o fletcher16.hex2 + +hex2 \ + -f ../../sysa/mescc-tools-seed/src/mescc-tools-seed/M2-Planet/test/common_x86/ELF-i386-debug.hex2 \ + -f fletcher16.hex2 \ + --LittleEndian \ + --architecture x86 \ + --BaseAddress 0x8048000 \ + -o fletcher16-gen \ + --exec_enable diff --git a/dev-utils/fletcher16-gen/fletcher16-gen.c b/dev-utils/fletcher16-gen/fletcher16-gen.c new file mode 100644 index 00000000..849640af --- /dev/null +++ b/dev-utils/fletcher16-gen/fletcher16-gen.c @@ -0,0 +1,40 @@ +/* + * SPDX-FileCopyrightText: 2021 fosslinux + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include +#include + +#define BUF_SIZE 1024 +// CONSTANT BUF_SIZE 1024 +#define PATH_MAX 512 +// CONSTANT PATH_MAX 512 + +int fletch16(FILE* fp) +{ + long sum1 = 0; + long sum2 = 0; + int index; + int c = fgetc(fp); + while(c != EOF) + { + sum1 = (sum1 + c) % 255; + sum2 = (sum2 + sum1) % 255; + c = fgetc(fp); + } + + return (sum2 << 8) | sum1; +} + +int main(int argc, char** argv) +{ + /* Open the file containing the checksums */ + FILE* fp = fopen(argv[1], "r"); + require(fp != NULL, prepend_string( + prepend_string("Error opening checksum file ", argv[1]), "\n")); + int csum = fletch16(fp); + file_print(prepend_string(prepend_string(prepend_string( + numerate_number(csum), " "), argv[1]), "\n"), stdout); +} diff --git a/dev-utils/m2-functions/file_print.c b/dev-utils/m2-functions/file_print.c new file mode 100644 index 00000000..2b1ce25a --- /dev/null +++ b/dev-utils/m2-functions/file_print.c @@ -0,0 +1,17 @@ +/* + * SPDX-FileCopyrightText: 2016 Jeremiah Orians + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include +// void fputc(char s, FILE* f); + +void file_print(char* s, FILE* f) +{ + while(0 != s[0]) + { + fputc(s[0], f); + s = s + 1; + } +} diff --git a/dev-utils/m2-functions/in_set.c b/dev-utils/m2-functions/in_set.c new file mode 100644 index 00000000..88c83969 --- /dev/null +++ b/dev-utils/m2-functions/in_set.c @@ -0,0 +1,21 @@ +/* + * SPDX-FileCopyrightText: 2016 Jeremiah Orians + * SPDX-FileCopyrightText: 2018 Jan (janneke) Nieuwenhuizen + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#define FALSE 0 +// CONSTANT FALSE 0 +#define TRUE 1 +// CONSTANT TRUE 1 + +int in_set(int c, char* s) +{ + while(0 != s[0]) + { + if(c == s[0]) return TRUE; + s = s + 1; + } + return FALSE; +} diff --git a/dev-utils/m2-functions/match.c b/dev-utils/m2-functions/match.c new file mode 100644 index 00000000..f9e41b10 --- /dev/null +++ b/dev-utils/m2-functions/match.c @@ -0,0 +1,24 @@ +/* + * SPDX-FileCopyrightText: 2016 Jeremiah Orians + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#define FALSE 0 +// CONSTANT FALSE 0 +#define TRUE 1 +// CONSTANT TRUE 1 + +int match(char* a, char* b) +{ + int i = -1; + do + { + i = i + 1; + if(a[i] != b[i]) + { + return FALSE; + } + } while((0 != a[i]) && (0 !=b[i])); + return TRUE; +} diff --git a/dev-utils/m2-functions/numerate_number.c b/dev-utils/m2-functions/numerate_number.c new file mode 100644 index 00000000..2c01314e --- /dev/null +++ b/dev-utils/m2-functions/numerate_number.c @@ -0,0 +1,159 @@ +/* + * SPDX-FileCopyrightText: 2016 Jeremiah Orians + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include +// void* calloc(int count, int size); +#define TRUE 1 +//CONSTANT TRUE 1 +#define FALSE 0 +//CONSTANT FALSE 0 +int in_set(int c, char* s); +//CONSTANT NULL 0 + +char* numerate_number(int a) +{ + char* result = calloc(16, sizeof(char)); + if(NULL == result) return NULL; + + int i = 0; + + /* Deal with Zero case */ + if(0 == a) + { + result[0] = '0'; + return result; + } + + /* Deal with negatives */ + if(0 > a) + { + result[0] = '-'; + i = 1; + a = a * -1; + } + + /* Using the largest 10^n number possible in 32bits */ + int divisor = 0x3B9ACA00; + /* Skip leading Zeros */ + while(0 == (a / divisor)) divisor = divisor / 10; + + /* Now simply collect numbers until divisor is gone */ + while(0 < divisor) + { + result[i] = ((a / divisor) + 48); + a = a % divisor; + divisor = divisor / 10; + i = i + 1; + } + + return result; +} + +int char2hex(int c) +{ + if (c >= '0' && c <= '9') return (c - 48); + else if (c >= 'a' && c <= 'f') return (c - 87); + else if (c >= 'A' && c <= 'F') return (c - 55); + else return -1; +} + +int hex2char(int c) +{ + if((c >= 0) && (c <= 9)) return (c + 48); + else if((c >= 10) && (c <= 15)) return (c + 55); + else return -1; +} + +int char2dec(int c) +{ + if (c >= '0' && c <= '9') return (c - 48); + else return -1; +} + +int dec2char(int c) +{ + if((c >= 0) && (c <= 9)) return (c + 48); + else return -1; +} + +int index_number(char* s, char c) +{ + int i = 0; + while(s[i] != c) + { + i = i + 1; + if(0 == s[i]) return -1; + } + return i; +} + +int toupper(int c) +{ + if(in_set(c, "abcdefghijklmnopqrstuvwxyz")) return (c & 0xDF); + return c; +} + +int set_reader(char* set, int mult, char* input) +{ + int n = 0; + int i = 0; + int hold; + int negative_p = FALSE; + + if(input[0] == '-') + { + negative_p = TRUE; + i = i + 1; + } + + while(in_set(input[i], set)) + { + n = n * mult; + hold = index_number(set, toupper(input[i])); + + /* Input managed to change between in_set and index_number */ + if(-1 == hold) return 0; + n = n + hold; + i = i + 1; + } + + /* loop exited before NULL and thus invalid input */ + if(0 != input[i]) return 0; + + if(negative_p) + { + n = 0 - n; + } + + return n; +} + +int numerate_string(char *a) +{ + /* If NULL string */ + if(0 == a[0]) return 0; + + /* Deal with binary*/ + else if ('0' == a[0] && 'b' == a[1]) + { + return set_reader("01", 2, a+2); + } + /* Deal with hex */ + else if ('0' == a[0] && 'x' == a[1]) + { + return set_reader("0123456789ABCDEFabcdef", 16, a+2); + } + /* Deal with octal */ + else if('0' == a[0]) + { + return set_reader("01234567", 8, a+1); + } + /* Deal with decimal */ + else + { + return set_reader("0123456789", 10, a); + } +} diff --git a/dev-utils/m2-functions/require.c b/dev-utils/m2-functions/require.c new file mode 100644 index 00000000..7fd2dd96 --- /dev/null +++ b/dev-utils/m2-functions/require.c @@ -0,0 +1,20 @@ +/* + * SPDX-FileCopyrightText: 2016 Jeremiah Orians + * SPDX-FileCopyrightText: 2018 Jan (janneke) Nieuwenhuizen + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include +#include + +void file_print(char* s, FILE* f); + +void require(int bool, char* error) +{ + if(!bool) + { + file_print(error, stderr); + exit(EXIT_FAILURE); + } +} diff --git a/dev-utils/m2-functions/string.c b/dev-utils/m2-functions/string.c new file mode 100644 index 00000000..4bae890f --- /dev/null +++ b/dev-utils/m2-functions/string.c @@ -0,0 +1,59 @@ +/* + * SPDX-FileCopyrightText: 2016 Jeremiah Orians + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +#include +#include +#define MAX_STRING 4096 +//CONSTANT MAX_STRING 4096 +// void* calloc(int count, int size); +void file_print(char* s, FILE* f); + +char* copy_string(char* target, char* source) +{ + while(0 != source[0]) + { + target[0] = source[0]; + target = target + 1; + source = source + 1; + } + return target; +} + +char* postpend_char(char* s, char a) +{ + char* ret = calloc(MAX_STRING, sizeof(char)); + if(NULL == ret) return NULL; + + char* hold = copy_string(ret, s); + hold[0] = a; + return ret; +} + +char* prepend_char(char a, char* s) +{ + char* ret = calloc(MAX_STRING, sizeof(char)); + if(NULL == ret) return NULL; + + ret[0] = a; + copy_string((ret+1), s); + return ret; +} + +char* prepend_string(char* add, char* base) +{ + char* ret = calloc(MAX_STRING, sizeof(char)); + if(NULL == ret) return NULL; + + copy_string(copy_string(ret, add), base); + return ret; +} + +int string_length(char* a) +{ + int i = 0; + while(0 != a[i]) i = i + 1; + return i; +} From 372e08e4f97378b0704fc5fb1a6c06d3c30de3c4 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Sat, 13 Feb 2021 17:29:49 +1100 Subject: [PATCH 03/10] Implement fletcher16 checksumming up to path Uses fletcher16 from previous commits. Next we will use sha-2 to do checksumming. --- .reuse/dep5 | 2 +- rootfs.sh | 1 + sysa/after.kaem.run | 1 + sysa/blynn-compiler/blynn-compiler.kaem | 3 +++ sysa/blynn-compiler/checksums | 1 + sysa/coreutils-5.0/coreutils-5.0.kaem | 2 ++ sysa/gzip-1.2.4/checksums | 3 +++ sysa/gzip-1.2.4/gzip-1.2.4.kaem | 3 +++ sysa/mes/checksums | 13 +++++++++++++ sysa/mes/mes.kaem | 3 +++ sysa/mescc-tools-extra/checksums | 3 +++ sysa/mescc-tools-extra/mescc-tools-extra.kaem | 3 +++ sysa/mescc-tools-seed/checksums | 8 ++++++++ sysa/patch-2.5.9/checksums | 1 + sysa/patch-2.5.9/patch-2.5.9.kaem | 3 +++ sysa/sed-4.0.7/checksums | 1 + sysa/sed-4.0.7/sed-4.0.7.kaem | 3 +++ sysa/tar-1.12/checksums | 1 + sysa/tar-1.12/tar-1.12.kaem | 3 +++ sysa/tcc-0.9.26/checksums | 17 +++++++++++++++++ sysa/tcc-0.9.26/tcc-0.9.26.kaem | 5 ++++- sysa/tcc-0.9.27/checksums/tcc-0.9.27 | 9 +++++++++ sysa/tcc-0.9.27/tcc-0.9.27.kaem | 3 +++ 23 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 sysa/blynn-compiler/checksums create mode 100644 sysa/gzip-1.2.4/checksums create mode 100644 sysa/mes/checksums create mode 100644 sysa/mescc-tools-extra/checksums create mode 100644 sysa/mescc-tools-seed/checksums create mode 100644 sysa/patch-2.5.9/checksums create mode 100644 sysa/sed-4.0.7/checksums create mode 100644 sysa/tar-1.12/checksums create mode 100644 sysa/tcc-0.9.26/checksums create mode 100644 sysa/tcc-0.9.27/checksums/tcc-0.9.27 diff --git a/.reuse/dep5 b/.reuse/dep5 index 930300b2..19638ba1 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -9,6 +9,6 @@ Source: https://github.com/fosslinux/live-bootstrap # Copyright: $YEAR $NAME <$CONTACT> # License: ... -Files: SHA256SUMS.sources +Files: SHA256SUMS.sources sysa/*/checksums sysa/*/checksums/* Copyright: none License: MIT diff --git a/rootfs.sh b/rootfs.sh index 501cb98d..4027b8c1 100755 --- a/rootfs.sh +++ b/rootfs.sh @@ -83,6 +83,7 @@ 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 tmp/after/ # mescc-tools-extra diff --git a/sysa/after.kaem.run b/sysa/after.kaem.run index 516a7473..b8b568f5 100755 --- a/sysa/after.kaem.run +++ b/sysa/after.kaem.run @@ -35,6 +35,7 @@ cp ../bin/kaem bin/kaem cp ../catm bin/catm chmod 755 bin/hex2 bin/M1 bin/M2-Planet bin/blood-elf \ bin/get_machine bin/mes-m2 bin/kaem bin/catm +fletcher16 mescc-tools-seed-checksums PATH=/after/bin # Part 4: blynn-compiler diff --git a/sysa/blynn-compiler/blynn-compiler.kaem b/sysa/blynn-compiler/blynn-compiler.kaem index 293e574a..5d4bb7c1 100755 --- a/sysa/blynn-compiler/blynn-compiler.kaem +++ b/sysa/blynn-compiler/blynn-compiler.kaem @@ -259,3 +259,6 @@ cp bin/precisely ${bindir}/precisely chmod 755 ${bindir}/precisely cd .. + +# Checksums +fletcher16 checksums diff --git a/sysa/blynn-compiler/checksums b/sysa/blynn-compiler/checksums new file mode 100644 index 00000000..a6bd3f6c --- /dev/null +++ b/sysa/blynn-compiler/checksums @@ -0,0 +1 @@ +62114 /after/bin/precisely diff --git a/sysa/coreutils-5.0/coreutils-5.0.kaem b/sysa/coreutils-5.0/coreutils-5.0.kaem index 43dbec3e..ed3f58af 100755 --- a/sysa/coreutils-5.0/coreutils-5.0.kaem +++ b/sysa/coreutils-5.0/coreutils-5.0.kaem @@ -29,3 +29,5 @@ patch -Np0 -i ../../patches/ls-strcmp.patch # Build and install /after/bin/make -f Makefile /after/bin/make -f Makefile install + +cd ../.. diff --git a/sysa/gzip-1.2.4/checksums b/sysa/gzip-1.2.4/checksums new file mode 100644 index 00000000..048e7596 --- /dev/null +++ b/sysa/gzip-1.2.4/checksums @@ -0,0 +1,3 @@ +39142 /after/bin/gzip +39142 /after/bin/gunzip +39142 /after/bin/zcat diff --git a/sysa/gzip-1.2.4/gzip-1.2.4.kaem b/sysa/gzip-1.2.4/gzip-1.2.4.kaem index c0bcb32c..a1f312b3 100755 --- a/sysa/gzip-1.2.4/gzip-1.2.4.kaem +++ b/sysa/gzip-1.2.4/gzip-1.2.4.kaem @@ -44,3 +44,6 @@ chmod 755 ${bindir}/gunzip chmod 755 ${bindir}/zcat cd ../.. + +# Checksums +fletcher16 checksums diff --git a/sysa/mes/checksums b/sysa/mes/checksums new file mode 100644 index 00000000..ed17a141 --- /dev/null +++ b/sysa/mes/checksums @@ -0,0 +1,13 @@ +63031 /after/bin/mes +23643 /after/bin/mescc.scm +36724 /after/lib/crt1.s +42390 /after/lib/crt1.o +39638 /after/lib/x86.M1 +526 /after/lib/libmescc.s +10591 /after/lib/libc+tcc.s +45027 /after/lib/libc.s +17259 /after/lib/libmescc.a +20204 /after/lib/libc+tcc.a +34645 /after/lib/libc.a +8245 /after/lib/linux/elf32-header.hex2 +15474 /after/lib/linux/elf32-footer-single-main.hex2 diff --git a/sysa/mes/mes.kaem b/sysa/mes/mes.kaem index d5d49840..c6fc792e 100755 --- a/sysa/mes/mes.kaem +++ b/sysa/mes/mes.kaem @@ -296,3 +296,6 @@ libdir=${prefix}/lib ${MES} -c "(display 'Hello,Mes!) (newline)" cd ../.. + +# Checksums +fletcher16 checksums diff --git a/sysa/mescc-tools-extra/checksums b/sysa/mescc-tools-extra/checksums new file mode 100644 index 00000000..23ba3068 --- /dev/null +++ b/sysa/mescc-tools-extra/checksums @@ -0,0 +1,3 @@ +27475 /after/bin/chmod +34512 /after/bin/cp +37928 /after/bin/fletcher16 diff --git a/sysa/mescc-tools-extra/mescc-tools-extra.kaem b/sysa/mescc-tools-extra/mescc-tools-extra.kaem index e2a0727b..dc8a39da 100755 --- a/sysa/mescc-tools-extra/mescc-tools-extra.kaem +++ b/sysa/mescc-tools-extra/mescc-tools-extra.kaem @@ -125,3 +125,6 @@ hex2 \ --exec_enable cd .. + +# Checksums +fletcher16 checksums diff --git a/sysa/mescc-tools-seed/checksums b/sysa/mescc-tools-seed/checksums new file mode 100644 index 00000000..4e9f6962 --- /dev/null +++ b/sysa/mescc-tools-seed/checksums @@ -0,0 +1,8 @@ +12760 /after/bin/blood-elf +31684 /after/bin/catm +52674 /after/bin/get_machine +47046 /after/bin/hex2 +25862 /after/bin/kaem +33226 /after/bin/M1 +61798 /after/bin/M2-Planet +44920 /after/bin/mes-m2 diff --git a/sysa/patch-2.5.9/checksums b/sysa/patch-2.5.9/checksums new file mode 100644 index 00000000..a2be0d4a --- /dev/null +++ b/sysa/patch-2.5.9/checksums @@ -0,0 +1 @@ +10790 /after/bin/patch diff --git a/sysa/patch-2.5.9/patch-2.5.9.kaem b/sysa/patch-2.5.9/patch-2.5.9.kaem index 05e4be86..de5155da 100755 --- a/sysa/patch-2.5.9/patch-2.5.9.kaem +++ b/sysa/patch-2.5.9/patch-2.5.9.kaem @@ -49,3 +49,6 @@ tcc -static -o ${bindir}/patch error.o getopt.o getopt1.o addext.o argmatch.o ba patch --version cd ../.. + +# Checksums +fletcher16 checksums diff --git a/sysa/sed-4.0.7/checksums b/sysa/sed-4.0.7/checksums new file mode 100644 index 00000000..fd9ef673 --- /dev/null +++ b/sysa/sed-4.0.7/checksums @@ -0,0 +1 @@ +15435 /after/bin/sed diff --git a/sysa/sed-4.0.7/sed-4.0.7.kaem b/sysa/sed-4.0.7/sed-4.0.7.kaem index eec3b519..235ed29e 100755 --- a/sysa/sed-4.0.7/sed-4.0.7.kaem +++ b/sysa/sed-4.0.7/sed-4.0.7.kaem @@ -44,3 +44,6 @@ tcc -static -o ${bindir}/sed -L lib lib/libsed.a compile.o execute.o regex.o fmt sed --version cd .. + +# Checksums +fletcher16 checksums diff --git a/sysa/tar-1.12/checksums b/sysa/tar-1.12/checksums new file mode 100644 index 00000000..04a4dbd8 --- /dev/null +++ b/sysa/tar-1.12/checksums @@ -0,0 +1 @@ +26761 /after/bin/tar diff --git a/sysa/tar-1.12/tar-1.12.kaem b/sysa/tar-1.12/tar-1.12.kaem index 3dd58702..7a326048 100755 --- a/sysa/tar-1.12/tar-1.12.kaem +++ b/sysa/tar-1.12/tar-1.12.kaem @@ -56,3 +56,6 @@ tcc -c -I lib -DSIZEOF_UNSIGNED_LONG=4 -DHAVE_FCNTL_H src/update.c tcc -static -o ${bindir}/tar -L lib lib/libtar.a arith.o buffer.o compare.o create.o delete.o extract.o incremen.o list.o mangle.o misc.o names.o open3.o rtapelib.o tar_patched.o update.o -ltar cd .. + +# Checksums +fletcher16 checksums diff --git a/sysa/tcc-0.9.26/checksums b/sysa/tcc-0.9.26/checksums new file mode 100644 index 00000000..20ea422b --- /dev/null +++ b/sysa/tcc-0.9.26/checksums @@ -0,0 +1,17 @@ +27585 /after/bin/boot0-tcc +10300 /after/bin/boot1-tcc +47485 /after/bin/boot2-tcc +38508 /after/bin/boot3-tcc +336 /after/bin/boot4-tcc +35666 /after/bin/boot5-tcc +14206 /after/bin/mes-tcc +35666 /after/bin/tcc +35666 /after/bin/tcc-0.9.26 +47832 /after/lib/libc.a +47832 /after/lib/libc+gnu.a +20204 /after/lib/libc+tcc.a +54049 /after/lib/libgetopt.a +23061 /after/lib/crt1.o +16980 /after/lib/crti.o +47705 /after/lib/crtn.o +10853 /after/lib/tcc/libtcc1.a diff --git a/sysa/tcc-0.9.26/tcc-0.9.26.kaem b/sysa/tcc-0.9.26/tcc-0.9.26.kaem index 59473b69..0349aba7 100755 --- a/sysa/tcc-0.9.26/tcc-0.9.26.kaem +++ b/sysa/tcc-0.9.26/tcc-0.9.26.kaem @@ -379,4 +379,7 @@ chmod 755 ${bindir}/tcc-0.9.26 tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 lib/posix/getopt.c tcc -ar cr ${libdir}/libgetopt.a getopt.o -cd .. +cd ../.. + +# Checksums +fletcher16 checksums diff --git a/sysa/tcc-0.9.27/checksums/tcc-0.9.27 b/sysa/tcc-0.9.27/checksums/tcc-0.9.27 new file mode 100644 index 00000000..39e88faf --- /dev/null +++ b/sysa/tcc-0.9.27/checksums/tcc-0.9.27 @@ -0,0 +1,9 @@ +35075 /after/bin/tcc +47832 /after/lib/libc.a +47832 /after/lib/libc+gnu.a +20204 /after/lib/libc+tcc.a +54049 /after/lib/libgetopt.a +23061 /after/lib/crt1.o +16980 /after/lib/crti.o +47705 /after/lib/crtn.o +54138 /after/lib/tcc/libtcc1.a diff --git a/sysa/tcc-0.9.27/tcc-0.9.27.kaem b/sysa/tcc-0.9.27/tcc-0.9.27.kaem index d602e885..862c3446 100755 --- a/sysa/tcc-0.9.27/tcc-0.9.27.kaem +++ b/sysa/tcc-0.9.27/tcc-0.9.27.kaem @@ -40,3 +40,6 @@ tcc -version kaem --file ../../compile-libc.kaem cd ../.. + +# Checksums +fletcher16 checksums/tcc-0.9.27 From 44bad278e0f683899cfd348593bfcf8c56e13520 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Mon, 15 Feb 2021 19:31:17 +1100 Subject: [PATCH 04/10] Add optional output_filename argument in rootfs.sh Downloads to a particular filename, allows for different names than whatever is upstream. --- rootfs.sh | 94 ++++++++++++++++++++++++++----------------------------- 1 file changed, 45 insertions(+), 49 deletions(-) diff --git a/rootfs.sh b/rootfs.sh index 4027b8c1..34547050 100755 --- a/rootfs.sh +++ b/rootfs.sh @@ -8,13 +8,13 @@ set -ex -QEMU_CMD="${1:-qemu-system-x86_64}" # or 'chroot' or 'minikernel' +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 + echo 'must be run from base of repo' + exit 1 fi pushd sysa @@ -27,33 +27,28 @@ 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 - - file=$(basename "$url") - mkdir -p "$dir" - - test -s "$dir/$file" || command wget -O "$dir/$file" "$url" - cp -v "$dir/$file" . - checksum_do "$dir" "$file" +_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" +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 + 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 @@ -127,11 +122,12 @@ tar -C tmp/after/tar-1.12/src -xf "tmp/after/tar-1.12/src/$(basename $url)" --st get_file() { url=$1 make_build=${2:-0} + output_filename=$3 ext="${url##*.}" if [ "$ext" = "tar" ]; then - bname=$(basename "$url" ".tar") + bname=$(basename "${output_filename:-${url}}" ".tar") else - bname=$(basename "$url" ".tar.${ext}") + bname=$(basename "${output_filename:-${url}}" ".tar.${ext}") fi cp -r "${bname}" tmp/after/ target="tmp/after/${bname}" @@ -141,7 +137,7 @@ get_file() { fi pushd "tmp/after/${bname}/src" if [ ! -f "$(basename "$url")" ]; then - wget "$url" + _wget "$url" "${output_filename:-${url##*/}}" fi popd } @@ -209,26 +205,26 @@ find . | cpio -H newc -o | gzip > initramfs.igz # Run case "${QEMU_CMD}" in - chroot) - sudo PATH="/after/bin:${PATH}" chroot . /init | tee "$LOGFILE" - ;; - minikernel) - git clone --depth 1 --branch v0.4 https://github.com/bittorf/kritis-linux.git + chroot) + sudo PATH="/after/bin:${PATH}" chroot . /init | 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" - ;; + 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 ../.. From 92cb05442e4ca600b6d6fd409695225f86e91629 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Mon, 15 Feb 2021 19:33:12 +1100 Subject: [PATCH 05/10] Add sha-2 (commit 61155d) Unfortunatley the sha2 project does not have versioned releases so we use the latest commit. We have also manually added a frontend to sha-2 to allow us to invoke it from the command line, thanks bittrof for the help! --- LICENSES/Unlicense.txt | 22 ++++ SHA256SUMS.sources | 1 + rootfs.sh | 3 + sysa/after.kaem.run | 20 +-- sysa/run.sh | 22 ++-- sysa/sha-2-61555d/checksums | 1 + sysa/sha-2-61555d/patches/frontend.patch | 151 +++++++++++++++++++++++ sysa/sha-2-61555d/sha-2-61555d.kaem | 30 +++++ 8 files changed, 232 insertions(+), 18 deletions(-) create mode 100644 LICENSES/Unlicense.txt create mode 100644 sysa/sha-2-61555d/checksums create mode 100644 sysa/sha-2-61555d/patches/frontend.patch create mode 100755 sysa/sha-2-61555d/sha-2-61555d.kaem diff --git a/LICENSES/Unlicense.txt b/LICENSES/Unlicense.txt new file mode 100644 index 00000000..5227a51b --- /dev/null +++ b/LICENSES/Unlicense.txt @@ -0,0 +1,22 @@ +This is free and unencumbered software released into the public domain. + +Anyone is free to copy, modify, publish, use, compile, sell, or distribute +this software, either in source code form or as a compiled binary, for any +purpose, commercial or non-commercial, and by any means. + +In jurisdictions that recognize copyright laws, the author or authors of this +software dedicate any and all copyright interest in the software to the public +domain. We make this dedication for the benefit of the public at large and +to the detriment of our heirs and +successors. We intend this dedication to be an overt act of relinquishment +in perpetuity of all present and future rights to this software under copyright +law. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH +THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +For more information, please refer to diff --git a/SHA256SUMS.sources b/SHA256SUMS.sources index 3608aee1..7d709c05 100644 --- a/SHA256SUMS.sources +++ b/SHA256SUMS.sources @@ -17,3 +17,4 @@ ecb5c6469d732bcf01d6ec1afe9e64f1668caba5bfdb103c28d7f537ba3cdb8a patch-2.5.9.ta 9fa29beb2fc4a3c373829fc051830796de301f32a719d0b52a400d1719bbd7b1 perl-5.003.tar.gz 1184478b298978b164a383ed5661e3a117c48ab97d6d0ab7ef614cdbe918b9eb perl5.004_05.tar.gz c6c37e888b136ccefab903c51149f4b7bd659d69d4aea21245f61053a57aa60a tar-1.12.tar.gz +404a8d72427a559c074e581bf8f7d5a73283faf249cd3faf6dc1c6faf97d07c7 sha-2-61555d.tar.gz diff --git a/rootfs.sh b/rootfs.sh index 34547050..4667e35b 100755 --- a/rootfs.sh +++ b/rootfs.sh @@ -148,6 +148,9 @@ get_file https://ftp.gnu.org/gnu/gzip/gzip-1.2.4.tar 1 # patch 2.5.9 get_file https://ftp.gnu.org/pub/gnu/patch/patch-2.5.9.tar.gz 1 +# sha-2 61555d +get_file https://github.com/amosnier/sha-2/archive/61555d.tar.gz 1 sha-2-61555d.tar.gz + # make 3.80 get_file https://ftp.gnu.org/gnu/make/make-3.80.tar.gz 1 diff --git a/sysa/after.kaem.run b/sysa/after.kaem.run index b8b568f5..fb136ae1 100755 --- a/sysa/after.kaem.run +++ b/sysa/after.kaem.run @@ -86,41 +86,47 @@ cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 12: mes-libc-patched +# Part 12: sha-2 +pkg="sha-2-61555d" +cd ${pkg} +kaem --file ${pkg}.kaem +cd .. + +# Part 13: mes-libc-patched cd tcc-0.9.27 kaem --file mes-libc-patched.kaem cd .. -# Part 13: tcc-patched +# Part 14: tcc-patched cd tcc-0.9.27 kaem --file tcc-patched.kaem cd .. -# Part 14: make +# Part 15: make pkg="make-3.80" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 15: bzip2 +# Part 16: bzip2 pkg="bzip2-1.0.8" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 16: coreutils +# Part 17: coreutils pkg="coreutils-5.0" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 17: heirloom-devtools +# Part 18: heirloom-devtools pkg="heirloom-devtools-070527" cd ${pkg} kaem --file ${pkg}.kaem cd .. -# Part 18: bash +# Part 19: bash pkg="bash-2.05b" cd ${pkg} kaem --file ${pkg}.kaem diff --git a/sysa/run.sh b/sysa/run.sh index c545ed10..4c580234 100755 --- a/sysa/run.sh +++ b/sysa/run.sh @@ -9,36 +9,36 @@ set -e export PREFIX=/after -# Part 19 +# Part 20 build flex-2.5.11 -# Part 20 +# Part 21 build musl-1.1.24 -# Part 21 -build tcc-0.9.27 tcc-musl.sh - # Part 22 -build m4-1.4.7 +build tcc-0.9.27 tcc-musl.sh checksums/tcc-musl # Part 23 -build flex-2.6.4 +build m4-1.4.7 # Part 24 +build flex-2.6.4 + +# Part 25 build bison-3.4.1 stage1.sh build bison-3.4.1 stage2.sh build bison-3.4.1 stage3.sh -# Part 25 +# Part 26 build grep-2.4 -# Part 26 +# Part 27 build diffutils-2.7 -# Part 27 +# Part 28 build coreutils-5.0 -# Part 28 +# Part 29 build gawk-3.0.4 # Part 29 diff --git a/sysa/sha-2-61555d/checksums b/sysa/sha-2-61555d/checksums new file mode 100644 index 00000000..4c9c42d4 --- /dev/null +++ b/sysa/sha-2-61555d/checksums @@ -0,0 +1 @@ +53384 /after/bin/sha256sum diff --git a/sysa/sha-2-61555d/patches/frontend.patch b/sysa/sha-2-61555d/patches/frontend.patch new file mode 100644 index 00000000..706e5314 --- /dev/null +++ b/sysa/sha-2-61555d/patches/frontend.patch @@ -0,0 +1,151 @@ +SPDX-FileCopyrightText: 2021 Bastian Bittorf +SPDX-FileCopyrightText: 2021 fosslinux + +SPDX-License-Identifier: Unlicense + +This adds a main() function to this tool, giving a frontend so we can call +it from the command line. + +--- sha-256.c 2019-08-04 22:20:53.000000000 +1000 ++++ sha-256.c 2021-02-15 17:21:27.478945543 +1100 +@@ -1,10 +1,16 @@ + #include + #include +- +-#include "sha-256.h" ++#include + + #define CHUNK_SIZE 64 + #define TOTAL_LEN_LEN 8 ++#define MAX_FILE_SIZE 2*1024*1024 ++ ++void show_usage(void) ++{ ++ printf("Usage: sha256sum \n"); ++ printf(" sha256sum -c \n"); ++} + + /* + * ABOUT bool: this file does not use bool in order to be as pre-C99 compatible as possible. +@@ -217,3 +223,121 @@ + hash[j++] = (uint8_t) h[i]; + } + } ++ ++static void hash_to_string(char hash_string[66], uint8_t hash[32]) ++{ ++ for (size_t i = 0; i < 32; i++) { ++ hash_string += sprintf(hash_string, "%02x", hash[i]); ++ } ++ hash_string[65] = '\0'; ++} ++ ++static void hash_as_string(char filename[128], char hash_string[66]) ++{ ++ char buffer[MAX_FILE_SIZE]; ++ ++ FILE* fp = fopen(filename, "r"); ++ if (fp == NULL) ++ { ++ printf("Opening file %s failed!", filename); ++ hash_string = NULL; ++ return; ++ } ++ ++ size_t i; ++ for (i = 0; i < MAX_FILE_SIZE; i++) { ++ int c = fgetc(fp); ++ if (c == EOF) { ++ break; ++ } ++ buffer[i] = c; ++ } ++ ++ uint8_t hash[32]; ++ ++ calc_sha_256(hash, buffer, i); ++ hash_to_string(hash_string, hash); ++} ++ ++int main(int argc, char **argv) ++{ ++ char buffer[MAX_FILE_SIZE]; ++ size_t i; ++ FILE *fp; ++ FILE *csum_fp; ++ ++ if (argc == 1) { ++ show_usage(); ++ return 2; ++ } ++ ++ if ((strcmp(argv[1], "-c") == 0) || (strcmp(argv[1], "--check") == 0)) { ++ /* Operate in check mode */ ++ int failed = 0; ++ ++ /* Get and open checksum file */ ++ char *csum_filename = argv[2]; ++ csum_fp = fopen(csum_filename, "r"); ++ if (csum_fp == NULL) { ++ printf("Opening file %s failed!", csum_filename); ++ }; ++ ++ /* We break out of this loop at EOF */ ++ while (1) { ++ /* Get the hash we need to check against */ ++ char hash_true[256]; ++ char filename[512]; ++ int c = fgetc(csum_fp); ++ i = 0; ++ while (c != ' ' && c != EOF) { ++ hash_true[i] = c; ++ c = fgetc(csum_fp); ++ i++; ++ } ++ if(c == EOF) break; ++ /* Skip the next space(s) */ ++ while (c == ' ') { ++ c = fgetc(csum_fp); ++ } ++ if(c == EOF) break; ++ /* Get the filename */ ++ i = 0; ++ while (c != '\n' && c != EOF) { ++ filename[i] = c; ++ c = fgetc(csum_fp); ++ i++; ++ } ++ filename[i] = '\0'; ++ ++ /* Break out @ EOF */ ++ if (c == EOF) break; ++ ++ /* Get the hash */ ++ char hash_string[66]; ++ hash_as_string(filename, hash_string); ++ if (hash_string == NULL) return 127; ++ ++ /* Output results */ ++ printf("%s: ", filename); ++ if (strcmp(hash_true, hash_string)) { ++ printf("FAILED\n"); ++ failed = 1; ++ } else { ++ printf("OK\n"); ++ } ++ } ++ ++ if (failed) return 1; ++ } else { ++ /* All the arguments are files to generate checksums for */ ++ ++ for (i = 1; i < argc; i++) { ++ char hash[66]; ++ hash_as_string(argv[i], hash); ++ if (hash == NULL) return 127; ++ printf("%s %s\n", hash, argv[i]); ++ } ++ } ++ ++ return 0; ++} diff --git a/sysa/sha-2-61555d/sha-2-61555d.kaem b/sysa/sha-2-61555d/sha-2-61555d.kaem new file mode 100755 index 00000000..0a9a6426 --- /dev/null +++ b/sysa/sha-2-61555d/sha-2-61555d.kaem @@ -0,0 +1,30 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2021 fosslinux +# +# SPDX-License-Identifier: GPL-3.0-or-later + +set -ex + +cd build + +# Extract +gunzip ../src/${pkg}.tar.gz +tar xf ../src/${pkg}.tar +cd sha-2-61555d45676473e77c11f8da97301e2d2b865871 + +# Patch +patch -Np0 -i ../../patches/frontend.patch + +# Compile +tcc -c -o sha-256.o sha-256.c + +# Link +tcc -static -o ${bindir}/sha256sum sha-256.o + +# No test avaliable + +cd ../.. + +# Checksums +fletcher16 checksums From d6780c994760acce6863c396321e9a72a77150e4 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Thu, 18 Feb 2021 18:27:37 +1100 Subject: [PATCH 06/10] Recheck all of the fletcher16 using sha-2 Ensure validity at a higher bit depth --- .reuse/dep5 | 2 +- rootfs.sh | 2 +- sysa/after.kaem.run | 3 +++ sysa/pre-sha.sha256sums | 38 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 sysa/pre-sha.sha256sums diff --git a/.reuse/dep5 b/.reuse/dep5 index 19638ba1..66f7bf23 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -9,6 +9,6 @@ Source: https://github.com/fosslinux/live-bootstrap # Copyright: $YEAR $NAME <$CONTACT> # License: ... -Files: SHA256SUMS.sources sysa/*/checksums sysa/*/checksums/* +Files: SHA256SUMS.sources sysa/pre-sha.sha256sums sysa/*/checksums sysa/*/checksums/* Copyright: none License: MIT diff --git a/rootfs.sh b/rootfs.sh index 4667e35b..c9e86602 100755 --- a/rootfs.sh +++ b/rootfs.sh @@ -79,7 +79,7 @@ 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 tmp/after/ +cp helpers.sh run.sh pre-sha.sha256sums tmp/after/ # mescc-tools-extra cp -r mescc-tools-extra tmp/after/ diff --git a/sysa/after.kaem.run b/sysa/after.kaem.run index fb136ae1..5efa3abd 100755 --- a/sysa/after.kaem.run +++ b/sysa/after.kaem.run @@ -92,6 +92,9 @@ cd ${pkg} kaem --file ${pkg}.kaem cd .. +# Part 13: Check all up to this part as sha256sum +sha256sum -c pre-sha.sha256sums + # Part 13: mes-libc-patched cd tcc-0.9.27 kaem --file mes-libc-patched.kaem diff --git a/sysa/pre-sha.sha256sums b/sysa/pre-sha.sha256sums new file mode 100644 index 00000000..11332e11 --- /dev/null +++ b/sysa/pre-sha.sha256sums @@ -0,0 +1,38 @@ +e7b1b2c7d999cd31becd7368f735b1672f24e1e469d73f0641fca5e0b6a314e8 /after/bin/boot0-tcc +009ad5707f1bcac76cac07f0a0c4199d64915fe619488673fc137bc6a3bd2398 /after/bin/boot1-tcc +35fc4f304ce3068aae776634b691cd77f57872867facee96841cd73c257a04ec /after/bin/boot2-tcc +ca5018cda11edeb4bffa45e7baf3501130ca75986a98e78ba7e27ae27f7b503a /after/bin/boot3-tcc +5fe2eb19bdf8feeca3241ef96461636db84b99ec7613bf59f9fd9ff03d935f5e /after/bin/boot4-tcc +cacc2cda3ce6c2cc0cb761b8aa2115a003e166c94d1039974fc0221263897c52 /after/bin/boot5-tcc +773eae17b7f347526f8033afc9d1f06af116dfbcd0a26cbde7e29ab47e77850d /after/bin/chmod +02f8cb033b41118bbea92c90a5bba30f50215c94792282c97967bd60a48373f4 /after/bin/cp +e1481ecf337fb657f3949af0b45bb620c1886cd1a1b003fe27338832c250f41d /after/bin/fletcher16 +bbad3c53d86df800088146ef3b65b755786557ab11f04fe9706503e9f9c241b3 /after/bin/gunzip +bbad3c53d86df800088146ef3b65b755786557ab11f04fe9706503e9f9c241b3 /after/bin/gzip +d41067670562f87c6e43af0b461c4070c19a8ffc15c455cb075d98419ae76c73 /after/bin/mes +b91c81e543b878ead4cc975df75e3d211f7bd2dcdd4c90e42df99d44311ce71e /after/bin/mescc.scm +e94a2468c045582cfd13df51acd0932afdc834fa60139f7bfb7a2d65afa39a65 /after/bin/mes-tcc +3cf426251744300a099a40f3609ccbd32ec3b9f3334601defa5736e7fd6c6f1d /after/bin/patch +e01eaee677cd4fd65a65e7d1e2905a8587a3bab82fc1d0b81cffbe2959f2813d /after/bin/precisely +b4b16b3314a6f4a8be1b849aba45252e621a7123025dabdf9af6c2d4d657e9b6 /after/bin/sed +bc9ddf9854bd954c71bb1cf5b0af77fd65b8fa7f290b42c75020fb8893deb53c /after/bin/sha256sum +9f83aae8cee866b3af409bb6d28e32d0a04db0e7b64680af4e38b5f43b5ece96 /after/bin/tar +690c2a941c444ba761076f6b8ef1ba2b634ebe2e63ea44c8f3789f6e3df6d2a9 /after/bin/tcc +cacc2cda3ce6c2cc0cb761b8aa2115a003e166c94d1039974fc0221263897c52 /after/bin/tcc-0.9.26 +bbad3c53d86df800088146ef3b65b755786557ab11f04fe9706503e9f9c241b3 /after/bin/zcat +44b5f15e1f015685fe4c3d66eda5ba52aac77b94f2edd98b764cec05ca350d49 /after/lib/crt1.o +90811dafd33ad56b8e4b0adcc04263f9329b9047b7cc337abe8151a75017172c /after/lib/crt1.s +09d4f9821a2566f7e56381a19259c41bd97f3c5ed83f490705acbfd1139a7736 /after/lib/crti.o +461ca1494737fab86fe1c1d3addeaf9d0ece413e353abcdea8674db3f700cda3 /after/lib/crtn.o +34f62227f8cc61d365d92a182f8f3cc91cc6c50a1bbb8f4774a4383bceaefa5f /after/lib/libc.a +34f62227f8cc61d365d92a182f8f3cc91cc6c50a1bbb8f4774a4383bceaefa5f /after/lib/libc+gnu.a +b5ce4e1288a27864156d74268090c13aea6b5a261fa81c75bfbe844d0689d03d /after/lib/libc.s +3156e619dbd85c471e2a8d053ba536eaaa8f91da657003777b8e87e7bab4266d /after/lib/libc+tcc.a +aaf89a9d6818cdb8ece73454631b1a1ae83503e5eb7777d38cdaf141cba0e530 /after/lib/libc+tcc.s +12c07ae103e7e3b390150a79e5c600d88de14e9bb73a066f6342582729ef5a3f /after/lib/libgetopt.a +52f697278ccdff5e457f27e10f465a91ab9858f0c6cee0683831cadb3109bbb7 /after/lib/libmescc.a +d8646707db6aa2a76fdc5dbb3521376439e357f9f1de1d67f02a1afeefd342ac /after/lib/libmescc.s +f9873d9aab12e70f24d97f8319e17a1e698ca60779ae9a6ab3ede648cd60fc61 /after/lib/linux/elf32-footer-single-main.hex2 +b16ab368bc4c7b8bd896d03cba565a60e97760dea4da9f5c8a1a3d2902a79df6 /after/lib/linux/elf32-header.hex2 +a650b13efc65073fb851e9db89728089d8845c401f85faaa09801874ab058089 /after/lib/tcc/libtcc1.a +c9944a799d584abfa76f385c14ac0caf6f46d03b34bf2712493602b12826c6b2 /after/lib/x86.M1 From 8724c94d200f0308745648bc85c6ef997ef82d46 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Thu, 18 Feb 2021 18:29:18 +1100 Subject: [PATCH 07/10] Implement sha256summing for all remaining kaem scripts --- sysa/bash-2.05b/bash-2.05b.kaem | 3 ++ sysa/bash-2.05b/checksums | 1 + sysa/bzip2-1.0.8/bzip2-1.0.8.kaem | 3 ++ sysa/bzip2-1.0.8/checksums | 2 + sysa/coreutils-5.0/checksums/pass1 | 54 +++++++++++++++++++ sysa/coreutils-5.0/coreutils-5.0.kaem | 3 ++ sysa/heirloom-devtools-070527/checksums | 5 ++ .../heirloom-devtools-070527.kaem | 4 ++ sysa/make-3.80/checksums | 1 + sysa/make-3.80/make-3.80.kaem | 3 ++ sysa/tcc-0.9.27/checksums/mes-libc-patched | 6 +++ sysa/tcc-0.9.27/checksums/tcc-patched | 1 + sysa/tcc-0.9.27/mes-libc-patched.kaem | 4 ++ sysa/tcc-0.9.27/tcc-patched.kaem | 4 ++ 14 files changed, 94 insertions(+) create mode 100644 sysa/bash-2.05b/checksums create mode 100644 sysa/bzip2-1.0.8/checksums create mode 100644 sysa/coreutils-5.0/checksums/pass1 create mode 100644 sysa/heirloom-devtools-070527/checksums create mode 100644 sysa/make-3.80/checksums create mode 100644 sysa/tcc-0.9.27/checksums/mes-libc-patched create mode 100644 sysa/tcc-0.9.27/checksums/tcc-patched diff --git a/sysa/bash-2.05b/bash-2.05b.kaem b/sysa/bash-2.05b/bash-2.05b.kaem index c1044865..1ba65918 100755 --- a/sysa/bash-2.05b/bash-2.05b.kaem +++ b/sysa/bash-2.05b/bash-2.05b.kaem @@ -45,3 +45,6 @@ ln -s /after/bin/bash /bin/bash ln -s /after/bin/bash /bin/sh cd ../.. + +# Checksums +sha256sum -c checksums diff --git a/sysa/bash-2.05b/checksums b/sysa/bash-2.05b/checksums new file mode 100644 index 00000000..499dcd72 --- /dev/null +++ b/sysa/bash-2.05b/checksums @@ -0,0 +1 @@ +d60023c3cd1bede628e920ac18a0f71115274f1867eb50ccd05ece1f64bc5fd6 /after/bin/bash diff --git a/sysa/bzip2-1.0.8/bzip2-1.0.8.kaem b/sysa/bzip2-1.0.8/bzip2-1.0.8.kaem index a5725899..695c481c 100755 --- a/sysa/bzip2-1.0.8/bzip2-1.0.8.kaem +++ b/sysa/bzip2-1.0.8/bzip2-1.0.8.kaem @@ -31,3 +31,6 @@ chmod 755 /after/bin/bunzip2 bzip2 --help cd ../.. + +# Checksums +sha256sum -c checksums diff --git a/sysa/bzip2-1.0.8/checksums b/sysa/bzip2-1.0.8/checksums new file mode 100644 index 00000000..5d7aa35d --- /dev/null +++ b/sysa/bzip2-1.0.8/checksums @@ -0,0 +1,2 @@ +74cb8b1278d648d3f63b71cc5b055a83e83e12a044c7e533c1b348ee8cf34314 /after/bin/bzip2 +74cb8b1278d648d3f63b71cc5b055a83e83e12a044c7e533c1b348ee8cf34314 /after/bin/bunzip2 diff --git a/sysa/coreutils-5.0/checksums/pass1 b/sysa/coreutils-5.0/checksums/pass1 new file mode 100644 index 00000000..d328f30b --- /dev/null +++ b/sysa/coreutils-5.0/checksums/pass1 @@ -0,0 +1,54 @@ +57021d532906e8ec95173b4557959147cfdb240a26fbe36e48960e95f5b14cf4 /after/bin/install +18804ab55d0516bd19059339a63f145cd4d86084bdfb88b06ea36ac2128037a3 /after/bin/basename +3154f34ec9d8a30faf4ee8d6d29a91b4e03e61613030c2872f8215493a94d7b4 /after/bin/cat +eef190bbc238ffbd9de39b0a2629f815f3efd4a07848bbe9e5ddf15728a9ae6a /after/bin/chmod +3db27eaf11453f08205bf42007bc81df0d1e2a35eb0845de4a17803ee2d5ad9a /after/bin/cksum +1ed5730145be705af04ab2b6f498bb12f5778b553510373e2f7885c174d9f6c7 /after/bin/csplit +8289d664efad63db71cbc5a93bb2b08bfd19eb578ed3f8cf3902c602319a9b96 /after/bin/cut +5abdf478511ae3d7ea8d7c67808f8eb19d37cb9f5f2bd3e63c9fa1ccb939ccb5 /after/bin/echo +d275419b74a87b13a0454224c59863de38dc6e4392e4f6daa0d9aa635b55db0a /after/bin/expand +f9d1a04f64dda43d2d4c5358b2e9ec67697a587d493a038992ef4bfa18f834df /after/bin/factor +2e318c11041074ed917569fe7df5519db615fba24f4182e2468789abe6de5d86 /after/bin/false +31763c8ad64d314501f236796af7536f6103d8ed392b1b47787ef035371304d2 /after/bin/fmt +4248a1741f49ef40fc74cf59e609eb55d416f301c6a0854f123cfd182c9d69b7 /after/bin/fold +4abd96e4e60ed3c492797387b5a1c6d6a0099600074817bc803baf7b5e5624ef /after/bin/head +45a53024754c38846593aa0bef64ac8af1b33647d88b4aae85f05f095afd0ebe /after/bin/id +56430b7c42580af3c5b5ef7fd1c43fcf373d1844eb41d80a0055b90a1471784e /after/bin/join +ab0354eb681fe6eaa9299ce27a34c46be22ce34b635b7ad20fe02a802f5f411d /after/bin/kill +b7e74600ec00aa8f13cd113ba832032ca95d2dda1070f568765b4941dab77de5 /after/bin/link +9cb09b77c3bc6044c86959a5e5eb7f402f13a88f3f719dc4087b8797a4dc1cac /after/bin/ln +005df5e851e0d52114507821ebb444ae7e2876a7619fe1da82091662e3844b2f /after/bin/logname +f81e08130457074d9a20489347069a7ae2aa60ed7ab7759561ca98dc9fdb22b8 /after/bin/mkfifo +58065d43c38f38cfed6eb20cfce6a221cc1a2f3f5aabf4c30563d34f0e4b3972 /after/bin/mkdir +7e2816b19067a66fdfe79d0f39a568c6f274cd92be10c43a4284908e3c6a7b36 /after/bin/mknod +e08ca394b75cf19cf8d51a21a9965922cacb213b275fcdfe71e9be78de5443df /after/bin/nl +3a7413ebd546d60817e67aeb4d909c2528566bc25e8a5119ba65c2f834ca95ba /after/bin/od +60cb00b56e5dbadc8e239e5ebdda5ded82bf8409e26aedbedfb36f256c0566f2 /after/bin/paste +4bf4283733fb2e541084e63ba8b1d643eaf19e0e11931935f9fd2357a4998fbe /after/bin/pathchk +6e0f574cff56e9ce4e58a9db2c3999f7114269ece023496fbc629310e3b3911b /after/bin/printf +78681ca7d88324d4b595328b3beef7d46c75e957f4b7eec46985ba51bdaeb062 /after/bin/ptx +4ab6aa69bdfdc287a0fa402fc198defeef7ce6094519232425026d6ac65f39e5 /after/bin/pwd +dab15e939cf79bb7609d86fd50afb9ca7395de313f9d6e14b5ec5cc304aa4aa7 /after/bin/readlink +402cf598fff0876fae60f1ce2e0deec9e955c51ab32a587857d7f353c9f5fca6 /after/bin/rmdir +1802bd63bd1af9dd18141079f3efdd9f00092c4d8989b165c1da2068a3a61025 /after/bin/seq +add34da9989d32db6a0b12476a074ef3c59acca09fd4ed8a1e7da19ebcc2f311 /after/bin/sleep +d5d329c9bb11ea3cb9b95d0a7bea948b48defe5738882b8148f766cbbfcf30c3 /after/bin/split +f77918803ea96e92e10c653f53a196ff2f3444e8317d019e2908472b5ff1d2a0 /after/bin/sum +b2e00dee5951d3320ba0adac294311f31858d5860520f262b5b2f788c272fc88 /after/bin/tail +f491c177aaccd96b6f6c61bd288b5f039722edd47ae66e49ace4ae8722a62323 /after/bin/tee +0b4843b26cbb135e34f87f9255d931f38f8de42a6d93008c36f2682ae5441d54 /after/bin/touch +cc04233f2020b59c0c6ff2b267a7c99ffcedc2a59ff94e09ef1dea7197765f29 /after/bin/tr +dc2b1e033e1b21b0c2cdf0d71c0dae5bf76da11e45b20f5258377ae1638845b7 /after/bin/tsort +997ed6336650515aa97ae96b22f7cbc46d6346ba985e70336c21cbc5113c0066 /after/bin/unexpand +a7884b7ba882ca34443b638a512dbbc415824d149d3b588b7d2fd7f063300a4f /after/bin/unlink +b32921d0f32bee98f4af4d8ab30670dbce2dcf35f63221a6c3fd143859e11d9a /after/bin/wc +4d39991d41b5479a506dc3ce13fa170bd5cfb0031e248f2fa32bf1338935f4af /after/bin/whoami +199c5b3db58b79ca9a6d16352e779c6db1d8aef40d25e396fe41994e42de4720 /after/bin/test +56b8e1436013b40f4fdedd1f240fb80a521a96819a73e38010e24d09430d2c5b /after/bin/true +dd76ea2581577775bee50ca31b436442f60f63a70fab6bb01eef927c1fd6139b /after/bin/yes +30afc17da299c1e7caddc5cbc2389513770aae000284e8623f271f0f3c70c8d7 /after/bin/ls +57021d532906e8ec95173b4557959147cfdb240a26fbe36e48960e95f5b14cf4 /after/bin/install +d1eaf36eacb4e0688bded5d887bebd79a4777992825a696747e16330c0555eba /after/bin/md5sum +6c826bbd5a58244ca1ee4af928ce27eeaa87346d0bd69aa18b0eafb296e6c147 /after/bin/mv +ea0e3e2d87d46998450a6ab2c06758faf2ff9aaec70de7f1cec06a38e483cec6 /after/bin/rm +8918994159a3afb3f58ddc143b007bcba573eab6fbe43f705bf1cd6a2c3d03ab /after/bin/sha1sum diff --git a/sysa/coreutils-5.0/coreutils-5.0.kaem b/sysa/coreutils-5.0/coreutils-5.0.kaem index ed3f58af..86ad64a9 100755 --- a/sysa/coreutils-5.0/coreutils-5.0.kaem +++ b/sysa/coreutils-5.0/coreutils-5.0.kaem @@ -31,3 +31,6 @@ patch -Np0 -i ../../patches/ls-strcmp.patch /after/bin/make -f Makefile install cd ../.. + +# Checksums +sha256sum -c checksums/pass1 diff --git a/sysa/heirloom-devtools-070527/checksums b/sysa/heirloom-devtools-070527/checksums new file mode 100644 index 00000000..1dc85046 --- /dev/null +++ b/sysa/heirloom-devtools-070527/checksums @@ -0,0 +1,5 @@ +ce634646b0fb57bdfecf84533562e624504d48144e3589195e2752cac9e94fdc /after/bin/yacc +276941719f71e8733d988cbc87f7be40c52ba9b6ddcc2d93898bcecb5a49b657 /after/bin/lex +ffe696afc1bda32a5f4035e29b3275cab73a27df7635ccbe02ed49a30374ccdd /after/lib/libl.a +bf3fb293f1ff89ee3dbcb08166c64b7a6793b49a12673d7633e3353ebea80d4d /yaccpar +ee0f187b844f50d64c912bfcb5d73706662846d6d8a90b8b1fb20dda60464734 /lex/ncform diff --git a/sysa/heirloom-devtools-070527/heirloom-devtools-070527.kaem b/sysa/heirloom-devtools-070527/heirloom-devtools-070527.kaem index b07666f4..477cb767 100755 --- a/sysa/heirloom-devtools-070527/heirloom-devtools-070527.kaem +++ b/sysa/heirloom-devtools-070527/heirloom-devtools-070527.kaem @@ -1,6 +1,7 @@ #!/bin/sh # SPDX-FileCopyrightText: 2021 Andrius Štikonas +# SPDX-FileCopyrightText: 2021 fosslinux # # SPDX-License-Identifier: GPL-3.0-or-later @@ -41,3 +42,6 @@ install libl.a ${libdir} install -m 644 ncform ${lexdir} cd ../../.. + +# Checksums +sha256sum -c checksums diff --git a/sysa/make-3.80/checksums b/sysa/make-3.80/checksums new file mode 100644 index 00000000..5f0bbed4 --- /dev/null +++ b/sysa/make-3.80/checksums @@ -0,0 +1 @@ +7745ab1036a83ed63416af84bd166bfe768554ac393fbc53818acd4ccc18ce7f /after/bin/make diff --git a/sysa/make-3.80/make-3.80.kaem b/sysa/make-3.80/make-3.80.kaem index 358fb8a9..89e60946 100755 --- a/sysa/make-3.80/make-3.80.kaem +++ b/sysa/make-3.80/make-3.80.kaem @@ -55,3 +55,6 @@ tcc -o ${bindir}/make getopt.o getopt1.o ar.o arscan.o commands.o default.o dir. make --version cd ../.. + +# Checksums +sha256sum -c checksums diff --git a/sysa/tcc-0.9.27/checksums/mes-libc-patched b/sysa/tcc-0.9.27/checksums/mes-libc-patched new file mode 100644 index 00000000..997f2560 --- /dev/null +++ b/sysa/tcc-0.9.27/checksums/mes-libc-patched @@ -0,0 +1,6 @@ +a1313f0a2aef2e63a3d03b2c8de98e6c022f0999e4d7e039bd140c250be4a4da /after/lib/libc.a +a1313f0a2aef2e63a3d03b2c8de98e6c022f0999e4d7e039bd140c250be4a4da /after/lib/libc+gnu.a +12c07ae103e7e3b390150a79e5c600d88de14e9bb73a066f6342582729ef5a3f /after/lib/libgetopt.a +d1168ee9b528e39f0b40e8d51fb7fa3619c4a5ee928137f7faf6d0879b0916b0 /after/lib/crt1.o +461ca1494737fab86fe1c1d3addeaf9d0ece413e353abcdea8674db3f700cda3 /after/lib/crtn.o +09d4f9821a2566f7e56381a19259c41bd97f3c5ed83f490705acbfd1139a7736 /after/lib/crti.o diff --git a/sysa/tcc-0.9.27/checksums/tcc-patched b/sysa/tcc-0.9.27/checksums/tcc-patched new file mode 100644 index 00000000..7016705b --- /dev/null +++ b/sysa/tcc-0.9.27/checksums/tcc-patched @@ -0,0 +1 @@ +d9dd8e605c8dfd584216e94df4759b1aeb894bdd3d99937bf0eba28cf875e25a /after/bin/tcc diff --git a/sysa/tcc-0.9.27/mes-libc-patched.kaem b/sysa/tcc-0.9.27/mes-libc-patched.kaem index 5d4f2b82..19171c3a 100755 --- a/sysa/tcc-0.9.27/mes-libc-patched.kaem +++ b/sysa/tcc-0.9.27/mes-libc-patched.kaem @@ -1,6 +1,7 @@ #!/bin/sh # SPDX-FileCopyrightText: 2021 Paul Dersey +# SPDX-FileCopyrightText: 2021 fosslinux # # SPDX-License-Identifier: GPL-3.0-or-later @@ -17,3 +18,6 @@ cd ../tcc-0.9.27 kaem --file ../../compile-libc.kaem cd ../.. + +# Checksums +sha256sum -c checksums/mes-libc-patched diff --git a/sysa/tcc-0.9.27/tcc-patched.kaem b/sysa/tcc-0.9.27/tcc-patched.kaem index 9c4ccd37..bdff83fd 100755 --- a/sysa/tcc-0.9.27/tcc-patched.kaem +++ b/sysa/tcc-0.9.27/tcc-patched.kaem @@ -1,5 +1,6 @@ #!/bin/sh +# SPDX-FileCopyrightText: 2021 fosslinux # SPDX-FileCopyrightText: 2021 fosslinux # # SPDX-License-Identifier: GPL-3.0-or-later @@ -35,3 +36,6 @@ tcc-0.9.26 \ tcc -version cd ../.. + +# Checksums +sha256sum -c checksums/tcc-patched From 77ccf06efca3f5d65bedde0c0e93daaad9dcf41b Mon Sep 17 00:00:00 2001 From: fosslinux Date: Thu, 18 Feb 2021 18:29:58 +1100 Subject: [PATCH 08/10] Implement sha256summing in bash build harness 1. Adds sha256sum stage to the bash build harness. 2. Adds a third argument to build(), the checksum file name. This is used where there is more than one checksum file, most notably in multi-stage compilations. 3. Adds checksum files to all remaining programs. 4. Adds appropriate 3rd argument where needed (coreutils, tcc-musl, bison). --- sysa/bison-3.4.1/checksums/stage1 | 1 + sysa/bison-3.4.1/checksums/stage2 | 1 + sysa/bison-3.4.1/checksums/stage3 | 1 + sysa/coreutils-5.0/checksums/pass2 | 54 ++++++++++++++++++++++++++++++ sysa/diffutils-2.7/checksums | 2 ++ sysa/flex-2.5.11/checksums | 1 + sysa/flex-2.6.4/checksums | 1 + sysa/gawk-3.0.4/checksums | 1 + sysa/grep-2.4/checksums | 1 + sysa/helpers.sh | 9 ++++- sysa/m4-1.4.7/checksums | 1 + sysa/musl-1.1.24/checksums | 14 ++++++++ sysa/run.sh | 10 +++--- sysa/tcc-0.9.27/checksums/tcc-musl | 1 + 14 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 sysa/bison-3.4.1/checksums/stage1 create mode 100644 sysa/bison-3.4.1/checksums/stage2 create mode 100644 sysa/bison-3.4.1/checksums/stage3 create mode 100644 sysa/coreutils-5.0/checksums/pass2 create mode 100644 sysa/diffutils-2.7/checksums create mode 100644 sysa/flex-2.5.11/checksums create mode 100644 sysa/flex-2.6.4/checksums create mode 100644 sysa/gawk-3.0.4/checksums create mode 100644 sysa/grep-2.4/checksums create mode 100644 sysa/m4-1.4.7/checksums create mode 100644 sysa/musl-1.1.24/checksums create mode 100644 sysa/tcc-0.9.27/checksums/tcc-musl diff --git a/sysa/bison-3.4.1/checksums/stage1 b/sysa/bison-3.4.1/checksums/stage1 new file mode 100644 index 00000000..e5e5e44a --- /dev/null +++ b/sysa/bison-3.4.1/checksums/stage1 @@ -0,0 +1 @@ +6fe2a7c7493480b8ba6d1145d10b5dc97f0d11d10c0da7c96e939a334e4aefad /after/bin/bison diff --git a/sysa/bison-3.4.1/checksums/stage2 b/sysa/bison-3.4.1/checksums/stage2 new file mode 100644 index 00000000..c552368d --- /dev/null +++ b/sysa/bison-3.4.1/checksums/stage2 @@ -0,0 +1 @@ +0d95976908f41c34195d634863144acf9ae0b1d2c04647fdf5cfd3103beec4dd /after/bin/bison diff --git a/sysa/bison-3.4.1/checksums/stage3 b/sysa/bison-3.4.1/checksums/stage3 new file mode 100644 index 00000000..02560d55 --- /dev/null +++ b/sysa/bison-3.4.1/checksums/stage3 @@ -0,0 +1 @@ +b02a549930ed891d40ef85060e3d0ae1d681830d7962237a9d99c6eeea23f4ef /after/bin/bison diff --git a/sysa/coreutils-5.0/checksums/pass2 b/sysa/coreutils-5.0/checksums/pass2 new file mode 100644 index 00000000..fa33dc5d --- /dev/null +++ b/sysa/coreutils-5.0/checksums/pass2 @@ -0,0 +1,54 @@ +e72c5b0ebff9c8f72cd40355eb6baed175bbfc3addaa16ec6085e6a0e850a028 /after/bin/install +ad6bf7547d6b38b3ccd2ae389ae4fd8a31a57138507b289305ad40d2d1b640ba /after/bin/basename +182ed1dd7bada465e34ef89af126119a4f02b4a9a1ab77ddb3d59fe366115d71 /after/bin/cat +9d5e12cd79d3e5fac23205d09ee2d26dc6070c2fab06e86e03c048b4b810fc35 /after/bin/chmod +4baa1a727b4cb9739e8095fa205d21ec14543a5ca2660c4c5e187848c8b6285e /after/bin/cksum +57c4bc1e89be122e7269d5306f90317082346d5cf9f1b7ce8210664911a1d2c0 /after/bin/csplit +8b8f0c8ab7538f6d972f6e13c1d3b51b3a2b09185f649471d018c77813b0f208 /after/bin/cut +21eecaacde1c44ae6bb944743d7bc61806bcb3fe24f792a1da1fced1f6a2d5a1 /after/bin/echo +c6c56ca458452782a7014c194b4001e13b89a1cdae42f699f42e527c535e6b30 /after/bin/expand +b5bb5ba4d52da5e86d8fc80c831a229cc4c057644e886c367711eab571cf8aec /after/bin/factor +25ab087dad2bdec3d8a0c51b93f1aec42516085905232b908dd19ac620727932 /after/bin/false +1fabff3d2bc61990fd94f9ed5055032cad1b3982a6effaaaed9d76d553708e17 /after/bin/fmt +ca21a324c2628d66994c19f444739d112246ade4eaaac71ab76f41751b5c6f9f /after/bin/fold +6b7b368cec7d0402c0cd17f1d59066dbf46c81345435cf994046e1f535853808 /after/bin/head +9afae9c301cbcfd25bc50efe47f92a90be8801772f83f6455197048df0161f42 /after/bin/id +dc62c58ca836141a6476135c9a20b01aa75f4403ffff0dc08675d285f2c31730 /after/bin/join +e8eaf3838c0ebd70f3ef5b475fcbe32771e1fd16db57a780212ff01af829b8be /after/bin/kill +9160804d2a84af504ce9ccb793b511b114b33e67b71e282101a7c85a5d1eb827 /after/bin/link +a9696d75821b2964b29c0a2f896964ac5bd723509ba940903f5d3e5a4ae28cc7 /after/bin/ln +66cc6ec8440ac2635c3e8c8a93618448a3b0ac32a2828d2c58ea4b04c43a0624 /after/bin/logname +0c006ee959d0bb585449e8cc03c7a4e8bef654d548f8e65adcf5d7c116828320 /after/bin/mkfifo +e8ce9b04108e6faeaf4e506e98ccb42d501af0c5c7b999ada0ac589eeef8e076 /after/bin/mkdir +696a2c4448890691317e9d2fd6097b635d9825e80eb4dde0430a617d68b7e2bf /after/bin/mknod +779f4108063fbbf2026f2948f6caf52dc834b4a22f74e43b3ebfce15ef111061 /after/bin/nl +a0b6658f0f27fbf753cd4617d33f1f9e82bb973d342e83e229ce48c09d5e8d86 /after/bin/od +fe7afbb1ac9144cfd13bf8955f0474740a192de00f37dc4f549032b74013422f /after/bin/paste +bbc99502af4745aeb45989adc055dc3d24d86b4f43ba63178b6e39912ee19750 /after/bin/pathchk +5860714658263857e0b8061d7d483b1a83e25935e45e47b8430465e1f751b908 /after/bin/printf +b43ab09f2edd05645e59a5b9be05ae0bf30d7b38585c59bc25ec46ef3c82f327 /after/bin/ptx +d3d0223c690358d5c392619396cec73dad97a84efbfcf959c7507efd0aef5708 /after/bin/pwd +53c504ac4df5e12bbc345a6ee78d3eb8f916263ae464d694d9e0f8334ff976f6 /after/bin/readlink +b58288bcad22f69ad34e1a91e1a5dc67544589f62b38bbff95a057f5600cefe2 /after/bin/rmdir +7871b2d181bf1c4460b0f78b91fc0ae6ccc9528bc7ae941367b066cb7b72cd0e /after/bin/seq +b1d8b246b3306cfc2491c81cf00969396e1ec5cfd3fa73012aa8fed0ce1446b0 /after/bin/sleep +8bf47b44f6a506ffed5d0f69791adc8463968b5562413186dd8a71ee595d26ee /after/bin/split +ae10f35493f3d275af4ffe70281ecbc72b047ed7d48620a9109e60c159a3c36b /after/bin/sum +10083826d7cb1a42e7061811f20548e4d24432b3e646f6d0ab537c0db6dabd48 /after/bin/tail +48558bc37919c524a1cbe674142484cc1027bf0010d3f68fb93403fc148de9d3 /after/bin/tee +0455bd0c814663287a2807bf78859d5f43aa7a2490c4da0c07d29a32df772dca /after/bin/touch +f31fd1fc30d2e0b16a37b277f4fe608f6a756cc4d09312d84f6a9ff86054eb38 /after/bin/tr +edc3b88d1de07f5ba7f59cf1e131476907ce59739ab2181bfd31d1ace2ee8a25 /after/bin/tsort +b68e707c10d51d4c7fce328e7619011d8baf6605df1058d9dd513e8671447fe7 /after/bin/unexpand +67900322d337e18a6782c5e81643a099c8775b1a4200eeb6808409db6e62eabf /after/bin/unlink +6201303021c9d6dffa796c50fec6e8f199efd5d00328373248531b6ec5ae27c7 /after/bin/wc +5de85a50c357e6450d616970479fa24c9965c5ce0c7f05da337d96510653811e /after/bin/whoami +4ed60b9f4dd8b7909fb69f07f5120e62b22eed0a746bb28139fab560538f2544 /after/bin/test +8165613f96eddbb107cf0a263789fa135a7a26c016bbcd2d69891294025a7fba /after/bin/true +82938399bdc017d8b60de8e22894c6b8cb7e377d4c72372b9126feaa7c9d1759 /after/bin/yes +c66b7e80bcfc8169d661a3b8529f179637c4df3441355a19cc900ba5e7c62cfb /after/bin/ls +e72c5b0ebff9c8f72cd40355eb6baed175bbfc3addaa16ec6085e6a0e850a028 /after/bin/install +ad7403999d4d48d30bb49f7433998a31e852ecb34242ebac9f7d09d4e8dfa25c /after/bin/md5sum +b7b46fd6f6a1c4871f76a35565ae94706a1f60ee645d5754d8c326ae9ca97117 /after/bin/mv +1bc536cd595734a9f85524eaed18f5d1127bde3e74337bdf348108225552975a /after/bin/rm +d84999007c0f75f8ed1aef1273b251bac868f4f2f5f6486a9ee1a0c04d95b1be /after/bin/sha1sum diff --git a/sysa/diffutils-2.7/checksums b/sysa/diffutils-2.7/checksums new file mode 100644 index 00000000..57503b5a --- /dev/null +++ b/sysa/diffutils-2.7/checksums @@ -0,0 +1,2 @@ +4e02244d35aec2a439e67805574ff945aec2fbb5c20fc6d7aabe46e9c1ba09e9 /after/bin/cmp +b5c4cf04c70c93a26d61589671ea7e1dcb3bc3f1a565720a328d6d80e314538d /after/bin/diff diff --git a/sysa/flex-2.5.11/checksums b/sysa/flex-2.5.11/checksums new file mode 100644 index 00000000..44fc7de7 --- /dev/null +++ b/sysa/flex-2.5.11/checksums @@ -0,0 +1 @@ +122a20639d0733b34421d12e1ec45341317916c5b0a798410d4a25481fc39d2b /after/bin/flex diff --git a/sysa/flex-2.6.4/checksums b/sysa/flex-2.6.4/checksums new file mode 100644 index 00000000..c8937abb --- /dev/null +++ b/sysa/flex-2.6.4/checksums @@ -0,0 +1 @@ +cf92dbc55dd58f4212443e998635bab855422391ad40e97ec67fb266f07d849d /after/bin/flex diff --git a/sysa/gawk-3.0.4/checksums b/sysa/gawk-3.0.4/checksums new file mode 100644 index 00000000..d7334602 --- /dev/null +++ b/sysa/gawk-3.0.4/checksums @@ -0,0 +1 @@ +44a4f40de252c9c50ed45760a7a317934909c91eae904c59fa266d81da85fe56 /after/bin/gawk diff --git a/sysa/grep-2.4/checksums b/sysa/grep-2.4/checksums new file mode 100644 index 00000000..2ab9ecba --- /dev/null +++ b/sysa/grep-2.4/checksums @@ -0,0 +1 @@ +1acd145236315018b46591a3a9bb5f86f995ad318cca6d34ee8e25db81478d92 /after/bin/grep diff --git a/sysa/helpers.sh b/sysa/helpers.sh index 49aa7161..5a78ce26 100755 --- a/sysa/helpers.sh +++ b/sysa/helpers.sh @@ -1,6 +1,8 @@ #!/bin/bash -e # SPDX-FileCopyrightText: 2021 Andrius Štikonas +# SPDX-FileCopyrightText: 2021 fosslinux +# # SPDX-License-Identifier: GPL-3.0-or-later export PATH=/after/bin @@ -8,12 +10,14 @@ export PATH=/after/bin # Common build steps # Build function provides a few common stages with default implementation # that can be overridden on per package basis in the build script. -# build takes two arguments: +# build takes three arguments: # 1) name-version of the package # 2) optionally specify build script. Default is name-version.sh +# 3) optionally specify name of checksum file. Default is checksums build () { pkg=$1 script_name=${2:-${pkg}.sh} + checksum_f=${3:-checksums} cd "$pkg" || (echo "Cannot cd into ${pkg}!"; kill $$) echo "${pkg}: beginning build using script ${script_name}" @@ -52,6 +56,9 @@ build () { cd ../.. + echo "${pkg}: checksumming installed files." + sha256sum -c "${checksum_f}" + echo "${pkg}: build successful" cd .. diff --git a/sysa/m4-1.4.7/checksums b/sysa/m4-1.4.7/checksums new file mode 100644 index 00000000..bb6531ac --- /dev/null +++ b/sysa/m4-1.4.7/checksums @@ -0,0 +1 @@ +58b1e4d808fd498aad2a19eabe06527f588508d45f0d10925295c73259ef4062 /after/bin/m4 diff --git a/sysa/musl-1.1.24/checksums b/sysa/musl-1.1.24/checksums new file mode 100644 index 00000000..c1e26432 --- /dev/null +++ b/sysa/musl-1.1.24/checksums @@ -0,0 +1,14 @@ +457fff81b3188b82621f3ae49847ebc60128017fcbdba012245169af76cf122a /after/lib/musl/crt1.o +e3560c563125643467b29842db7984ccd1ecd3a6010358f9096674e199e36e05 /after/lib/musl/crti.o +b3a8cf971e9870bc3b2aa8fb8fc082b6a222cc0540a70f122a76ac6ced9151d0 /after/lib/musl/crtn.o +972db16d0c35619e1a12cfbaa1a500d97836b2850b6d93a08bf4e30e7cc377dc /after/lib/musl/libc.a +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 /after/lib/musl/libcrypt.a +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 /after/lib/musl/libdl.a +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 /after/lib/musl/libm.a +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 /after/lib/musl/libpthread.a +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 /after/lib/musl/libresolv.a +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 /after/lib/musl/librt.a +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 /after/lib/musl/libutil.a +e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 /after/lib/musl/libxnet.a +b60b59a94f10f039977cea2cea6f15b55b402b25df2e1b2a4e83fa84ccf2fd43 /after/lib/musl/rcrt1.o +a50500329680bed4dcc5ec3891fd50f65af9cae7de0b8e8fe925c37f1c6bb16b /after/lib/musl/Scrt1.o diff --git a/sysa/run.sh b/sysa/run.sh index 4c580234..44140eb5 100755 --- a/sysa/run.sh +++ b/sysa/run.sh @@ -1,6 +1,8 @@ #!/bin/bash # SPDX-FileCopyrightText: 2021 Andrius Štikonas +# SPDX-FileCopyrightText: 2021 fosslinux +# # SPDX-License-Identifier: GPL-3.0-or-later set -e @@ -25,9 +27,9 @@ build m4-1.4.7 build flex-2.6.4 # Part 25 -build bison-3.4.1 stage1.sh -build bison-3.4.1 stage2.sh -build bison-3.4.1 stage3.sh +build bison-3.4.1 stage1.sh checksums/stage1 +build bison-3.4.1 stage2.sh checksums/stage2 +build bison-3.4.1 stage3.sh checksums/stage3 # Part 26 build grep-2.4 @@ -36,7 +38,7 @@ build grep-2.4 build diffutils-2.7 # Part 28 -build coreutils-5.0 +build coreutils-5.0 coreutils-5.0.sh checksums/pass2 # Part 29 build gawk-3.0.4 diff --git a/sysa/tcc-0.9.27/checksums/tcc-musl b/sysa/tcc-0.9.27/checksums/tcc-musl new file mode 100644 index 00000000..6b66cba6 --- /dev/null +++ b/sysa/tcc-0.9.27/checksums/tcc-musl @@ -0,0 +1 @@ +9819c29a2c8259883b4a97d6b57f2fdac87b9807ba9594f7c063601a7fe84af9 /after/bin/tcc-musl From f1a2910979ad31fde0460e711b15660d742ca4b2 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Sun, 14 Feb 2021 18:47:21 +1100 Subject: [PATCH 09/10] Add guidelines regarding checksumming to DEVEL.md --- DEVEL.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/DEVEL.md b/DEVEL.md index 5b16fc33..bcb10f70 100644 --- a/DEVEL.md +++ b/DEVEL.md @@ -40,14 +40,26 @@ It then diverges based upon which driver is being used: There are default functions run which can be overridden by an optional script `package-version.sh` within the package-specific directory. -In this folder, there are other folders. `src` is required, others are optional. -Permissable folders: +In this folder, there are other folders/files. `src` and `checksums` are +required, others are optional. + +Permissable folders/files: - `files`: auxiliary files required for the build distributed by live-bootstrap. - `mk`: makefiles. - `patches`: patches for the source. - `src`: the upstream unmodified source code. This may be either a submodule or nonexistant. +- `checksums`: the checksums for the resulting binaries and libraries that + are compiled and installed. This may be either a folder or a file. It should + be a folder when there are multiple checksumming files required (normally + multiple seperate passes) but a file when there is only one checksumming + file. + - Up to and including `patch`, `fletcher16` is used for the checksumming. + - 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`). Furthermore, there is a special top-level dir `dev-utils`. In here are appropriate utilities that are often useful for development and not generally From 87b303f4551a994ed06cedab53aeeff82ccee807 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Sat, 20 Feb 2021 09:53:37 +1100 Subject: [PATCH 10/10] Add perl checksums And the gawk change, fix checksums for that as well For commit e2796e8. --- sysa/gawk-3.0.4/checksums | 2 +- sysa/perl-5.000/checksums | 1 + sysa/perl-5.003/checksums | 1 + sysa/perl5.004_05/checksums | 1 + sysa/run.sh | 6 +++--- 5 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 sysa/perl-5.000/checksums create mode 100644 sysa/perl-5.003/checksums create mode 100644 sysa/perl5.004_05/checksums diff --git a/sysa/gawk-3.0.4/checksums b/sysa/gawk-3.0.4/checksums index d7334602..eb948ea3 100644 --- a/sysa/gawk-3.0.4/checksums +++ b/sysa/gawk-3.0.4/checksums @@ -1 +1 @@ -44a4f40de252c9c50ed45760a7a317934909c91eae904c59fa266d81da85fe56 /after/bin/gawk +c0c1ec4e274d7dbcdbef3eac580d064f6a1ad5a0aef25ca1c329a72965f98865 /after/bin/gawk diff --git a/sysa/perl-5.000/checksums b/sysa/perl-5.000/checksums new file mode 100644 index 00000000..90333f56 --- /dev/null +++ b/sysa/perl-5.000/checksums @@ -0,0 +1 @@ +03a11370e2e37f8edfe9d73e6f52e7d8778425f75bd140a8ff01f61a1ecf5a22 /after/bin/perl diff --git a/sysa/perl-5.003/checksums b/sysa/perl-5.003/checksums new file mode 100644 index 00000000..666bf4b8 --- /dev/null +++ b/sysa/perl-5.003/checksums @@ -0,0 +1 @@ +fc9285ff53bc43b5b0e21880c72323f3bd14fb613151295bfa5afc13addc4765 /after/bin/perl diff --git a/sysa/perl5.004_05/checksums b/sysa/perl5.004_05/checksums new file mode 100644 index 00000000..b2433d03 --- /dev/null +++ b/sysa/perl5.004_05/checksums @@ -0,0 +1 @@ +6e019830d36d928e8eeee45d768f29b85d006a6c487852788c02639d15ee660a /after/bin/perl diff --git a/sysa/run.sh b/sysa/run.sh index 44140eb5..49615858 100755 --- a/sysa/run.sh +++ b/sysa/run.sh @@ -43,13 +43,13 @@ build coreutils-5.0 coreutils-5.0.sh checksums/pass2 # Part 29 build gawk-3.0.4 -# Part 29 +# Part 30 build perl-5.000 -# Part 30 +# Part 31 build perl-5.003 -# Part 31 +# Part 32 build perl5.004_05 echo "Bootstrapping completed."