odroid-m1:software:building_android

Android

This page will introduce you to how you can download and build the Android source tree to customize it for your usage.

If you have not built Android on your desktop yet, please read Android's official build environment set up guide https://source.android.com/source/initializing.html carefully before you proceed. Otherwise, you may experience unexpected errors and will need to read a long and complicated build log to find the problem.

We have used only Ubuntu 16.04 and 18.04 64bit with 16GB RAM since other newer versions had some issues while building the Android OS.
If you use Ubuntu 20.04 or later, you should install python 2.7 before building the Android OS.
Android 11 build needs the OpenJDK 8, not the Oracle-Java-JDK.
Also note that you need around 239GB of free space in your storage to get the full source code and binary space. https://source.android.com/source/requirements.html

If you want to build the full Android source tree, don't download & build the kernel source separately.
Separate Kernel build might break the Android build process.

Before building Android, you must change the default shell from dash to bash.

host
$ sudo dpkg-reconfigure dash

Answer:No

The Android 11.0.0 build source tree use builtin prebuilt compiler.
So you don't need to download another cross compiler.

This command will initiate to download the Android source tree for ODROID-M1.
The full source includes u-boot, kernel and Android repositories.

host
$ mkdir odroid-m1
$ cd odroid-m1
$ repo init -u https://github.com/hardkernel/android.git -b rk356x_11.0.0_master -m Android11.xml
$ repo sync
'repo sync' command will be fail.
You must download camera_engine_rkaiq.zip and core.zip directly.
https://dn.odroid.com/RK3568/source/ and install source from zip.
camera_engine_rkaiq.zip → external/
core.zip → system/
host
$ source build/envsetup.sh
$ lunch odroidm1-eng
$ ./build.sh -KAoS
We recommend that you build userdebug once you've tested it with the eng variant.
lunch odroidm1-userdebug

Once Android build is complete, you will have all necessary files to download into your MicroSD/eMMC. You can install the Android image by two ways. First, using the self-install image. you just flashing this image and that's all. After booting, Android will be installed by automatically. And as other way, you can flash each images by manual.

This is the same way the Hardkernel team creates Android release image and easiest way to have bootable media on your ODROID-M1 if you proceed one more build step. This procedure combines all required image files created by Android build into a single file, odroidev/Image-odroidm1/selfinstall.img.

You also can make a bootable media by using the self-install image, and you already made it.

host
$ ./build.sh -KA

If you already build kernel & android images, you can just build selfinstall image.

host
$ ./build.sh -S

you can write the self-install image via etcher or the dd commands.

host
$ sudo dd if=odroidev/Image-odroidm1/selfinstall.img of=/dev/sdd
$ sync
$ sudo umount /dev/sdd

Android 10 and higher's fastboot is moved to usermode.. As a result, fastboot mode is merged to the recovery mode. You can get into fastboot mode via the add commands. After rebooting, The ODROID-M1 will be into the fastboot mode.

host
$ adb reboot fastboot
  • odroid-m1/software/building_android.txt
  • Last modified: 2022/05/12 10:41
  • by codewalker