Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to build kernel source tree in Linux

Shulou Source: shulou.com Published: 2022-06-02 01:43:32 09月26日 Update

It is believed that many inexperienced people don't know what to do about how to build kernel source tree in Linux. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

To write a driver for Linux, you must build a kernel source tree.

The purpose of the kernel source tree is to construct modules that can be loaded and unloaded in the Linux kernel, so if you want to build modules for the target board, you must ensure that the kernel version used to build the kernel source tree is the same as the kernel version in your target board. The target board used by the author is i.MX6Q E9, the official source code package linux_E9_3.0.35_for_Linux_v3.0.tar.bz2.

01. Decompress the source package

Tar jxvf linux_E9_3.0.35_for_Linux_v3.0.tar.bz2

02. Enter the kernel source directory

Cd ~ / linux_E9_3.0.35_for_Linux

03. Modify Makefile, specify architecture, and cross-compiler under kernel source root directory

ARCH = armCROSS_COMPILE = / opt/arm-linux-gcc/bin/arm-none-linux-gnueabi-

04. Configure the kernel

Make menuconfig

Just load the official configuration directly into the source code.

05. Compile

Make

06. Compiler module

Make modules

07. Installation module

Make modules_install

After you finish, you can see the folder named by the version number in the / lib/modules directory.

[xxx@XXX ~] $cd / lib/modules [xxx@XXX modules] $ls3.0.35 3.16.2-1-ARCH 3.16.3-1-ARCH extramodules-3.16-ARCH [xxx@XXX modules] $

At this point, the construction of kernel source tree is completed.

After reading the above, have you mastered how to build the kernel source tree in Linux? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Tags: Kernel source code module version target compilation content official method more directory problem configuration consistency helplessness for this package function reason can be found in Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info Shulou Information Apple Huawei vpn