User:CodeKipper/SDK build howto A23

From linux-sunxi.org
Jump to navigation Jump to search

Allwinner usually provides device manufacturers with a complete SDK that includes the matching u-boot and kernel sources (with some odd binaries), Android packages, buildroot, build scripts and a matching Linaro toolchain.

Development board vendors share the SDK with hardware owners to customize. This howto assumes you have such an SDK. This document is based on the A23 SDKs.

Warning

This howto is not complete and the intention is to merge it into the original SDK how to.

Contents of the SDK

The SDK is split into several parts, but the build scripts requires them to be complete.

  • android
  • lichee
    • build.sh -- main build script
    • buildroot -- rootfs, toolchain, and build scripts
    • linux-3.4 -- linux kernel
    • brandy -- boot related stuff
      • build.sh -- simple build script for u-boot
      • u-boot-2011.09 -- Allwinner's port of u-Boot
    • out -- build intermediaries and results. toolchain is also in here
    • tools
      • tools_win -- LiveSuit/PhoenixSuit tools and drivers
      • pack -- tools and configuration related to firmware packing
        • chips -- chip specific files (boot0/u-boot binaries, fex files)
        • common -- common config files and tools
        • out -- work directory for firmware packing
        • pack -- firmware packing script

Android Build

Once you have unpacked the SDK (the lichee directory in particular), you can go in a do a straight full build, which results in a LiveSuite image.

Configuring the Build

The SDK can build android or linux flavor images, and may target different boards. Running ./build.sh will list the options.

lichee$ ./build.sh

To change the configuration add config as an argument. Running build.sh will produce binaries and images under out/android/common. We will need to point to these files during the building of the android image.

Building Android

android$ source build/envsetup.sh 
including device/asus/grouper/vendorsetup.sh
including device/asus/tilapia/vendorsetup.sh
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/armv7-a/vendorsetup.sh
including device/generic/mips/vendorsetup.sh
including device/generic/x86/vendorsetup.sh
including device/lge/mako/vendorsetup.sh
including device/samsung/maguro/vendorsetup.sh
including device/samsung/manta/vendorsetup.sh
including device/samsung/toroplus/vendorsetup.sh
including device/samsung/toro/vendorsetup.sh
including device/softwinner/polaris-c1/vendorsetup.sh
including device/softwinner/polaris-c2/vendorsetup.sh
including device/softwinner/polaris-common/vendorsetup.sh
including device/softwinner/polaris-evb/vendorsetup.sh
including device/softwinner/polaris-p1gms/vendorsetup.sh
including device/softwinner/polaris-p1/vendorsetup.sh
including device/softwinner/polaris-p4/vendorsetup.sh
including device/ti/panda/vendorsetup.sh
including sdk/bash_completion/adb.bash

android$ lunch

You're building on Linux

Lunch menu... pick a combo:
     1. full-eng
     2. full_x86-eng
     3. vbox_x86-eng
     4. full_mips-eng
     5. full_grouper-userdebug
     6. full_tilapia-userdebug
     7. mini_armv7a_neon-userdebug
     8. mini_armv7a-userdebug
     9. mini_mips-userdebug
     10. mini_x86-userdebug
     11. full_mako-userdebug
     12. full_maguro-userdebug
     13. full_manta-userdebug
     14. full_toroplus-userdebug
     15. full_toro-userdebug
     16. polaris_c1-eng
     17. polaris_c2-eng
     18. polaris_evb-eng
     19. polaris_p1gms-user
     20. polaris_p1-eng
     21. polaris_p4-eng
     22. full_panda-userdebug

Which would you like? [full-eng] 21

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.2.2
TARGET_PRODUCT=polaris_p4
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.2.0-68-generic-x86_64-with-Ubuntu-12.04-precise
HOST_BUILD_TYPE=release
BUILD_ID=JDQ39
OUT_DIR=out
============================================


android$make

This should create the image files that are needed for packing. I found that this failed as the kernel and modules were missing from the device/softwinner/polaris-p4/ directory. To fix this then I created symbolic links to the files created when we built buildroot.

android$ cd device/softwinner/polaris-p4/
android$ ln -s ../../../../lichee/out/android/common/bImage kernel
android$ mkdir modules
android$ ln -s ../../../../../lichee/out/android/common/lib/modules/3.4.39 modules/modules
android$ make

Packing the Image

Run the following command to pack the final LiveSuit image.

lichee$ ./build.sh pack

Enter the same selection as you made when you configured the build at the start.

I found that the packing script was looking for the CRANE_IMAGE_OUT variable to be set. I know this is done by vendorsetup.sh in androiddevice/softwinner/polaris-common but I haven't worked out what calls that. In the end I added this line to lichee/tools/pack

CRANE_IMAGE_OUT=../../../../android/out/target/product/polaris-p4

The resulting file that can flashed using LiveSuit can be found lichee/tools/pack. In this case it's called sun8iw3p1_android_polaris-p4.img.