开发环境
ubuntu10.04-desktop-amd64
eclipse
=================================================
提示: 参考Ti官网:
因为上面有些错误,才做下记录。目前发先在配置jdk的时候,少了两句。
源码下载,有两种方式:repo和bin文件
我用的是TI-Android-JB-4.1.2_AM335x_4.0.1.bin
需要的包:
For 64-bit Ubuntu 10.04
The following command installs the required packages for setting up the android build host:
$ sudo apt-get install git-core gnupg flex bison gperf build-essential \ zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \ x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev \ libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown \ libxml2-utils xsltproc minicom tftpd uboot-mkimage expect
Install Oracle JDK 6
- Download the latest JDK 6 installer from Oracle http://www.oracle.com/technetwork/java/javase/downloads/index.html.
Accept the license agreement and click on the Linux x64 bin installer. The downloaded file will be named jdk-6uXX-linux-x64.bin where XX is the JDK 6 update version. - Follow the following steps to install JDK 6
$ chmod a+x jdk-6uXX-linux-x64.bin $ ./jdk-6uXX-linux-x64.bin $ sudo mkdir -p /usr/lib/jvm $ sudo mv jdk1.6.0_XX /usr/lib/jvm/ $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.6.0_XX/bin/java" 1 $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.6.0_XX/bin/javac" 1 $ sudo update-alternatives --install "/usr/bin/jar" "jar" "/usr/lib/jvm/jdk1.6.0_45/bin/jar" 1 (擦,这句命令在TI官方没有,但是在编译filesystem时,报jar命令找不到的错误。)
$ sudo update-alternatives --install "/usr/bin/javadoc" "javadoc" "/usr/lib/jvm/jdk1.6.0_45/bin/javadoc" 1 (官网这条命令也漏了)
$ sudo update-alternatives --config javadoc $ sudo update-alternatives --config java $ sudo update-alternatives --config javac $ sudo update-alternatives --config jar
解压源码文件:
$ cd $HOME $ chmod a+x TI-Android-JB-4.1.2_AM335x_4.0.1.bin $ ./TI-Android-JB-4.1.2_AM335x_4.0.1.bin
- Accept the Licence when the installer prompts
- This will generate following sources
- Android File system : $HOME/TI-Android-JB-4.1.2_AM335x_4.0.1/
- Android Linux Kernel: $HOME/TI-Android-JB-4.1.2_AM335x_4.0.1/kernel
- Bootloader : $HOME/TI-Android-JB-4.1.2_AM335x_4.0.1/u-boot
- Toolchain location will be at $HOME/TI-Android-JB-4.1.2_AM335x_4.0.1/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin
Toolchain setup指定工具链
- Setup the toolchain path to point to arm-eabi- tools in prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin
-
TI-source是你的源码目录
$ export PATH=$HOME/TI-source/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH 我的说export PATH=/home/dzt/android/TI-Android/prebuilts/ gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH
环境基本完成.
开始编译:
Build Procedure
To Build Bootloader
- Change directory to u-boot
$ cd <android source path>/u-boot
- Execute following commands:
$ make CROSS_COMPILE=arm-eabi- distclean ----清理config $ make CROSS_COMPILE=arm-eabi- am335x_evm_config ---设置config $ make CROSS_COMPILE=arm-eabi-
- This command will generate MLO and the u-boot Image u-boot.img
NOTE: The above command will work for AM335x EVM, AM335x Starter Kit and BeagleBone
To Build Android Linux Kernel
- Change directory to kernel
$ cd <android source path>/kernel
- Execute following commands
$ make ARCH=arm CROSS_COMPILE=arm-eabi- distclean $ make ARCH=arm CROSS_COMPILE=arm-eabi- am335x_evm_android_defconfig $ make ARCH=arm CROSS_COMPILE=arm-eabi- uImage
This will generate uImage(kernel image) in kernel/arch/arm/boot folder
NOTE: Generated uImage can be run on AM335xevm, AM335x Starter Kit and BeagleBone.
To Build Android Filesystem
Filesystem with SGX(回到源码目录,暂时不知道SGX是什么)
cd ..
- To Build the root filesystem for AM335x EVM, AM335x Starter Kit and BeagleBone
$ make TARGET_PRODUCT=<product-name> OMAPES=4.x -j<N>
- am335xevm for AM335x EVM
- am335xevm_sk for AM335x Starter Kit
- beaglebone for BeagleBone
e.g: To build the full filesystem for AM335x EVM:
$ make TARGET_PRODUCT=am335xevm OMAPES=4.x -j4
NOTE:
- <N> should be twice the number of processors on your host machine. For example, a dual core machine would use -j4
- The above command will build Android filesystem, kernel, <product_name> related modules,
- Drivers and modules for SGX and WLAN will be built and installed in android rootfs for AM335x EVM and AM335x Starter Kit
- Android rootfs components (root and system directories) will be located in out/target/product/<product-name>.
本次编译出错:
jar: command not found
解决:原来是jdk的jar命令没有配置好,见上面install jdk.
还在摸索中。。。