Difference between revisions of "Linux Kernel 4.9.y"

From IGEP - ISEE Wiki

Jump to: navigation, search
Line 150: Line 150:
 
  sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/media/rootfs/ modules_install
 
  sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/media/rootfs/ modules_install
 
==<span id="Linux_kernels" class="mw-headline">Linux kernels</span>==
 
==<span id="Linux_kernels" class="mw-headline">Linux kernels</span>==
* Linux Kernel 4.1
+
* [[Linux Kernel 4.1.y|Linux Kernel 4.1]]
* Linux Kernel 3.
+
* [[Linux Kernel 3.8.y|Linux K]][[Linux Kernel 3.8.y|ernel 3.8]] 
  
  
 
[[Category:Linux]]
 
[[Category:Linux]]
 
[[Category:Linux_Kernel]]
 
[[Category:Linux_Kernel]]

Revision as of 10:18, 25 June 2018

245px-Tux.svg.png
 

What is Linux?

Linux is a clone of the operating system Unix, written from scratch by Linus Torvalds with assistance from a loosely-knit team of hackers across the Net. It aims towards POSIX and Single UNIX Specification compliance.

It has all the features you would expect in a modern fully-fledged Unix, including true multitasking, virtual memory, shared libraries, demand loading, shared copy-on-write executables, proper memory management, and multistack networking including IPv4 and IPv6.

Although originally developed first for 32-bit x86-based PCs (386 or higher), today Linux also runs on a multitude of other processor architectures, in both 32- and 64-bit variants.

Introduction

In order to build the Linux Kernel for IGEP PROCESSOR BOARDS it is recommended to cross-compile the kernel, that means to build the kernel in your HOST machine for a target architecture.

To Ubuntu_16.04 there are two fundamental variables that the kernel uses to select the target architecture. Normally these values are guessed based on your build environment, but of course that environment here does not match our target embedded system, so we'll need to override them. The variables in question are:

  • ARCH: The ARCH variable is the architecture you're targeting as the kernel knows it. For IGEP PROCESSOR BOARDS you'll set to "arm" architecture.
  • CROSS_COMPILE: Hopefully the CROSS_COMPILE variable is pretty self-explanatory. Set this to the prefix of your toolchain (including the trailing dash "-"). So if your toolchain is invoked as say arm-linux-gnueabihf-gcc, just chop off that trailing gcc and that's what you use: arm-linux-gnueabihf-

There is an additional variable, INSTALL_MOD_PATH, which defines where the /lib directory will be created, and all the modules stored. While you don't have to transfer the kernel sources to your target device, if you build any modules, you'll want this directory.

The general process that it has to be followed in order to compile your Linux Kernel is usually the same:

  1. Clone the git from ISEE git with the latest stable version of the corresponding Linux Kernel.
  2. Select the corresponding branch inside the git repository.
  3. Select the correct default configuration (defconfig)
  4. Compile the Kernel Image, Device Tree and Modules of that configuration.

Prepare the environment

Information.jpg The following steps has been tested using Ubuntu 16.04 and the 4.9 version of the arm-linux-gnueabihf compiler

First we have to set up the Cross Compiler correctly if it is necessary. In this post there are some steps that can be followed in order to do it.

If it is necessary we can install this extra packages that could be necessaries:

sudo apt-get install libc6-armel-cross libc6-armhf-cross libc6-dev-armel-cross libncurses5-dev

The next step is to clone the corresponding git repository. There are different git repositories depending on the model of the processor of the board. The following table shows the steps for each of the IGEP PROCESSOR BOARDS:

PROCESSOR GIT REPOSITORY BRANCH
DM3730 https://git.isee.biz/linux-kernel/linux-omap-2.6.git isee-linux-v.4.9.y
AM335X https://git.isee.biz/linux-kernel/linux-omap-2.6.git isee-linux-v.4.9.y
iMX6 https://git.isee.biz/linux-kernel/linux-imx.git

isee-imx_4.9.11_1.0.0_ga

To get to desired branch we will use:

git checkout [your_branch]

Compile the Linux Kernel

Once the development environment has been correctly set up, the following steps can be followed in order to compile the Linux Kernel using a Cross Compiler.

First of all, the default configuration (defconfig) has to be loaded. It can be done by writing the following command:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- [your_defconfig]

In the following table it can be found the name of each default configuration associated to each IGEP PROCESSORS BOARDS:

BOARD DEFCONFIG EXAMPLE
IGEPv5 OMAP5432 omap2plus_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
IGEPv2 DM3730 omap2plus_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
IGEP COM AQUILA AM335x am335x_igep0034_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
IGEP COM MODULE DM3730/AM3703 omap2plus_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
IGEP SMARC iMX6 imx6_igep0046_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- imx6_igep0046_defconfig
IGEP SMARC AM335x am335x_igep0034_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_igep0034_defconfig

Once the default configuration has been loaded, it is time to compile the Linux Kernel. There are three important elements to compile:

  • Image: The kernel image. There are three several formats. Generally we will use the zImage: a compressed version of the Linux kernel image that is self-extracting.
  • DTBs: Device tree binary, a low level device description, specific to your device.
  • Modules: Kernel Modules, pieces of code that can be loaded and unloaded into the kernel upon demand. They extend the functionality of the kernel without the need to reboot the system. 

In order to compile this three elements we have to type:

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- zImage dtbs modules

Finally we will find the resulting compiled Kernel in the arch/arm/boot folder:

  • zImage: located in arch/arm/boot/zImage
  • DTB: located in arch/arm/boot/dts/.dtb. Depending of the board the dtb file will be different. In the following table it is detailed the corresponding dtb filename for each b


BOARD DTB NAME
IGEPv2 DM3730 omap3-igep0020-rev-f.dts
IGEP COM MODULE DM3730/AM3703 omap3-igep0030-rev-g.dts
IGEP COM AQUILA AM335x am335x-igep0033.dtsi
IGEPv5 OMAP5432 omap5-igep0050.dts
IGEP SMARC AM335x am335x-igep-base0040.dts
IGEP SMARC iMX6 Quad imx6q-igep-base0040rd102.dts
IGEP SMARC iMX6 Dual Lite imx6dl-igep-base0040rd102.dts

 

Finally, the last step is to install the modules inside the desired rootfs. It can be done by typing:

sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH= modules_install

For example, if the rootfs is located in a external storage device mounted on the /media folder:

sudo make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=/media/rootfs/ modules_install

Linux kernels