Merge pull request #125 from stikonas/stage0_posix

Update to stage0-posix 1.3.
This commit is contained in:
fosslinux 2021-06-18 23:20:46 +10:00 committed by GitHub
commit 7ff2de94c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
52 changed files with 230 additions and 2045 deletions

8
.gitmodules vendored
View File

@ -4,11 +4,8 @@
# SPDX-License-Identifier: MIT
[submodule "sysa/mescc-tools-seed/src/mescc-tools-seed"]
path = sysa/mescc-tools-seed/src/mescc-tools-seed
path = sysa/stage0-posix/src
url = https://github.com/oriansj/mescc-tools-seed/
[submodule "bootstrap-seeds"]
path = sysa/bootstrap-seeds
url = https://github.com/oriansj/bootstrap-seeds
[submodule "sysa/mes/src/mes"]
path = sysa/mes/src/mes
url = https://gitlab.com/janneke/mes.git
@ -18,9 +15,6 @@
[submodule "sysa/tcc-0.9.26/src/tcc-0.9.26"]
path = sysa/tcc-0.9.26/src/tcc-0.9.26
url = https://gitlab.com/janneke/tinycc
[submodule "sysa/mescc-tools-patched"]
path = sysa/mescc-tools-seed/src/mescc-tools-patched
url = https://github.com/oriansj/mescc-tools
[submodule "sysa/tcc-0.9.27/src/tcc-0.9.27"]
path = sysa/tcc-0.9.27/src/tcc-0.9.27
url = git://repo.or.cz/tinycc.git

File diff suppressed because one or more lines are too long

View File

@ -73,10 +73,8 @@ ac610bda97abe0d9f6b7c963255a11dcb196c25e337c61f94e4778d632f1d8fd patch-2.7.6.ta
a5e66f6ebf701b0567f569f57cae82abf5ce57af70a2b45ae71323b61f49134e perl-5.6.2.tar.gz
3ec396d97debb6c1a112c1c6ff58b03a55866b75cd4fe06b74295ac9c5fc5ff2 perl-5f2dc80.tar.bz2
c365874794187f8444e5d22998cd5888ffa47f36def4b77517a808dec27c0600 sed-4.0.9.tar.gz
404a8d72427a559c074e581bf8f7d5a73283faf249cd3faf6dc1c6faf97d07c7 sha-2-61555d.tar.gz
c6c37e888b136ccefab903c51149f4b7bd659d69d4aea21245f61053a57aa60a tar-1.12.tar.gz
63bebd26879c5e1eea4352f0d03c991f966aeb3ddeb3c7445c902568d5411d28 tar-1.34.tar.xz
de23af78fca90ce32dff2dd45b3432b2334740bb9bb7b05bf60fdbfc396ceb9c tcc-0.9.27.tar.bz2
988403c1542d15ad044600b909997ba3079b10e03224c61188117f3676b02caa texinfo-6.7.tar.xz
1b700d375e253e88bdf79caa244284a899b80f59fd64fdd3aaa6408b7bd715ae untar.c
166c48d2842519bc4f96333bff9e265f8cdda44d38e40594ef3f9bbb52890490 xz-5.0.5.tar.bz2

View File

@ -1,8 +0,0 @@
# SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: MIT
fletcher16.M1
fletcher16-footer.M1
fletcher16.hex2
fletcher16-gen

View File

@ -1,42 +0,0 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
#
# 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

View File

@ -1,40 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <stdlib.h>
#include <stdio.h>
#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);
}

View File

@ -1,17 +0,0 @@
/*
* SPDX-FileCopyrightText: 2016 Jeremiah Orians
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include<stdio.h>
// void fputc(char s, FILE* f);
void file_print(char* s, FILE* f)
{
while(0 != s[0])
{
fputc(s[0], f);
s = s + 1;
}
}

View File

@ -1,21 +0,0 @@
/*
* SPDX-FileCopyrightText: 2016 Jeremiah Orians
* SPDX-FileCopyrightText: 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* 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;
}

View File

@ -1,24 +0,0 @@
/*
* 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;
}

View File

@ -1,159 +0,0 @@
/*
* SPDX-FileCopyrightText: 2016 Jeremiah Orians
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include<stdlib.h>
// 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);
}
}

View File

@ -1,20 +0,0 @@
/*
* SPDX-FileCopyrightText: 2016 Jeremiah Orians
* SPDX-FileCopyrightText: 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include<stdio.h>
#include<stdlib.h>
void file_print(char* s, FILE* f);
void require(int bool, char* error)
{
if(!bool)
{
file_print(error, stderr);
exit(EXIT_FAILURE);
}
}

View File

@ -1,59 +0,0 @@
/*
* SPDX-FileCopyrightText: 2016 Jeremiah Orians
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include<stdlib.h>
#include<stdio.h>
#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;
}

View File

@ -6,8 +6,8 @@
.. SPDX-License-Identifier: CC-BY-SA-4.0
mescc-tools-seed
================
stage0-posix
============
This is where all the magic begins. We start with our hex0 and kaem
seeds and bootstrap our way up to M2-Planet, a subset of C, and mes-m2,
@ -28,9 +28,10 @@ taken here:
- M2-Planet (v1) compiles blood-elf (final)
- M2-Planet (v1) compiles get_machine
- M2-Planet (v1) compiles M2-Planet (final)
- M2-Planet (final) compiles mescc-tools-extra (see next step)
This seems very intimidating, but becomes clearer when reading the
source: https://github.com/oriansj/mescc-tools-seed/blob/master/x86/
source: https://github.com/oriansj/stage0-posix/blob/master/x86/
(start at mescc-tools-seed-kaem.kaem).
From here, we can move on from the lowest level stuff.
@ -38,19 +39,18 @@ From here, we can move on from the lowest level stuff.
mescc-tools-extra
=================
mescc-tools and mes-m2 are the projects bootstrapped by
mescc-tools-seed. However, we have some currently unmerged additions to
mescc-tools that we require for this project, namely filesystem
mescc-tools-extra contains some additional programs, namely filesystem
utilities ``cp`` and ``chown``. This allows us to have one unified
directory for our binaries. Futhermore, we also build ``fletcher16``, a
preliminary checksumming tool, that we use to ensure reproducibility and
authenticity of generated binaries.
directory for our binaries. Futhermore, we also build ``sha256sum``, a
checksumming tool, that we use to ensure reproducibility and authenticity
of generated binaries. We also build initial ``untar`` and ``ungz``
utilities to deal with compressed archives.
``/after``
==========
We now move into the ``/after`` directory. As mescc-tools-seed has no
concept of ``chdir()`` (not added until very late in mescc-tools-seed),
We now move into the ``/after`` directory. As stage0-posix has no
concept of ``chdir()`` (not added until very late in stage0-posix),
we have to copy a lot of files into the root of the initramfs, making it
very messy. We get into the move ordered directory ``/after`` here,
copying over all of the required binaries from ``/``.
@ -86,14 +86,6 @@ recompiled 5(!) times to add new features that are required for other
features, namely ``long long`` and ``float``. Each time, the libc is
also recompiled.
untar
=====
``tar`` is the most common archive format used by software source
code, often compressed also. To avoid continuing using submodules we
switch to software distribution using tar archives. ``untar.c`` is
a single file implementation of tar format and is part of libarchive 3.4.
Note that now we begin to delve into the realm of old GNU software,
using older versions compilable by tinycc. Prior to this point, all tools
have been adapted significantly for the bootstrap; now, we will be using
@ -125,21 +117,6 @@ patch 2.5.9
significantly more complex edits, including just changes to lines.
Luckily, we are able to patch ``patch`` using ``sed`` only.
sha-2
=====
``sha-2`` is a standalone external ``sha256sum`` implementation,
originally as a library, but patched to have a command line interface.
It is mostly output-compatible with ``sha256sum`` from coreutils. We use
this in replacement of ``fletcher16``.
Redo checksums using ``sha256sum``
==================================
We have now just built ``sha256sum``, which has a significantly (many orders
of magnitude) lower collision rate than ``fletcher16``, so we recheck all of
the existing binaries using ``sha256sum``.
make 3.80
=========

71
sysa.py
View File

@ -146,36 +146,41 @@ class SysA:
self.after()
def stage0_posix(self):
"""Copy in all the stage0-posix (formerly known as mescc-tools-seed)"""
mescc_tools_seed_base_dir = os.path.join(self.sysa_dir, 'mescc-tools-seed',
'src', 'mescc-tools-seed')
mescc_tools_seed_dir = os.path.join(mescc_tools_seed_base_dir, self.arch)
copy_tree(mescc_tools_seed_dir, self.tmp_dir)
"""Copy in all of the stage0-posix"""
stage0_posix_base_dir = os.path.join(self.sysa_dir, 'stage0-posix', 'src')
stage0_posix_arch_dir = os.path.join(stage0_posix_base_dir, self.arch)
copy_tree(stage0_posix_arch_dir, self.tmp_dir)
m2_planet_dir = os.path.join(mescc_tools_seed_base_dir, 'M2-Planet')
m2_planet_dir = os.path.join(stage0_posix_base_dir, 'M2-Planet')
copytree(m2_planet_dir, self.tmp_dir)
# M2libc
m2libc_dir = os.path.join(stage0_posix_base_dir, 'M2libc')
copytree(m2libc_dir, self.tmp_dir)
# mescc-tools
mescc_tools_dir = os.path.join(stage0_posix_base_dir, 'mescc-tools')
copytree(mescc_tools_dir, self.tmp_dir)
# mescc-tools-extra
# Some additional tools such as cp, chmod, untar and ungz
mescc_tools_extra_dir = os.path.join(stage0_posix_base_dir, 'mescc-tools-extra')
copytree(mescc_tools_extra_dir, self.tmp_dir)
# At the moment not useful for bootstrap but easier to keep it
mes_m2_dir = os.path.join(mescc_tools_seed_base_dir, 'mes-m2')
mes_m2_dir = os.path.join(stage0_posix_base_dir, 'mes-m2')
copytree(mes_m2_dir, self.tmp_dir)
mescc_tools_patched_dir = os.path.join(self.sysa_dir, 'mescc-tools-seed',
'src', 'mescc-tools-patched')
shutil.copytree(mescc_tools_patched_dir,
os.path.join(self.tmp_dir, 'mescc-tools'), shutil.ignore_patterns('*.git*'))
# bootstrap seeds
bootstrap_seeds_dir = os.path.join(self.sysa_dir, 'bootstrap-seeds')
bootstrap_seeds_dir = os.path.join(self.sysa_dir, 'stage0-posix', 'src', 'bootstrap-seeds')
copytree(bootstrap_seeds_dir, self.tmp_dir)
kaem_optional_seed = os.path.join(bootstrap_seeds_dir, 'POSIX',
self.arch, 'kaem-optional-seed')
shutil.copy2(kaem_optional_seed, os.path.join(self.tmp_dir, 'init'))
# replace the init kaem with our own custom one
shutil.move(os.path.join(self.tmp_dir, 'kaem.run'),
os.path.join(self.tmp_dir, 'mescc-tools-seed.kaem.run'))
shutil.copy2(os.path.join(self.sysa_dir, 'base.kaem.run'),
os.path.join(self.tmp_dir, 'kaem.run'))
# stage0-posix hook to continue running live-bootstrap
shutil.copy2(os.path.join(self.sysa_dir, 'after.kaem'),
os.path.join(self.tmp_dir, 'after.kaem'))
# create directories needed
os.mkdir(os.path.join(self.tmp_dir, 'bin'))
@ -183,15 +188,14 @@ class SysA:
def after(self):
"""
Prepare sources in /after directory.
After mescc-tools-seed we get into our own directory because
the mescc-tools-seed one is hella messy.
After stage0-posix we get into our own directory because
the stage0-posix one is hella messy.
"""
self.create_after_dirs()
self.create_configuration_file()
self.mescc_tools_checksum()
self.stage0_posix_checksum()
self.deploy_extra_files()
self.mescc_tools_extra()
self.mes()
self.tcc_0_9_26()
self.get_packages()
@ -233,26 +237,19 @@ class SysA:
# Needed for patch to work, although can be fixed with TMPDIR
os.mkdir(os.path.join(self.tmp_dir, 'tmp'))
def mescc_tools_checksum(self):
"""Early fletcher16 checksum files"""
shutil.copy2(os.path.join(self.sysa_dir, 'mescc-tools-seed', 'checksums'),
os.path.join(self.after_dir, 'mescc-tools-seed-checksums'))
def stage0_posix_checksum(self):
"""Early checksum files"""
shutil.copy2(os.path.join(self.sysa_dir, 'stage0-posix', 'checksums'),
os.path.join(self.after_dir, 'stage0-posix-checksums'))
def deploy_extra_files(self):
"""Deploy misc files"""
extra_files = ['helpers.sh', 'run.sh', 'run2.sh', 'pre-sha.sha256sums']
extra_files = ['helpers.sh', 'run.sh', 'run2.sh']
for extra_file in extra_files:
shutil.copy2(os.path.join(self.sysa_dir, extra_file), self.after_dir)
shutil.copy2(os.path.join(self.sysa_dir, 'after.kaem'), self.tmp_dir)
shutil.copy2(os.path.join(self.sysa_dir, 'after.kaem.run'),
os.path.join(self.after_dir, 'kaem.run'))
shutil.copy2(os.path.join(self.git_dir, 'SHA256SUMS.sources'), self.after_dir)
def mescc_tools_extra(self):
"""Some additional tools such as cp and chmod (for M2-Planet)"""
copytree(os.path.join(self.sysa_dir, 'mescc-tools-extra'), self.after_dir)
def mes(self):
"""GNU Mes"""
copytree(os.path.join(self.sysa_dir, 'mes'), self.after_dir)
@ -267,8 +264,6 @@ class SysA:
# pylint: disable=line-too-long,too-many-statements
def get_packages(self):
"""Prepare remaining sources"""
# untar from libarchive 3.4
self.get_file("https://raw.githubusercontent.com/libarchive/libarchive/3.4/contrib/untar.c")
# gzip 1.2.4
self.get_file("https://mirrors.kernel.org/gnu/gzip/gzip-1.2.4.tar", mkbuild=True)
@ -282,10 +277,6 @@ class SysA:
# patch 2.5.9
self.get_file("https://ftp.gnu.org/pub/gnu/patch/patch-2.5.9.tar.gz", mkbuild=True)
# sha-2 61555d
self.get_file("https://github.com/amosnier/sha-2/archive/61555d.tar.gz", mkbuild=True,
output="sha-2-61555d.tar.gz")
# make 3.80
self.get_file("https://mirrors.kernel.org/gnu/make/make-3.80.tar.gz", mkbuild=True)

View File

@ -1,12 +1,138 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
# SPDX-FileCopyrightText: 2020-2021 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: GPL-3.0-or-later
cd after
set -ex
PATH=/after/bin:/bin
# Finally, reinvoke kaem in this directory
../bin/kaem --file kaem.run
# Set commonly used variables
prefix=/after
bindir=${prefix}/bin
libdir=${prefix}/lib
incdir=${prefix}/include
MES_PREFIX=${prefix}/mes/src/mes
GUILE_LOAD_PATH=${prefix}/mes/src/nyacc/module:${prefix}/mes/src/mes/mes/module:${prefix}/mes/src/mes/module
cd ${prefix}
# Remove remaining dependencies on / (root of /after)
cp ../bin/blood-elf bin/blood-elf
cp ../bin/catm bin/catm
cp ../bin/chmod bin/chmod
cp ../bin/get_machine bin/get_machine
cp ../bin/hex2 bin/hex2
cp ../bin/kaem bin/kaem
cp ../bin/M1 bin/M1
cp ../bin/M2-Planet bin/M2-Planet
cp ../bin/mes-m2 bin/mes-m2
cp ../bin/sha256sum bin/sha256sum
cp ../bin/ungz bin/ungz
cp ../bin/untar bin/untar
/bin/cp /bin/cp /after/bin/cp
/bin/chmod 755 bin/blood-elf
/bin/chmod 755 bin/catm
/bin/chmod 755 bin/chmod
/bin/chmod 755 bin/cp
/bin/chmod 755 bin/get_machine
/bin/chmod 755 bin/hex2
/bin/chmod 755 bin/kaem
/bin/chmod 755 bin/M1
/bin/chmod 755 bin/M2-Planet
/bin/chmod 755 bin/mes-m2
/bin/chmod 755 bin/sha256sum
/bin/chmod 755 bin/ungz
/bin/chmod 755 bin/untar
sha256sum -c stage0-posix-checksums
PATH=/after/bin
# mes
pkg="mes"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# tcc 0.9.26
pkg="tcc-0.9.26"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# gzip
pkg="gzip-1.2.4"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# tar
pkg="tar-1.12"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# sed
pkg="sed-4.0.9"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# patch
pkg="patch-2.5.9"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# sha-2
#pkg="sha-2-61555d"
#cd ${pkg}
#kaem --file ${pkg}.kaem
#cd ..
# Check all up to this part as sha256sum
#sha256sum -c pre-sha.sha256sums
# make
pkg="make-3.80"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# bzip2
pkg="bzip2-1.0.8"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# tcc 0.9.27
pkg="tcc-0.9.27"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# coreutils
pkg="coreutils-5.0"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# heirloom-devtools
pkg="heirloom-devtools-070527"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# bash
pkg="bash-2.05b"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
bash run.sh

View File

@ -1,128 +0,0 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
# SPDX-FileCopyrightText: 2021 Paul Dersey <pdersey@gmail.com>
# SPDX-FileCopyrightText: 2020-2021 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -ex
PATH=/after/bin:/bin
# Set commonly used variables
prefix=/after
bindir=${prefix}/bin
libdir=${prefix}/lib
incdir=${prefix}/include
MES_PREFIX=${prefix}/mes/src/mes
GUILE_LOAD_PATH=${prefix}/mes/src/nyacc/module:${prefix}/mes/src/mes/mes/module:${prefix}/mes/src/mes/module
# cp and chown (mescc-tools-extra)
pkg="mescc-tools-extra"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Remove remaining dependencies on / (root of /after)
cp ../bin/hex2 bin/hex2
cp ../bin/M1 bin/M1
cp ../bin/M2-Planet bin/M2-Planet
cp ../bin/blood-elf bin/blood-elf
cp ../bin/get_machine bin/get_machine
cp ../bin/mes-m2 bin/mes-m2
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
# mes
pkg="mes"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# tcc 0.9.26
pkg="tcc-0.9.26"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# untar
pkg="untar"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# gzip
pkg="gzip-1.2.4"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# tar
pkg="tar-1.12"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# sed
pkg="sed-4.0.9"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# patch
pkg="patch-2.5.9"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# sha-2
pkg="sha-2-61555d"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# Check all up to this part as sha256sum
sha256sum -c pre-sha.sha256sums
# make
pkg="make-3.80"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# bzip2
pkg="bzip2-1.0.8"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# tcc 0.9.27
pkg="tcc-0.9.27"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# coreutils
pkg="coreutils-5.0"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# heirloom-devtools
pkg="heirloom-devtools-070527"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
# bash
pkg="bash-2.05b"
cd ${pkg}
kaem --file ${pkg}.kaem
cd ..
bash run.sh

View File

@ -1,13 +0,0 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2020-2021 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: GPL-3.0-or-later
# Part 1: mescc-tools-seed
./bootstrap-seeds/POSIX/x86/kaem-optional-seed mescc-tools-seed.kaem.run
# Part 2-infinity: get the hell out of this mess of a directory
bin/kaem --verbose --strict --file after.kaem

@ -1 +0,0 @@
Subproject commit cfa108377c15382f58b20394150840e1099b6767

View File

@ -1,3 +1 @@
20706 /after/bin/gzip
20706 /after/bin/gunzip
20706 /after/bin/zcat
c8c923c0bea92a642e1b3e5dde162bb7c35ea14a75e0f8fbb811d7ea92edffe6 /after/bin/gzip

View File

@ -43,4 +43,4 @@ chmod 755 ${bindir}/zcat
cd ../..
# Checksums
fletcher16 checksums
sha256sum -c checksums

View File

@ -1,13 +1,13 @@
17767 /after/bin/mes
23643 /after/bin/mescc.scm
36724 /after/lib/x86-mes/crt1.s
42390 /after/lib/x86-mes/crt1.o
39638 /after/lib/x86-mes/x86.M1
526 /after/lib/x86-mes/libmescc.s
10591 /after/lib/x86-mes/libc+tcc.s
45027 /after/lib/x86-mes/libc.s
17259 /after/lib/x86-mes/libmescc.a
20204 /after/lib/x86-mes/libc+tcc.a
34645 /after/lib/x86-mes/libc.a
8245 /after/lib/linux/x86-mes/elf32-header.hex2
15474 /after/lib/linux/x86-mes/elf32-footer-single-main.hex2
d2e38ce7eab153cb2a019de92d12f1afc81f3ca0d4e068597fdab472250c7408 /after/bin/mes-m2
b91c81e543b878ead4cc975df75e3d211f7bd2dcdd4c90e42df99d44311ce71e /after/bin/mescc.scm
90811dafd33ad56b8e4b0adcc04263f9329b9047b7cc337abe8151a75017172c /after/lib/x86-mes/crt1.s
e065af5f73d40b20029e9ba23143660f99c6abacb82d1b4c8f2067a4e395d553 /after/lib/x86-mes/crt1.o
c9944a799d584abfa76f385c14ac0caf6f46d03b34bf2712493602b12826c6b2 /after/lib/x86-mes/x86.M1
d8646707db6aa2a76fdc5dbb3521376439e357f9f1de1d67f02a1afeefd342ac /after/lib/x86-mes/libmescc.s
aaf89a9d6818cdb8ece73454631b1a1ae83503e5eb7777d38cdaf141cba0e530 /after/lib/x86-mes/libc+tcc.s
b5ce4e1288a27864156d74268090c13aea6b5a261fa81c75bfbe844d0689d03d /after/lib/x86-mes/libc.s
52f697278ccdff5e457f27e10f465a91ab9858f0c6cee0683831cadb3109bbb7 /after/lib/x86-mes/libmescc.a
3156e619dbd85c471e2a8d053ba536eaaa8f91da657003777b8e87e7bab4266d /after/lib/x86-mes/libc+tcc.a
400615ca47339a3149680748b319f089ca5cb7ff2fdb42cce252f8c408445c1b /after/lib/x86-mes/libc.a
b16ab368bc4c7b8bd896d03cba565a60e97760dea4da9f5c8a1a3d2902a79df6 /after/lib/linux/x86-mes/elf32-header.hex2
f9873d9aab12e70f24d97f8319e17a1e698ca60779ae9a6ab3ede648cd60fc61 /after/lib/linux/x86-mes/elf32-footer-single-main.hex2

View File

@ -11,7 +11,7 @@ set -ex
MES_ARENA=20000000
MES_MAX_ARENA=20000000
MES_STACK=6000000
MES=${bindir}/mes
MES=${bindir}/mes-m2
libdir=${prefix}/mes/src/mes/lib
cp files/mescc.scm ${bindir}/
@ -23,7 +23,6 @@ cd src/mes
# Bootstrap Mes using M2-Planet
kaem --verbose --file kaem.run
cp bin/mes-m2 ${MES}
chmod 755 ${MES}
# Build Mes C library using mes-m2 bootstrapped Mes
@ -265,11 +264,7 @@ cp include/sys/ucontext.h ${incdir}/sys/ucontext.h
cp include/sys/user.h ${incdir}/sys/user.h
cp include/sys/wait.h ${incdir}/sys/wait.h
# Test mes
libdir=${prefix}/lib
${MES} -c "(display 'Hello,Mes!) (newline)"
cd ../..
# Checksums
fletcher16 checksums
sha256sum -c checksums

View File

@ -1,3 +0,0 @@
27475 /after/bin/chmod
51523 /after/bin/cp
37928 /after/bin/fletcher16

View File

@ -1,130 +0,0 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2020-2021 fosslinux <fosslinux@aussies.space>
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -ex
cd src
# cp command
M2-Planet \
-f /M2-Planet/test/common_x86/functions/file.c \
-f /M2-Planet/test/common_x86/functions/exit.c \
-f /M2-Planet/test/common_x86/functions/malloc.c \
-f /M2-Planet/test/common_x86/functions/getcwd.c \
-f /M2-Planet/test/common_x86/functions/chdir.c \
-f functions/string.c \
-f functions/file_print.c \
-f functions/match.c \
-f functions/require.c \
-f /M2-Planet/functions/calloc.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f cp.c \
--architecture x86 \
--debug \
-o cp.M1
blood-elf -f cp.M1 -o cp-footer.M1
M1 \
-f /M2-Planet/test/common_x86/x86_defs.M1 \
-f /M2-Planet/test/common_x86/libc-core.M1 \
-f cp.M1 \
-f cp-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}/cp \
--exec_enable
# chmod command
M2-Planet \
-f /M2-Planet/test/common_x86/functions/file.c \
-f /M2-Planet/test/common_x86/functions/exit.c \
-f /M2-Planet/test/common_x86/functions/malloc.c \
-f /M2-Planet/test/common_x86/functions/getcwd.c \
-f /M2-Planet/test/common_x86/functions/chdir.c \
-f functions/string.c \
-f functions/file_print.c \
-f functions/match.c \
-f functions/require.c \
-f functions/in_set.c \
-f functions/numerate_number.c \
-f /M2-Planet/functions/calloc.c \
-f /M2-Planet/test/common_x86/functions/stat.c \
-f chmod.c \
--architecture x86 \
--debug \
-o chmod.M1
blood-elf -f chmod.M1 -o chmod-footer.M1
M1 \
-f /M2-Planet/test/common_x86/x86_defs.M1 \
-f /M2-Planet/test/common_x86/libc-core.M1 \
-f chmod.M1 \
-f chmod-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}/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 ..
# Checksums
fletcher16 checksums

View File

@ -1,161 +0,0 @@
/*
* SPDX-FileCopyrightText: 2020 fosslinux <fosslinux@aussies.space>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
/* Define all of the constants */
// CONSTANT FALSE 0
#define FALSE 0
// CONSTANT TRUE 1
#define TRUE 1
// CONSTANT MAX_STRING 4096
#define MAX_STRING 4096
// CONSTANT MAX_ARRAY 256
#define MAX_ARRAY 256
/* There are all of the constants we need for the bitmask */
/* constant name */ /* decimal */ /* octal */
// CONSTANT S_ISUID 2048 /* 04000 */
// CONSTANT S_ISGID 1024 /* 02000 */
// CONSTANT S_ISVTX 512 /* 01000 */
// CONSTANT S_IRUSR 256 /* 00400 */
// CONSTANT S_IWUSR 128 /* 00200 */
// CONSTANT S_IXUSR 64 /* 00100 */
// CONSTANT S_IRGRP 32 /* 00040 */
// CONSTANT S_IWGRP 16 /* 00020 */
// CONSTANT S_IXGRP 8 /* 00010 */
// CONSTANT S_IROTH 4 /* 00004 */
// CONSTANT S_IWOTH 2 /* 00002 */
// CONSTANT S_IXOTH 1 /* 00001 */
/* Prototypes for external funcs */
void file_print(char* s, FILE* f);
char* prepend_char(char a, char* s);
int numerate_string(char *a);
void require(int bool, char* error);
char* copy_string(char* target, char* source);
int match(char* a, char* b);
/* Globals */
int verbose;
/* UTILITY FUNCTIONS */
/* Function to find the length of a char**; an array of strings */
int array_length(char** array)
{
int length = 0;
while(array[length] != NULL)
{
length = length + 1;
}
return length;
}
/* PROCESSING FUNCTIONS */
int main(int argc, char** argv)
{
/* Initialize variables */
char** files = calloc(MAX_ARRAY, sizeof(char*));
require(files != NULL, "Memory initialization of files failed\n");
int files_index = 0;
char* mode = NULL;
/* Set defaults */
verbose = FALSE;
int i = 1;
/* Loop arguments */
while(i <= argc)
{
if(NULL == argv[i])
{ /* Ignore and continue */
i = i + 1;
}
else if(match(argv[i], "-h") || match(argv[i], "--help"))
{
file_print("Usage: ", stdout);
file_print(argv[0], stdout);
file_print(" [-h | --help] [-V | --version] [-v | --verbose]\n", stdout);
exit(EXIT_SUCCESS);
}
else if(match(argv[i], "-V") || match(argv[i], "--version"))
{ /* Output version */
file_print("chmod version 1.1.0\n", stdout);
exit(EXIT_SUCCESS);
}
else if(match(argv[i], "-v") || match(argv[i], "--verbose"))
{
verbose = TRUE;
i = i + 1;
}
else if(argv[i][0] != '-')
{ /* It must be the file or the mode */
if(mode == NULL)
{ /* Mode always comes first */
mode = calloc(MAX_STRING, sizeof(char));
require(mode != NULL, "Memory initialization of mode failed\n");
copy_string(mode, argv[i]);
}
else
{ /* It's a file, as the mode is already done */
files[files_index] = calloc(MAX_STRING, sizeof(char));
require(files[files_index] != NULL, "Memory initialization of files[files_index] failed\n");
copy_string(files[files_index], argv[i]);
files_index = files_index + 1;
}
i = i + 1;
}
else
{ /* Unknown argument */
file_print("UNKNOWN_ARGUMENT\n", stderr);
exit(EXIT_FAILURE);
}
}
/* Ensure the two values have values */
require(mode != NULL, "Provide a mode\n");
require(files[0] != NULL, "Provide a file\n");
/* Convert the mode str into octal */
if(mode[0] != '0')
{ /* We need to indicate it is octal */
mode = prepend_char('0', mode);
}
int omode = numerate_string(mode);
/* Loop over files to be operated on */
FILE* test;
for(i = 0; i < array_length(files); i = i + 1)
{
/* Make sure the file can be opened */
test = fopen(files[i], "r");
require(test != NULL, "A file cannot be read\n");
fclose(test);
/* Verbose message */
if(verbose)
{
file_print("mode of '", stdout);
file_print(files[i], stdout);
file_print("' changed to ", stdout);
file_print(mode, stdout);
file_print("\n", stdout);
}
/* Perform the chmod */
chmod(files[i], omode);
free(files[i]);
}
free(mode);
free(files);
}

View File

@ -1,323 +0,0 @@
/*
* SPDX-FileCopyrightText: 2020 fosslinux <fosslinux@aussies.space>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
/* Define all of the constants */
// CONSTANT FALSE 0
#define FALSE 0
// CONSTANT TRUE 1
#define TRUE 1
// CONSTANT MAX_STRING 4096
#define MAX_STRING 4096
// CONSTANT MAX_ARRAY 256
#define MAX_ARRAY 256
/* Prototypes for external funcs */
int match(char* a, char* b);
void file_print(char* s, FILE* f);
char* copy_string(char* target, char* source);
char* prepend_string(char* add, char* base);
void require(int bool, char* error);
char* postpend_char(char* s, char a);
int string_length(char* a);
void require(int bool, char* error);
/* Globals */
int verbose;
/* UTILITY FUNCTIONS */
/* Function to find a character's position in a string (last match) */
int find_last_char_pos(char* string, char a)
{
int i = string_length(string) - 1;
if(i < 0) return i;
while(i >= 0)
{
/*
* This conditional should be in the while conditional but we are
* running into the M2-Planet short-circuit bug.
*/
if(a == string[i]) break;
i = i - 1;
}
return i;
}
/* Function to find the length of a char**; an array of strings */
int array_length(char** array)
{
int length = 0;
while(array[length] != NULL)
{
length = length + 1;
}
return length;
}
/* PROCESSING FUNCTIONS */
char* directory_dest(char* dest, char* source, int require_directory)
{
/*
* First, check if it is a directory to copy to.
* We have two ways of knowing this:
* - If the destination ends in a slash, the user has explicitly said
* it is a directory.
* - Normally we would use stat() but we don't want to force support for
* that syscall onto the kernel, so we just attempt to chdir() into it
* and if it works then it must be a directory. A bit hacky, bit it
* works.
*/
int isdirectory = FALSE;
if(dest[string_length(dest) - 1] == '/')
{
isdirectory = TRUE;
}
if(!isdirectory)
{ /* Use the other testing method */
/*
* Get the current path so that we can chdir back to it if it does
* chdir successfully.
*/
char* current_path = calloc(MAX_STRING, sizeof(char));
require(current_path != NULL, "Memory initialization of current_path in directory_dest failed\n");
getcwd(current_path, MAX_STRING);
require(!match("", current_path), "getcwd() failed\n");
/*
* chdir expects an absolute path.
* If the first character is / then it is already absolute, otherwise
* it is relative and needs to be changed (by appending current_path
* to the dest path).
*/
char* chdir_dest = calloc(MAX_STRING, sizeof(char));
require(chdir_dest != NULL, "Memory initialization of chdir_dest in directory_dest failed\n");
if(dest[0] != '/')
{ /* The path is relative, append current_path */
copy_string(chdir_dest, prepend_string(prepend_string(current_path, "/"), dest));
}
else
{ /* The path is absolute */
copy_string(chdir_dest, dest);
}
if(0 <= chdir(chdir_dest))
{ /* chdir returned successfully */
/*
* But because of M2-Planet, that doesn't mean anything actually
* happened, check that before we go any further.
*/
char* new_path = calloc(MAX_STRING, sizeof(char));
require(new_path != NULL, "Memory initialization of new_path in directory_dest failed\n");
getcwd(new_path, MAX_STRING);
if(!match(current_path, new_path))
{
isdirectory = TRUE;
chdir(current_path);
}
}
free(chdir_dest);
free(current_path);
}
/*
* If it isn't a directory, and we require one, error out.
* Otherwise, just return what we were given, we're done here.
*/
if(require_directory) require(isdirectory, "Provide a directory destination for multiple source files\n");
if(!isdirectory) return dest;
/* If it is, we need to make dest a full path */
/* 1. Get the basename of source */
char* basename = calloc(MAX_STRING, sizeof(char));
require(basename != NULL, "Memory initialization of basename in directory_dest failed\n");
int last_slash_pos = find_last_char_pos(source, '/');
if(last_slash_pos >= 0)
{ /* Yes, there is a slash in it, copy over everything after that pos */
int spos; /* source pos */
int bpos = 0; /* basename pos */
int source_length = string_length(source);
/* Do the actual copy */
for(spos = last_slash_pos + 1; spos < string_length(source); spos = spos + 1)
{
basename[bpos] = source[spos];
bpos = bpos + 1;
}
}
else
{ /* No, there is no slash in it, hence the basename is just the source */
copy_string(basename, source);
}
/* 2. Ensure our dest (which is a directory) has a trailing slash */
if(dest[string_length(dest) - 1] != '/')
{
dest = postpend_char(dest, '/');
}
/* 3. Add the basename to the end of the directory */
dest = prepend_string(dest, basename);
free(basename);
/* Now we have a returnable path! */
return dest;
}
int copy_file(char* source, char* dest)
{
if(verbose)
{ /* Output message */
/* Of the form 'source' -> 'dest' */
file_print("'", stdout);
file_print(source, stdout);
file_print("' -> '", stdout);
file_print(dest, stdout);
file_print("'\n", stdout);
}
/* Open source and dest as FILE*s */
FILE* fsource = fopen(source, "r");
require(fsource != NULL, prepend_string(
prepend_string("Error opening source file ", source), "\n"));
FILE* fdest = fopen(dest, "w");
require(fdest >= 0, prepend_string(
prepend_string("Error opening destination file", dest), "\n"));
/*
* The following loop reads a character from the source and writes it to the
* dest file. This is all M2-Planet supports.
*/
char c = fgetc(fsource);
while(c != EOF)
{
fputc(c, fdest);
c = fgetc(fsource);
}
/* Cleanup */
fclose(fsource);
fclose(fdest);
}
int main(int argc, char** argv)
{
/* Initialize variables */
char** sources = calloc(MAX_ARRAY, sizeof(char*));
require(sources != NULL, "Memory initialization of sources failed\n");
int sources_index = 0;
char* dest = NULL;
/* Set defaults */
verbose = FALSE;
int i = 1;
int j;
int args_found;
/* Loop arguments */
while(i <= argc)
{
if(NULL == argv[i])
{ /* Ignore and continue */
i = i + 1;
}
else if(match(argv[i], "-h") || match(argv[i], "--help"))
{
file_print("Usage: ", stdout);
file_print(argv[0], stdout);
file_print(" [-h | --help] [-V | --version] [-v | --verbose] source1 source2 sourcen destination\n", stdout);
exit(EXIT_SUCCESS);
}
else if(match(argv[i], "-V") || match(argv[i], "--version"))
{ /* Output version */
file_print("cp version 1.1.0\n", stdout);
exit(EXIT_SUCCESS);
}
else if(match(argv[i], "-v") || match(argv[i], "--verbose"))
{
verbose = TRUE;
i = i + 1;
}
else if(argv[i][0] != '-')
{ /* It is not an option */
/*
* We can tell if this is the source file or the destination file
* through looking *ahead*. If it is the last of this type of argument then
* it must be the destination. (1 destination, many sources).
*/
j = i + 1;
args_found = 0;
while(j < array_length(argv))
{
if(argv[j][0] != '-')
{ /* It's one of these type of arguments */
args_found = args_found + 1;
}
j = j + 1;
}
if(args_found == 0)
{ /* We are setting the destination (there are no more left after this) */
dest = calloc(MAX_STRING, sizeof(char));
require(dest != NULL, "Memory initialization of dest failed\n");
copy_string(dest, argv[i]);
}
else
{ /* We are setting a source */
require(sources_index < MAX_ARRAY, "Too many files\n");
sources[sources_index] = calloc(MAX_STRING, sizeof(char));
require(sources[sources_index] != NULL, "Memory initialization of sources[source_index] failed\n");
copy_string(sources[sources_index], argv[i]);
sources_index = sources_index + 1;
}
i = i + 1;
}
else
{ /* Unknown argument */
file_print("UNKNOWN_ARGUMENT\n", stderr);
exit(EXIT_FAILURE);
}
}
/* Sanitize values */
/* Ensure the two values have values */
/* Another workaround for short-circuit bug */
int error = FALSE;
if(sources[0] == NULL) error = TRUE;
if(error == FALSE) if(match(sources[0], "")) error = TRUE;
require(!error, "Provide a source file\n");
error = FALSE;
if(dest == NULL) error = TRUE;
if(error == FALSE) if(match(dest, "")) error = TRUE;
require(!error, "Provide a destination file\n");
/* Loop through all of the sources, copying each one */
char* this_dest;
for(i = 0; i < array_length(sources); i = i + 1)
{
/* Convert the dest variable to a full path if it's a directory copying to */
/*
* Also, if there is more than one source, we have to be copying to
* a directory destination...
*/
if(array_length(sources) == 1)
{
dest = directory_dest(dest, sources[i], FALSE);
copy_file(sources[i], dest);
}
else
{
this_dest = calloc(MAX_STRING, sizeof(char));
require(this_dest != NULL, "Memory initialization of this_dest failed\n");
this_dest = directory_dest(dest, sources[i], TRUE);
copy_file(sources[i], this_dest);
}
/* Perform the actual copy */
free(sources[i]);
}
free(sources);
free(dest);
}

View File

@ -1,103 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <stdlib.h>
#include <stdio.h>
#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;
}

View File

@ -1,17 +0,0 @@
/*
* SPDX-FileCopyrightText: 2016 Jeremiah Orians
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include<stdio.h>
// void fputc(char s, FILE* f);
void file_print(char* s, FILE* f)
{
while(0 != s[0])
{
fputc(s[0], f);
s = s + 1;
}
}

View File

@ -1,21 +0,0 @@
/*
* SPDX-FileCopyrightText: 2016 Jeremiah Orians
* SPDX-FileCopyrightText: 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* 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;
}

View File

@ -1,24 +0,0 @@
/*
* 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;
}

View File

@ -1,159 +0,0 @@
/*
* SPDX-FileCopyrightText: 2016 Jeremiah Orians
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include<stdlib.h>
// 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);
}
}

View File

@ -1,20 +0,0 @@
/*
* SPDX-FileCopyrightText: 2016 Jeremiah Orians
* SPDX-FileCopyrightText: 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include<stdio.h>
#include<stdlib.h>
void file_print(char* s, FILE* f);
void require(int bool, char* error)
{
if(!bool)
{
file_print(error, stderr);
exit(EXIT_FAILURE);
}
}

View File

@ -1,59 +0,0 @@
/*
* SPDX-FileCopyrightText: 2016 Jeremiah Orians
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include<stdlib.h>
#include<stdio.h>
#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;
}

View File

@ -1,8 +0,0 @@
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

@ -1 +0,0 @@
Subproject commit 3f5b7588a20bc2225f25a31eed53a8152563955f

@ -1 +0,0 @@
Subproject commit 0e6d8d6d3f261b550af1768b767f66b30fd07854

View File

@ -1 +1 @@
62187 /after/bin/patch
032c0a3bb32b542f7d3eb0305bd89898ab2fc4b9fd0502085337e3422db1f393 /after/bin/patch

View File

@ -51,4 +51,4 @@ patch --version
cd ../..
# Checksums
fletcher16 checksums
sha256sum -c checksums

View File

@ -1,38 +0,0 @@
e7b1b2c7d999cd31becd7368f735b1672f24e1e469d73f0641fca5e0b6a314e8 /after/bin/boot0-tcc
b963670c966c8b545f278c58558ee512d1879556f33be3dd60fdc6c6fe0c42ee /after/bin/boot1-tcc
6f2cb537b862b143e031d43a9b554c14bf09dfa7d0232265e5ee5b7792adbdf3 /after/bin/boot2-tcc
9d3bf2cd0eeac4607032299e5ec999ff3dc8e8dd075e1dbd84292949d15c163c /after/bin/boot3-tcc
d4708bc79bee1f4d23789866380a98b5ed0e165ac8ca917b8b928c2d323ddc10 /after/bin/boot4-tcc
819ebd10859c34f1f34b5ab341fdce4541ccade97ec96b7eac5876875f91e8a7 /after/bin/boot5-tcc
773eae17b7f347526f8033afc9d1f06af116dfbcd0a26cbde7e29ab47e77850d /after/bin/chmod
764881d80efac5509aa85fd4683a20beffa831442f57815d43ee030fb8f9f486 /after/bin/cp
e1481ecf337fb657f3949af0b45bb620c1886cd1a1b003fe27338832c250f41d /after/bin/fletcher16
c8c923c0bea92a642e1b3e5dde162bb7c35ea14a75e0f8fbb811d7ea92edffe6 /after/bin/gunzip
c8c923c0bea92a642e1b3e5dde162bb7c35ea14a75e0f8fbb811d7ea92edffe6 /after/bin/gzip
e835fdb1cd8c7852e8c879f1efdea6f7392bdd04938f5a01a6199ab2730fac4b /after/bin/mes
b91c81e543b878ead4cc975df75e3d211f7bd2dcdd4c90e42df99d44311ce71e /after/bin/mescc.scm
e94a2468c045582cfd13df51acd0932afdc834fa60139f7bfb7a2d65afa39a65 /after/bin/mes-tcc
032c0a3bb32b542f7d3eb0305bd89898ab2fc4b9fd0502085337e3422db1f393 /after/bin/patch
61d9850bf8348a5571f59231e392a06021c9be78f32797943d98bc493ea5b03f /after/bin/sed
c09ac8658c8853f5316c8abbf5b8379dba03a42dfc3eb9c07982a4da85480b6f /after/bin/sha256sum
74e0a13cb6e92d70c43f71ec704afbc44b7a38c703fe40700f7af7c640a22158 /after/bin/untar
ade67862293d3193aaa569931d520dab26b26fcfebd538346a2a83195a59d7e7 /after/bin/tar
819ebd10859c34f1f34b5ab341fdce4541ccade97ec96b7eac5876875f91e8a7 /after/bin/tcc
819ebd10859c34f1f34b5ab341fdce4541ccade97ec96b7eac5876875f91e8a7 /after/bin/tcc-0.9.26
c8c923c0bea92a642e1b3e5dde162bb7c35ea14a75e0f8fbb811d7ea92edffe6 /after/bin/zcat
44b5f15e1f015685fe4c3d66eda5ba52aac77b94f2edd98b764cec05ca350d49 /after/lib/crt1.o
90811dafd33ad56b8e4b0adcc04263f9329b9047b7cc337abe8151a75017172c /after/lib/x86-mes/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/x86-mes/libc.s
3156e619dbd85c471e2a8d053ba536eaaa8f91da657003777b8e87e7bab4266d /after/lib/x86-mes/libc+tcc.a
aaf89a9d6818cdb8ece73454631b1a1ae83503e5eb7777d38cdaf141cba0e530 /after/lib/x86-mes/libc+tcc.s
12c07ae103e7e3b390150a79e5c600d88de14e9bb73a066f6342582729ef5a3f /after/lib/libgetopt.a
52f697278ccdff5e457f27e10f465a91ab9858f0c6cee0683831cadb3109bbb7 /after/lib/x86-mes/libmescc.a
d8646707db6aa2a76fdc5dbb3521376439e357f9f1de1d67f02a1afeefd342ac /after/lib/x86-mes/libmescc.s
f9873d9aab12e70f24d97f8319e17a1e698ca60779ae9a6ab3ede648cd60fc61 /after/lib/linux/x86-mes/elf32-footer-single-main.hex2
b16ab368bc4c7b8bd896d03cba565a60e97760dea4da9f5c8a1a3d2902a79df6 /after/lib/linux/x86-mes/elf32-header.hex2
4f7e4089ab34cedf828586d233c29c445c61f4248fc790a057c1b7e12a07ef01 /after/lib/tcc/libtcc1.a
c9944a799d584abfa76f385c14ac0caf6f46d03b34bf2712493602b12826c6b2 /after/lib/x86-mes/x86.M1

View File

@ -1 +1 @@
32529 /after/bin/sed
61d9850bf8348a5571f59231e392a06021c9be78f32797943d98bc493ea5b03f /after/bin/sed

View File

@ -52,4 +52,4 @@ sed --version
cd ../..
# Checksums
fletcher16 checksums/pass1
sha256sum -c checksums/pass1

View File

@ -1 +0,0 @@
11460 /after/bin/sha256sum

View File

@ -1,151 +0,0 @@
SPDX-FileCopyrightText: 2021 Bastian Bittorf <bb@npl.de>
SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
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 <stdint.h>
#include <string.h>
-
-#include "sha-256.h"
+#include <stdio.h>
#define CHUNK_SIZE 64
#define TOTAL_LEN_LEN 8
+#define MAX_FILE_SIZE 2*1024*1024
+
+void show_usage(void)
+{
+ printf("Usage: sha256sum <file>\n");
+ printf(" sha256sum <file> -c <known_SHA256_hash>\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;
+}

View File

@ -1,30 +0,0 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2021 fosslinux <fosslinux@aussies.space>
#
# 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

View File

@ -0,0 +1,12 @@
75ce25fae5c4d18bb89240e5f83f96fe70a9a6b4870824bf74c3d9977916af42 /after/bin/blood-elf
d5b1b6da29eec7d0f9592027e752fc65454068d1cbc1325d27d5b9275c4be3d7 /after/bin/catm
2dd399c02f36b1fe345128d1723b01bc1eb2820336fd5b54a37fae54196a1de3 /after/bin/chmod
574c6bbed1fa4cf41f1ef2115a147549a869e73e7cdce6716168033038e38490 /after/bin/get_machine
c37e1e4dc58fbafca1a178e63db3cc0b5aaf4fccd99c3011a4b8546129a468fa /after/bin/hex2
a214c6236a810c8cb0d6291e156bb9a35c955cc18d74ece6314a89246bbf1cd7 /after/bin/kaem
0961b730018553a779c20eb0693d53c9271b1e1f967e9455df678344006b531e /after/bin/M1
f44564db06bb910f5c8e3c99a3e28f86eee5f30863ee7ec06a945b5cdc72e590 /after/bin/M2-Planet
d2e38ce7eab153cb2a019de92d12f1afc81f3ca0d4e068597fdab472250c7408 /after/bin/mes-m2
3892d2e1c9e0a248d70afd942d4a580fc228799385d32712eacc53a216992593 /after/bin/sha256sum
98c51ed8b5d3453c4a7eceab6b44815abb7bd306b4fd3b2375861e924c2cf83f /after/bin/ungz
9a918b28c5929fc4156a0203887dc4bac40498b38491d1f3e0c58d6755d589f5 /after/bin/untar

1
sysa/stage0-posix/src Submodule

@ -0,0 +1 @@
Subproject commit 880e60906b01bec7024d04250f41d9b6da4fa114

View File

@ -1 +1 @@
56696 /after/bin/tar
ade67862293d3193aaa569931d520dab26b26fcfebd538346a2a83195a59d7e7 /after/bin/tar

View File

@ -66,4 +66,4 @@ tcc -static -o ${bindir}/tar -L lib lib/libtar.a arith.o buffer.o compare.o crea
cd ../..
# Checksums
fletcher16 checksums
sha256sum -c checksums

View File

@ -1,16 +1,13 @@
27585 /after/bin/boot0-tcc
9907 /after/bin/boot1-tcc
36471 /after/bin/boot2-tcc
53635 /after/bin/boot3-tcc
39309 /after/bin/boot4-tcc
24849 /after/bin/boot5-tcc
14206 /after/bin/mes-tcc
24849 /after/bin/tcc
24849 /after/bin/tcc-0.9.26
47832 /after/lib/libc.a
47832 /after/lib/libc+gnu.a
54049 /after/lib/libgetopt.a
23061 /after/lib/crt1.o
16980 /after/lib/crti.o
47705 /after/lib/crtn.o
29550 /after/lib/tcc/libtcc1.a
e7b1b2c7d999cd31becd7368f735b1672f24e1e469d73f0641fca5e0b6a314e8 /after/bin/boot0-tcc
b963670c966c8b545f278c58558ee512d1879556f33be3dd60fdc6c6fe0c42ee /after/bin/boot1-tcc
6f2cb537b862b143e031d43a9b554c14bf09dfa7d0232265e5ee5b7792adbdf3 /after/bin/boot2-tcc
9d3bf2cd0eeac4607032299e5ec999ff3dc8e8dd075e1dbd84292949d15c163c /after/bin/boot3-tcc
d4708bc79bee1f4d23789866380a98b5ed0e165ac8ca917b8b928c2d323ddc10 /after/bin/boot4-tcc
e94a2468c045582cfd13df51acd0932afdc834fa60139f7bfb7a2d65afa39a65 /after/bin/mes-tcc
819ebd10859c34f1f34b5ab341fdce4541ccade97ec96b7eac5876875f91e8a7 /after/bin/tcc
34f62227f8cc61d365d92a182f8f3cc91cc6c50a1bbb8f4774a4383bceaefa5f /after/lib/libc.a
12c07ae103e7e3b390150a79e5c600d88de14e9bb73a066f6342582729ef5a3f /after/lib/libgetopt.a
44b5f15e1f015685fe4c3d66eda5ba52aac77b94f2edd98b764cec05ca350d49 /after/lib/crt1.o
09d4f9821a2566f7e56381a19259c41bd97f3c5ed83f490705acbfd1139a7736 /after/lib/crti.o
461ca1494737fab86fe1c1d3addeaf9d0ece413e353abcdea8674db3f700cda3 /after/lib/crtn.o
4f7e4089ab34cedf828586d233c29c445c61f4248fc790a057c1b7e12a07ef01 /after/lib/tcc/libtcc1.a

View File

@ -12,7 +12,7 @@ MES_ARENA=30000000
MES_MAX_ARENA=30000000
MES_LIB=${MES_PREFIX}/lib
MES_SOURCE=${MES_PREFIX}
MES=${bindir}/mes
MES=${bindir}/mes-m2
cd src/tcc-0.9.26
@ -73,8 +73,7 @@ mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crti.
mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-1.o unified-libc-1.c
mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-2.o unified-libc-2.c
mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-3.o unified-libc-3.c
mes-tcc -ar cr ${libdir}/libc+gnu.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
cp ${libdir}/libc+gnu.a ${libdir}/libc.a
mes-tcc -ar cr ${libdir}/libc.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
# libtcc1.a
mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 lib/libtcc1.c
@ -129,8 +128,7 @@ boot0-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o
boot0-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-1.o unified-libc-1.c
boot0-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-2.o unified-libc-2.c
boot0-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-3.o unified-libc-3.c
boot0-tcc -ar cr ${libdir}/libc+gnu.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
cp ${libdir}/libc+gnu.a ${libdir}/libc.a
boot0-tcc -ar cr ${libdir}/libc.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
cd ../tcc-0.9.26
# Test boot0
@ -176,8 +174,7 @@ boot1-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o
boot1-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-1.o unified-libc-1.c
boot1-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-2.o unified-libc-2.c
boot1-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-3.o unified-libc-3.c
boot1-tcc -ar cr ${libdir}/libc+gnu.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
cp ${libdir}/libc+gnu.a ${libdir}/libc.a
boot1-tcc -ar cr ${libdir}/libc.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
cd ../tcc-0.9.26
# Test boot1
@ -224,8 +221,7 @@ boot2-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o
boot2-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-1.o unified-libc-1.c
boot2-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-2.o unified-libc-2.c
boot2-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-3.o unified-libc-3.c
boot2-tcc -ar cr ${libdir}/libc+gnu.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
cp ${libdir}/libc+gnu.a ${libdir}/libc.a
boot2-tcc -ar cr ${libdir}/libc.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
cd ../tcc-0.9.26
# Test boot2
@ -272,8 +268,7 @@ boot3-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o
boot3-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-1.o unified-libc-1.c
boot3-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-2.o unified-libc-2.c
boot3-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-3.o unified-libc-3.c
boot3-tcc -ar cr ${libdir}/libc+gnu.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
cp ${libdir}/libc+gnu.a ${libdir}/libc.a
boot3-tcc -ar cr ${libdir}/libc.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
cd ../tcc-0.9.26
# Test boot3
@ -320,8 +315,7 @@ boot4-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o
boot4-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-1.o unified-libc-1.c
boot4-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-2.o unified-libc-2.c
boot4-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-3.o unified-libc-3.c
boot4-tcc -ar cr ${libdir}/libc+gnu.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
cp ${libdir}/libc+gnu.a ${libdir}/libc.a
boot4-tcc -ar cr ${libdir}/libc.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
cd ../tcc-0.9.26
# Test boot4
@ -368,8 +362,7 @@ boot5-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o
boot5-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-1.o unified-libc-1.c
boot5-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-2.o unified-libc-2.c
boot5-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc-3.o unified-libc-3.c
boot5-tcc -ar cr ${libdir}/libc+gnu.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
cp ${libdir}/libc+gnu.a ${libdir}/libc.a
boot5-tcc -ar cr ${libdir}/libc.a unified-libc-1.o unified-libc-2.o unified-libc-3.o
# Test boot5
boot5-tcc -version
@ -388,4 +381,4 @@ tcc -ar cr ${libdir}/libgetopt.a getopt.o
cd ../..
# Checksums
fletcher16 checksums
sha256sum -c checksums

View File

@ -1 +0,0 @@
27524 /after/bin/untar

View File

@ -1,14 +0,0 @@
#!/bin/sh
# SPDX-FileCopyrightText: 2021 Andrius Štikonas <andrius@stikonas.eu>
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -ex
# Compile
# 0.9.26 is intentional as later tcc segfaults when linking
tcc-0.9.26 src/untar.c -o ${bindir}/untar
# Checksums
fletcher16 checksums