From 7fe5cd2ae5e3c14c6095fb475793089ccc2a1054 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrius=20=C5=A0tikonas?= Date: Sun, 30 Apr 2023 19:26:44 +0100 Subject: [PATCH] wip --- rootfs.py | 5 ++- sysa/checksum-transcriber.amd64.SHA256SUM | 1 + sysa/checksum-transcriber.riscv64.SHA256SUM | 1 + sysa/mes-0.24.2/sources | 2 - sysa/{mes-0.24.2 => mes}/files/config.h | 0 sysa/mes/mes.amd64.checksums | 13 ++++++ .../mes-0.24.2.kaem => mes/mes.kaem} | 29 +++++++----- sysa/mes/mes.riscv64.checksums | 13 ++++++ .../mes.x86.checksums} | 20 ++++----- sysa/mes/sources | 2 + sysa/run.kaem | 4 +- sysa/stage0-posix/src | 2 +- sysa/tcc-0.9.26/sources | 2 +- sysa/tcc-0.9.26/tcc-0.9.26.kaem | 44 ++++++++++++------- 14 files changed, 93 insertions(+), 45 deletions(-) create mode 100644 sysa/checksum-transcriber.amd64.SHA256SUM create mode 100644 sysa/checksum-transcriber.riscv64.SHA256SUM delete mode 100644 sysa/mes-0.24.2/sources rename sysa/{mes-0.24.2 => mes}/files/config.h (100%) create mode 100644 sysa/mes/mes.amd64.checksums rename sysa/{mes-0.24.2/mes-0.24.2.kaem => mes/mes.kaem} (83%) create mode 100644 sysa/mes/mes.riscv64.checksums rename sysa/{mes-0.24.2/mes-0.24.2.checksums => mes/mes.x86.checksums} (50%) create mode 100644 sysa/mes/sources diff --git a/rootfs.py b/rootfs.py index 20efeba..e91a1f7 100755 --- a/rootfs.py +++ b/rootfs.py @@ -119,8 +119,8 @@ def main(): raise ValueError("One of qemu, chroot, bwrap, or bare metal must be selected.") # Arch validation - if args.arch != "x86": - raise ValueError("Only x86 is supported at the moment.") + #if args.arch != "x86" and args.arch != "amd64": + # raise ValueError("Only x86 is supported at the moment.") # Tmp validation if args.bwrap and args.tmpfs: @@ -194,6 +194,7 @@ print(shutil.which('chroot')) '--dev-bind', '/dev/zero', '/dev/zero', '--dev-bind', '/dev/random', '/dev/random', '--dev-bind', '/dev/urandom', '/dev/urandom', + '--bind', '/usr/bin/qemu-riscv64', '/usr/bin/qemu-riscv64', init) run('bwrap', '--unshare-user', diff --git a/sysa/checksum-transcriber.amd64.SHA256SUM b/sysa/checksum-transcriber.amd64.SHA256SUM new file mode 100644 index 0000000..04740b4 --- /dev/null +++ b/sysa/checksum-transcriber.amd64.SHA256SUM @@ -0,0 +1 @@ +4d1a7b8a0e42f278df20893610dd37dec62b609c2c342d9252917907e4d73c03 /usr/bin/checksum-transcriber diff --git a/sysa/checksum-transcriber.riscv64.SHA256SUM b/sysa/checksum-transcriber.riscv64.SHA256SUM new file mode 100644 index 0000000..f745f4a --- /dev/null +++ b/sysa/checksum-transcriber.riscv64.SHA256SUM @@ -0,0 +1 @@ +b6145df4b2a92d5ee75902f4367e7a1a5456a5cef7a2e1365610637b054c477a /usr/bin/checksum-transcriber diff --git a/sysa/mes-0.24.2/sources b/sysa/mes-0.24.2/sources deleted file mode 100644 index f68bbed..0000000 --- a/sysa/mes-0.24.2/sources +++ /dev/null @@ -1,2 +0,0 @@ -https://mirrors.kernel.org/gnu/mes/mes-0.24.2.tar.gz 7ddae0854e46ebfa18c13ab37e64839a7b86ea88aeed366a8d017efd11dae86e -https://download.savannah.gnu.org/releases/nyacc/nyacc-1.00.2.tar.gz f36e4fb7dd524dc3f4b354d3d5313f69e7ce5a6ae93711e8cf6d51eaa8d2b318 diff --git a/sysa/mes-0.24.2/files/config.h b/sysa/mes/files/config.h similarity index 100% rename from sysa/mes-0.24.2/files/config.h rename to sysa/mes/files/config.h diff --git a/sysa/mes/mes.amd64.checksums b/sysa/mes/mes.amd64.checksums new file mode 100644 index 0000000..b747a36 --- /dev/null +++ b/sysa/mes/mes.amd64.checksums @@ -0,0 +1,13 @@ +8f725f40d736c7c4edbeaaa41dd696745d05ce26374dcde4e94273835885895d /usr/bin/mes +bba3caa8ef981f01be5e54f73139d181fc73c7d10b33812c179f3c0863425d99 /usr/bin/mes-m2 +88d2418872d462058859c2b0a8b3be019d2dce7ac3b26cfec030199280640581 /usr/bin/mescc.scm +d0a80b94228deb99bda15244f0ed3736badd0632c78a3379195ba24a78f68a75 /usr/lib/x86_64-mes/crt1.o +914c77fc209484400be0c005fcd56346cc96b44c32ab76e9bac583603c93ba8c /usr/lib/x86_64-mes/x86_64.M1 +684bfcde34f118026d875acf2dbe2e4a39dce96d5f938f534995b582ba1a4241 /usr/lib/x86_64-mes/libmescc.s +56abe8557fd4aa52ec6873d2268ac00935805f7df3a18460f0be2165f8a231b3 /usr/lib/x86_64-mes/libc+tcc.s +5f2aaad5aa0dfa5de9aacb2e81c675c9e00309d10b3fb5f818e682a316006b1f /usr/lib/x86_64-mes/libc.s +ad1f1e390f675db2a3545aecc63df798d49317cad2ae5eadb9382df960bbd9f3 /usr/lib/x86_64-mes/libmescc.a +b1010d6fd1ea75c0b7fe62f6adff8f4bfc103350ac8df89400db25a553bf4113 /usr/lib/x86_64-mes/libc+tcc.a +106fb8420b80897a1075fc42a1aaf74d1eb5fd5ac82f6dabcf59c8cabdd6c908 /usr/lib/x86_64-mes/libc.a +91685843a1be78160d1fa605de3ef43455e704cc955862f62f3143592352ce74 /usr/lib/linux/x86_64-mes/elf64-header.hex2 +94c796cb34a6e581491d0cf609e7fad01715c84a17b8b2017178a36568a80e48 /usr/lib/linux/x86_64-mes/elf64-footer-single-main.hex2 diff --git a/sysa/mes-0.24.2/mes-0.24.2.kaem b/sysa/mes/mes.kaem similarity index 83% rename from sysa/mes-0.24.2/mes-0.24.2.kaem rename to sysa/mes/mes.kaem index 4c166dd..5bbd3ca 100755 --- a/sysa/mes-0.24.2/mes-0.24.2.kaem +++ b/sysa/mes/mes.kaem @@ -22,6 +22,10 @@ if match ${ARCH} amd64; then MES_ARCH=x86_64 ARCH_BITS=64 fi +if match ${ARCH} riscv64; then + MES_ARCH=riscv64 + ARCH_BITS=64 +fi # Check tarball checksums checksum-transcriber sources @@ -37,7 +41,7 @@ cd .. cd build untar --file ../src/${NYACC_PKG}.tar untar --non-strict --file ../src/${MES_PKG}.tar # ignore symlinks -mes_run=/sysa/${MES_PKG}/build/${MES_PKG}/kaem.run +mes_run=${MES_PREFIX}/kaem.run replace --file ${mes_run} --output ${mes_run} --match-on 0x1000000 --replace-with 0x8048000 rm ../src/${NYACC_PKG}.tar ../src/${MES_PKG}.tar @@ -62,7 +66,7 @@ cp ${MES_ARCH}_defs.M1 lib/m2/${MES_ARCH}/${MES_ARCH}_defs.M1 rm ${MES_ARCH}_defs.M1 # Build mes-m2 -kaem --verbose --strict --file kaem.run +kaem --verbose --strict --file kaem.${MES_ARCH} cp bin/mes-m2 ${bindir}/mes-m2 chmod 755 ${bindir}/mes-m2 @@ -83,9 +87,10 @@ chmod 755 ${mescc_scm} alias mescc="${MES} -e main ${bindir}/mescc.scm -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -c" # Start with crt1.o -mescc lib/linux/${MES_ARCH}-mes-mescc/crt1.c +mescc lib/linux/${MES_ARCH}-mes-mescc/crt1.c -o lib/${MES_ARCH}-mes/crt1.o # Now for libc-mini.a +mescc lib/mes/__init_io.c mescc lib/mes/eputs.c mescc lib/mes/oputs.c mescc lib/mes/globals.c @@ -94,9 +99,8 @@ mescc lib/linux/${MES_ARCH}-mes-mescc/_exit.c mescc lib/linux/${MES_ARCH}-mes-mescc/_write.c mescc lib/stdlib/puts.c mescc lib/string/strlen.c -mescc lib/mes/mini-write.c -catm ${libdir}/${MES_ARCH}-mes/libc-mini.a eputs.o oputs.o globals.o exit.o _exit.o _write.o puts.o strlen.o mini-write.o -catm ${libdir}/${MES_ARCH}-mes/libc-mini.s eputs.s oputs.s globals.s exit.s _exit.s _write.s puts.s strlen.s mini-write.s +catm ${libdir}/${MES_ARCH}-mes/libc-mini.a __init_io.o eputs.o oputs.o globals.o exit.o _exit.o _write.o puts.o strlen.o +catm ${libdir}/${MES_ARCH}-mes/libc-mini.s __init_io.s eputs.s oputs.s globals.s exit.s _exit.s _write.s puts.s strlen.s # libmescc.a mescc lib/linux/${MES_ARCH}-mes-mescc/syscall-internal.c @@ -174,12 +178,13 @@ mescc lib/linux/_open3.c mescc lib/linux/_read.c mescc lib/linux/time.c mescc lib/linux/unlink.c +mescc lib/linux/wait4.c mescc lib/linux/waitpid.c mescc lib/linux/${MES_ARCH}-mes-mescc/syscall.c mescc lib/linux/getpid.c mescc lib/linux/kill.c -catm ${libdir}/${MES_ARCH}-mes/libc.a eputs.o oputs.o globals.o exit.o _exit.o _write.o puts.o strlen.o isnumber.o abtol.o cast.o eputc.o fdgetc.o fdputc.o fdputs.o fdungetc.o itoa.o ltoa.o ltoab.o mes_open.o ntoab.o oputc.o ultoa.o utoa.o isdigit.o isspace.o isxdigit.o assert_msg.o write.o atoi.o lseek.o __assert_fail.o __buffered_read.o __mes_debug.o execv.o getcwd.o getenv.o isatty.o open.o buffered-read.o setenv.o wait.o fgetc.o fputc.o fputs.o getc.o getchar.o putc.o putchar.o ungetc.o free.o malloc.o realloc.o memchr.o memcmp.o memcpy.o memmove.o memset.o strcmp.o strcpy.o strncmp.o raise.o access.o brk.o chmod.o clock_gettime.o dup.o dup2.o execve.o fork.o fsync.o _getcwd.o gettimeofday.o ioctl3.o _open3.o _read.o time.o unlink.o waitpid.o syscall.o getpid.o kill.o -catm ${libdir}/${MES_ARCH}-mes/libc.s eputs.s oputs.s globals.s exit.s _exit.s _write.s puts.s strlen.s isnumber.s abtol.s cast.s eputc.s fdgetc.s fdputc.s fdputs.s fdungetc.s itoa.s ltoa.s ltoab.s mes_open.s ntoab.s oputc.s ultoa.s utoa.s isdigit.s isspace.s isxdigit.s assert_msg.s write.s atoi.s lseek.s __assert_fail.s __buffered_read.s __mes_debug.s execv.s getcwd.s getenv.s isatty.s open.s buffered-read.s setenv.s wait.s fgetc.s fputc.s fputs.s getc.s getchar.s putc.s putchar.s ungetc.s free.s malloc.s realloc.s memchr.s memcmp.s memcpy.s memmove.s memset.s strcmp.s strcpy.s strncmp.s raise.s access.s brk.s chmod.s clock_gettime.s dup.s dup2.s execve.s fork.s fsync.s _getcwd.s gettimeofday.s ioctl3.s _open3.s _read.s time.s unlink.s waitpid.s syscall.s getpid.s kill.s +catm ${libdir}/${MES_ARCH}-mes/libc.a __init_io.o eputs.o oputs.o globals.o exit.o _exit.o _write.o puts.o strlen.o isnumber.o abtol.o cast.o eputc.o fdgetc.o fdputc.o fdputs.o fdungetc.o itoa.o ltoa.o ltoab.o mes_open.o ntoab.o oputc.o ultoa.o utoa.o isdigit.o isspace.o isxdigit.o assert_msg.o write.o atoi.o lseek.o __assert_fail.o __buffered_read.o __mes_debug.o execv.o getcwd.o getenv.o isatty.o open.o buffered-read.o setenv.o wait.o fgetc.o fputc.o fputs.o getc.o getchar.o putc.o putchar.o ungetc.o free.o malloc.o realloc.o memchr.o memcmp.o memcpy.o memmove.o memset.o strcmp.o strcpy.o strncmp.o raise.o access.o brk.o chmod.o clock_gettime.o dup.o dup2.o execve.o fork.o fsync.o _getcwd.o gettimeofday.o ioctl3.o _open3.o _read.o time.o unlink.o wait4.o waitpid.o syscall.o getpid.o kill.o +catm ${libdir}/${MES_ARCH}-mes/libc.s __init_io.s eputs.s oputs.s globals.s exit.s _exit.s _write.s puts.s strlen.s isnumber.s abtol.s cast.s eputc.s fdgetc.s fdputc.s fdputs.s fdungetc.s itoa.s ltoa.s ltoab.s mes_open.s ntoab.s oputc.s ultoa.s utoa.s isdigit.s isspace.s isxdigit.s assert_msg.s write.s atoi.s lseek.s __assert_fail.s __buffered_read.s __mes_debug.s execv.s getcwd.s getenv.s isatty.s open.s buffered-read.s setenv.s wait.s fgetc.s fputc.s fputs.s getc.s getchar.s putc.s putchar.s ungetc.s free.s malloc.s realloc.s memchr.s memcmp.s memcpy.s memmove.s memset.s strcmp.s strcpy.s strncmp.s raise.s access.s brk.s chmod.s clock_gettime.s dup.s dup2.s execve.s fork.s fsync.s _getcwd.s gettimeofday.s ioctl3.s _open3.s _read.s time.s unlink.s wait4.s waitpid.s syscall.s getpid.s kill.s # libc+tcc.a mescc lib/ctype/islower.c @@ -261,7 +266,7 @@ mescc src/symbol.c mescc src/vector.c # Link everything into new mes executable -${MES} -e main ${mescc_scm} -- --base-address 0x08048000 -L ${libdir} -nostdlib -o ${bindir}/mes -L . crt1.o builtins.o cc.o core.o display.o eval-apply.o gc.o globals.o hash.o lib.o math.o mes.o module.o posix.o reader.o stack.o string.o struct.o symbol.o vector.o -lc -lmescc +${MES} -e main ${mescc_scm} -- --base-address 0x08048000 -L ${libdir} -o ${bindir}/mes builtins.o cc.o core.o display.o eval-apply.o gc.o globals.o hash.o lib.o math.o mes.o module.o posix.o reader.o stack.o string.o struct.o symbol.o vector.o -lc -lmescc # Make directories mkdir ${prefix}/lib/linux ${incdir}/mes ${incdir}/sys ${incdir}/linux ${incdir}/arch @@ -275,8 +280,8 @@ cp ${libdir}/${MES_ARCH}-mes/libc.s ${prefix}/lib/${MES_ARCH}-mes/ cp ${libdir}/${MES_ARCH}-mes/libc+tcc.s ${prefix}/lib/${MES_ARCH}-mes/ cp ${libdir}/${MES_ARCH}-mes/libmescc.s ${prefix}/lib/${MES_ARCH}-mes/ cp ${libdir}/${MES_ARCH}-mes/${MES_ARCH}.M1 ${prefix}/lib/${MES_ARCH}-mes/ -cp crt1.o ${prefix}/lib/${MES_ARCH}-mes/ -cp crt1.s ${prefix}/lib/${MES_ARCH}-mes/ +cp ${libdir}/${MES_ARCH}-mes/crt1.o ${prefix}/lib/${MES_ARCH}-mes/ +cp ${libdir}/${MES_ARCH}-mes/crt1.s ${prefix}/lib/${MES_ARCH}-mes/ cp ${libdir}/linux/${MES_ARCH}-mes/elf${ARCH_BITS}-footer-single-main.hex2 ${prefix}/lib/linux/${MES_ARCH}-mes/ cp ${libdir}/linux/${MES_ARCH}-mes/elf${ARCH_BITS}-header.hex2 ${prefix}/lib/linux/${MES_ARCH}-mes/ @@ -372,5 +377,5 @@ if match x${UPDATE_CHECKSUMS} xTrue; then cp ${pkg}.checksums ${srcdir} else - sha256sum -c ${pkg}.checksums + sha256sum -c ${pkg}.${ARCH}.checksums fi diff --git a/sysa/mes/mes.riscv64.checksums b/sysa/mes/mes.riscv64.checksums new file mode 100644 index 0000000..56c5eb1 --- /dev/null +++ b/sysa/mes/mes.riscv64.checksums @@ -0,0 +1,13 @@ +793dc63c5dde996387936b85c11807e29bb31161ae3cb20b0e8f4b99b9485a3e /usr/bin/mes +ee4cdc7cb3e8ee5c3ca189041296f768f505e7c3b65b6401416e5e5ed5b0a765 /usr/bin/mes-m2 +fb3b11b5e5fdc919a0f1ebb526986184535cbb6d384bde64e971da43a3fc0cd3 /usr/bin/mescc.scm +a96a0a8f1b2dd1e5a7dad8264c92b5448be7d29aa7706d40d67be978d5ddc305 /usr/lib/riscv64-mes/crt1.o +1511e99da81caa02490078c7a880ac97d439b6fec99cf846dc2044468e2444b8 /usr/lib/riscv64-mes/riscv64.M1 +8f7e94270c7cbb076ff5fe3cdd0d6c891537e7945e5aa4bdbf167867471bfbc2 /usr/lib/riscv64-mes/libmescc.s +fff2fffc68db7bad23941142769e3fbf72bc7bd9fdf596b293f82bbc2d27842e /usr/lib/riscv64-mes/libc+tcc.s +d06c995f0e00d3fe0f26ae1e0a6cedfaae2fd45e65d8f024d7867cf3bf2308dd /usr/lib/riscv64-mes/libc.s +5027a055f6c564417bf5194a9b43a8a93ae59d9a26ce75a55895f253a6aab2c2 /usr/lib/riscv64-mes/libmescc.a +b0191568af8c334b35a83d421278e5dcb75ca99c9137c4a830031ceceb9adabe /usr/lib/riscv64-mes/libc+tcc.a +96aa8edc9fc65fc85a238a7ead0cfcb8e651d89c33450ba94bc26b9a568f9162 /usr/lib/riscv64-mes/libc.a +a7b187f0d82369640a441b0c3ec8f27b0cf9296ea98cd64cca2da9af681641ca /usr/lib/linux/riscv64-mes/elf64-header.hex2 +94c796cb34a6e581491d0cf609e7fad01715c84a17b8b2017178a36568a80e48 /usr/lib/linux/riscv64-mes/elf64-footer-single-main.hex2 diff --git a/sysa/mes-0.24.2/mes-0.24.2.checksums b/sysa/mes/mes.x86.checksums similarity index 50% rename from sysa/mes-0.24.2/mes-0.24.2.checksums rename to sysa/mes/mes.x86.checksums index fcd3f2e..7c834f2 100644 --- a/sysa/mes-0.24.2/mes-0.24.2.checksums +++ b/sysa/mes/mes.x86.checksums @@ -1,14 +1,14 @@ -b2a48b2724a7b791df66efc2384a405a91d26579459a6797514dec89c2e76658 /usr/bin/mes -148ce096422535832802494f1128c26b6580cf3b66635e56abb33f7b3fc26043 /usr/bin/mes-m2 -17c86665c2f925d88e3c1f827f312bbc7575b9e6006ef57833e895b6e73b8087 /usr/bin/mescc.scm -4feafab424611c976dc4628aa862e37b4e92b5869aebbcf7655e684c3f589041 /usr/lib/x86-mes/crt1.s -69e9ec2ee2ebf065575cdaf878629178b85330257dde0da790a428c0280d1ecb /usr/lib/x86-mes/crt1.o +314d72afbd9afe36e7d84a9df622a56cbdbf7eddcea3e76fd2918f1d7bae21f5 /usr/bin/mes +2887b02b5bedd36b99f4f211e398d1d7d6dc4487eb8fc3d35e6d2a530befdf8f /usr/bin/mes-m2 +db51a5db377719d063ff91fb26dd0a99cb8fb96bf829c69c939f6013ce7b0c71 /usr/bin/mescc.scm +234c264965116a24583dd569050adc766d7cc2da83b1db38085210f26031b70c /usr/lib/x86-mes/crt1.s +494f184a87175abc485a898c250c3831b2b5dcf5aead46591e00b39d1c5529fc /usr/lib/x86-mes/crt1.o c9944a799d584abfa76f385c14ac0caf6f46d03b34bf2712493602b12826c6b2 /usr/lib/x86-mes/x86.M1 -d8646707db6aa2a76fdc5dbb3521376439e357f9f1de1d67f02a1afeefd342ac /usr/lib/x86-mes/libmescc.s -7ec49fbcbc70b49648150b021a2ff9ab2b27e89eb8815919a7ffabe375ab1edc /usr/lib/x86-mes/libc+tcc.s -b935d4c30213b49d899ab8bccce33117057ea0f3a1a8d3afc5e07fb8ce4590db /usr/lib/x86-mes/libc.s +771988b1df0dfa04bf5f1ab72af18c32b1a8205a07f10e5235d79dac0a072b00 /usr/lib/x86-mes/libmescc.s +bbd2d3115c4b09689c4da5e2d7486d89c962c562588fc687c7d3ba1e6533b0cc /usr/lib/x86-mes/libc+tcc.s +0e354262a2752ec3ff89ae7c23b38356fc1af79dbb5acea3d082e579e89937ac /usr/lib/x86-mes/libc.s 52f697278ccdff5e457f27e10f465a91ab9858f0c6cee0683831cadb3109bbb7 /usr/lib/x86-mes/libmescc.a -840ee884db456e1982f40bce82209515a8e0b09bc404c4bc2a26d237bfa4d9ca /usr/lib/x86-mes/libc+tcc.a -32be26479096c52dbffe9c8bf14765f753d6882c3ae43760eda03406c0cf2539 /usr/lib/x86-mes/libc.a +82122c365e64c7a15f5d90922bb84d13ac52deb85fb52529792a0fc52c77b00e /usr/lib/x86-mes/libc+tcc.a +0d620fcb75074df832556ce7b37da1626db5c90d7435260b7079cb32a127803f /usr/lib/x86-mes/libc.a b16ab368bc4c7b8bd896d03cba565a60e97760dea4da9f5c8a1a3d2902a79df6 /usr/lib/linux/x86-mes/elf32-header.hex2 f9873d9aab12e70f24d97f8319e17a1e698ca60779ae9a6ab3ede648cd60fc61 /usr/lib/linux/x86-mes/elf32-footer-single-main.hex2 diff --git a/sysa/mes/sources b/sysa/mes/sources new file mode 100644 index 0000000..a9906b9 --- /dev/null +++ b/sysa/mes/sources @@ -0,0 +1,2 @@ +https://gitlab.com/janneke/mes/-/archive/wip-riscv/mes-wip-riscv.tar.gz c1fe251fa958d63a820d422542fad0545099540a4ecf3b37119b108409b7313d mes.tar.gz +https://download.savannah.gnu.org/releases/nyacc/nyacc-1.00.2.tar.gz f36e4fb7dd524dc3f4b354d3d5313f69e7ce5a6ae93711e8cf6d51eaa8d2b318 diff --git a/sysa/run.kaem b/sysa/run.kaem index 47fe782..81c8cf2 100755 --- a/sysa/run.kaem +++ b/sysa/run.kaem @@ -20,8 +20,8 @@ M2-Mesoplanet --architecture x86 -f simple-patch.c -o /x86/bin/simple-patch # Environmental variables needed for mes NYACC_PKG=nyacc-1.00.2 MES_VERSION=0.24.2 -MES_PKG=mes-${MES_VERSION} -MES_PKG_DIR=${MES_PKG} +MES_PKG=mes +MES_PKG_DIR=mes-wip-riscv MES_PREFIX=${sysa}/${MES_PKG}/build/${MES_PKG_DIR} GUILE_LOAD_PATH=${MES_PREFIX}/mes/module:${MES_PREFIX}/module:${sysa}/${MES_PKG}/build/${NYACC_PKG}/module diff --git a/sysa/stage0-posix/src b/sysa/stage0-posix/src index fe529ef..7d98ede 160000 --- a/sysa/stage0-posix/src +++ b/sysa/stage0-posix/src @@ -1 +1 @@ -Subproject commit fe529ef2e1053cb0551fb71276f9ced9fe229d87 +Subproject commit 7d98ede569fe92a1da9a43d3eb24af7fd328af1a diff --git a/sysa/tcc-0.9.26/sources b/sysa/tcc-0.9.26/sources index 3d341fb..0e412d5 100644 --- a/sysa/tcc-0.9.26/sources +++ b/sysa/tcc-0.9.26/sources @@ -1 +1 @@ -https://lilypond.org/janneke/tcc/tcc-0.9.26-1136-g5bba73cc.tar.gz 23cacd448cff2baf6ed76c2d1e2d654ff4e557046e311dfb6be7e1c631014ef8 tcc-0.9.26.tar.gz +https://git.stikonas.eu/andrius/tinycc/archive/wip-riscv.tar.gz 8e604d7ccccc51be6b439986d1abb5c81c77e1ab2670123d458034d6129255e4 tcc-0.9.26.tar.gz 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 c91ffd7..c4baf42 100755 --- a/sysa/tcc-0.9.26/tcc-0.9.26.kaem +++ b/sysa/tcc-0.9.26/tcc-0.9.26.kaem @@ -15,7 +15,7 @@ MES_SOURCE=${MES_PREFIX} MES=${bindir}/mes TCC_TAR=tcc-0.9.26 -TCC_PKG=tcc-0.9.26-1136-g5bba73cc +TCC_PKG=tinycc # Check tarball checksums checksum-transcriber sources @@ -30,11 +30,11 @@ ungz --file ${distfiles}/${MES_PKG}.tar.gz --output ${MES_PKG}.tar cd .. cd build -untar --file ../src/${TCC_TAR}.tar -/x86/bin/simple-patch ${TCC_PKG}/tcctools.c \ - ../simple-patches/remove-fileopen.before ../simple-patches/remove-fileopen.after -/x86/bin/simple-patch ${TCC_PKG}/tcctools.c \ - ../simple-patches/addback-fileopen.before ../simple-patches/addback-fileopen.after +untar --non-strict --file ../src/${TCC_TAR}.tar +#/x86/bin/simple-patch ${TCC_PKG}/tcctools.c \ +# ../simple-patches/remove-fileopen.before ../simple-patches/remove-fileopen.after +#/x86/bin/simple-patch ${TCC_PKG}/tcctools.c \ +# ../simple-patches/addback-fileopen.before ../simple-patches/addback-fileopen.after untar --non-strict --file ../src/${MES_PKG}.tar @@ -42,13 +42,27 @@ untar --non-strict --file ../src/${MES_PKG}.tar cd ${TCC_PKG} catm config.h +if match ${ARCH} x86; then + MES_ARCH=x86 + TCC_TARGET_ARCH=I386 +fi +if match ${ARCH} amd64; then + MES_ARCH=x86_64 + TCC_TARGET_ARCH=X86_64 +fi +if match ${ARCH} riscv64; then + MES_ARCH=riscv64 + TCC_TARGET_ARCH=RISCV64 +fi + + ${MES} --no-auto-compile -e main ${bindir}/mescc.scm -- \ -S \ -o tcc.s \ -I ${incdir} \ -D BOOTSTRAP=1 \ -I . \ - -D TCC_TARGET_I386=1 \ + -D TCC_TARGET_${TCC_TARGET_ARCH}=1 \ -D inline= \ -D CONFIG_TCCDIR=\"${libdir}/mes/tcc\" \ -D CONFIG_SYSROOT=\"/\" \ @@ -85,29 +99,29 @@ cd ../${MES_PKG_DIR} # Create unified libc file cd lib -catm ../unified-libc.c ctype/isalnum.c ctype/isalpha.c ctype/isascii.c ctype/iscntrl.c ctype/isdigit.c ctype/isgraph.c ctype/islower.c ctype/isnumber.c ctype/isprint.c ctype/ispunct.c ctype/isspace.c ctype/isupper.c ctype/isxdigit.c ctype/tolower.c ctype/toupper.c dirent/closedir.c dirent/__getdirentries.c dirent/opendir.c dirent/readdir.c linux/access.c linux/brk.c linux/chdir.c linux/chmod.c linux/clock_gettime.c linux/close.c linux/dup2.c linux/dup.c linux/execve.c linux/fcntl.c linux/fork.c linux/fsync.c linux/fstat.c linux/_getcwd.c linux/getdents.c linux/getegid.c linux/geteuid.c linux/getgid.c linux/getpid.c linux/getppid.c linux/getrusage.c linux/gettimeofday.c linux/getuid.c linux/ioctl.c linux/ioctl3.c linux/kill.c linux/link.c linux/lseek.c linux/lstat.c linux/malloc.c linux/mkdir.c linux/mknod.c linux/nanosleep.c linux/_open3.c linux/pipe.c linux/_read.c linux/readlink.c linux/rename.c linux/rmdir.c linux/setgid.c linux/settimer.c linux/setuid.c linux/signal.c linux/sigprogmask.c linux/symlink.c linux/stat.c linux/time.c linux/unlink.c linux/waitpid.c linux/x86-mes-gcc/_exit.c linux/x86-mes-gcc/syscall.c linux/x86-mes-gcc/_write.c math/ceil.c math/fabs.c math/floor.c mes/abtod.c mes/abtol.c mes/__assert_fail.c mes/assert_msg.c mes/__buffered_read.c mes/cast.c mes/dtoab.c mes/eputc.c mes/eputs.c mes/fdgetc.c mes/fdgets.c mes/fdputc.c mes/fdputs.c mes/fdungetc.c mes/globals.c mes/itoa.c mes/ltoab.c mes/ltoa.c mes/__mes_debug.c mes/mes_open.c mes/ntoab.c mes/oputc.c mes/oputs.c mes/search-path.c mes/ultoa.c mes/utoa.c posix/alarm.c posix/buffered-read.c posix/execl.c posix/execlp.c posix/execv.c posix/execvp.c posix/getcwd.c posix/getenv.c posix/isatty.c posix/mktemp.c posix/open.c posix/raise.c posix/sbrk.c posix/setenv.c posix/sleep.c posix/unsetenv.c posix/wait.c posix/write.c stdio/clearerr.c stdio/fclose.c stdio/fdopen.c stdio/feof.c stdio/ferror.c stdio/fflush.c stdio/fgetc.c stdio/fgets.c stdio/fileno.c stdio/fopen.c stdio/fprintf.c stdio/fputc.c stdio/fputs.c stdio/fread.c stdio/freopen.c stdio/fscanf.c stdio/fseek.c stdio/ftell.c stdio/fwrite.c stdio/getc.c stdio/getchar.c stdio/perror.c stdio/printf.c stdio/putc.c stdio/putchar.c stdio/remove.c stdio/snprintf.c stdio/sprintf.c stdio/sscanf.c stdio/ungetc.c stdio/vfprintf.c stdio/vfscanf.c stdio/vprintf.c stdio/vsnprintf.c stdio/vsprintf.c stdio/vsscanf.c stdlib/abort.c stdlib/abs.c stdlib/alloca.c stdlib/atexit.c stdlib/atof.c stdlib/atoi.c stdlib/atol.c stdlib/calloc.c stdlib/__exit.c stdlib/exit.c stdlib/free.c stdlib/mbstowcs.c stdlib/puts.c stdlib/qsort.c stdlib/realloc.c stdlib/strtod.c stdlib/strtof.c stdlib/strtol.c stdlib/strtold.c stdlib/strtoll.c stdlib/strtoul.c stdlib/strtoull.c string/bcmp.c string/bcopy.c string/bzero.c string/index.c string/memchr.c string/memcmp.c string/memcpy.c string/memmem.c string/memmove.c string/memset.c string/rindex.c string/strcat.c string/strchr.c string/strcmp.c string/strcpy.c string/strcspn.c string/strdup.c string/strerror.c string/strlen.c string/strlwr.c string/strncat.c string/strncmp.c string/strncpy.c string/strpbrk.c string/strrchr.c string/strspn.c string/strstr.c string/strupr.c stub/atan2.c stub/bsearch.c stub/chown.c stub/__cleanup.c stub/cos.c stub/ctime.c stub/exp.c stub/fpurge.c stub/freadahead.c stub/frexp.c stub/getgrgid.c stub/getgrnam.c stub/getlogin.c stub/getpgid.c stub/getpgrp.c stub/getpwnam.c stub/getpwuid.c stub/gmtime.c stub/ldexp.c stub/localtime.c stub/log.c stub/mktime.c stub/modf.c stub/mprotect.c stub/pclose.c stub/popen.c stub/pow.c stub/rand.c stub/rewind.c stub/setbuf.c stub/setgrent.c stub/setlocale.c stub/setvbuf.c stub/sigaction.c stub/sigaddset.c stub/sigblock.c stub/sigdelset.c stub/sigemptyset.c stub/sigsetmask.c stub/sin.c stub/sys_siglist.c stub/system.c stub/sqrt.c stub/strftime.c stub/times.c stub/ttyname.c stub/umask.c stub/utime.c x86-mes-gcc/setjmp.c +catm ../unified-libc.c ctype/isalnum.c ctype/isalpha.c ctype/isascii.c ctype/iscntrl.c ctype/isdigit.c ctype/isgraph.c ctype/islower.c ctype/isnumber.c ctype/isprint.c ctype/ispunct.c ctype/isspace.c ctype/isupper.c ctype/isxdigit.c ctype/tolower.c ctype/toupper.c dirent/closedir.c dirent/__getdirentries.c dirent/opendir.c dirent/readdir.c linux/access.c linux/brk.c linux/chdir.c linux/chmod.c linux/clock_gettime.c linux/close.c linux/dup2.c linux/dup.c linux/execve.c linux/fcntl.c linux/fork.c linux/fsync.c linux/fstat.c linux/_getcwd.c linux/getdents.c linux/getegid.c linux/geteuid.c linux/getgid.c linux/getpid.c linux/getppid.c linux/getrusage.c linux/gettimeofday.c linux/getuid.c linux/ioctl.c linux/ioctl3.c linux/kill.c linux/link.c linux/lseek.c linux/lstat.c linux/malloc.c linux/mkdir.c linux/mknod.c linux/nanosleep.c linux/_open3.c linux/pipe.c linux/_read.c linux/readlink.c linux/rename.c linux/rmdir.c linux/setgid.c linux/settimer.c linux/setuid.c linux/signal.c linux/sigprogmask.c linux/symlink.c linux/stat.c linux/time.c linux/unlink.c linux/waitpid.c linux/${MES_ARCH}-mes-gcc/_exit.c linux/${MES_ARCH}-mes-gcc/syscall.c linux/${MES_ARCH}-mes-gcc/_write.c math/ceil.c math/fabs.c math/floor.c mes/abtod.c mes/abtol.c mes/__assert_fail.c mes/assert_msg.c mes/__buffered_read.c mes/cast.c mes/dtoab.c mes/eputc.c mes/eputs.c mes/fdgetc.c mes/fdgets.c mes/fdputc.c mes/fdputs.c mes/fdungetc.c mes/globals.c mes/itoa.c mes/ltoab.c mes/ltoa.c mes/__mes_debug.c mes/mes_open.c mes/ntoab.c mes/oputc.c mes/oputs.c mes/search-path.c mes/ultoa.c mes/utoa.c posix/alarm.c posix/buffered-read.c posix/execl.c posix/execlp.c posix/execv.c posix/execvp.c posix/getcwd.c posix/getenv.c posix/isatty.c posix/mktemp.c posix/open.c posix/raise.c posix/sbrk.c posix/setenv.c posix/sleep.c posix/unsetenv.c posix/wait.c posix/write.c stdio/clearerr.c stdio/fclose.c stdio/fdopen.c stdio/feof.c stdio/ferror.c stdio/fflush.c stdio/fgetc.c stdio/fgets.c stdio/fileno.c stdio/fopen.c stdio/fprintf.c stdio/fputc.c stdio/fputs.c stdio/fread.c stdio/freopen.c stdio/fscanf.c stdio/fseek.c stdio/ftell.c stdio/fwrite.c stdio/getc.c stdio/getchar.c stdio/perror.c stdio/printf.c stdio/putc.c stdio/putchar.c stdio/remove.c stdio/snprintf.c stdio/sprintf.c stdio/sscanf.c stdio/ungetc.c stdio/vfprintf.c stdio/vfscanf.c stdio/vprintf.c stdio/vsnprintf.c stdio/vsprintf.c stdio/vsscanf.c stdlib/abort.c stdlib/abs.c stdlib/alloca.c stdlib/atexit.c stdlib/atof.c stdlib/atoi.c stdlib/atol.c stdlib/calloc.c stdlib/__exit.c stdlib/exit.c stdlib/free.c stdlib/mbstowcs.c stdlib/puts.c stdlib/qsort.c stdlib/realloc.c stdlib/strtod.c stdlib/strtof.c stdlib/strtol.c stdlib/strtold.c stdlib/strtoll.c stdlib/strtoul.c stdlib/strtoull.c string/bcmp.c string/bcopy.c string/bzero.c string/index.c string/memchr.c string/memcmp.c string/memcpy.c string/memmem.c string/memmove.c string/memset.c string/rindex.c string/strcat.c string/strchr.c string/strcmp.c string/strcpy.c string/strcspn.c string/strdup.c string/strerror.c string/strlen.c string/strlwr.c string/strncat.c string/strncmp.c string/strncpy.c string/strpbrk.c string/strrchr.c string/strspn.c string/strstr.c string/strupr.c stub/atan2.c stub/bsearch.c stub/chown.c stub/__cleanup.c stub/cos.c stub/ctime.c stub/exp.c stub/fpurge.c stub/freadahead.c stub/frexp.c stub/getgrgid.c stub/getgrnam.c stub/getlogin.c stub/getpgid.c stub/getpgrp.c stub/getpwnam.c stub/getpwuid.c stub/gmtime.c stub/ldexp.c stub/localtime.c stub/log.c stub/mktime.c stub/modf.c stub/mprotect.c stub/pclose.c stub/popen.c stub/pow.c stub/rand.c stub/rewind.c stub/setbuf.c stub/setgrent.c stub/setlocale.c stub/setvbuf.c stub/sigaction.c stub/sigaddset.c stub/sigblock.c stub/sigdelset.c stub/sigemptyset.c stub/sigsetmask.c stub/sin.c stub/sys_siglist.c stub/system.c stub/sqrt.c stub/strftime.c stub/times.c stub/ttyname.c stub/umask.c stub/utime.c ${MES_ARCH}-mes-gcc/setjmp.c cd .. # crt1.o -mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crt1.o lib/linux/x86-mes-gcc/crt1.c +mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${libdir}/crt1.o lib/linux/${MES_ARCH}-mes-gcc/crt1.c # crtn.o -mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crtn.o lib/linux/x86-mes-gcc/crtn.c +mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${libdir}/crtn.o lib/linux/${MES_ARCH}-mes-gcc/crtn.c # crti.o -mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o ${libdir}/crti.o lib/linux/x86-mes-gcc/crti.c +mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${libdir}/crti.o lib/linux/${MES_ARCH}-mes-gcc/crti.c # libc+gcc.a -mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 -o unified-libc.o unified-libc.c +mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o unified-libc.o unified-libc.c mes-tcc -ar cr ${libdir}/libc.a unified-libc.o # libtcc1.a mkdir ${libdir}/tcc -mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 lib/libtcc1.c +mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} lib/libtcc1.c mes-tcc -ar cr ${libdir}/tcc/libtcc1.a libtcc1.o # libgetopt.a -mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/x86 lib/posix/getopt.c +mes-tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} lib/posix/getopt.c mes-tcc -ar cr ${libdir}/libgetopt.a getopt.o cd ../${TCC_PKG} @@ -124,7 +138,7 @@ mes-tcc \ -D HAVE_SETJMP=1 \ -I . \ -I ${prefix}/include \ - -D TCC_TARGET_I386=1 \ + -D TCC_TARGET_${TCC_TARGET_ARCH}=1 \ -D CONFIG_TCCDIR=\"${libdir}/tcc\" \ -D CONFIG_TCC_CRTPREFIX=\"${libdir}\" \ -D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \