From 118e1b1dfb53b96df2e700c91ed2ebe6e2ce2ca0 Mon Sep 17 00:00:00 2001 From: George Hotz <geohot@gmail.com> Date: Wed, 6 Oct 2021 10:04:42 -0500 Subject: [PATCH] mipigeth + remove junk --- .github/workflows/test_embedded.yml | 2 +- README.md | 8 ++++++++ {risc => mipigeth}/.gitignore | 0 mipigeth/README | 5 +++++ mipigeth/build.sh | 10 ++++++++++ {risc => mipigeth}/compare.sh | 0 {risc => mipigeth}/data | 0 {risc => mipigeth}/requirements.txt | 0 {risc => mipigeth}/run.py | 0 {risc => mipigeth}/simple.py | 0 {risc => mipigeth}/startup.bin | Bin {risc => mipigeth}/startup.s | 0 mipigeth/startup.sh | 2 ++ risc/README | 24 ------------------------ risc/build.sh | 23 ----------------------- risc/clangwrap.sh | 14 -------------- risc/startup.sh | 2 -- risc/test.go | 7 ------- 18 files changed, 26 insertions(+), 71 deletions(-) rename {risc => mipigeth}/.gitignore (100%) create mode 100644 mipigeth/README create mode 100755 mipigeth/build.sh rename {risc => mipigeth}/compare.sh (100%) rename {risc => mipigeth}/data (100%) rename {risc => mipigeth}/requirements.txt (100%) rename {risc => mipigeth}/run.py (100%) rename {risc => mipigeth}/simple.py (100%) rename {risc => mipigeth}/startup.bin (100%) rename {risc => mipigeth}/startup.s (100%) create mode 100755 mipigeth/startup.sh delete mode 100644 risc/README delete mode 100755 risc/build.sh delete mode 100755 risc/clangwrap.sh delete mode 100755 risc/startup.sh delete mode 100644 risc/test.go diff --git a/.github/workflows/test_embedded.yml b/.github/workflows/test_embedded.yml index 2c137b551..68f516e36 100644 --- a/.github/workflows/test_embedded.yml +++ b/.github/workflows/test_embedded.yml @@ -21,5 +21,5 @@ jobs: minigeth/go-ethereum 13284491 - name: Test in the embedded world run: | - cd risc + cd mipigeth ./build.sh && ./run.py diff --git a/README.md b/README.md index f5f4a520b..89d8cd39a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,14 @@ It's half geth, half of what I think truebit was supposed to be. When it's done, * ...emulating a MIPS machine * ...running an EVM +## Directory Layout + +``` +minigeth -- A standalone "geth" capable of computing a block transition +mipigeth -- This geth compiled for MIPS. Outputs a binary that's run and mapped at 0x0 +mipsevm -- A MIPS runtime in the EVM (see also contracts/) +``` + ## Steps 1. Get minigeth to verify a block locally paying attention to oracle (done) diff --git a/risc/.gitignore b/mipigeth/.gitignore similarity index 100% rename from risc/.gitignore rename to mipigeth/.gitignore diff --git a/mipigeth/README b/mipigeth/README new file mode 100644 index 000000000..681d81c72 --- /dev/null +++ b/mipigeth/README @@ -0,0 +1,5 @@ +Compiler and emulator for minigeth in MIPS + +Similar to mipsevm, but faster. Will likely be removed if mipsevm is fast enough. + +Parts will remain to build and patch the binary diff --git a/mipigeth/build.sh b/mipigeth/build.sh new file mode 100755 index 000000000..d6448f2be --- /dev/null +++ b/mipigeth/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash -e +cd ../minigeth +export GOOS=linux +export GOARCH=mips +export GOMIPS=softfloat +go build +cd ../mipigeth + +cp ../minigeth/go-ethereum go-ethereum +file go-ethereum diff --git a/risc/compare.sh b/mipigeth/compare.sh similarity index 100% rename from risc/compare.sh rename to mipigeth/compare.sh diff --git a/risc/data b/mipigeth/data similarity index 100% rename from risc/data rename to mipigeth/data diff --git a/risc/requirements.txt b/mipigeth/requirements.txt similarity index 100% rename from risc/requirements.txt rename to mipigeth/requirements.txt diff --git a/risc/run.py b/mipigeth/run.py similarity index 100% rename from risc/run.py rename to mipigeth/run.py diff --git a/risc/simple.py b/mipigeth/simple.py similarity index 100% rename from risc/simple.py rename to mipigeth/simple.py diff --git a/risc/startup.bin b/mipigeth/startup.bin similarity index 100% rename from risc/startup.bin rename to mipigeth/startup.bin diff --git a/risc/startup.s b/mipigeth/startup.s similarity index 100% rename from risc/startup.s rename to mipigeth/startup.s diff --git a/mipigeth/startup.sh b/mipigeth/startup.sh new file mode 100755 index 000000000..c27225fd2 --- /dev/null +++ b/mipigeth/startup.sh @@ -0,0 +1,2 @@ +#!/bin/bash -e +../mipsevm/maketests.py startup.s startup.bin diff --git a/risc/README b/risc/README deleted file mode 100644 index ee2267518..000000000 --- a/risc/README +++ /dev/null @@ -1,24 +0,0 @@ -Compiler and emulator for minigeth in MIPS - -Similar to mipsevm, but faster. Will likely be removed if mipsevm is fast enough. - -Parts will remain to build and patch the binary - -== Building newlib? == -~/fun/mips/mips-gcc-4.8.1/bin/mips-elf-gcc - -wget ftp://sourceware.org/pub/newlib/newlib-4.1.0.tar.gz - -CC_FOR_TARGET="/usr/local/opt/llvm/bin/clang -ffreestanding" ../newlib-4.1.0/configure CFLAGS_FOR_TARGET="-target mips-elf" --prefix=$PWD/../sysroot/ --enable-static --target mips-elf -PATH=/Users/kafka/fun/mips/mips-gcc-4.8.1/bin:$PATH make -j8 - -== Building glibc? == -CXX=/usr/local/opt/llvm/bin/clang++ CC=/usr/local/opt/llvm/bin/clang ../glibc-2.34/configure --build mips-linux-gnu - -== Building musl? == -RANLIB="/usr/local/opt/llvm/bin/llvm-ranlib" AR="/usr/local/opt/llvm/bin/llvm-ar" CC="/usr/local/opt/llvm/bin/clang" CFLAGS="-target mips-elf -msoft-float" ../musl-1.2.2/configure --host mips-elf --prefix=$PWD/../sysroot/ --disable-shared -make -j8 -make install - -#works with mods -/usr/local/opt/llvm/bin/llvm-objdump -T ./go-ethereum diff --git a/risc/build.sh b/risc/build.sh deleted file mode 100755 index 056adeaaa..000000000 --- a/risc/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash -e -cd ../minigeth -export GOOS=linux -export GOARCH=mips -export GOMIPS=softfloat - -# brew install llvm -# ...and struggle to build musl -# for 0 gain -#export CGO_ENABLED=1 -#export CC="$PWD/../risc/clangwrap.sh" -#go build -v -ldflags "-linkmode external -extldflags -static" - -go build -cp go-ethereum ../risc/go-ethereum -cd ../risc -file go-ethereum - -# optional (doesn't work because of replacements) -#/usr/local/opt/llvm/bin/llvm-strip go-ethereum -#file go-ethereum - -#GOOS=linux GOARCH=mips go build test.go diff --git a/risc/clangwrap.sh b/risc/clangwrap.sh deleted file mode 100755 index a7d81b612..000000000 --- a/risc/clangwrap.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -export PATH="/usr/local/opt/llvm/bin" -for arg do - shift - [ "$arg" == "-g" ] && continue - #[ "$arg" == "-lpthread" ] && set -- "$@" "/Users/kafka/fun/mips/build/sysroot/lib/crt1.o" - #[ "$arg" == "-lpthread" ] && continue - [ "$arg" == "-Werror" ] && continue - [ "$arg" == "-fno-caret-diagnostics" ] && continue - #[ "$arg" == "-msoft-float" ] && continue - set -- "$@" "$arg" -done -echo "ARGS" $@ 1>&2 -exec clang -g0 -lc -target mips-linux-gnu --sysroot /Users/kafka/fun/mips/build/sysroot -fuse-ld=lld -Wno-error -nostdlib /Users/kafka/fun/mips/build/sysroot/lib/crt1.o "$@" diff --git a/risc/startup.sh b/risc/startup.sh deleted file mode 100755 index 99a50cc30..000000000 --- a/risc/startup.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -e -../mipsevm/maketests.py ../risc/startup.s ../risc/startup.bin diff --git a/risc/test.go b/risc/test.go deleted file mode 100644 index c04811917..000000000 --- a/risc/test.go +++ /dev/null @@ -1,7 +0,0 @@ -package main - -import "fmt" - -func main() { - fmt.Println("hello world") -} -- 2.23.0