Xunwei iTOP-4412 Elite Edition Linux kernel transplantation

Preparation

Usual machine: VM-Ware 16.2.3
Operation system:Ubuntu Linux 16.04 Work text: /home/workInstrument: arm-linux-gcc-4.6.4
Cross editing

Build and configure the cross-compilation environment. For the complete construction and configuration process, please refer to the following blog post:

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

1. Obtaining the Linux kernel source code

1. Download the kernel source code from the official Linux website

Download the kernel source code from the official Linux website: https://www.kernel.org/. We chose linux4.14.326, as shown in the figure below:

Click Pack "tarball" (packaging multiple files into one file is called a tarball) to download the kernel source code, as shown in the following figure:

The kernel source code file linux-4.14.326.tar.xz has been downloaded, as shown in the figure below:

2. Unzip the kernel source code in the virtual machine

After the download is completed, open the virtual machine, create the "kernel" directory folder in the "/home/work" folder of the virtual machine Ubuntu, and copy the downloaded kernel source code compressed package linux-4.14.326.tar.xz Go in and the operation process is as shown below:

Note: Decompression instructions for .tar.xz packaged files

tar.xz is a file compression format, where tar is a file archive format under a Unix-like operating system. It is used to package multiple files into one file, called tarball. Using tarball can facilitate transmission, backup, Archiving or other purposes. xz is a lossless data compression tool that uses the LZMA/LZMA2 compression algorithm to compress files to a very small size.

Therefore, the tar.xz file is a file containing all files obtained by archiving multiple files and then compressing them. In the Ubuntu operating system, the tools used to decompress tar.xz files are the tar command and the unxz command. We use the tar command to decompress and explain.

Using the tar command to decompress a tar.xz file requires two parameters. First, the -tar option is used to specify the operation to be performed, and then the -f option specifies the file name to be operated. Use the "-" sign to indicate reading from the standard input. Get a file or output a file to standard output.

Back to the topic of this article, you need to compress the packaged file under /home/work/kernel. As shown in the figure above, /home/work/kernel is the current directory. You only need to unzip it to the current directory. The command is as follows:

tar -xvf linux-4.14.326.tar.xz

Among them, the -x option means to decompress the file, the -v option is used to output detailed information, and the -f option specifies the file name to be operated, and the file name can be replaced with the actual file name.

After decompression is completed, the linux-4.14.326 folder is generated, as shown in the figure below:

2. Modify the source code compilation architecture and compiler

Open the Makefile: Enter the decompressed Linux kernel source code folder, find the Makefile folder, and use the command " gedit Makefile " to open the Makefile. The process is as shown in the figure below:

After opening the Makefile source file, open "Display line numbers", as shown in the following figure:

Modify the architecture (arch) and cross-compiler (CROSS_COMPILE) corresponding to lines 320 and 321, as shown in the following figure:

 Save, close and exit.

3. Cut the kernel

1. Generate .config default cropping menu file

You can directly use the official default configuration of Linux. Enter the command "make exynos_defconfig" directly under the kernel source code, as shown in the following figure:

2. Enter the cutting interface

Configure the platform and debug the serial port: Enter the command " make menuconfig " under the kernel source code and try to open the cropping interface.

If an error message appears, as shown below:

According to the above tips, it can be seen that the ncurses library is required in this process, but it cannot be found in the system, which is a basic dependency library problem. The solution is to install ncurses-devel. Enter the following command:

sudo apt-get install ncurses-dev

 Enter "make menuconfig" again to successfully open the cropping interface, as shown in the figure below:

3. Select chip type

Scroll down to select "System Type" and press Enter, as shown in the following figure:

Scroll down and select "Samsung EXYNOS" to quickly select the core model "Samsung Orion" of the iTOP-4412 development board, as shown in the following figure:

 Press Enter to enter the option configuration of the path. During the configuration process, use the "space bar" to select [*] and cancel [ ]. The final configuration is as shown in the figure below:

4. Debug serial port configuration

Move right to "Exit", press Enter to return to the first-level directory of "menuconfig", and move down from the first-level directory to find the kernel monitoring path of "Kernel hacking".

Press Enter to enter the kernel monitoring path of "Kernel hacking", and select the two options "Kernel low-level debugging functions (read help!)" and "Early printk", as shown in the figure below: 

 Then select the "Kernel low-level debugging port (Use Samsung S3C UART 0 for low-level debug)" option and set the serial port to serial port 2, as shown in the figure below::

5. Configuration of file system startup mode

Return to the first-level directory of menuconfig and select "Boot options" from the first-level directory, as shown in the following figure:

Press Enter, enter "Boot options" and configure, as shown in the figure below:

 Enter the middle line marked by the second red box in the above picture, set the kernel startup parameters, and set it to "root=/dev/mmcblk0p2 rw console=ttySAC2,115200 init=/linuxrc rootwait" as shown in the figure below:

Save and exit, continue to change the Kernel command type to: kernel mode, as shown in the figure below:

After modification, the result is as shown below: 

6. Network configuration

The onboard dm9621 network card chip of the itop4412 development board is of USB type, so it needs to rely on the USB network framework, so the support item must be selected through the cropping menu.

Return to the first-level directory of menuconfig and select "Device Drivers" from the first-level directory, as shown in the following figure:

After entering the device driver option, select the "Network device support" network device support option, as shown in the figure below:

After entering the network device support options, select USB network adaptation, as shown in the figure below:

 Enter the USB network adaptation settings and select support for DM96XX under it, as shown in the figure below:

7. Configure NFS service

Return to the first-level directory of menuconfig and select the "File systems" file system option from the first-level directory, as shown in the following figure:

Enter the file system and continue to select the network file system option, as shown in the figure below:

 Enter the network file system, and in the network file system configuration interface, select the options related to NFS, as shown in the following figure:

After the settings are completed, save and exit the menuconfig configuration.

4. Compile the kernel

We enter the following command in the kernel source directory:

make uImage LOADADDR=0X40007000

The compilation process takes a few minutes, where "LOADADDR=0X40007000" indicates the loading address of the specified kernel. The successful compilation is as shown in the figure below:

If the compilation is unsuccessful, the error message "mkimage" command not found - U-Boot images will not be built will appear, as shown in the following figure:

In fact, it is the lack of uboot tool. Just install it. The installation command is as follows: 

sudo apt-get install u-boot-tools

After installation, as shown below: 

 After the installation is successful, enter the compile kernel command again, as shown in the figure below:

5. Modify the device tree (dts) file

 Enter the kernel arch/arm/boot/dts/, which contains the iTOP device tree file by default, as shown in the figure below:

Then find the iTOP4412 Samsung Orion kernel matching device tree file, as shown below:

Open and edit the exynos4412-itop-scp-core.dtsi file, as shown below:

1. Comment out the firmware device

Firmware is the device information of Samsung's firmware. Because the firmware cannot be found, the kernel startup fails. Comment out lines 29 to 32 of the code, as shown below:

2. Modify event attributes

Because there is no event attribute, we need to change the events on line 72 to event, as shown in the following figure:

3. Configure the core board power chip

The Exynos4412 chip has two packaging forms: POP and SCP. The power management of the chip is the low-power dynamic Samsung S5M8767 power management architecture.

Modify the following code to look like the picture below:

 

 

 CTRL+S, CTRL+Q, save and exit.

4. Solve the string overflow problem

Open and edit the exynos4.dtsi file, as shown below:

 Comment out the dmas attribute in the serial port 2 node serial_2 in the file, as shown in the figure below:

Save and exit.​ 

5. Compile the device tree

Return to the kernel source file directory and enter the command shown in the figure below, as shown in the figure below:

Wait for the compilation result as shown below:

 As shown in the two figures above, it is the device tree dtb file "exynos4412-itop-elite.dtb" and kernel image uImage generated by compilation.

Guess you like

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