1.2. Directory Structure¶
The Processor SDK for Android contains the following top-level directories and files
These directories contain the code and tools used to develop for Processor SDK Android devices.
- android-devkit - Contains the cross-compile toolchain and libraries to speed development for the target device.
- bin - Contains the helper scripts for flashing the eMMC on the development device as well as the Android Debug Bridge (adb) tool.
- board-support - Contains the SDK components that need to be modified when porting to a custom platform. This includes the kernel, boot loader, Android Open Source Project filesystem, as well as any out of tree drivers.
- docs - Contains various SDK documentation such as the software manifest and additional user’s guide. This is also the location where you can find the training directory with the device training materials.
- filesystem -
- Makefile - Provides build targets for many of the SDK components from the top-level of the SDK.
- Rules.make - Sets default values used by the top-level Makefile as well as sub-component Makefiles.
- setup.sh - Runs the fastboot.sh script (found in bin/) to flash the eMMC of the connected device using the files in the board-support/prebuilt-images/ directory.
1.2.1. Top-Level Makefile¶
Overview
Inside of the Processor Android SDK there is a top-level Makefile that can be used to build some of the sub-components found within the SDK. This Makefile uses the Rules.make file and gives an example of how the various components can be built and the parameters to use.
Rules.make
The following sections cover the Rules.make file found in the top-level of the Processor Linux SDK.
Purpose
The Rules.make file in the top-level of the Processor Linux SDK is used not only by the top-level Makefile, but also by many of the sub-component Makefiles to gain access to common shared variables and settings. The next section covers the main variables defined in the Rules.make file.
Variables Defined
- PLATFORM - This represents the machine name of the device supported by the SDK. The PLATFORM variable can be used by component Makefiles to make decisions on a per-machine basis.
- UBOOT_MACHINE - This us used when building u-boot to configure the u-boot sources for the correct device.
- TI_SDK_PATH - This points to the top-level of the SDK. This is the same directory where the Rules.make file itself is located.
- DESTDIR - This points to the base installation directory that applications/drivers should be installed to. This is usually the root of a target file system but can be changed to point anywhere. By default the initial value is a unique key value of __DESTDIR__.
- ANDROID_DEVKIT_PATH - This points to the android-devkit directory. This directory is the base directory containing the cross-compiler and cross-libraries.
- CROSS_COMPILE - This setting represents the CROSS_COMPILE prefix to be used when invoking the cross-compiler. Many components such as the Linux kernel use the variable CROSS_COMPILE to prepend the proper prefix to commands such as gcc to invoke the ARM cross-compiler.
- LINUXKERNEL_INSTALL_DIR - This points to the location of the Linux kernel sources, which is used by components such as out-of-tree kernel drivers to find the Linux kernel Makefiles and headers.
Makefile
The following sections cover the Makefile found in the top-level of the Processor Linux SDK
Target Types
For each of the targets discussed below the following target type are defined
- <target> - This is the build target which will compile the release version of the component
- <target>_install - This target will install the component to the location pointed to by DESTDIR
- <target>_clean - This target will clean the component
Top-Level Targets
The Processor Linux SDK provides the following targets by default which will invoke the corresponding component targets:
- all - This will call the build target for each component defined in the Makefile
- install - This will call the install target for each component defined in the Makefile
- clean - This will call the clean target for each component defined in the Makefile
Common Targets
The following targets are common to all platforms in Processor Linux SDK:
- linux - Compiles the Linux kernel using the default tisdk_<PLATFORM>_defconfig configuration
- u-boot - Compiles u-boot using the default config from the Rules.make file
Additional Targets
Depending on the capabilities and software available for a given device additional targets may also be defined. You can find the list of all the targets by looking at the all target as described in the **Top-Level Targets** section above. Add devices will have one or the other of the following targets depending on the u-boot version used:
- u-boot-spl - This target will build both u-boot and the u-boot SPL (MLO) binaries used in newer versions of u-boot. This actually provides a u-boot and u-boot-spl target in the Makefile.
Usage Examples
The following examples demonstrate how to use the top-level Makefile for some common tasks. All of the examples below assume that you are calling the Makefile from the top-level of the SDK.
- Build Everything
host# make
- Clean Everything
host# make clean
- Install Everything
host# make install
- Build the Linux kernel
host# make linux
- Install the Linux kernel modules
host# make linux_install
A Note about Out-of-tree Kernel Modules
Some drivers like the SGX drivers are delivered as modules outside of the kernel tree. If you rebuild the kernel and install it using the “make linux_install” target you will also need to rebuild the out of tree modules and install them as well. The modules_install command used by the linux_install target will remove any existing drivers before installing the new ones. This means those drivers are no longer available until they have been rebuilt against the kernel and re-installed.
A Note about the Linux Kernel Version
To simplify and accelerate rebuilding and installing the linux kernel, the file .scmversion is included in the kernel source tree to pin down the version of the kernel provided in the SDK. If upgrading the kernel sources or adding new commits, this file should be removed so that the appropriate version is built into the kernel image.