xref: /lima/
NameDateSize

..16-Mar-201612 KiB

.gitignore29-Dec-201216

include/04-Jun-20134 KiB

limare/29-Dec-20124 KiB

Makefile29-Dec-2012257

Makefile.inc29-Dec-2012761

Makefile.post29-Dec-2012253

Makefile.sysroot29-Dec-20122.8 KiB

README.android29-Dec-20124.1 KiB

tools/29-Dec-20124 KiB

wrap/04-Jun-20134 KiB

README.android

1How to set up the android ndk/sdk for building Lima.
2----------------------------------------------------
3
4Create a separate directory for this, this README uses ~/android/, but of
5course, feel free to substitute with your own.
6
7Getting the NDK/SDK:
8--------------------
9
10You will need the NDK, as this will contain the toolchain and sysroot that we
11will build against:
12http://developer.android.com/sdk/ndk/index.html
13
14You will also need the SDK, as it contains tools like adb (android debug
15bridge).
16http://developer.android.com/sdk/index.html
17
18Download and untar them into your android directory.
19
20This then gives us, with the ndk at the time of writing this readme:
21~/android/android-ndk-r7
22~/android/android-sdk-linux
23
24Setting up the NDK:
25-------------------
26
27Since we need to add some libraries and header files of our own later on, we
28need to create a standalone toolchain. While the headerfiles are generic, the
29libraries will be taken from the device, so this standalone toolchain will be
30somewhat device specific. The device for which this toolchain is being created
31in this example, is a telechips 8901, with a android-2.3 image, therefor the
32toolchain will be sent to ~/android/telechips-2.3/.
33
34Since there is a rather major issue with the make-standalone-toolchain.sh
35script, we need to provide the full path for our standalone toolchain.
36Otherwise you end up with a separate directory called ~ which will contain
37your toolchain.
38
39The script also requires to be told which platform we are for, since this
40example is for android-2.3, the platform is android-9 (see
41docs/STABLE-APIS.html in the ndk).
42
43./android-ndk-r7/build/tools/make-standalone-toolchain.sh --platform=android-9 \
44			  --install-dir=/home/user/android/telechips-2.3/
45
46You can now edit Makefile.inc in the top lima directory to point to your
47standalone toolchain and your SDK.
48
49Please verify that you now are able to build some things, by running make
50in the top lima directory. Linking will fail though as we are still missing
51some libraries (we will resolve that in the next section).
52
53Getting ADB (android debug bridge):
54-----------------------------------
55
56Descend into your sdk directory, and tools/android. This will open up a window
57called "Android SDK Manager". There, deselect whatever it tries to install, and
58instead only select "Android SDK Platform-tools" under "Tools", and then press
59"install 1 pack".
60
61Once this is done, you can verify that ADB works, by running:
62
63 make remount
64
65This will run adb remount, which remounts the /system/ partition on your
66device so that it is writable. We will be installing lima bits to it
67later on.
68
69This might fail, stating "error: insufficient permissions for device",
70which means that we still need to set up udev for this device.
71
72Setting up udev:
73----------------
74
75If adb works out of the box, this step was already done for you by your
76distribution.
77
78Run lsusb, and spot your device. For the telechips tablets, this is:
79
80	Bus xxx Device xxx: ID 18d1:deed Google Inc.
81
82As root, then edit /etc/udev/rules.d/51-android.rules and add the following
83line:
84
85SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0666", GROUP="plugdev"
86
87Now run:
88
89chmod a+r /etc/udev/rules.d/51-android.rules
90
91If you now plug in your device (or re-plug), it should be accessible.
92
93Getting the right libraries:
94----------------------------
95
96There is Makefile.sysroot. When its sysroot target is run, the sysroot/usr/lib
97directory in your standalone toolchain will be emptied, and the necessary
98libraries from your device will be pulled in instead.
99
100make -f Makefile.sysroot sysroot
101
102If all went well, you should now be able to fully build lima.
103
104If linking failed, then pull in the necessary libraries from the device
105yourself.
106
107Setting up the device:
108----------------------
109
110The following command will add two symlinks on your device, so that
111the mali EGL/GLES libraries can be linked to properly.
112
113make -f Makefile.sysroot device
114
115TODO:
116-----
117
118Everything. Most of the above could be easily automated, and make could
119check for different devices with different images, and rebuild and reinstall
120if a different device pops up.
121
122But for the time being, this is good enough, and unless someone feels
123bothered enough, it might not change :)
124