forked from limboemu/limbo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.developers
295 lines (223 loc) · 10.5 KB
/
README.developers
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
Limbo Emulator (QEMU) for Android
================================================================================
1. What is Limbo?
Limbo is a QEMU-based emulator for Android. It currently supports PC emulation
for Intel x86 architecture.
For more information, instructions, guides, known issues, and downloads visit:
https://github.com/limboemu/limbo
===============================================================================
2. Requirements:
Android SDK
Android NDK r14b/gcc (clang is optional but generates slower runtime binaries)
Android Studio (3.1.1 prefered)
Android device with Android OS 5.0 (Lollipop) and above
Linux Desktop pc (Ubuntu prefered)
Make sure you have the following packages installed, if not run:
sudo apt-get install make autoconf automake git python binutils libtool-bin pkg-config flex bison
===============================================================================
3. Known Issues:
https://github.com/limboemu/limbo/issues
===============================================================================
4. Setup Environment
a. Update variables for paths to NDK directories for your Build Environment
in ./limbo-android-lib/src/main/jni/android-limbo-config.mak
b. Configure your PATH variable add the NDK Directory so makefile can find ndk-build
Examples:
For bash:
export PATH=$PATH:/home/dev/tools/ndk/android-ndk-r14b
5. Get and Patch libraries
#Make sure you're under the jni directory
cd ./limbo-android-lib/src/main/jni
#Note: if some of these file links don't download with wget use your browser to download them
##### Get QEMU
wget http://download.qemu-project.org/qemu-5.1.0.tar.xz -P /tmp/
tar -xJf /tmp/qemu-5.1.0.tar.xz
mv qemu-5.1.0 qemu
##### GET glib
wget https://ftp.gnome.org/pub/GNOME/sources/glib/2.56/glib-2.56.1.tar.xz -P /tmp/
tar -xJf /tmp/glib-2.56.1.tar.xz
mv glib-2.56.1 glib
##### GET libffi
wget https://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz -P /tmp/
tar -xzf /tmp/libffi-3.2.1.tar.gz
mv libffi-3.2.1 libffi
##### GET pixman
wget https://www.cairographics.org/releases/pixman-0.34.0.tar.gz -P /tmp/
tar -xzf /tmp/pixman-0.34.0.tar.gz
mv pixman-0.34.0 pixman
##### GET SDL2
wget https://www.libsdl.org/release/SDL2-2.0.8.tar.gz -P /tmp/
tar -xzf /tmp/SDL2-2.0.8.tar.gz
mv SDL2-2.0.8 SDL2
Now you should have this directory structure:
jni/
android-config/
compat/
glib/
libffi/
limbo/
patches/
pixman/
qemu/
SDL2/
### Apply patch for QEMU 5.1.0:
Make sure the following line is uncommented in android-qemu-config.mak
include android-qemu-config-5.1.0.mak
Apply the patch on the terminal:
cd ./limbo-android-lib/src/main/jni/qemu/
patch -p1 < ../patches/qemu-5.1.0.patch
# for QEMU versions 4 and above you can enable MTTCG on the ui
# this will only work if your android device is 64bit
modify Config.java:
set to true: public static boolean enableMTTCG = true;
### Apply glib patch for Limbo:
cd ./limbo-android-lib/src/main/jni/glib/
patch -p1 < ../patches/glib-2.56.1.patch
### Other QEMU versions:
# If you want to distribute Limbo build with other QEMU versions, create your own patch like this:
cd /limbo-android-lib/src/main/jni/qemu/
diff -ru --no-dereference /tmp/qemu-x.x.x . | grep -v '^Only in' > ../patches/qemu-x.x.x.patch
Don't forget to create your android-qemu-config-x.x.x.mak file
and include it in android-qemu-config.mak
===============================================================================
5. Build
a. To build the NDK part of the app make sure you're under the jni directory:
cd limbo-android-lib/src/main/jni
Make sure you update the android-config/android-limbo-config.mak file with the NDK path you have installed:
NDK_ROOT = /home/dev/tools/ndk/android-ndk-r14b
b. From Android Studio import BOTH the Android library limbo-android-lib AND the module for the guest
architecture you need (x86,arm,ppc,sparc) ie limbo-android-x86.
c. Build the native libraries:
cd limbo-android-lib/src/main/jni:
To build Limbo Emulator:
export BUILD_HOST=<EABI>
export BUILD_GUEST=<GUEST_ARCH>
export NDK_DEBUG=<ENABLE_DEBUG>
make limbo
where:
EABI is the Android device type (host arch): armeabi-v7a, arm64-v8a, x86, x86_64
GUEST_ARCH is the Emulator type: x86_64-softmmu,aarch64-softmmu,sparc64-softmmu, ppc64-softmmu
ENABLE_DEBUG is 1 (optional)
If you want to remove ALL previously compiled native objects and libraries:
make clean
If you're building apk for multiple host architectures you need to do in betweeen builds:
make distclean
If you're building apk for multiple guest architectures you can specify them with commas:
BUILD_GUEST=x86_64-softmmu,aarch64-softmmu
Examples:
1) To build Limbo x86 Emulator for ARM64 phones type:
export BUILD_HOST=arm64-v8a
export BUILD_GUEST=x86_64-softmmu
make limbo
2) To build Limbo x86 Emulator for ARM phones type:
export BUILD_HOST=armeabi-v7a
export BUILD_GUEST=x86_64-softmmu
make limbo
3) To build Limbo ARM Emulator for ARM64 phones type:
export BUILD_HOST=arm64-v8a
export BUILD_GUEST=aarch64-softmmu
make limbo
4) To build Limbo x86 Emulator for Intel x86 32bit phones/tablets/PCs type:
export BUILD_HOST=x86
export BUILD_GUEST=x86_64-softmmu
make limbo
5) To build Limbo x86 Emulator for Intel x86 64bit PCs type:
export BUILD_HOST=x86_64
export BUILD_GUEST=x86_64-softmmu
make limbo
6) To build Limbo ARM Emulator for ARM64 phones for debugging type:
export NDK_DEBUG=1
export BUILD_HOST=arm64-v8a
export BUILD_GUEST=aarch64-softmmu
make limbo
7) To build multiple Limbo emulators for ARM phones type:
export BUILD_HOST=arm64-v8a
export BUILD_GUEST=x86_64-softmmu,aarch64-softmmu
make limbo
You should now have the following libraries in these 2 folders:
limbo-android-lib/src/main/jniLibs/<EABI>/
libcompat-iconv.so
libcompat-intl.so
libcompat-limbo.so
libcompat-SDL2-ext.so
libglib-2.0.so
liblimbo.so
libpixman-1.so
libSDL2.so
limbo-android-<GUEST_ARCH>/src/main/jniLibs/<EABI>/
libqemu-system-xxx.so
Note:
When you build the apk in Android Studio it will contain the libraries from both
folders so you don't need to copy files manually.
d. Build the Android apk for the corresponding guest using Android Studio.
Make sure the *.so libraries are zipped in the final .apk
e. If you want to build the debugging version:
Set variables in Config.java:
debug = true;
Modify android-config/android-limbo-config.mak and point to a configuration
with no optimization:
USE_OPTIMIZATION=false
Follow the steps to build the native libraries as described above
export NDK_DEBUG=1
Important:
From Android studio click Build> Rebuild Project and Run > Debug
f. To debug the native code for a particular guest:
# for x86 guest and ARM64 phone:
export BUILD_HOST=arm64-v8a
export BUILD_GUEST=x86_64-softmmu
make ndk-gdb PKG_NAME=com.limbo.emu.main
# for other guests use respectively:
make ndk-gdb PKG_NAME=com.limbo.emu.main.arm
make ndk-gdb PKG_NAME=com.limbo.emu.main.sparc
make ndk-gdb PKG_NAME=com.limbo.emu.main.ppc
Note: you might want to disable signal handling in gdb:
handle all nostop noprint
To catch a SIGSEGV:
handle 11 stop print
Useful commands:
To set breakpoints: b <file.c>:<code_line>
To step statement: s
To go to next statement: n
To continue: c
To halt(interrupt): ctrl-c
To see stack (backtrace): bt
===============================================================================
6. Development
a. Codes Changes for Android compatibility are in patch files marked with __ANDROID__
b. Similarly for LIMBO functionality code changes are tagged with __LIMBO__
c. Important Configuration files (You'll need to update this with the NDK path before compiling):
limbo-android-lib/src/main/jni/android-config/android-limbo-config.mak
d. Advanced QEMU config files:
limbo-android-lib/src/main/jni/android-config/android-qemu-config.mak
d. Advanced Device Configuration files:
limbo-android-lib/src/main/jni/android-config/android-device-config/*.mak
e. Important Makefiles:
limbo-android-lib/src/main/jni/Makefile
limbo-android-lib/src/main/jni/Android.mk
limbo-android-lib/src/main/jni/Application.mk
limbo-android-lib/src/main/jni/android-limbo-build.mak
limbo-android-lib/src/main/jni/android-qemu-build.mak
f. Frontend UI options configuration see: Config.java
===============================================================================
7. Run
a. Installing a full Qwerty keyboard for Android like Hacker's keyboard
from the Google Android store. Make sure you use Transparent theme
and Direct Draw found under Theme settings.
b. Start the Limbo app and choose CPU, Memory (~8-64MB),etc..
c. Choose a bootable disk image(s) for CDRom, Floppy, and a HDD image
d. Start the virtual machine.
e. For more instructions and guides visit:
https://github.com/limboemu/limbo
f. Have fun!
===============================================================================
8. Changelog
See limbo-android-lib/src/main/assets/CHANGELOG for release notes
===============================================================================
9. License
Limbo PC Emulator is released under GPL v2 License.
All icons unders /res are from Gnome Project (GPL v2 License)
See file COPYING under root directory
and LICENSE under limbo-android-lib/src/main/assets
Other source included are released under their own license please view Licenses under each subdirectory
===============================================================================
Endofdoc