Appendix B

Open Source Repositories

The Android operating system is mostly open source. Although some components are closed source, many parts of the system are either released open source under a permissive license (BSD or Apache) or under a license that requires that modifications be released open source (GNU Public License [GPL]). Because of the GPL, many vendors in the ecosystem make source code modifications available to the general public. This appendix documents the publicly accessible resources that distribute the source code used to build various Android devices.

Google

As mentioned in Chapter 1 of this book, Google is the originator of the Android operating system. Google develops new versions in secret and then contributes the code to the Android Open Source Project (AOSP) upon release. Several of the facilities Google provides for accessing source code are documented elsewhere in this text, but for your convenience, we have repeated them here.

AOSP

The AOSP is a collection of Git repositories that contain the open source parts of the Android operating system. It is the primary outlet for all things Android. It even serves as the upstream starting point for original equipment manufacturers (OEMs) to build firmware images. In addition to the source code for the different runtime components, AOSP includes a full build environment, source for the Native Development Kit (NDK) and Software Development Kit (SDK), and more. It supports building full device images for Nexus devices in spite of some components being provided in binary-only form.

For any given device, there are two primary components: the platform and the kernel. For Nexus devices, both components are contained completely in AOSP. The AOSP repository, which was once hosted alongside the Linux kernel source, is now hosted on Google's own servers at the following URL: https://android.googlesource.com/.

AOSP uses a special tool called repo to organize and manage the collection of Git repositories. You can find more information on using this tool and obtain a full source checkout from Google's official documentation at http://source.android.com/source/downloading.html.

In addition to being able to check out the AOSP repository in whole or in part, Google provides a source browsing facility via its Google Code site: https://code.google.com/p/android-source-browsing/.

As mentioned in Chapter 10, kernel source repositories are split up based on System-on-Chip (SoC) support. There are repositories for Open Multimedia Applications Platform (OMAP) from Texas Instruments, Mobile Station Modem (MSM) from Qualcomm, Exynos from Samsung, Tegra from Nvidia, and the emulator (goldfish). Although the upstream source trees for these are maintained by the SoC manufacturers themselves, Google hosts the repository officially used for Nexus devices.

Gerrit Code Review

Beyond providing source code repositories and a source browser, Google also hosts a Gerrit code review system. It is through this system that contributors from outside Google are encouraged to submit patches. Keeping an eye on this repository enables researchers to see potential changes that are being made to the AOSP code prior to the changes actually being committed. You can find the Gerrit source-code review system at: https://android-review.googlesource.com/.

SoC Manufacturers

Within the Android ecosystem, the SoC manufacturers are responsible for creating Board Support Packages (BSPs). These BSPs are nothing more than modified versions of upstream projects ported to work on the SoC manufacturers' hardware.

Each manufacturer maintains its own source repositories. Whether this development is done completely in the open is largely up to the manufacturer itself. Many do provide an open source repository, but some do not. The primary open source component for BSPs is the Linux kernel. Under the terms of the GPL, these companies are legally bound to provide access to kernel source modifications in some form.

The rest of this section sheds light on the practices of the top SoC manufacturers.

AllWinner

The AllWinner SoC is an ARM core that is developed by AllWinner Technology in the Guangdong Province in China. The code name for these SoCs is sunxi. Conveniently, AllWinner makes the source code for its BSP, including its kernel and several other components, available via GitHub: https://github.com/linux-sunxi.

It's worth noting that there is no official Google mirror of these sources because, to date, no official AOSP-supported devices have been built on AllWinner's SoCs.

Intel

Unlike the rest of the SoC manufacturers in this section, Intel does not produce ARM chips. Instead, Intel is attempting to break into the mobile space using power efficient x86-based SoCs based on its Atom line. Specifically, the Bay Trail and Silvermont SoCs are aimed at the mobile space, but very few actual Android devices are built on them. That said, Intel is the biggest proponent of running Android on X86 hardware and provides quite a few resources under the “android-ia” moniker. Intel makes its resources available via its developer site, Gerrit code review, and download site:

Marvell

Marvell is traditionally known as a manufacturer of several plug form factor ARM computers. Few mobile devices are based on Marvell ARM SoCs. One device that is rumored to be based on Android and a Marvell SoC is the One Laptop Per Child (OLPC) XO Tablet. Apart from the mobile space, many second-generation Google TV devices, which are cousins of Android devices, are built on Marvell SoCs. Although Marvell appears to have an open source site, it was empty at the time of this writing.

Some Marvell SoC-specific code is included in the upstream Linux kernel, though. You can find it at: http://opensource.marvell.com/.

MediaTek

MediaTek is another Chinese SoC manufacturer. In addition to producing SoCs, it also produces many other peripheral chips used by other OEMs. The source code for drivers for many of its components is available on its download site at: http://www.mediatek.com/_en/07_downloads/01_windows.php?sn=501.

Like AllWinner, no AOSP-supported devices to date have been built on a MediaTek SoC.

Nvidia

Nvidia produces the Tegra line of ARM SoCs used by several Android devices, including the Nexus 7 2012. As an upstanding member of the ecosystem, Nvidia operates a developer program, both for its Tegra SoCs and for its budding Shield video game system. Additionally, it provides a convenient GitWeb interface to its open source Git repositories. It's also possible to check out the source directly from the GitWeb site or from the AOSP mirror:

Texas Instruments

Though Texas Instruments (TI) has stated its intention to exit the mobile space, its OMAP SoCs have been used in a large number of Android devices over the years. This includes the Samsung Galaxy Nexus, Pandaboard, and Google Glass. As one would expect, Google hosts a mirror of the OMAP kernel inside AOSP. You can find various versions of the OMAP kernel source at:

Due to its long life in the ecosystem, there are numerous resources that address the OMAP platform, including community-run Wikis. Following are links to a few of the relevant resources:

Qualcomm

Qualcomm is perhaps the most prolific SoC manufacturer in the Android ecosystem, producing both MSM and Application Processor Qualcomm (APQ) families of SoCs. APQ differs from MSM in that it is only an application processor; it does not include a baseband.

In the Android open source community, Qualcomm provides extensive resources to the CodeAurora forum. CodeAurora is a consortium of companies that are working openly to bring optimizations and innovation to end users. A number of open source repositories, including some that are not Android-specific, are available via the CodeAurora forum site. Additionally, Google maintains a mirror of the MSM kernel tree used in its Nexus devices. Use the following three URLs to find source code for Qualcomm:

Samsung

Samsung produces its own family of SoCs dubbed Exynos. It uses these in the manufacturing of several of its Android-based mobile devices, including certain versions of the Galaxy S3 and Galaxy S4. Samsung makes its kernel source code and some of its modifications to the Android tree available via a searchable Open Source portal. Because the Nexus S and Nexus 10 are based on Exynos SoCs, Google hosts a mirror of the kernel trees. The following URLs provide access to Samsung's open source code:

In addition, several development boards are based on Exynos. Hardkernel's ODROID products, InSignal's OrigenBoard, and ArndaleBoard are among these. Source code for these devices is available from the respective manufacturers at the following sites:

OEMs

Recall that OEMs are ultimately responsible for creating end-user devices that are functional. It is no surprise that OEMs make the most modifications to the various components. This includes open source components as well as those licensed under proprietary licenses or developed in house. However, only the former changes are typically released in source code form. Like the SoC manufacturers, OEMs are legally required to release some code under the terms of the GPL.

Although all OEMs are bound by mostly the same rules, actual practices vary from one to the next. That is, some OEMs use an open development process using sites like GitHub, whereas others develop in secret and provide only downloadable code in archive form. The time it takes each OEM to make its code available can also vary from one OEM to the next or one release to the next. The rest of this section sheds light on the practices of several top device OEMs and provides links to the source code download portal for them.

ASUS

As a manufacturer of several Android devices, including the popular Nexus 7 tablets, ASUS makes source code available to the general public. Shortly after releasing a new firmware update, ASUS makes the source code available on its support website in the form of compressed TAR archives. Because the Nexus 7 tablets run vanilla Android, no source code is hosted for those devices. To find the source code for a particular device, visit the ASUS support site (www.asus.com/support) and search for the device by name or model number, click the Drivers & Tools, and select Android from the drop-down list.

HTC

HTC is one of the oldest Android equipment manufacturers. It created the very first publicly available developer device—the HTC G1. At the time of its release, it was frequently called the “G Phone.” Later, HTC produced the Nexus One, which was the first Nexus device ever made. Although these two devices were supported by AOSP, HTC has also made a large number of retail devices over the years. Most recently, it released another favorite among consumers: the HTC One.

HTC typically posts source code within a few days of making a firmware release. The available source is limited to the Linux kernel. None of HTC's extensive platform modifications are released as open source. HTC releases source code as compressed TAR archives via its Developer Center website at http://www.htcdev.com/devcenter/downloads.

LG

LG has quickly become one of the top OEMs with devices such as the Optimus G and LG G2. LG also created the two most recent Nexus smart phones, the Nexus 4 and 5. As with other OEMs, LG does not release source code for its Nexus devices because they are entirely AOSP supported. However, LG does release source code for its retail devices. Unfortunately, it sometimes takes quite a while for LG to post the source code after releasing a new firmware revision. You can easily locate the compressed TAR archive containing source code for a particular device by searching LG's open source portal for the device's name or model number: http://www.lg.com/global/support/opensource/index.

Motorola

Motorola has been a player in the Android ecosystem for quite some time. It comes as no surprise with Motorola's background in silicon as well as the mobile space. Motorola created the ultra-popular RAZR flip phone. In 2013, Google acquired Motorola Mobility, the department of Motorola that produces Android devices. Though it has yet to make a Nexus device, it has made quite a few retail devices. For example, Motorola produces the DROID line of devices for Verizon.

Motorola releases the source code used to build its devices via a Source Forge project page. The releases happen in a fairly timely fashion, usually within a month or so of the release of a device or firmware. The files are made available as compressed TAR archives at http://sourceforge.net/motorola/wiki/Projects/.

Samsung

Samsung is the market leader in Android devices and has produced some of the most popular devices to date. Samsung's offerings include the Galaxy line of devices as well as three Nexus devices: the Nexus S, Galaxy Nexus, and Nexus 10. Samsung is fairly timely in its source code releases. It makes the source code available as compressed TAR archives via its open source portal. This includes both kernel and platform archives, which you can find at http://opensource.samsung.com/.

Sony Mobile

Sony's mobile division was born from a partnership and subsequent acquisition of Ericsson, a Swedish mobile company. Over the years of involvement in the mobile ecosystem, Ericsson produced many devices. Some of the most recent devices include the Xperia line. Sony Mobile has yet to produce a Nexus device.

Sony-Ericsson is perhaps the quickest and most open when it comes to its source code. In some cases, it releases the source code for devices prior to release. Further, Sony-Ericsson is the only Android device OEM that embraces open source so much as to create an official GitHub account to host code. In addition to its GitHub account, Sony-Ericsson also makes traditional compressed TAR archives available via its developer portal. You can access these sites using the following URLs:

Upstream Sources

As mentioned numerous times through this book, Android is an amalgamation of many open source projects. AOSP contains a local copy of nearly all of these projects in the external directory. As of this writing, the subdirectory count is 169. Although it isn't necessarily a one-to-one mapping, many of these directories represent an open source project that is managed entirely separately from Android. Each project likely varies in the way the developers do their development. In any case, a few quick Internet searches should turn up a project home page for each project. Using those resources, you can usually find access to the latest versions of the upstream project's source code. For example, WebKit is one of the larger open source projects in the external directory. Its project home page is http://www.webkit.org/ and the process for obtaining its source code is documented in detail at http://www.webkit.org/building/checkout.html.

The largest open source component of the Android operating system is undoubtedly the Linux kernel. Literally thousands of developers have contributed to the project. The source code itself, uncompressed, stands at almost 600 megabytes (MB). As mentioned earlier in this appendix, Google and other companies host working mirrors of the Linux kernel source code. These mirrors are often specific to a device or SoC family. In addition, the Linux kernel project continues to chug along on its own. The upstream Linux kernel project has many resources surrounding it, but the source code itself has been hosted on www.kernel.org for quite some time. Be warned, though; using the upstream Linux kernel source repositories is not for the faint of heart, because there are many projects, repositories, and divisions of responsibility. The following URLs link to the Linux kernel's official source code repositories and include: the main repository listing, the stable tree, and Linus' merge tree.

Others

In addition to the source code resources already documented in this appendix, the Android hobbyist community also makes a decent amount of source code available. From Custom firmware to motivated individuals, Android-related source code is available all over the Internet. This section documents several sources we found while researching Android security.

Custom Firmware

Custom firmware teams operate much in the same way that an OEM's software team would operate. They customize the AOSP code and manage integrating software that supports the various hardware components found in devices. Projects such as CyanogenMod, AOKP, SuperNexus, OmniROM, and more make their source code available openly. Most even develop entirely in the open. You can find the source code for the four projects mentioned here at the following URLs:

Linaro

The Linaro project is another great resource that makes a lot of source code available. It operates similar to a Linux distribution in that it tries to port and integrate components in an open effort to product high quality builds. The Linaro project source code is at https://wiki.linaro.org/Source.

Replicant

Another interesting project is the Replicant project. The aim of Replicant is to produce a fully open source and liberally licensed device firmware that is compatible with Android. It doesn't seek to carry the Android name, but is based on AOSP. Find out more at http://redmine.replicant.us/projects/replicant/wiki/ReplicantSources.

Code Indexes

As a matter of convenience, a few independent parties have set up a browsable and searchable index of the AOSP source code. Here's one we recommend:

Individuals

Beyond these projects, quite a few individuals in the community put up a repository and develop interesting features. For example, efforts by individuals include back-porting new Android releases to unsupported devices. Locating these types of source repositories can be tricky, though. Searching popular open source development sites like GitHub and BitBucket is one way to locate these repositories. Another way is to watch the popular Android-related news sites like Android Police or forums like XDA Developers.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.222.196.175