Skip to content

Android_SDK Source Code Compilation

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.

tar -zxvf *.tar.gz

3. Enter the a133-linux directory generated by extraction and enter the command to restore the source code.

git reset --hard

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

image-20251107092156026

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.

./build.sh

Tip

The generated image is located at a133-android10.0-v2.0/longan/out/.

image-20251107095352068

Q&A

  • Android Compilation Fails?

If Android compilation fails without obvious errors, try modifying the following content and recompiling.

image-20250814093933050

  • 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).