-
Notifications
You must be signed in to change notification settings - Fork 458
/
README.developers
343 lines (261 loc) · 12.3 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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
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 or r23b/clang
Android Studio (3.1.1 preferred)
Android device with Android OS 8.0 (Oreo) and above
Linux Desktop pc (Ubuntu preferred)
Make sure you have the following packages installed, if not run:
sudo apt-get install make autoconf automake git python binutils
sudo apt-get install libtool-bin pkg-config flex bison gettext texinfo rsync
For development you can use your own editors Geany is highly
recommended for editing the native code
===============================================================================
3. Known Issues:
https://github.com/limboemu/limbo/issues
===============================================================================
4. Update Configuration
If you build the supported QEMU version then the only thing you need to do is edit file:
limbo-android-lib/src/main/jni/android-limbo-config.mak
In all other cases you have to look at the config files under:
limbo-android-lib/src/main/jni/android-config/
For more information see the Building section.
5. Get and Compile external libraries
#Make sure you're under the jni directory
cd ./limbo-android-lib/src/main/jni
# Now download the source code for the external libraries and unzip them under the jni directory
#Note: if some of these file links don't download with wget use your browser to download them
##### Get QEMU
# download link: http://download.qemu-project.org/qemu-x.x.x.tar.xz
# Current versions supported by limbo: 5.1.0 and 2.9.1
# example for version 5.1.0:
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
# For QEMU version 2.9.1:
wget http://download.qemu-project.org/qemu-2.9.1.tar.xz -P /tmp/
tar -xJf /tmp/qemu-2.9.1.tar.xz
mv qemu-2.9.1 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.3.tar.gz -P /tmp/
tar -xzf /tmp/libffi-3.3.tar.gz
mv libffi-3.3 libffi
##### GET pixman
wget https://www.cairographics.org/releases/pixman-0.40.0.tar.gz -P /tmp/
tar -xzf /tmp/pixman-0.40.0.tar.gz
mv pixman-0.40.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/
===============================================================================
6. Apply patches
### Apply patch for QEMU:
# example for 5.1.0:
cd ./limbo-android-lib/src/main/jni/qemu/
patch -p1 < ../patches/qemu-5.1.0.patch
# for 2.9.1:
patch -p1 < ../patches/qemu-2.9.1.patch
### Apply glib patch for Limbo:
cd ./limbo-android-lib/src/main/jni/glib/
patch -p1 < ../patches/glib-2.56.1.patch
### Apply SDL2 patch for Limbo:
cd ./limbo-android-lib/src/main/jni/SDL2/
patch -p1 < ../patches/sdl2-2.0.8.patch
### Other QEMU versions:
# If you want to redistribute 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
===============================================================================
7. Build
a. To build the native part of the app make sure you're under the jni directory:
cd limbo-android-lib/src/main/jni
Make sure you update file android-limbo-config.mak with the NDK folder to your installation folder
keep in mind the last NDK version that supported gcc was r14b. The alternative is to use clang
with ndk version r23. For example:
NDK_ROOT = /home/dev/tools/ndk/android-ndk-r14b
The rest of the configuration is for specifying the right QEMU version: USE_QEMU_VERSION
the host architecture (android device): BUILD_HOST
and the emulator guest architecture: BUILD_GUEST
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:
# Make sure you're still under the jni directory:
cd limbo-android-lib/src/main/jni
# Instead of editing android-limbo-config.mak you can also supply the variables on the command line.
# For example:
export BUILD_HOST=<EABI>
export BUILD_GUEST=<GUEST_ARCH>
export NDK_DEBUG=<ENABLE_DEBUG>
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)
# To start the build type on your terminal:
make limbo
Notes:
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 between 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
8) To build limbo for older devices with gcc set the following options:
export NDK_ROOT=/home/dev/tools/ndk/android-ndk-r14b
export USE_GCC=true
export BUILD_HOST=armeabi-v7a
export BUILD_GUEST=x86_64-softmmu
export USE_QEMU_VERSION=2.9.1
export USE_AAUDIO=false
For more options see android-limbo-config.mak
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. To build from the command line instead of Android Studio:
export ANDROID_SDK_ROOT=~/Android/Sdk
gradle wrapper
./gradlew assembleRelease
f. 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
===============================================================================
8. Debugging
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
===============================================================================
9. Development Notes
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-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
g. When using git apply the following setting to your config file if you want to use
return new lines for windows:
[core]
eol = true
autocrlf = input
fileMode = false
===============================================================================
10. 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!
===============================================================================
10. Changelog
See limbo-android-lib/src/main/assets/CHANGELOG for release notes
===============================================================================
11. License
Limbo PC Emulator is released under GPL v2 License.
All icons under /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