Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
9b8181a2
Commit
9b8181a2
authored
Oct 06, 2021
by
George Hotz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build hello world
parent
71a65cba
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
27 additions
and
8 deletions
+27
-8
.gitignore
mipigeth/.gitignore
+2
-0
build.sh
mipigeth/build.sh
+2
-2
compile.py
mipigeth/compile.py
+10
-6
test.go
mipigeth/test.go
+7
-0
testbuild.sh
mipigeth/testbuild.sh
+6
-0
No files found.
mipigeth/.gitignore
View file @
9b8181a2
...
@@ -2,4 +2,6 @@ __pycache__
...
@@ -2,4 +2,6 @@ __pycache__
go-ethereum
go-ethereum
sysroot
sysroot
test
test
test.bin
minigeth
minigeth.bin
minigeth.bin
mipigeth/build.sh
View file @
9b8181a2
...
@@ -6,7 +6,7 @@ export GOMIPS=softfloat
...
@@ -6,7 +6,7 @@ export GOMIPS=softfloat
go build
go build
cd
../mipigeth
cd
../mipigeth
cp
../minigeth/go-ethereum
go-ethereum
cp
../minigeth/go-ethereum
minigeth
file
go-ethereum
file
minigeth
./compile.py
./compile.py
mipigeth/compile.py
View file @
9b8181a2
#!/usr/bin/env python3
#!/usr/bin/env python3
import
sys
import
struct
import
struct
from
rangetree
import
RangeTree
from
rangetree
import
RangeTree
from
elftools.elf.elffile
import
ELFFile
from
elftools.elf.elffile
import
ELFFile
...
@@ -6,8 +7,8 @@ from elftools.elf.elffile import ELFFile
...
@@ -6,8 +7,8 @@ from elftools.elf.elffile import ELFFile
from
unicorn
import
*
from
unicorn
import
*
from
unicorn.mips_const
import
*
from
unicorn.mips_const
import
*
def
load_minigeth
(
mu
):
def
load_minigeth
(
mu
,
fn
=
"minigeth"
):
elf
=
open
(
"go-ethereum"
,
"rb"
)
elf
=
open
(
fn
,
"rb"
)
data
=
elf
.
read
()
data
=
elf
.
read
()
elf
.
seek
(
0
)
elf
.
seek
(
0
)
...
@@ -62,16 +63,19 @@ def load_minigeth(mu):
...
@@ -62,16 +63,19 @@ def load_minigeth(mu):
#traceback.print_exc()
#traceback.print_exc()
pass
pass
assert
(
found
==
2
)
#assert(found == 2)
return
prog_size
,
r
return
prog_size
,
r
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
mu
=
Uc
(
UC_ARCH_MIPS
,
UC_MODE_32
+
UC_MODE_BIG_ENDIAN
)
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
)
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
))
f
.
write
(
mu
.
mem_read
(
0
,
prog_size
))
\ No newline at end of file
mipigeth/test.go
0 → 100644
View file @
9b8181a2
package
main
import
"fmt"
func
main
()
{
fmt
.
Println
(
"hello world"
)
}
mipigeth/testbuild.sh
0 → 100755
View file @
9b8181a2
#!/bin/bash -e
export
GOOS
=
linux
export
GOARCH
=
mips
export
GOMIPS
=
softfloat
go build test.go
./compile.py
test
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment