diff --git a/seed/seed.kaem b/seed/seed.kaem index 5fd74491..94b01aca 100755 --- a/seed/seed.kaem +++ b/seed/seed.kaem @@ -61,6 +61,7 @@ M2LIBC_PATH=/M2libc # mes envars NYACC_PKG=nyacc-1.00.2 MES_PKG=mes-0.27.1 +PNUT_PKG=pnut-1.0 MES_PREFIX=${SRCDIR}/${MES_PKG}/build/${MES_PKG} GUILE_LOAD_PATH=${MES_PREFIX}/mes/module:${MES_PREFIX}/module:${SRCDIR}/${MES_PKG}/build/${NYACC_PKG}/module diff --git a/steps/manifest b/steps/manifest index 21778657..c6a48b95 100644 --- a/steps/manifest +++ b/steps/manifest @@ -34,6 +34,7 @@ build: checksum-transcriber-1.0 build: simple-patch-1.0 build: mes-0.27.1 +build: pnut-exe-1.0 build: tcc-0.9.26 build: tcc-0.9.27 define: BUILD_FIWIX = ( KERNEL_BOOTSTRAP == True || BUILD_KERNELS == True ) diff --git a/steps/pnut-exe-1.0/pass1.kaem b/steps/pnut-exe-1.0/pass1.kaem new file mode 100755 index 00000000..b1eea8ab --- /dev/null +++ b/steps/pnut-exe-1.0/pass1.kaem @@ -0,0 +1,74 @@ +#!/bin/sh + +# SPDX-FileCopyrightText: 2025 Laurent Huberdeau +# +# SPDX-License-Identifier: GPL-3.0-or-later + +set -ex + +# Variables +M2LIB="../../../M2-Planet/M2libc/" +PNUT_BRANCH="laurent-small-fixes-for-TCC" +PNUT_DIR="pnut-${PNUT_BRANCH}" + +# Check tarball checksums +checksum-transcriber sources +sha256sum -c sources.SHA256SUM + +# Unpack +mkdir build +cd build +# ungz --file ${DISTFILES}/${PNUT_PKG}.tar.gz --output ${PNUT_PKG}.tar +untar --file ${DISTFILES}/${PNUT_PKG}.tar + +M2-Planet \ + --architecture x86 \ + --debug \ + --expand-includes \ + -I ${M2LIB} \ + --file ${PNUT_DIR}/pnut.c \ + -D target_i386_linux=1 \ + -D NO_TERNARY_SUPPORT=1 \ + -D ONE_PASS_GENERATOR=1 \ + -D SMALL_HEAP=1 \ + -o pnut-exe.M1 + +# Generate basic DWARF debug info (optional) +blood-elf \ + --file pnut-exe.M1 \ + --little-endian \ + --entry _start \ + --output pnut-exe-footer.M1 + +# Compile to hex2 (for debug: -f pnut-footer.M1) +M1 \ + --file ${M2LIB}/x86/x86_defs.M1 \ + --file ${M2LIB}/x86/libc-full.M1 \ + --file pnut-exe.M1 \ + --file pnut-exe-footer.M1 \ + --architecture x86 \ + --little-endian \ + --output pnut-exe.hex2 + +# Assemble +mkdir -p bin + +hex2 \ + --architecture x86 \ + --little-endian \ + --file ${M2LIB}/x86/ELF-x86-debug.hex2 \ + --file pnut-exe.hex2 \ + --base-address 0x8048000 \ + --output bin/pnut-exe + +# Recompile pnut with itself, this time +./bin/pnut-exe \ + -D target_i386_linux=1 \ + -D ONE_PASS_GENERATOR=1 \ + -D BOOTSTRAP_TCC=1 \ + ${PNUT_DIR}/pnut.c \ + -o bin/pnut-exe-for-tcc + +# Install pnut-exe +cp bin/pnut-exe-for-tcc ${BINDIR}/pnut +chmod 755 ${BINDIR}/pnut diff --git a/steps/pnut-exe-1.0/pnut-exe-1.0.x86.checksums b/steps/pnut-exe-1.0/pnut-exe-1.0.x86.checksums new file mode 100644 index 00000000..85e3ffde --- /dev/null +++ b/steps/pnut-exe-1.0/pnut-exe-1.0.x86.checksums @@ -0,0 +1,13 @@ +62895fcf68b21961e018c797b3144fc86f9dbd5a535776e9e68a01b3fd33de08 /usr/bin/mes-m2 +761fe4fbbee5bfd45506ea8dbd0aeecfe8855159bd794e07fca1988109510170 /usr/bin/mescc.scm +234c264965116a24583dd569050adc766d7cc2da83b1db38085210f26031b70c /usr/lib/x86-mes/crt1.s +494f184a87175abc485a898c250c3831b2b5dcf5aead46591e00b39d1c5529fc /usr/lib/x86-mes/crt1.o +8afe05c3e1e8848b6f3e8de751524de5f69818eb8524659827918e3fddde3e1e /usr/lib/x86-mes/x86.M1 +06c6e43ab7f09e7779df786c57ba5b8775468ae8a47a0426278e9adc52d675c8 /usr/lib/x86-mes/libmescc.s +ef79bc2c59768c172ff4806c6eff9c5e1373d5660c51b33ee4a513f9dda726bd /usr/lib/x86-mes/libc+tcc.s +69050424c9bd83cea8d9b878d5a7cbca01fd4a43b3722a34145843d80f4c8e40 /usr/lib/x86-mes/libc.s +bfb362848fc83a8a58421636a51b1514d1915b58a5a2354c703dfec64c899cad /usr/lib/x86-mes/libmescc.a +b00e8579329bf011bfccebaeb96c1fedb160a38cad63fd628d6b9110b6fb268a /usr/lib/x86-mes/libc+tcc.a +b31c6a0fe5feb53d2d8ba1989c936fd94f43967b8e655ae1c36392723dc8ae3d /usr/lib/x86-mes/libc.a +82cac4353375a52efecc6fda1f8b37373988fe41ed197b63d8e906321b105d77 /usr/lib/linux/x86-mes/elf32-header.hex2 +f9873d9aab12e70f24d97f8319e17a1e698ca60779ae9a6ab3ede648cd60fc61 /usr/lib/linux/x86-mes/elf32-footer-single-main.hex2 diff --git a/steps/pnut-exe-1.0/sources b/steps/pnut-exe-1.0/sources new file mode 100644 index 00000000..8d9a376b --- /dev/null +++ b/steps/pnut-exe-1.0/sources @@ -0,0 +1,3 @@ +f https://github.com/udem-dlteam/pnut/archive/refs/heads/laurent/small-fixes-for-TCC.tar.gz 6e662dbf450c8ec2b3be0bfd5db6e198c566f430e63c29edd7225dbdf09de17b pnut-1.0.tar.gz +f https://github.com/udem-dlteam/pnut/archive/refs/heads/laurent/small-fixes-for-TCC.tar.gz 66df0ebd8e2507cbab63c253b1911c5cbb9ba90635f88e9017a4adc83c90ecb0 pnut-1.0.tar +f https://mirrors.kernel.org/gnu/mes/mes-0.27.1.tar.gz 183a40ea47ea49f8a1e3bd1b9d12e676374d64d63bc79e7bc1ae7d673dfdf25d