2021-01-09 08:19:16 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2022-04-24 04:59:17 +01:00
|
|
|
# SPDX-FileCopyrightText: 2021-22 fosslinux <fosslinux@aussies.space>
|
2021-02-08 06:23:31 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2021-01-09 08:19:16 +00:00
|
|
|
set -ex
|
|
|
|
|
|
|
|
# Vars
|
|
|
|
MES_STACK=15000000
|
|
|
|
MES_ARENA=30000000
|
|
|
|
MES_MAX_ARENA=30000000
|
|
|
|
MES_LIB=${MES_PREFIX}/lib
|
|
|
|
MES_SOURCE=${MES_PREFIX}
|
2023-11-28 02:16:09 +00:00
|
|
|
MES=${BINDIR}/mes
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2021-06-20 22:23:51 +01:00
|
|
|
TCC_TAR=tcc-0.9.26
|
2023-11-19 01:42:07 +00:00
|
|
|
TCC_PKG=tcc-0.9.26-1147-gee75a10c
|
2021-06-20 22:23:51 +01:00
|
|
|
|
2022-09-29 11:35:31 +01:00
|
|
|
# Check tarball checksums
|
|
|
|
checksum-transcriber sources
|
|
|
|
sha256sum -c sources.SHA256SUM
|
|
|
|
|
2021-06-20 22:23:51 +01:00
|
|
|
# Unpack
|
2022-04-24 04:59:17 +01:00
|
|
|
mkdir src build
|
|
|
|
|
2021-06-20 22:23:51 +01:00
|
|
|
cd src
|
2023-11-28 02:16:09 +00:00
|
|
|
ungz --file ${DISTFILES}/${TCC_TAR}.tar.gz --output ${TCC_TAR}.tar
|
|
|
|
ungz --file ${DISTFILES}/${MES_PKG}.tar.gz --output ${MES_PKG}.tar
|
2022-04-24 04:59:17 +01:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
cd build
|
2023-11-19 01:42:07 +00:00
|
|
|
untar --non-strict --file ../src/${TCC_TAR}.tar
|
2023-06-05 15:48:46 +01:00
|
|
|
simple-patch ${TCC_PKG}/tcctools.c \
|
2023-05-01 21:59:03 +01:00
|
|
|
../simple-patches/remove-fileopen.before ../simple-patches/remove-fileopen.after
|
2023-06-05 15:48:46 +01:00
|
|
|
simple-patch ${TCC_PKG}/tcctools.c \
|
2023-05-01 21:59:03 +01:00
|
|
|
../simple-patches/addback-fileopen.before ../simple-patches/addback-fileopen.after
|
2023-03-31 19:08:50 +01:00
|
|
|
|
2022-06-02 22:44:02 +01:00
|
|
|
untar --non-strict --file ../src/${MES_PKG}.tar
|
2021-01-13 10:38:34 +00:00
|
|
|
|
|
|
|
# Create config.h
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
catm ${MES_PKG}/include/mes/config.h
|
2023-11-19 01:42:07 +00:00
|
|
|
catm ${TCC_PKG}/config.h
|
2021-06-21 00:27:06 +01:00
|
|
|
cd ${TCC_PKG}
|
2021-01-13 10:38:34 +00:00
|
|
|
|
2023-11-14 00:37:11 +00:00
|
|
|
if match ${ARCH} x86; then
|
|
|
|
MES_ARCH=x86
|
|
|
|
TCC_TARGET_ARCH=I386
|
|
|
|
MES_LIBC_SUFFIX=gcc
|
|
|
|
HAVE_LONG_LONG=0
|
|
|
|
fi
|
2023-11-19 01:42:07 +00:00
|
|
|
if match ${ARCH} amd64; then
|
|
|
|
MES_ARCH=x86_64
|
|
|
|
TCC_TARGET_ARCH=X86_64
|
|
|
|
MES_LIBC_SUFFIX=gcc
|
|
|
|
HAVE_LONG_LONG=1
|
|
|
|
fi
|
|
|
|
if match ${ARCH} riscv64; then
|
|
|
|
MES_ARCH=riscv64
|
|
|
|
TCC_TARGET_ARCH=RISCV64
|
|
|
|
MES_LIBC_SUFFIX=tcc
|
|
|
|
HAVE_LONG_LONG=1
|
|
|
|
fi
|
|
|
|
|
2023-11-14 00:37:11 +00:00
|
|
|
|
2023-11-28 02:16:09 +00:00
|
|
|
${MES} --no-auto-compile -e main ${BINDIR}/mescc.scm -- \
|
2021-01-09 08:19:16 +00:00
|
|
|
-S \
|
|
|
|
-o tcc.s \
|
2023-11-28 02:16:09 +00:00
|
|
|
-I ${INCDIR} \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D BOOTSTRAP=1 \
|
2023-11-19 01:42:07 +00:00
|
|
|
-D HAVE_LONG_LONG=${HAVE_LONG_LONG} \
|
2021-01-09 08:19:16 +00:00
|
|
|
-I . \
|
2023-11-19 01:42:07 +00:00
|
|
|
-D TCC_TARGET_${TCC_TARGET_ARCH}=1 \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D inline= \
|
2023-11-28 02:16:09 +00:00
|
|
|
-D CONFIG_TCCDIR=\"${LIBDIR}/tcc\" \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D CONFIG_SYSROOT=\"/\" \
|
2023-11-28 02:16:09 +00:00
|
|
|
-D CONFIG_TCC_CRTPREFIX=\"${LIBDIR}\" \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \
|
2023-11-28 02:34:41 +00:00
|
|
|
-D CONFIG_TCC_SYSINCLUDEPATHS=\"${PREFIX}/include/mes\" \
|
2023-11-28 02:16:09 +00:00
|
|
|
-D TCC_LIBGCC=\"${LIBDIR}/libc.a\" \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D CONFIG_TCC_LIBTCC1_MES=0 \
|
|
|
|
-D CONFIG_TCCBOOT=1 \
|
|
|
|
-D CONFIG_TCC_STATIC=1 \
|
|
|
|
-D CONFIG_USE_LIBGCC=1 \
|
|
|
|
-D TCC_VERSION=\"0.9.26\" \
|
|
|
|
-D ONE_SOURCE=1 \
|
|
|
|
tcc.c
|
2023-11-28 02:16:09 +00:00
|
|
|
${MES} --no-auto-compile -e main ${BINDIR}/mescc.scm -- \
|
2023-03-31 19:08:50 +01:00
|
|
|
--base-address 0x08048000 \
|
2023-11-19 01:42:07 +00:00
|
|
|
-o tcc-mes \
|
2023-11-28 02:16:09 +00:00
|
|
|
-L ${LIBDIR} \
|
2021-01-09 08:19:16 +00:00
|
|
|
tcc.s \
|
|
|
|
-l c+tcc
|
2023-11-28 02:16:09 +00:00
|
|
|
cp tcc-mes ${BINDIR}/
|
|
|
|
chmod 755 ${BINDIR}/tcc-mes
|
2021-06-24 00:32:19 +01:00
|
|
|
|
2023-11-19 01:42:07 +00:00
|
|
|
# test tcc-mes
|
|
|
|
tcc-mes -version
|
2021-01-09 08:19:16 +00:00
|
|
|
|
|
|
|
# Recompile the mes C library
|
2023-11-28 02:16:09 +00:00
|
|
|
cd ../${MES_PKG}
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2021-06-21 00:27:06 +01:00
|
|
|
# Create unified libc file
|
|
|
|
cd lib
|
2023-11-14 00:37:11 +00:00
|
|
|
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/wait4.c linux/${MES_ARCH}-mes-${MES_LIBC_SUFFIX}/_exit.c linux/${MES_ARCH}-mes-${MES_LIBC_SUFFIX}/syscall.c linux/${MES_ARCH}-mes-${MES_LIBC_SUFFIX}/_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/__init_io.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-${MES_LIBC_SUFFIX}/setjmp.c
|
2021-06-21 00:27:06 +01:00
|
|
|
cd ..
|
2021-01-09 08:19:16 +00:00
|
|
|
|
|
|
|
# crt1.o
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-mes -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crt1.o lib/linux/${MES_ARCH}-mes-${MES_LIBC_SUFFIX}/crt1.c
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2023-11-28 02:16:09 +00:00
|
|
|
catm ${LIBDIR}/crtn.o
|
|
|
|
catm ${LIBDIR}/crti.o
|
2023-11-19 01:42:07 +00:00
|
|
|
if match ${ARCH} x86; then
|
|
|
|
# crtn.o
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-mes -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
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2023-11-19 01:42:07 +00:00
|
|
|
# crti.o
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-mes -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
|
2023-11-19 01:42:07 +00:00
|
|
|
fi
|
2021-01-09 08:19:16 +00:00
|
|
|
|
|
|
|
# libc+gcc.a
|
2023-11-19 01:42:07 +00:00
|
|
|
tcc-mes -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o unified-libc.o unified-libc.c
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-mes -ar cr ${LIBDIR}/libc.a unified-libc.o
|
2021-01-09 08:19:16 +00:00
|
|
|
|
|
|
|
# libtcc1.a
|
2023-11-28 02:16:09 +00:00
|
|
|
mkdir ${LIBDIR}/tcc
|
2023-11-19 01:42:07 +00:00
|
|
|
tcc-mes -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -D HAVE_FLOAT=1 -I include -I include/linux/${MES_ARCH} -o libtcc1.o lib/libtcc1.c
|
|
|
|
if match ${ARCH} riscv64; then
|
|
|
|
tcc-mes -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -D HAVE_FLOAT=1 -I include -I include/linux/${MES_ARCH} -o lib-arm64.o ../${TCC_PKG}/lib/lib-arm64.c
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-mes -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o lib-arm64.o
|
2023-11-19 01:42:07 +00:00
|
|
|
else
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-mes -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o
|
2023-11-19 01:42:07 +00:00
|
|
|
fi
|
2021-01-09 08:19:16 +00:00
|
|
|
|
|
|
|
# libgetopt.a
|
2023-11-19 01:42:07 +00:00
|
|
|
tcc-mes -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} lib/posix/getopt.c
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-mes -ar cr ${LIBDIR}/libgetopt.a getopt.o
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2021-06-20 22:23:51 +01:00
|
|
|
cd ../${TCC_PKG}
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2021-01-10 23:40:25 +00:00
|
|
|
# boot0 (ref comments here for all boot*)
|
|
|
|
# compile
|
2023-11-19 01:42:07 +00:00
|
|
|
tcc-mes \
|
2021-01-09 08:19:16 +00:00
|
|
|
-g \
|
|
|
|
-v \
|
|
|
|
-static \
|
2023-11-19 01:42:07 +00:00
|
|
|
-o tcc-boot0 \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D BOOTSTRAP=1 \
|
2023-11-19 01:42:07 +00:00
|
|
|
-D HAVE_FLOAT=1 \
|
|
|
|
-D HAVE_BITFIELD=1 \
|
|
|
|
-D HAVE_LONG_LONG=1 \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D HAVE_SETJMP=1 \
|
|
|
|
-I . \
|
2023-11-28 02:16:09 +00:00
|
|
|
-I ${PREFIX}/include/mes \
|
2023-11-19 01:42:07 +00:00
|
|
|
-D TCC_TARGET_${TCC_TARGET_ARCH}=1 \
|
2023-11-28 02:16:09 +00:00
|
|
|
-D CONFIG_TCCDIR=\"${LIBDIR}/tcc\" \
|
|
|
|
-D CONFIG_TCC_CRTPREFIX=\"${LIBDIR}\" \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \
|
2023-11-28 02:16:09 +00:00
|
|
|
-D CONFIG_TCC_LIBPATHS=\"${LIBDIR}:${LIBDIR}/tcc\" \
|
2023-11-28 02:34:41 +00:00
|
|
|
-D CONFIG_TCC_SYSINCLUDEPATHS=\"${PREFIX}/include/mes\" \
|
2023-11-28 02:16:09 +00:00
|
|
|
-D TCC_LIBGCC=\"${LIBDIR}/libc.a\" \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D TCC_LIBTCC1=\"libtcc1.a\" \
|
|
|
|
-D CONFIG_TCCBOOT=1 \
|
|
|
|
-D CONFIG_TCC_STATIC=1 \
|
|
|
|
-D CONFIG_USE_LIBGCC=1 \
|
|
|
|
-D TCC_VERSION=\"0.9.26\" \
|
|
|
|
-D ONE_SOURCE=1 \
|
|
|
|
-L . \
|
2023-11-28 02:16:09 +00:00
|
|
|
-L ${LIBDIR} \
|
2021-01-09 08:19:16 +00:00
|
|
|
tcc.c
|
2021-01-10 23:40:25 +00:00
|
|
|
# Install
|
2023-11-28 02:16:09 +00:00
|
|
|
cp tcc-boot0 ${BINDIR}/
|
|
|
|
chmod 755 ${BINDIR}/tcc-boot0
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
cd ../${MES_PKG}
|
2021-01-10 23:40:25 +00:00
|
|
|
# Recompile libc: crt{1,n,i}, libtcc.a, libc.a
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot0 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crt1.o lib/linux/${MES_ARCH}-mes-${MES_LIBC_SUFFIX}/crt1.c
|
2023-11-19 01:42:07 +00:00
|
|
|
if match ${ARCH} x86; then
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot0 -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
|
|
|
|
tcc-boot0 -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
|
2023-11-19 01:42:07 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
tcc-boot0 -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -D HAVE_FLOAT=1 -I include -I include/linux/${MES_ARCH} -o libtcc1.o lib/libtcc1.c
|
|
|
|
if match ${ARCH} riscv64; then
|
|
|
|
tcc-boot0 -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -D HAVE_FLOAT=1 -I include -I include/linux/${MES_ARCH} -o lib-arm64.o ../${TCC_PKG}/lib/lib-arm64.c
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot0 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o lib-arm64.o
|
2023-11-19 01:42:07 +00:00
|
|
|
else
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot0 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o
|
2023-11-19 01:42:07 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
tcc-boot0 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o unified-libc.o unified-libc.c
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot0 -ar cr ${LIBDIR}/libc.a unified-libc.o
|
2021-06-20 22:23:51 +01:00
|
|
|
cd ../${TCC_PKG}
|
2021-01-09 08:19:16 +00:00
|
|
|
|
|
|
|
# Test boot0
|
2023-11-19 01:42:07 +00:00
|
|
|
tcc-boot0 -version
|
2021-01-09 08:19:16 +00:00
|
|
|
|
|
|
|
# boot1
|
2023-11-19 01:42:07 +00:00
|
|
|
tcc-boot0 \
|
2021-01-09 08:19:16 +00:00
|
|
|
-g \
|
|
|
|
-v \
|
|
|
|
-static \
|
2023-11-19 01:42:07 +00:00
|
|
|
-o tcc-boot1 \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D BOOTSTRAP=1 \
|
2023-11-19 01:42:07 +00:00
|
|
|
-D HAVE_FLOAT=1 \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D HAVE_BITFIELD=1 \
|
|
|
|
-D HAVE_LONG_LONG=1 \
|
|
|
|
-D HAVE_SETJMP=1 \
|
|
|
|
-I . \
|
2023-11-28 02:34:41 +00:00
|
|
|
-I ${PREFIX}/include/mes \
|
2023-11-19 01:42:07 +00:00
|
|
|
-D TCC_TARGET_${TCC_TARGET_ARCH}=1 \
|
2023-11-28 02:16:09 +00:00
|
|
|
-D CONFIG_TCCDIR=\"${LIBDIR}/tcc\" \
|
|
|
|
-D CONFIG_TCC_CRTPREFIX=\"${LIBDIR}\" \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \
|
2023-11-28 02:16:09 +00:00
|
|
|
-D CONFIG_TCC_LIBPATHS=\"${LIBDIR}:${LIBDIR}/tcc\" \
|
2023-11-28 02:34:41 +00:00
|
|
|
-D CONFIG_TCC_SYSINCLUDEPATHS=\"${PREFIX}/include/mes\" \
|
2023-11-28 02:16:09 +00:00
|
|
|
-D TCC_LIBGCC=\"${LIBDIR}/libc.a\" \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D TCC_LIBTCC1=\"libtcc1.a\" \
|
|
|
|
-D CONFIG_TCCBOOT=1 \
|
|
|
|
-D CONFIG_TCC_STATIC=1 \
|
|
|
|
-D CONFIG_USE_LIBGCC=1 \
|
|
|
|
-D TCC_VERSION=\"0.9.26\" \
|
|
|
|
-D ONE_SOURCE=1 \
|
|
|
|
-L . \
|
|
|
|
tcc.c
|
2023-11-28 02:16:09 +00:00
|
|
|
cp tcc-boot1 ${BINDIR}
|
|
|
|
chmod 755 ${BINDIR}/tcc-boot1
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
cd ../${MES_PKG}
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot1 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crt1.o lib/linux/${MES_ARCH}-mes-${MES_LIBC_SUFFIX}/crt1.c
|
2023-11-19 01:42:07 +00:00
|
|
|
if match ${ARCH} x86; then
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot1 -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
|
|
|
|
tcc-boot1 -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
|
2023-11-19 01:42:07 +00:00
|
|
|
fi
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2023-11-19 01:42:07 +00:00
|
|
|
tcc-boot1 -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -D HAVE_FLOAT=1 -I include -I include/linux/${MES_ARCH} -o libtcc1.o lib/libtcc1.c
|
|
|
|
if match ${ARCH} riscv64; then
|
|
|
|
tcc-boot1 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o lib-arm64.o ../${TCC_PKG}/lib/lib-arm64.c
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot1 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o lib-arm64.o
|
2023-11-19 01:42:07 +00:00
|
|
|
else
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot1 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o
|
2023-11-19 01:42:07 +00:00
|
|
|
fi
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2023-11-19 01:42:07 +00:00
|
|
|
tcc-boot1 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o unified-libc.o unified-libc.c
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot1 -ar cr ${LIBDIR}/libc.a unified-libc.o
|
2021-06-20 22:23:51 +01:00
|
|
|
cd ../${TCC_PKG}
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2023-11-19 01:42:07 +00:00
|
|
|
# Test boot1
|
|
|
|
tcc-boot1 -version
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2023-11-19 01:42:07 +00:00
|
|
|
# boot2
|
|
|
|
tcc-boot1 \
|
2021-01-09 08:19:16 +00:00
|
|
|
-g \
|
|
|
|
-v \
|
|
|
|
-static \
|
2023-11-19 01:42:07 +00:00
|
|
|
-o tcc-boot2 \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D BOOTSTRAP=1 \
|
|
|
|
-D HAVE_BITFIELD=1 \
|
|
|
|
-D HAVE_FLOAT=1 \
|
|
|
|
-D HAVE_LONG_LONG=1 \
|
|
|
|
-D HAVE_SETJMP=1 \
|
|
|
|
-I . \
|
2023-11-28 02:34:41 +00:00
|
|
|
-I ${PREFIX}/include/mes \
|
2023-11-19 01:42:07 +00:00
|
|
|
-D TCC_TARGET_${TCC_TARGET_ARCH}=1 \
|
2023-11-28 02:16:09 +00:00
|
|
|
-D CONFIG_TCCDIR=\"${LIBDIR}/tcc\" \
|
|
|
|
-D CONFIG_TCC_CRTPREFIX=\"${LIBDIR}\" \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \
|
2023-11-28 02:16:09 +00:00
|
|
|
-D CONFIG_TCC_LIBPATHS=\"${LIBDIR}:${LIBDIR}/tcc\" \
|
2023-11-28 02:34:41 +00:00
|
|
|
-D CONFIG_TCC_SYSINCLUDEPATHS=\"${PREFIX}/include/mes\" \
|
2023-11-28 02:16:09 +00:00
|
|
|
-D TCC_LIBGCC=\"${LIBDIR}/libc.a\" \
|
2021-01-09 08:19:16 +00:00
|
|
|
-D TCC_LIBTCC1=\"libtcc1.a\" \
|
|
|
|
-D CONFIG_TCCBOOT=1 \
|
|
|
|
-D CONFIG_TCC_STATIC=1 \
|
|
|
|
-D CONFIG_USE_LIBGCC=1 \
|
|
|
|
-D TCC_VERSION=\"0.9.26\" \
|
|
|
|
-D ONE_SOURCE=1 \
|
|
|
|
-L . \
|
|
|
|
tcc.c
|
2023-11-28 02:16:09 +00:00
|
|
|
cp tcc-boot2 ${BINDIR}
|
|
|
|
chmod 755 ${BINDIR}/tcc-boot2
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
cd ../${MES_PKG}
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot2 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o ${LIBDIR}/crt1.o lib/linux/${MES_ARCH}-mes-${MES_LIBC_SUFFIX}/crt1.c
|
2023-11-19 01:42:07 +00:00
|
|
|
if match ${ARCH} x86; then
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot2 -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
|
|
|
|
tcc-boot2 -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
|
2023-11-19 01:42:07 +00:00
|
|
|
fi
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2023-11-19 01:42:07 +00:00
|
|
|
tcc-boot2 -c -D HAVE_CONFIG_H=1 -D HAVE_LONG_LONG=1 -D HAVE_FLOAT=1 -I include -I include/linux/${MES_ARCH} -o libtcc1.o lib/libtcc1.c
|
|
|
|
if match ${ARCH} riscv64; then
|
|
|
|
tcc-boot2 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o lib-arm64.o ../${TCC_PKG}/lib/lib-arm64.c
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot2 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o lib-arm64.o
|
2023-11-19 01:42:07 +00:00
|
|
|
else
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot2 -ar cr ${LIBDIR}/tcc/libtcc1.a libtcc1.o
|
2023-11-19 01:42:07 +00:00
|
|
|
fi
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2023-11-19 01:42:07 +00:00
|
|
|
tcc-boot2 -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} -o unified-libc.o unified-libc.c
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc-boot2 -ar cr ${LIBDIR}/libc.a unified-libc.o
|
2021-06-20 22:23:51 +01:00
|
|
|
cd ../${TCC_PKG}
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2023-11-19 01:42:07 +00:00
|
|
|
# Test boot2
|
|
|
|
tcc-boot2 -version
|
2021-01-09 08:19:16 +00:00
|
|
|
|
|
|
|
# We have our final tcc 0.9.26!
|
2023-11-28 02:16:09 +00:00
|
|
|
cp ${BINDIR}/tcc-boot2 ${BINDIR}/tcc
|
|
|
|
chmod 755 ${BINDIR}/tcc
|
|
|
|
rm ${BINDIR}/tcc-boot2
|
|
|
|
cp ${BINDIR}/tcc ${BINDIR}/tcc-0.9.26
|
|
|
|
chmod 755 ${BINDIR}/tcc-0.9.26
|
2021-01-09 08:19:16 +00:00
|
|
|
|
|
|
|
# Also recompile getopt, we don't need to do this during the boot* stages
|
|
|
|
# because nothing is linked against it
|
Remove the notion of "sys*"
- This idea originates from very early in the project and was, at the
time, a very easy way to categorise things.
- Now, it doesn't really make much sense - it is fairly arbitary, often
occuring when there is a change in kernel, but not from builder-hex0
to fiwix, and sysb is in reality completely unnecessary.
- In short, the sys* stuff is a bit of a mess that makes the project
more difficult to understand.
- This puts everything down into one folder and has a manifest file that
is used to generate the build scripts on the fly rather than using
coded scripts.
- This is created in the "seed" stage.
stage0-posix -- (calls) --> seed -- (generates) --> main steps
Alongside this change there are a variety of other smaller fixups to the
general structure of the live-bootstrap rootfs.
- Creating a rootfs has become much simpler and is defined as code in
go.sh. The new structure, for an about-to-be booted system, is
/
-- /steps (direct copy of steps/)
-- /distfiles (direct copy of distfiles/)
-- all files from seed/*
-- all files from seed/stage0-posix/*
- There is no longer such a thing as /usr/include/musl, this didn't
really make any sense, as musl is the final libc used. Rather, to
separate musl and mes, we have /usr/include/mes, which is much easier
to work with.
- This also makes mes easier to blow away later.
- A few things that weren't properly in packages have been changed;
checksum-transcriber, simple-patch, kexec-fiwix have all been given
fully qualified package names.
- Highly breaking change, scripts now exist in their package directory
but NOT WITH THE packagename.sh. Rather, they use pass1.sh, pass2.sh,
etc. This avoids manual definition of passes.
- Ditto with patches; default directory is patches, but then any patch
series specific to a pass are named patches-passX.
2023-11-06 23:51:23 +00:00
|
|
|
cd ../${MES_PKG}
|
2023-11-19 01:42:07 +00:00
|
|
|
tcc -c -D HAVE_CONFIG_H=1 -I include -I include/linux/${MES_ARCH} lib/posix/getopt.c
|
2023-11-28 02:16:09 +00:00
|
|
|
tcc -ar cr ${LIBDIR}/libgetopt.a getopt.o
|
2021-01-09 08:19:16 +00:00
|
|
|
|
2021-02-13 06:29:49 +00:00
|
|
|
cd ../..
|
|
|
|
|
|
|
|
# Checksums
|
2022-05-20 15:55:35 +01:00
|
|
|
if match x${UPDATE_CHECKSUMS} xTrue; then
|
|
|
|
sha256sum -o ${pkg}.checksums \
|
2023-11-19 01:42:07 +00:00
|
|
|
/usr/bin/tcc-mes \
|
|
|
|
/usr/bin/tcc-boot0 \
|
|
|
|
/usr/bin/tcc-boot1 \
|
2022-05-20 15:55:35 +01:00
|
|
|
/usr/bin/tcc \
|
|
|
|
/usr/lib/mes/libc.a \
|
|
|
|
/usr/lib/mes/libgetopt.a \
|
|
|
|
/usr/lib/mes/crt1.o \
|
|
|
|
/usr/lib/mes/crti.o \
|
|
|
|
/usr/lib/mes/crtn.o \
|
|
|
|
/usr/lib/mes/tcc/libtcc1.a
|
|
|
|
|
2023-11-28 02:16:09 +00:00
|
|
|
cp ${pkg}.checksums ${SRCDIR}
|
2022-05-20 15:55:35 +01:00
|
|
|
else
|
2023-11-19 01:42:07 +00:00
|
|
|
sha256sum -c ${pkg}.${ARCH}.checksums
|
2022-05-20 15:55:35 +01:00
|
|
|
fi
|