Android KitKat 4.4 for Ariaboard am335x ==apt install== sudo apt-get install bison g++-multilib git gperf libxml2-utils make python-networkx zlib1g-dev:i386 zip curl flex if > u1604 apt install repo sun jdk 6 sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java6-installer make-3.82 cd ~ wget https://ftp.gnu.org/gnu/make/make-3.82.tar.gz tar -xvf make-3.82.tar.gz cd make-3.82 ./configure make ==use a proxy if needed== git proxy: git config --global http.proxy 'socks5://127.0.0.1:1080' git config --global https.proxy 'socks5://127.0.0.1:1080' http proxy: export http_proxy=http://192.168.8.25:1077 export https_proxy=http://192.168.8.25:1077 ==Kernel Cross Compiler== IMPORTANT, we usually will use armhf(gnueabihf), but for android we use arm(guneabi) use: https://launchpad.net/linaro-toolchain-binaries/trunk/2012.04/+download/gcc-linaro-arm-linux-gnueabi-2012.04-20120426_linux.tar.bz2 cd /opt wget https://launchpad.net/linaro-toolchain-binaries/trunk/2012.04/+download/gcc-linaro-arm-linux-gnueabi-2012.04-20120426_linux.tar.bz2 tar -xvf gcc-linaro-arm-linux-gnueabi-2012.04-20120426_linux.tar.bz2 at ~/.bashrc insert: export PATH=/opt/gcc-linaro-arm-linux-gnueabi-2012.04-20120426_linux/bin:$PATH ==Get Aosp 4.4.4_r1== Note we use ~/aosp Install repo command if not u1604 mkdir ~/bin curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo setup sync android code. mkdir ~/aosp cd aosp repo init -u https://android.googlesource.com/platform/manifest -b android-4.4.4_r1 repo sync -c This takes several hours because there is > 60 GiB to download. When complete you will have the AOSP code in ~/aosp ==Get Device files for am335x== cd ~/aosp/device mkdir ti cd ti git clone https://github.com/csimmonds/bbb-android-device-files.git beagleboneblack cd beagleboneblack Checkout the right version. If installing to an SD card: git checkout kk4.4-sdcard If installing to eMMC via fastboot: git checkout kk4.4-fastboot Apply the patch.... cd ~/aosp/system/core patch -p1 < ../../device/ti/beagleboneblack/0001-Fix-CallStack-API.patch Then select the product: cd ~/aosp . build/envsetup.sh lunch Select "beagleboneblack-eng" (option 1x) ==Build AOSP for am335x== croot ~/make-3.82/make -j`getconf _NPROCESSORS_ONLN` This takes an hour or two. When complete you will find the compiled Android system in ~/aosp/out/target/product/beagleboneblack/ ==Build U-boot== cd ~/aosp git clone https://github.com/c2h2/aria-uboot.git cd aria-uboot git checkout android ./build.sh ===eEnv.txt for SD CARD=== bootargs=console=ttyO0,115200n8 androidboot.console=ttyO0 rootwait ro bootcmd=mmc rescan ; fatload mmc 0 82000000 uImage ; fatload mmc 0 83000000 uRamdisk ; bootm 82000000 83000000 uenvcmd=boot ===eEnv.txt for eMMC=== bootargs=console=ttyO0,115200n8 androidboot.console=ttyO0 rootwait ro bootcmd=mmc rescan ; fatload mmc 1 82000000 uImage ; fatload mmc 1 83000000 uRamdisk ; bootm 82000000 83000000 uenvcmd=boot ==Build Kernel== use cross compiler: gcc-linaro-arm-linux-gnueabi-2012.04-20120426_linux.tar.bz2 cd ~/aosp git clone YOUR_GIT_ADDR kernel cd kernel git checkout aria_slot_480_800 ./doKernel.sh ==Build SGX Drivers== Once again I am getting these from Rowboat. This is messy because they are not very well integrated with the AOSP code. One issue is that the makefile has some paths hard coded which is why it has to be put into hardware/ti/sgx, and also why the kernel has to be in directory kernel/. cd ~/aosp/hardware/ti git clone https://github.com/csimmonds/hardware-ti-sgx sgx cd sgx git checkout ti_sgx_sdk-ddk_1.10-jb-4.3 With Rowboat, the binaries are copied into out/target/product/beagleboneblack/system after the AOSP build is complete and then post-processed into the install tar ball. I want to have them built as part of the AOSP build, so I edit one of the makefiles to put the binaries into my device directory. Then they get sucked into the final images by the rules in my device.mk. So, edit Rules.make: line 23 and change TARGETFS_INSTALL_DIR=$(ANDROID_ROOT_DIR)/out/target/product/$(TARGET_PRODUCT)/ to TARGETFS_INSTALL_DIR=$(ANDROID_ROOT_DIR)/device/ti/beagleboneblack/sgx This next bit has to be run in a completely new shell. I'm sorry, but for some reason it won't build in a shell that has been set up for an AOSP build (i.e. has ". build/emvsetup.sh").Note: W=1 is needed to avoid turning warnings into errors... $ cd ~/aosp/hardware/ti/sgx PATH=$HOME/aosp/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin:$PATH make TARGET_PRODUCT=beagleboneblack OMAPES=4.x ANDROID_ROOT_DIR=$HOME/aosp W=1 make TARGET_PRODUCT=beagleboneblack OMAPES=4.x ANDROID_ROOT_DIR=$HOME/aosp W=1 install That will result in populating device/ti/beagleboneblack/sgx ===Clean SGX Drivers=== If any compiling error occurs, or you want to remove SGX drivers, rm -rf ~/aosp/hardware/ti rm -rf ~/aosp/device/ti/beagleboneblack/sgx/* ==Final Build== Now you need to regenerate the Android image files to include the sgx binaries. This should only take a few minutes. $ cd ~/aosp . build/envsetup.sh lunch beagleboneblack-eng ~/make-3.82/make installclean ~/make-3.82/make -j`getconf _NPROCESSORS_ONLN` If something goes wrong, go back through the steps and try to identify the problem. ==Install option (1): install to SD card== You need a micro SD card of at least 4 GiB capacity. Insert your SD card into your SD card reader. It will appear as either /dev/sd? Or as /dev/mmcblk? Use fdisk or similar to create partitions like this: Partition type bootable? Size (MiB) ID and file system 1 primary * 64 c W95 FAT32 (LBA) 2 primary 32 83 Linux 3 primary 32 83 Linux 4 extended ---- (remainder of device) 5 logical 270 83 Linux 6 logical 3080 83 Linux 7 logical 270 83 Linux I am going to leave the details up to you: that way you can't blame me if it goes wrong, but as mentioned at the start, please do be aware that accidentally formatting the wrong device, for example your hard drive, is a distinct possibility. It has happened to me. So, please, double check everything.Then format the first partition, the boot partition, giving the correct device node: sudo mkfs -t vfat -n "boot" /dev/mmcblk0 Create the ramdisk: cd ~/aosp mkimage -A arm -O linux -T ramdisk -d out/target/product/beagleboneblack/ramdisk.img uRamdisk Mount the first partition and copy these files to it 1. u-boot/MLO 2. u-boot/u-boot.img 3. uRamdisk 4. device/ti/beagleboneblack/uEnv.txt 5. kernel/arch/arm/boot/uImageThe remaining image files are already in ext4 format so they can be copied directly to partitions 5, 6 and 7. For example if the SD card is /dev/mmcblk0 then cd ~/aosp/out/target/product/beagleboneblack sudo dd if=system.img of=/dev/mmcblk0p5 bs=4M sudo dd if=userdata.img of=/dev/mmcblk0p6 bs=4M sudo dd if=cache.img of=/dev/mmcblk0p7 bs=4M Now put the SD card in your BeagleBone. Hold down the boot button while powering on to get it to load U-Boot from the SD card. All being well, you should see the "Android" boot animation after about 30 seconds and the launcher screen after 90 to 120 seconds. The second time the boot should be faster, I find it to be about 30 seconds. ==Flash eMMC via SD card== Now you have a SD card made. We will need to back it up to an image. At PC Linux: sudo dd if=/dev/sdX of=andoird-ariaboard-am335x.image bs=4M pixz andoird-ariaboard-am335x.image # xz andoird-ariaboard-am335x.image Note: output image will be andoird-ariaboard-am335x.image.xz Copy the andoird-ariaboard-am335x.image.xz to sd card /root Now boot linux on Ariaboad am335x board with an SD card. Restore eMMC with command: xzcat andoird-ariaboard-am335x.image.xz > /dev/mmcblkX or unxz -c andoird-ariaboard-am335x.image.xz | dd of=/dev/mmcblkX ===sample script=== https://gist.github.com/c2h2/f2f6594492fd1926245cd6b11d6491c2 ==FAQ== *SD VS eMMC: 2 Images are identical with only one difference, check prior section uEnv.txt for SD and eMMC *Original author REF: https://github.com/c2h2/bbb-android-device-files/tree/kk4.4-sdcard