Skip to content

LINUX_SDK Source Compilation

Compilation Environment

Set up the environment on a PC to compile the Android/Linux SDK.

Environment Preparation

Install Ubuntu on a PC to perform SDK compilation.

  • Hardware: PC must meet RAM ≥ 16 GB, CPU cores ≥ 4, Hard Drive ≥ 500GB
  • Software: Ubuntu 22.04, allocate ≥ 200GB disk space for virtual machines

Install Dependencies

1. Enter Ubuntu, open Terminal, switch to root user

2. Enter 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. Click to download SDK. Copy the source code compressed package to the compilation host directory.

2. Navigate to the source code directory and enter the command to decompress.

tar -zxvf *.tar.gz

3. Enter the decompressed a133-linux directory and enter the command to restore the source code.

git reset --hard

First-time Compilation Configuration

./build.sh lunch
======you are building a133 linux======

1. BoardConfig-a133-kickpi-k5.mk
2. BoardConfig-a133-kickpi-k5c.mk
which board would you like (1-2):    //Select according to board type K5 or K5C

image-20251106203134675

Compile Full Image

./build.sh 

The generated image is located at a133-linux/out/update-a133-kickpi-k5-ubuntu16.04-lvds-7-1024-600-2025110620.img

image-20251107091114488

Individual Compilation

Compile kernel individually

./build.sh kernel

Compile rootfs individually

./build.sh rootfs

Kconfig Configuration

Kconfig modification and saving

./build.sh config
cd kernel/linux-4.9/
make ARCH=arm64 menuconfig
cd -
./build.sh saveconfig

Device Tree Path

kickpi-k5c.dts/device/config/chips/a133/configs/c3/kickpi-k5c.dts

Toolchain

Package path

build/toolchain/gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu.tar.xz

Tool path after compilation

out/gcc-linaro-5.3.1-2016.05-x86_64_aarch64-linux-gnu

Q&A

  • Missing event.c file issue?
aarch64-linux-gnu-gcc: error: /home/A/sdk/a133/a133-linux-test1/kernel/linux-4.9/modules/gpu/img-rgx/linux/rogue_km/binary_sunxi_linux_release/target_aarch64/kbuild/services/server/env/linux/event.c: No such file or directory

Perform clean operation

./build.sh clean
  • Cannot open Terminal in Ubuntu 22.04?

Press ctrl+alt+F3 on the virtual machine page to enter command line mode, follow the steps shown in the diagram.

cd /etc/default
nano locale

Change en_US to en_US.UTF-8, save and exit, enter reboot to restart.