Download and compile the Linux kernel source code
The Android source code does not contain the Linux source code and must be downloaded separately. You cannot download the Linux kernel directly from www.kernel.org, you should download the Linux kernel used in Android on the website provided by Google.
1. Download "Git clone https://android.googlesource.com/kernel/common.git", go to the common directory, "git branch-a" to view the current remote version, then export To export the required version "Git checkout-b android-*** remotes/origin/android-***"
2.Linux Kernel Source code directory structure:
3. Install the Android kernel's build environment
(1). Configure the Makefile file:
(2). Copy the following files to your working directory:
The version depends on the machine condition.
(3). Unzip, "ls/usr/local/arm-l" to see if the installation was successful.
(4). Install LIBNCURSES5, "Apt-get install Libncurses5-dev"
4. Configuring and compiling the Linux kernel
Typically, there is no. config file in the Linux source directory, which determines which functions and modules are part of the build Linux kernel. Perform one of the following 4 commands to generate a. config file:
(1) Make config: configured in text format;
(2) Make Menuconfig: configured as a character interface menu;
(3) Make Oldconfig: will give the default value of the text format configuration;
(4) Make xconfig: Configuring the Linux kernel as a graphical interface will require QT installation, "Apt-get install Libqt-dev"
It is recommended to use make menuconfig, which will generate Zimage files (Linux kernel binaries) after successful compilation, which can be installed on the Development Board or used to test the Linux kernel.
Android porting is primarily a Linux kernel migration, and Linux kernel porting is primarily a Linux-powered migration. To develop and test Linux drivers, you need to build an Android application development environment and a Linux kernel development environment.
"Android Deep Exploration Volume One" reading notes five