Compiling the AOSP and Creating an Image
Compile the AOSP source code to generate a Kbox Android image.
- Compile the AOSP source code.
- Generate your own unique set of release keys to sign the Android image deployed.
1 2 3 4
cd ~/aosp/ rm -rf ./build/target/product/security/release* chmod +x ./development/tools/make_key ./development/tools/make_key build/target/product/security/releasekey '/C=xx/ST=xxx/L=xxx/O=xxx/OU=xx/CN=xxx/emailAddress=xxxxx@xxx.com'
When you run the make_key command, the system prompts you to enter the password. You can press Enter to skip this step.
The parameters in the make_key command are described as follows:
- build/target/product/security/releasekey indicates the name of the key to be generated.
- The following parameters indicate your company information. Set the parameters as required.
- C: country name (2-letter code)
- ST: state or province name (full name)
- L: locality name (for example, city name)
- O: organization name (for example, company name)
- OU: organizational unit name (for example, section name)
- CN: common name (for example, user name or the host name of the server)
- emailAddress: contact email address
- Load all the commands in envsetup.sh to environment variables.
1source build/envsetup.sh
- Select a compilation mode. In user mode of Kbox, ADB that has the root permission is enabled by default for image compilation. This mode is used by default.
1lunch kbox_arm64-user
To compile the image in userdebug mode, change kbox_arm64-user to kbox_arm64-userdebug in the lunch command, as shown in the following:lunch kbox_arm64-userdebug
- Perform compilation.
1 2
make clean make -j
In above commands, set the number following -j to the number of CPU cores of the server. To query the number of CPU cores, run the following command:
1cat /proc/cpuinfo |grep "processor" | wc -l
If you run the make command without specifying the number of cores, one core is used for compilation by default. You can also use the -j parameter to specify the number of cores for compilation. The maximum allowed number of cores is the total number of CPU cores of the server. This document uses 64 cores as an example.
In normal cases, the compilation can be completed. Sometimes a compilation error may occur due to the concurrent compilation sequence. In this case, run the make command again.
- Generate your own unique set of release keys to sign the Android image deployed.
- Decompress Kbox-AOSP11.zip and upload make_img_sample in the Kbox-AOSP11 folder to the ~/dependency directory.
Configure appropriate permissions on the uploaded files and directories. It is not recommended to configure the write permission for other users in the owner group and other owner groups.
- Copy the generated image script to the ~/aosp directory and grant the execute permission on the script.
1 2 3 4
cd ~/dependency/make_img_sample/kbox11_android_build cp create-package.sh ~/aosp/ cd ~/aosp chmod +x create-package.sh
- Run the script to create a Kbox Android image.
The root permission is required for creating an image. Execute the script as the root user. The directory must be an absolute path.
1./create-package.sh ~/aosp/out/target/product/arm64/system.imgThe Kbox Android image is created. A Kbox image named android.tar is generated in the current directory.