Commit 9b8181a2 authored by George Hotz's avatar George Hotz

build hello world

parent 71a65cba
......@@ -2,4 +2,6 @@ __pycache__
go-ethereum
sysroot
test
test.bin
minigeth
minigeth.bin
......@@ -6,7 +6,7 @@ export GOMIPS=softfloat
go build
cd ../mipigeth
cp ../minigeth/go-ethereum go-ethereum
file go-ethereum
cp ../minigeth/go-ethereum minigeth
file minigeth
./compile.py
#!/usr/bin/env python3
import sys
import struct
from rangetree import RangeTree
from elftools.elf.elffile import ELFFile
......@@ -6,8 +7,8 @@ from elftools.elf.elffile import ELFFile
from unicorn import *
from unicorn.mips_const import *
def load_minigeth(mu):
elf = open("go-ethereum", "rb")
def load_minigeth(mu, fn="minigeth"):
elf = open(fn, "rb")
data = elf.read()
elf.seek(0)
......@@ -62,16 +63,19 @@ def load_minigeth(mu):
#traceback.print_exc()
pass
assert(found == 2)
#assert(found == 2)
return prog_size, r
if __name__ == "__main__":
mu = Uc(UC_ARCH_MIPS, UC_MODE_32 + UC_MODE_BIG_ENDIAN)
prog_size, _ = load_minigeth(mu)
fn = "minigeth"
if len(sys.argv) > 1:
fn = sys.argv[1]
prog_size, _ = load_minigeth(mu, fn)
print("compiled %d bytes" % prog_size)
with open("minigeth.bin", "wb") as f:
with open(fn+".bin", "wb") as f:
f.write(mu.mem_read(0, prog_size))
\ No newline at end of file
package main
import "fmt"
func main() {
fmt.Println("hello world")
}
#!/bin/bash -e
export GOOS=linux
export GOARCH=mips
export GOMIPS=softfloat
go build test.go
./compile.py test
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