-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathREADME
140 lines (106 loc) · 4.14 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Quickstart Instructions to build/run HiStar on Ubuntu/Debian amd64/i386
# install required packages
sudo apt-get install git-core build-essential texinfo flex bison qemu autoconf automake
# get GNU tools
mkdir tools
cd tools
wget http://mirrors.kernel.org/gnu/gcc/gcc-4.1.2/gcc-core-4.1.2.tar.bz2 \
http://mirrors.kernel.org/gnu/gcc/gcc-4.1.2/gcc-g++-4.1.2.tar.bz2 \
ftp://sourceware.org/pub/binutils/snapshots/binutils-2.22.51.tar.bz2
# unpack them
for F in *.tar.bz2; do tar jxvf $F; done
# setup binutils
cd binutils-2.22.51
./configure --target=x86_64-jos-linux --prefix=/usr/local \
--disable-nls --enable-64-bit-bfd
make
sudo make install
cd ..
# setup gcc
rm -r gcc-4.1.2/libstdc++-v3
cd gcc-4.1.2/
./configure --target=x86_64-jos-linux --prefix=/usr/local \
--disable-nls --without-headers --with-newlib \
--disable-threads --disable-shared --disable-libmudflap \
--disable-libssp
make
sudo make install
cd ..
# checkout histar
git clone http://www.scs.stanford.edu/histar/gitrepo/ histar
# configure histar
cd histar/conf/embedbin
cp default.mk local.mk
# edit local.mk and at your option comment out anything you don't want to
# compile, probably: development, demo, X11 graphics sections and also comment
# out usr/file and terminfo.tar
cd ../..
make
cp conf/sample-qemu.sh qemu.sh
# histar compiles in a directory called "obj.${git-branch-name}.${arch}"
# so edit the qemu.sh to run the version of histar you compiled
# the default case is the "master" branch for "amd64" so
edit qemu.sh, change "obj" to "obj.master.amd64"
From here you should be able to run ./qemu.sh and you should be at the shell
of a working histar box.
== Instructions to build other tools that may be useful ==
* To configure bochs, you need --enable-x86-64:
./configure --enable-disasm \
--enable-iodebug \
--enable-4meg-pages --enable-pae --enable-global-pages \
--enable-x86-64 \
--enable-all-optimizations \
--enable-x86-debugger \
--with-x11 --with-nogui \
--enable-instrumentation \
--enable-pci \
--enable-pnic \
--enable-gdb-stub
For the internal debugger (doesn't disassemble AMD64 code very well),
replace --enable-gdb-stub with --enable-debugger:
./configure --enable-disasm \
--enable-iodebug \
--enable-4meg-pages --enable-pae --enable-global-pages \
--enable-x86-64 \
--enable-all-optimizations \
--enable-x86-debugger \
--with-x11 --with-nogui \
--enable-instrumentation \
--enable-pci \
--enable-pnic \
--enable-debugger
On bochs 2.2, --enable-instrumentation doesn't compile, but CVS
versions work. Unfortunately, bochs doesn't seem to emulate AMD64
very faithfully. For example, the OpenBSD 3.7 floppy won't boot.
* binutils
Download binutils from http://www.kernel.org/pub/linux/devel/binutils/
./configure --target=x86_64-jos-linux --prefix=/usr/local \
--disable-nls --enable-64-bit-bfd
* GCC 4.1.2
unpack both gcc-core and gcc-g++
rm -r gcc-4.1.2/libstdc++-v3
./configure --target=x86_64-jos-linux --prefix=/usr/local \
--disable-nls --without-headers --with-newlib \
--disable-threads --disable-shared --disable-libmudflap \
--disable-libssp
We don't build libstdc++-v3, libmudflap, or libssp, because it
requires system headers and crt files for the target platform.
Note that for some versions of gcc, you may need to say "env
SHELL=/bin/sh gmake" if you have a different shell.
* GDB
./configure --target=x86_64-jos-linux --prefix=/usr/local \
--disable-nls --enable-64-bit-bfd
* AMD64 assembly intro:
http://www.x86-64.org/documentation/assembly
* Qemu
For qemu 0.9.0 and earlier, you must apply ./conf/qemu-cmpxchg8b.patch
to make the cmpxchg8b instruction restartable.
For qemu 0.8.2 and earlier, you must apply ./conf/qemu-movd.patch to
avoid 32-bit truncation for some MMX operations.
./configure --disable-kqemu --disable-sdl --disable-gfx-check \
--cc=gcc34 --host-cc=gcc34 \
--target-list='x86_64-softmmu i386-softmmu sparc-softmmu arm-softmmu'
* To boot HiStar for the first time:
% gmake
% cp conf/sample-qemu.sh qemu.sh
% ./qemu.sh