Commit 118e1b1d authored by George Hotz's avatar George Hotz

mipigeth + remove junk

parent c9a63b35
...@@ -21,5 +21,5 @@ jobs: ...@@ -21,5 +21,5 @@ jobs:
minigeth/go-ethereum 13284491 minigeth/go-ethereum 13284491
- name: Test in the embedded world - name: Test in the embedded world
run: | run: |
cd risc cd mipigeth
./build.sh && ./run.py ./build.sh && ./run.py
...@@ -11,6 +11,14 @@ It's half geth, half of what I think truebit was supposed to be. When it's done, ...@@ -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 * ...emulating a MIPS machine
* ...running an EVM * ...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 ## Steps
1. Get minigeth to verify a block locally paying attention to oracle (done) 1. Get minigeth to verify a block locally paying attention to oracle (done)
......
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
#!/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
#!/bin/bash -e
../mipsevm/maketests.py startup.s startup.bin
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
#!/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
#!/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 "$@"
#!/bin/bash -e
../mipsevm/maketests.py ../risc/startup.s ../risc/startup.bin
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment