Android/Building: Difference between revisions

From OLPC
Jump to navigation Jump to search
No edit summary
 
(52 intermediate revisions by 2 users not shown)
Line 1: Line 1:
How to build an Android image for XO-4.
How to build an Android and OLPC OS dual-boot image for XO-4.

We provide in [http://build.laptop.org/android/latest/ this directory] changes to the Android 4.3.1 source so that Android can be built for the XO-4 laptop, and then merged with an OLPC OS build to create a dual-boot image.


== Ingredients ==
== Ingredients ==


* a well connected development system,
* a well connected development system,
* about 20 GB of download capability,
* about 20 GB<!-- observed 14.6 GB on 2014-07-22 --> of download capability,


== Method ==
== Method ==


* follow the [http://source.android.com/source/downloading.html "Downloading the Source" guide] to install Repo,
* set up a build environment, see [http://source.android.com/source/initializing.html Initializing a Build Environment],
* install Repo, by following only the [http://source.android.com/source/downloading.html#installing-repo Installing Repo] section of the Downloading the Source guide,
* use Repo to download the Android source,
* use Repo to download the Android source from OLPC repositories,
$ repo init -u https://android.googlesource.com/platform/manifest -b android-4.3.1_r1
$ repo init -u git://dev.laptop.org/users/ben/android_manifest -b android-4.3.1-xo4
$ repo sync
$ repo sync
* if you would like to include google services, download developer package from here [http://dev.laptop.org/~ben/gapps.tar.gz gapps]. See also [http://wiki.cyanogenmod.org/w/Google_Apps Google Apps]
* go to [[#Source code]] see how to apply patches and prepare source code before start the build.
:* The Google Apps packages are NOT SUPPORTED in any way by OLPC.
$ tar -zxvf gapps.tar.gz
$ mv gapps vendor/olpc/xo4/
* start the build:
* start the build:
$ . build/envsetup.sh
$ . build/envsetup.sh
$ lunch 13
$ lunch 14
$ make installclean && make -j8 && make userdatatarball
$ make -j8

* ensure you have a copy of the OLPC OS Linux, Sugar and Gnome build file, e.g. 32013o4.zd,
:*(the 14 means to build engineer version ... use command "lunch" to list all the build options, [[Android/Building/Variants]])
* edit mkzd.sh to match file names,
:*(the -j8 means to run eight concurrent threads of build ... the number of threads should be chosen according to how many CPU cores your build environment has access to.)
* prepare a .zd file for the XO-4:
* install the {{code|android-tools-fsutils}} package or ensure you have simg2img tools in your /usr/bin/ [http://dev.laptop.org/~ben/simg2img simg2img]
* create zd file:

=== Android only image ===
$ cd vendor/olpc/xo4/mkzd
$ cd vendor/olpc/xo4/mkzd
$ ./mkzd.sh
$ sudo ./mkzd.sh

=== Combine Android with Sugar ===
* ensure you have a copy of the OLPC OS Linux, Sugar and Gnome build file, e.g. 32014o4.zd,
$ cd vendor/olpc/xo4/sugar-combiner
$ make
$ sudo ./mkzd.sh


== Alternative Method ==
== Alternative Method ==
Line 29: Line 41:
To merge an already published Android build with an already published OLPC OS derived build:
To merge an already published Android build with an already published OLPC OS derived build:
* download the system.img, ramdisk.img, and kernel files from the Android [http://build.laptop.org/android/latest/ build directory],
* download the system.img, ramdisk.img, and kernel files from the Android [http://build.laptop.org/android/latest/ build directory],
* download the build derived from OLPC OS, e.g. 32013xx4.zd or 4_0b125.zd,
* download the build derived from OLPC OS, e.g. 41008o4.zd or 4_0b125.zd,
* download the mkzd.sh tool, and edit it to match file names,
* download the mkzd.sh tool (from http://dev.laptop.org/git/users/ben/android_vendor_olpc_xo4/ ), and edit it to match file names,
* run mkzd.sh
* run mkzd.sh

Using an Android build before 2015 on XO-4 produced in 2015 requires a special kernel, contact OLPC for details.


== Source code ==
== Source code ==
Line 38: Line 52:


* OLPC Android kernel for XO4 [[Android/Kernel]]
* OLPC Android kernel for XO4 [[Android/Kernel]]
You can also download kernel image form [http://dev.laptop.org/git/users/ben/android_device_olpc_xo4-kernel/ device/olpc/xo4-kernel] git repository
:* You can also download kernel image form [http://build.laptop.org/android/latest/kernel latest kernel] if you don't want to change kernel
* source code from google AOSP project branch "android-4.3.1_r1". [http://source.android.com/source/downloading.html "Downloading the Source" guide]
* source code from google AOSP project branch "android-4.3.1_r1". [http://source.android.com/source/downloading.html "Downloading the Source" guide]
* OLPC patches for AOSP project.
* OLPC patches for AOSP project.


{| border="1" align="center" cellpadding="6" textAlign="left"
{| border="1" align="center" cellpadding="6" textAlign="left"
|- align="center"
|<div style="text-align: left; direction: ltr; margin-left: 1em;">frameworks/base</div>
|<div style="text-align: left; direction: ltr; margin-left: 1em;">manifest</div>
|[http://dev.laptop.org/git/users/ben/android_frameworks_base/log/?h=android-4.3.1-xo4 git repository]
|[http://dev.laptop.org/git/users/ben/android_manifest/log/?h=android-4.3.1-xo4 git repository]
|- align="center"
|- align="center"
|<div style="text-align: left; direction: ltr; margin-left: 1em;">frameworks/av</div>
|<div style="text-align: left; direction: ltr; margin-left: 1em;">frameworks/av</div>
|[http://dev.laptop.org/git/users/ben/android_frameworks_av/log/?h=android-4.3.1-xo4 git repository]
|[http://dev.laptop.org/git/users/ben/android_frameworks_av/log/?h=android-4.3.1-xo4 git repository]
|- align="center"
|<div style="text-align: left; direction: ltr; margin-left: 1em;">frameworks/base</div>
|[http://dev.laptop.org/git/users/ben/android_frameworks_base/log/?h=android-4.3.1-xo4 git repository]
|- align="center"
|- align="center"
|<div style="text-align: left; direction: ltr; margin-left: 1em;">frameworks/native</div>
|<div style="text-align: left; direction: ltr; margin-left: 1em;">frameworks/native</div>
Line 60: Line 78:
|<div style="text-align: left; direction: ltr; margin-left: 1em;">hardware/libhardware_legacy</div>
|<div style="text-align: left; direction: ltr; margin-left: 1em;">hardware/libhardware_legacy</div>
|[http://dev.laptop.org/git/users/ben/android_hardware_libhardware_legacy/log/?h=android-4.3.1-xo4 git repository]
|[http://dev.laptop.org/git/users/ben/android_hardware_libhardware_legacy/log/?h=android-4.3.1-xo4 git repository]
|- align="center"
|<div style="text-align: left; direction: ltr; margin-left: 1em;">hardware/marvell</div>
|[http://dev.laptop.org/git/users/ben/android_hardware_marvell/log/?h=android-4.3.1-xo4 git repository]
|- align="center"
|- align="center"
|<div style="text-align: left; direction: ltr; margin-left: 1em;">build</div>
|<div style="text-align: left; direction: ltr; margin-left: 1em;">build</div>
Line 67: Line 88:
|[http://dev.laptop.org/git/users/ben/android_bionic/log/?h=android-4.3.1-xo4 git repository]
|[http://dev.laptop.org/git/users/ben/android_bionic/log/?h=android-4.3.1-xo4 git repository]
|- align="center"
|- align="center"
|<div style="text-align: left; direction: ltr; margin-left: 1em;">external/bluetooth</div>
|<div style="text-align: left; direction: ltr; margin-left: 1em;">external/bluetooth/bluedroid</div>
|[http://dev.laptop.org/git/users/ben/android_external_bluetooth/log/?h=android-4.3.1-xo4 git repository]
|[http://dev.laptop.org/git/users/ben/android_external_bluetooth_bluedroid/log/?h=android-4.3.1-xo4 git repository]
|- align="center"
|- align="center"
|<div style="text-align: left; direction: ltr; margin-left: 1em;">external/kernel-headers</div>
|<div style="text-align: left; direction: ltr; margin-left: 1em;">external/kernel-headers</div>
Line 92: Line 113:
{| border="1" align="center" cellpadding="6"
{| border="1" align="center" cellpadding="6"
|<div style="text-align: left; direction: ltr; margin-left: 1em;">vendor/marvell/generic</div>
|<div style="text-align: left; direction: ltr; margin-left: 1em;">vendor/marvell/generic</div>
|[http://dev.laptop.org/git/users/ben/android_vendor_marvell_generic/ git repository]
|[http://dev.laptop.org/git/users/ben/android_vendor_marvell_generic/log/?h=android-4.3.1-xo4 git repository]
|-
|-
|<div style="text-align: left; direction: ltr; margin-left: 1em;">vendor/marvell/external</div>
|<div style="text-align: left; direction: ltr; margin-left: 1em;">vendor/marvell/external</div>
|[http://dev.laptop.org/git/users/ben/android_vendor_marvell_external/ git repository]
|[http://dev.laptop.org/git/users/ben/android_vendor_marvell_external/log/?h=android-4.3.1-xo4 git repository]
|- align="center"
|- align="center"
|<div style="text-align: left; direction: ltr; margin-left: 1em;">vendor/olpc/xo4</div>
|<div style="text-align: left; direction: ltr; margin-left: 1em;">vendor/olpc/xo4</div>
|[http://dev.laptop.org/git/users/ben/android_vendor_olpc_xo4/ git repository]
|[http://dev.laptop.org/git/users/ben/android_vendor_olpc_xo4/log/?h=android-4.3.1-xo4 git repository]
|- align="center"
|- align="center"
|<div style="text-align: left; direction: ltr; margin-left: 1em;">device/olpc/xo4</div>
|<div style="text-align: left; direction: ltr; margin-left: 1em;">device/olpc/xo4</div>
|[http://dev.laptop.org/git/users/ben/android_device_olpc_xo4/ git repository]
|[http://dev.laptop.org/git/users/ben/android_device_olpc_xo4/log/?h=android-4.3.1-xo4 git repository]
|- align="center"
|- align="center"
|<div style="text-align: left; direction: ltr; margin-left: 1em;">device/olpc/xo4-kernel</div>
|<div style="text-align: left; direction: ltr; margin-left: 1em;">device/olpc/xo4-kernel</div>
|[http://dev.laptop.org/git/users/ben/android_device_olpc_xo4-kernel/ git repository]
|[http://dev.laptop.org/git/users/ben/android_device_olpc_xo4-kernel/log/?h=android-4.3.1-xo4 git repository]
|}
|}


Line 112: Line 133:
* [[Android]]
* [[Android]]
* [[Android/Kernel]]
* [[Android/Kernel]]
* [[Android/Building/Variants]]
* [[Android/Building/SystemAPPs]]

Latest revision as of 09:26, 5 August 2015

How to build an Android and OLPC OS dual-boot image for XO-4.

Ingredients

  • a well connected development system,
  • about 20 GB of download capability,

Method

$ repo init -u git://dev.laptop.org/users/ben/android_manifest -b android-4.3.1-xo4
$ repo sync
  • if you would like to include google services, download developer package from here gapps. See also Google Apps
  • The Google Apps packages are NOT SUPPORTED in any way by OLPC.
$ tar -zxvf gapps.tar.gz
$ mv gapps vendor/olpc/xo4/
  • start the build:
$ . build/envsetup.sh
$ lunch 14
$ make installclean && make -j8 && make userdatatarball
  • (the 14 means to build engineer version ... use command "lunch" to list all the build options, Android/Building/Variants)
  • (the -j8 means to run eight concurrent threads of build ... the number of threads should be chosen according to how many CPU cores your build environment has access to.)
  • install the android-tools-fsutils package or ensure you have simg2img tools in your /usr/bin/ simg2img
  • create zd file:

Android only image

$ cd vendor/olpc/xo4/mkzd
$ sudo ./mkzd.sh

Combine Android with Sugar

  • ensure you have a copy of the OLPC OS Linux, Sugar and Gnome build file, e.g. 32014o4.zd,
$ cd vendor/olpc/xo4/sugar-combiner
$ make
$ sudo ./mkzd.sh

Alternative Method

To merge an already published Android build with an already published OLPC OS derived build:

Using an Android build before 2015 on XO-4 produced in 2015 requires a special kernel, contact OLPC for details.

Source code

source code for building Android is a combination of 4 parts.

  • You can also download kernel image form latest kernel if you don't want to change kernel
manifest
git repository
frameworks/av
git repository
frameworks/base
git repository
frameworks/native
git repository
system/core
git repository
hardware/libhardware
git repository
hardware/libhardware_legacy
git repository
hardware/marvell
git repository
build
git repository
bionic
git repository
external/bluetooth/bluedroid
git repository
external/kernel-headers
git repository
external/webkit
git repository
packages/apps/Calendar
git repository
packages/apps/Gallery2
git repository
packages/apps/Launcher2
git repository
packages/providers/CalendarProvider
git repository
  • source code from vendor, Marvell and OLPC
vendor/marvell/generic
git repository
vendor/marvell/external
git repository
vendor/olpc/xo4
git repository
device/olpc/xo4
git repository
device/olpc/xo4-kernel
git repository

See Also