0 Android bring up process combing

Write in front

The main task is to add a product to the existing android system code and sort out the migration steps of adding a product to the android system. Here, it is assumed that you have downloaded the aosp code.


First compile the existing code and debug the errors, mainly the errors encountered in the compilation environment. I put the errors I encountered at the end. If the same errors are encountered, you can refer to them.

source  build/envsetup.sh

In this step, you will encounter some strange environmental problems. Compile it first. Otherwise, if you have changed something, cough, it is hard to tell whether it is your own pot or the environmental pot.

New branch

Add a new branch

mkdir device/rockchip/rk3326/PX30_Myandroid 
cp -ra device/rockchip/rk3326/PX30_Android10/* device/rockchip/rk3326/PX30_Myandroid/

Third parties are allowed to customize the Product configuration. In the source code /device/rockchip/rk3326 directory, the following files need to be added / modified respectively:
AndroidProducts.mk: specify the product configuration and add the product to the lunch option
product.mk: the software related configurations of a product, such as the built-in software modules, are determined by androidproducts Product in MK_ Makefiles specified (non fixed)
BoardConfig.mk: chip hardware related configurations, partition settings, etc

Here are my changes
The main thing is to add a lunch option

      PX30_Myandroid-userdebug \
      PX30_Myandroid-user \

Mainly related to hardware configuration
PRODUCT_KERNEL_CONFIG: there are three parallel relationships instead of selection relationships. The corresponding directory is /kernel/arch/arm64/configurations

// Define board level information: use dts device tree file, defconfig configuration file of kernel, and defconfig configuration file of uboot
PRODUCT_KERNEL_DTS := px30-evb-ddr3-rgb-v10
PRODUCT_KERNEL_CONFIG := px30_android_defconfig android-10-go.config rk3326.config


mv PX30_Android10.mk PX30_Myandroid.mk

Modify the px30 inside_ Android10 to PX30_Myandroid
About these

PRODUCT_NAME := PX30_Myandroid 
PRODUCT_DEVICE := PX30_Myandroid 
PRODUCT_BRAND := rockchip
PRODUCT_MODEL := PX30_Myandroid 

Modify kernel

1 device file tree
First, create a new boardconfig Device tree file specified in MK
Involving documents to be modified

kernel/arch/arm64/boot/dts/rockchip/px30-evb-ddr3-rgb-v10.dts //New: px30-evb-ddr3-v10 DTS copy for modification
cd kernel/arch/arm64/boot/dts/rockchip
cp px30-evb-ddr3-v10.dts px30-evb-ddr3-rgb-v10.dts


System login animation

Android The system login animation for is similar to Windows The scroll bar of the system consists of two pages: foreground and background PNG Picture composition:

Foreground picture( android-logo-mask.png)Upper Android Hollowed out text part, background picture( android-logo-shine.png)Is a simple texture. When the system logs in, the foreground picture is displayed on the top layer, and the program code controls the continuous scrolling of the background picture. The background texture is scrolled through the hollowed out part of the text of the foreground picture, so as to achieve the animation effect

bool BootAnimation::android()
  initTexture(&mAndroid[0], mAssets, "images/android-logo-IP-mask.png"); // prospect
  initTexture(&mAndroid[1], mAssets, "images/android-logo-IP-shine.png"); // background

Problems encountered during compilation

Record the problems encountered during compilation and some solutions

Question 1

When setting up the environment, it is found that the up, down, left and right keys in the shell are garbled and cannot be used normally, which shows that the left, right, up and down keys on the linux shell are garbled ^[[d ^[[c ^[[[a ^[[b
View shell environment

echo $SHELL

If bin/sh is displayed, try typing


If OK,
a) Ask the administrator to add the bash environment to /etc/passwd, find their own username, and add: /bin/bash after the last colon
b) Use: chsh -s /bin/bash username or use the usermod -s /bin/bash username command to modify the shell type.
c) The other is that the current user's shell type is /bin/bash, but this problem still exists. In this case, you can enter: export TERM=linux on the terminal. This seems to be due to the problem of TERM in the ubuntu version.

Question 2

clang++: error: unable to execute command: Segmentation fault (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
Android (6052599 based on r353983c1) clang version 9.0.3 (https://android.googlesource.com/toolchain/clang 745b335211bb9eadfa6aa6301f84715cee4b37c5) (https://android.googlesource.com/toolchain/llvm 31c3f8c4ae6cc980405a3b90e7e88db00249eba5) (based on LLVM 9.0.3svn)
Target: aarch64-unknown-linux-android
Thread model: posix
InstalledDir: prebuilts/clang/host/linux-x86/clang-r353983c1/bin
clang++: note: diagnostic msg: PLEASE submit a bug report to https://github.com/android-ndk/ndk/issues and include the crash backtrace, preprocessed source, and associated run script.
clang++: note: diagnostic msg: 

Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: /work3/tengxingru/Rockchip_Android10/out/soong/.temp/regexp-macro-assembler-tracer-85a75a.cpp
clang++: note: diagnostic msg: /work3/tengxingru/Rockchip_Android10/out/soong/.temp/regexp-macro-assembler-tracer-85a75a.sh
clang++: note: diagnostic msg: 

14:54:04 ninja failed with: exit status 1

Unable to execute command: the problem of segmentation fault is really puzzling. After the tar package of my code is compressed, decompressed and copied, it will be different from the source code. After comparison, there are three differences, one of which is only one byte in the middle. It is difficult to understand. Let's sort out the possible reasons
1. During tar, there was an error in the file during the compression and decompression process. I unpacked the source code after tar, and compared it with the original code with diff tool. Unexpectedly, there are several different files in the source code. Copy the different files in the source code again. Don't ask me why. I have already doubted my life.
Pay attention to the language
Experience shows that LANG and LANGUAGE should be matched, for example
export LANG=zh_CN.UTF-8
export LANGUAGE=zh_CN:zh
export LANG=en_US.UTF-8
export LANGUAGE=en_US:en
After setting, try compiling again

3 pay attention to memory. For this reason, you can find a way to increase swap on the Internet. Normally, it should be to increase memory. If it is difficult to increase memory, try to reduce the number of compilation threads, that is, the n in the -jn. If multiple threads compile at the same time, you may encounter inexplicable problems due to insufficient memory.

Tags: Android

Posted by nomo1994 on Sat, 04 Jun 2022 00:57:26 +0530