Android_SDK Compilation
Build Environment
Prepare build environment on a PC and install dependencies.
Preparation
Prepare an X64 computer(or setup a virtual machine in Virtualbox ), install Ubuntu 22.04 LTS.
- Hardware: RAM ≥ 16 GB, CPU cores ≥ 4, Hard Drive ≥ 500 GB
- Software: Ubuntu 22.04
Dependencies Installation
1. Login into Ubuntu desktop, open Terminal, su to the root user.(or use sudo to install dependencies.)

2. Input the following commands in sequence to install dependencies.
sudo apt install git bc bison build-essential curl flex libsdl1.2-dev
sudo apt install g++-multilib gcc-multilib gnupg gperf libncurses5-dev
sudo apt install imagemagick lib32ncurses5-dev lib32readline-dev squashfs-tools
sudo apt install lib32z1-dev liblz4-tool xsltproc libssl-dev libwxgtk3.0-gtk3-dev
sudo apt install libxml2 libxml2-utils schedtool lzop pngcrush rsync
sudo apt install yasm zip zlib1g-dev python3 device-tree-compiler
sudo apt install python-pip gawk openjdk-8-jdk u-boot-tools patchelf expect
sudo pip install pyelftools
Obtaining SDK Source Code
Note
1. The source code cannot be compiled in a shared directory.
2. The compilation host cannot log in using the ROOT account.
1. Download SDK and copy the source code archive to the compilation host directory.
2. Navigate to the directory containing the source code and enter the command to extract it.
3. Enter the a133-linux directory generated by extraction and enter the command to restore the source code.
First Compilation Configuration
./build.sh lunch
======you are building a133 android======
1. BoardConfig-a133-kickpi-k5.mk
2. BoardConfig-a133-kickpi-k5c.mk
which board would you like (1-2): // Select based on board model K5 or K5C

Compile Complete Image
Warning
If Android compilation fails without obvious errors, you can modify the number of parallel jobs for Android compilation in build.sh. Reduce make -j32 to match your device's actual capabilities.
Tip
The generated image is located at a133-android10.0-v2.0/longan/out/.

Q&A
- Android Compilation Fails?
If Android compilation fails without obvious errors, try modifying the following content and recompiling.

- Compilation Error Related to
yylloc?
Due to differences in the compilation environment's ld, a yylloc error might occur. Modify the yylloc references in the code according to the actual path indicated in the error message.
--- a/longan/kernel/linux-4.9/scripts/dtc/dtc-lexer.lex.c
+++ b/longan/kernel/linux-4.9/scripts/dtc/dtc-lexer.lex.c
@@ -631,8 +631,8 @@ char *yytext;
#include "srcpos.h"
#include "dtc-parser.tab.h"
-//YYLTYPE yylloc;
-extern YYLTYPE yylloc;
+YYLTYPE yylloc;
+//extern YYLTYPE yylloc;
- APPs or Files Not Taking Effect After Compilation?
Android uses lazy compilation. Simply replacing files and recompiling may not include some APPs or files in the final image. This can be resolved using one of the following methods:
1. make installclean
2. rm out/target/product/apollo-p2/xxx/xxx
3. Change the compilation conditions (e.g., filename, APK name).