Xunwei iTOP-4412 Android 4.0/Linux source code compilation

1. Preparation work

Build and configureuboot, Linux3.0 and Android4.0’s compilation environment. For the complete construction and configuration process, please refer to the following blog post: 

Xunwei iTOP-4412's Android 4.0 system compilation environment construction (full version) - CSDN blog https://blog.csdn.net/Eva20192020/article/details/134668004?spm=1001.2014.3001.5502
Tip: It is recommended to delete the original package file after decompression in the virtual machine to save virtual machine space.

2. Compile U-boot

1. U-boot source code

Find the U-boot source code "iTop4412_uboot_20180320.tar.gz", as shown in the figure below,

The script for compiling uboot is "build_uboot.sh" in the source code folder. When compiling, you need to pass parameters to the script. According to Depending on the core board, the script execution parameters are as shown in the table below,

2、edit uboot mirror image

The following takes the POP 1G core board as an example to compile the image.

Place the CD"06_source code_uboot and is copied to the same root directory topeet/ of the installation library file of the build environment. First, create a new android4.0 directory. The process is as shown in the figure below:"iTop4412_uboot_20180320.tar.gz" file and “CodeSign4SecureBoot_POP”  directory kernel”

Then unzip "iTop4412_uboot_20180320.tar.gz" to get "iTop4412_uboot " folder, as shown below:

Enter the "iTop4412_uboot" folder and use the compile script "build_uboot.sh " compile uboot, what needs to be compiled here is "POP1G core board"uboot image, then the compilation command is: ./build_uboot.sh P_1GDDR PO

Enter the compilation command as shown in the figure below. Here you must first determine what type of core board it is, and then pass the corresponding parameters to the script.

   Compilation is completed as shown in the figure below:

As shown in the figure below, the script execution is completed and the "u-boot-iTOP- 4412.bin" file is generated in the "iTop4412_uboot" folder. The generated file "u-boot-iTOP-4412.bin" is POP 1G Memory core board correspondinguboot image file.

3. Compile the Linux kernel 

1,Inner core source

Linux internal source “\06_source_uboot Japanese kernel” Megamishita, Nyoshita Picture Shown:

The kernel is compiled as a combined configuration file. The basic configuration file name is "config_for_android_YY_elite". YY means as shown in the following table Parameter substitution. The configuration file for compiling Android is as follows: 

2, Compile the android system kernel image

Here we take the POP 1G core board as an example to compile Android 4.0 zImage < a i=4>Kernel image, Then the configuration file is"config_for_android_pop_elite" .

Change "06_source code_uboot and kernel" Copy the compressed package "iTop4412_Kernel_3.0_20220105.tar.gz" in the directory to the same root directory topeet/android4.0 as the U-boot mentioned above in Ubuntu, and then Unzip and get the folder "iTop4412_Kernel_3.0 ", as shown below:

 

Enter the folder "iTop4412_Kernel_3.0", compile the Android POP 1G image, use the command:

cp config_for_android_pop_elite .config

Overwrite the built-in configuration file, as shown in the figure below:

 If the user wants to use a 5-inch screen, he must first refer to the user manual "7.6Support5< /span>"" after a> inch screen, they can skip this step. 5", after the addition is completed ,As shown below. If the user does not use a 5CONFIG_TOUCHSCREEN_GT9XX=yCONFIG_TOPEET_LCD5X0=y" in the file. Add a line "CONFIG_TOUCHSCREEN_GT9XX=ySearch for the keyword ",vim.configinch screen kernel patch file", patch the kernel, and then use the command "

Then use the compilation command " make zImage ", as shown in the following figure:

Compilation is completed, as shown in the figure below:

文品夹“iTop4412_Kernel_3.0 ”下下“arch--> using the core board, as shown below :P 1G Mirror image available for 给 POzImage ”, herezImage” user image statement “boot-->arm

3. Compilation error handling

During the kernel compilation process, if an error occurs, as shown in the figure below:

We use the command:

vim kernel/timeconst.pl

Enter timeconst.pl file and use command

/if (!defined(@val))

Find the place where the error is reported, as shown in the figure below:

Save and exit, re-use the command make zImage to compile, and the compilation is completed. 

4. Compile module

BecauseAndroid code requires kernel wifi driver , after compiling the kernel, you still need to execute the command to compile modules "  make modules  " in the kernel directory, and then execute the compilation command Android4.0.3 file system script, Android4.0.3 source code can pass.  

 4. Compile Android4.0.3 file system

1. File system source code

Android4.0.3 The source code of the file system is as shown below:

The compiler for Android4.0.3 is version 4.4.7 (including all other versions< /span> . gcc " on the console , you can check the version of gcc -v Android compilers are all the same), as shown in the figure below, use the command "

 

 2.Build and compile android4.0.3 environment

Compiling the source code requires lowering the version of make . The specific steps are as follows:

 Copy the " make-3.81.tar.bz2 "  file provided by Xunwei to the above root directory topeet/ of Ubuntu.

After the copy is completed, use the command to decompress,
tar -vxf make-3.81.tar.bz2

To decompress the file, you can also use -jvxf, as shown in the figure below:

Use the command "   cd make-3.81   " to enter make-3.81 directory, and then use the following commands to configure and determine the installation location:
./configure --prefix=/home/topeet/makeinstall/

The completion is as shown in the figure below:

After configuration is completed, use the command "  sh build.sh   " to compile, as shown in the following figure:

 After is compiled, use the command "   make install" to install. The installation is completed as shown in the figure below:    

The installation is successful as shown below:

If you do not have root permissions, the following error message will appear. You need to use "  sudo make install  " or switch to root permissions, and then Execute the “   make install    command.

Insert the setting and entry method of the root permission password here. In order to subsequently install the operation permissions and enter the root permissions, you can set a separate password for the root permissions, as shown in the following figure:

Then use the command " cd ../makeinstall/bin " to enter the bin directory of the installation path, as shown in the figure below: bin a>

Make under bin, as shown below, is what we will use below, 

Use the following command to copy make to the /usr/bin directory, where /usr The /bin directory must have root permissions, as shown in the figure below:

cp make /usr/bin/

At this point, we have completed the environment for compiling android4.0.3 .

3. Compile android4.0.3

There is no parameter configuration in the source code. All types of core boards corresponding to Android4.0.3 use the same source code and the same compilation method.
edit script is “ build_android.sh ”.
Put the compressed package "iTop4412_ICS_git_20220105.tar" in the directory of the CD " Source Code _Android4.0.3 File System" .gz" to the Ubuntu system, unzip the compressed package and obtain the folder " iTop4412_ICS_git ".
What needs to be noted here is that Android source code folder " iTop4412_ICS_git " and kernel source code folder " iTop4412_Kernel_3.0 " needs to be placed in the same directory "android4.0". The specific steps are as shown in the figure below:
Enter the "iTop4412_ICS_git" Android source code directory. Before compiling Android, you need to check the header file dalvik/vm/native/dalvik_system_Zygote.cpp in the Android source code directory. If the header file "#include <sys/resource.h>" is not there, then Add it in.
Modify "dalvik_system_Zygote.cpp" using the command:
vim dalvik/vm/native/dalvik_system_Zygote.cpp

Enterdalvik_system_Zygote.cpp file, add the header file#include <sys/resource. h> , as shown below:

Save and exit, and perform the last step of the compilation process.

Use the command "./build_android.sh" to run the compilation script, compile Android4.0.3, as shown below:

Caution: Edit Android4.0.3 Required Ubuntu Provided by genealogy 2G or more available.
The meaning of "providing memory above 2G" here does not only refer to VMware Workstations virtual The machine is set to allocate 2G memory. For example, when the user compiles, the total memory of PC is 4G , and the allocation is set in the virtual machine< /span> or 8G is PC 2G memory, so it may not be able to compile. Of course, if the user's 2G, or even less than , then the virtual machine will automatically adjust to only occupy 2G is fasterWindows QQ, anti-virus software, music players, browsers, etc., so that the memory occupied under system, it is turned onWindows memory, but under 3G memory, whatever you want.

The compilation process is time-consuming. The first compilation will take more than 60 minutes. So calculate the time in advance before executing the compilation command.
Compilation is completed, as shown in the figure below:
After compilation is completed, it will be generated in the folder " iTop4412_ICS\out\target\product\smdk4x12 " Android4.0.3 image files “ ramdisk-uboot.img ” and “ system.img ", and the kernel image zImage file of Android4.03 system. As shown below:

5. Common compilation errors

1. If there is an error in uboot and kernel compilation, it is basically the 2nd and 4th steps in setting up the environment. In the 2nd step, the cross compiler uses the 2009q3 version provided by the manufacturer; in the 4th step, gcc will change its version to 4.4.7 Version.

2. If there is an error when compiling the Android file system, it is basically a gcc version problem.

For example, when compiling the file system, an error message appears:

make: *** [out/host/linux-x86/obj/EXECUTABLES/aapt_intermediates/aapt] 错误 1

solve:

Open frameworks/base/tools/aapt/Android.mk

then open the fileAndroid.mk, edit the following line:

ifeq ($(HOST_OS),linux)

#LOCAL_LDLIBS += -lrt       Comment out this line and change it to the following line.

LOCAL_LDLIBS += -lrt -lpthread

endif

 If the following error message appears during compilation of the file system:

“frameworks/base/include/utils/KeyedVector.h:193:27: error: ‘indexOfKey’ was not declared in this scope”

 Solution:

 vi frameworks/base/tools/aapt/Android.mk

 Go to the line where the error is reported. Add '-fpermissive' to line 27. The added content is:

LOCAL_CFLAGS += -Wno-format-y2k -fpermissive

Guess you like

Origin blog.csdn.net/Eva20192020/article/details/133976864