Difference between revisions of "Linux Kernel 4.9.y"

(Compile the Linux Kernel)
 
(17 intermediate revisions by 3 users not shown)
Line 2: Line 2:
  
 
=What is Linux?=
 
=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.
+
Linux is the result of merging the computational Kernel made by Linux Torval and the scheme present in any Unix operative system, Kernel was written from scratch by Linus and a loosely-knit team of hackers across the Net. It aims towards POSIX standard 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.
 
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.
Line 11: Line 11:
 
<span style="color: #000000;">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.</span>
 
<span style="color: #000000;">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.</span>
  
To [index.php/Ubuntu_16.04_LTS_Toolchain setup the cross-compiling] 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:
+
To [[Ubuntu 16.04 LTS Toolchain|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:
  
 
* <u>''' ARCH'''</u>''':''' The ARCH variable is the architecture you're targeting as the kernel knows it. For IGEP PROCESSOR BOARDS you'll set to "arm" architecture.
 
* <u>''' ARCH'''</u>''':''' The ARCH variable is the architecture you're targeting as the kernel knows it. For IGEP PROCESSOR BOARDS you'll set to "arm" architecture.
Line 33: Line 33:
 
<span class="mw-headline">If it is necessary we can install this extra packages that could be necessaries: </span>
 
<span class="mw-headline">If it is necessary we can install this extra packages that could be necessaries: </span>
  
  <span class="mw-headline">sudo apt-get install libc6-armel-cross libc6-armhf-cross libc6-dev-armel-cross libncurses5-dev<br></span>
+
  <span class="mw-headline">sudo apt-get install libc6-armel-cross libc6-armhf-cross libc6-dev-armel-cross libncurses5-dev<br><br>sudo apt-get install lzop<br></span>
 
<span class="mw-headline">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 <span style="color: #000000;">IGEP PROCESSOR BOARDS</span>:<br data-attributes="%20/"></span>
 
<span class="mw-headline">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 <span style="color: #000000;">IGEP PROCESSOR BOARDS</span>:<br data-attributes="%20/"></span>
  
Line 41: Line 41:
 
! style="width: 324.217px;"|GIT REPOSITORY
 
! style="width: 324.217px;"|GIT REPOSITORY
 
! style="width: 275.783px;"|BRANCH
 
! style="width: 275.783px;"|BRANCH
|-
 
| style="width: 97px;"|OMAP5432
 
| style="width: 324.217px;"|git clone git@git.isee.biz:linux-kernel/linux-omap-2.6.git
 
| style="width: 275.783px;"|isee-linux-v.4.9.y
 
 
|-
 
|-
 
| style="width: 97px;"|DM3730
 
| style="width: 97px;"|DM3730
| style="width: 324.217px;"|git clone git@git.isee.biz:linux-kernel/linux-omap-2.6.git
+
| style="width: 324.217px;"|https://git.isee.biz/linux-kernel/linux-omap-2.6.git
 
| style="width: 275.783px;"|isee-linux-v.4.9.y
 
| style="width: 275.783px;"|isee-linux-v.4.9.y
 
|-
 
|-
 
| style="width: 97px;"|AM335X
 
| style="width: 97px;"|AM335X
| style="width: 324.217px;"|git clone git@git.isee.biz:linux-kernel/linux-omap-2.6.git
+
| style="width: 324.217px;"|https://git.isee.biz/linux-kernel/linux-omap-2.6.git
 
| style="width: 275.783px;"|isee-linux-v.4.9.y
 
| style="width: 275.783px;"|isee-linux-v.4.9.y
 
|-
 
|-
 
| style="width: 97px;"|iMX6
 
| style="width: 97px;"|iMX6
| style="width: 324.217px;"|git clone git@git.isee.biz:linux-kernel/linux-imx.git
+
| style="width: 324.217px;"|https://git.isee.biz/linux-kernel/linux-imx.git
 
| style="width: 275.783px;"|
 
| style="width: 275.783px;"|
 
isee-imx_4.9.11_1.0.0_ga
 
isee-imx_4.9.11_1.0.0_ga
Line 73: Line 69:
 
In the following table it can be found the name of each default configuration associated to each IGEP PROCESSORS BOARDS:
 
In the following table it can be found the name of each default configuration associated to each IGEP PROCESSORS BOARDS:
  
{| class="contenttable sortable" style="width: 890px;"
+
{| class="contenttable sortable" style="width: 888px;"
 +
|-
 +
! style="width: 160px;"|BOARD
 +
! style="width: 163px;"|DEFCONFIG
 +
! style="width: 527px;"|EXAMPLE
 
|-
 
|-
! style="width: 160.1px;"|BOARD
+
| style="width: 160px;"|IGEPv5 OMAP5432
! style="width: 124.9px;"|DEFCONFIG
+
| style="width: 163px;"|[https://git.isee.biz/linux-kernel/linux-omap-2.6/blob/isee-linux-v.4.9.y/arch/arm/configs/omap2plus_defconfig omap2plus_defconfig]
! style="width: 566px;"|EXAMPLE
+
| style="width: 527px;"|<span style="color: #000000;"><code class="java plain">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- omap2plus_defconfig  <br /></code></span>
 
|-
 
|-
| style="width: 160.1px;"|IGEPv5 OMAP5432
+
| style="width: 160px;"|IGEPv2 DM3730
| style="width: 124.9px;"|[https://git.isee.biz/linux-kernel/linux-omap-2.6/blob/linux-3.8.y-omap5/arch/arm/configs/omap2plus_defconfig omap2plus_defconfig]
+
| style="width: 163px;"|[https://git.isee.biz/linux-kernel/linux-omap-2.6/blob/isee-linux-v.4.9.y/arch/arm/configs/omap2plus_defconfig omap2plus_defconfig]
| style="width: 566px;"|<span style="color: #000000;"><code class="java plain">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- <br /></code></span>
+
| style="width: 527px;"|<span style="color: #000000;"><code class="java plain">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- omap2plus_defconfig</code></span>
 
|-
 
|-
| style="width: 160.1px;"|IGEPv2 DM3730
+
| style="width: 160px;"|IGEP COM AQUILA AM335x
| style="width: 124.9px;"|[https://git.isee.biz/linux-kernel/linux-omap-2.6/blob/linux-3.17.y/arch/arm/configs/omap3-igep00x0_defconfig omap3-igep00x0_defconfig]
+
| style="width: 163px;"|[https://git.isee.biz/linux-kernel/linux-omap-2.6/blob/isee-linux-v.4.9.y/arch/arm/configs/am335x_igep0034_defconfig am335x_igep0034_defconfig]
| style="width: 566px;"|<span style="color: #000000;"><code class="java plain">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-</code></span>
+
| style="width: 527px;"|<span style="color: #000000;"><code class="java plain">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_igep0034_defconfig</code></span>
 
|-
 
|-
| style="width: 160.1px;"|IGEP COM AQUILA AM335x
+
| style="width: 160px;"|IGEP COM MODULE DM3730/AM3703
| style="width: 124.9px;"|[https://git.isee.biz/linux-kernel/linux-omap-2.6/blob/linux-4.1.y-am335x/arch/arm/configs/am335x_igep0033_defconfig am335x_igep0033_defconfig]
+
| style="width: 163px;"|[https://git.isee.biz/linux-kernel/linux-omap-2.6/blob/isee-linux-v.4.9.y/arch/arm/configs/omap2plus_defconfig omap2plus_defconfig]
| style="width: 566px;"|<span style="color: #000000;"><code class="java plain">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-</code></span>
+
| style="width: 527px;"|<span style="color: #000000;"><code class="java plain">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- omap2plus_defconfig</code></span>
 
|-
 
|-
| style="width: 160.1px;"|IGEP COM MODULE DM3730/AM3703
+
| style="width: 160px;"|IGEP SMARC AM335x
| style="width: 124.9px;"|[https://git.isee.biz/linux-kernel/linux-omap-2.6/blob/linux-3.17.y/arch/arm/configs/omap3-igep00x0_defconfig omap3-igep00x0_defconfig]
+
| style="width: 163px;"|[https://git.isee.biz/linux-kernel/linux-omap-2.6/blob/isee-linux-v.4.9.y/arch/arm/configs/am335x_igep0034_defconfig am335x_igep0034_defconfig]
| style="width: 566px;"|<span style="color: #000000;"><code class="java plain">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-</code></span>
+
| style="width: 527px;"|<span style="color: #000000;"><code class="java plain">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_igep0034_defconfig</code></span>
 
|-
 
|-
| style="width: 160.1px;"|IGEP SMARC iMX6
+
| style="width: 160px;"|IGEP SMARC iMX6S/DL/Q
| style="width: 124.9px;"|[https://git.isee.biz/linux-kernel/linux-imx/blob/isee-imx_4.9.11_1.0.0_ga/arch/arm/configs/imx6_igep0046_defconfig imx6_igep0046_defconfig]
+
| style="width: 163px;"|[https://git.isee.biz/linux-kernel/linux-imx/blob/isee-imx_4.9.11_1.0.0_ga/arch/arm/configs/imx6_igep0046_defconfig imx6_igep0046_defconfig]
| style="width: 566px;"|<span style="color: #000000;"><code class="java plain">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- imx6_igep0046_defconfig</code></span>
+
| style="width: 527px;"|<span style="color: #000000;"><code class="java plain">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- imx6_igep0046_defconfig</code></span>
 
|-
 
|-
| style="width: 160.1px;"|IGEP SMARC AM335x
+
| style="width: 160px;"|IGEP SMARC iMX6UL/ULL
| style="width: 124.9px;"|[https://git.isee.biz/linux-kernel/linux-omap-2.6/blob/isee-linux-v.4.9.y/arch/arm/configs/am335x_igep0034_defconfig am335x_igep0034_defconfig]
+
||[https://git.isee.biz/linux-kernel/linux-imx/blob/isee-imx_4.9.11_1.0.0_ga/arch/arm/configs/imx6_igep0146_defconfig imx6_igep0146_defconfig]
| style="width: 566px;"|<span style="color: #000000;"><code class="java plain">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_igep0034_defconfig</code></span>
+
| style="width: 527px;"|<span style="color: #000000;"><code class="java plain">make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- imx6_igep0146_defconfig</code></span>
 
|}
 
|}
 
Once the default configuration has been loaded, it is time to compile the Linux Kernel. There are three important elements to compile:
 
Once the default configuration has been loaded, it is time to compile the Linux Kernel. There are three important elements to compile:
Line 131: Line 131:
 
|-
 
|-
 
| style="width: 281.467px;"|IGEP COM AQUILA AM335x
 
| style="width: 281.467px;"|IGEP COM AQUILA AM335x
| style="width: 588.533px;"|[https://git.isee.biz/linux-kernel/linux-omap-2.6/blob/isee-linux-v.4.9.y/arch/arm/boot/dts/am335x-igep0033.dtsi am335x-igep0033.dtsi]
+
| style="width: 588.533px;"|[https://git.isee.biz/linux-kernel/linux-omap-2.6/blob/isee-linux-v.4.9.y/arch/arm/boot/dts/am335x-base0033.dts am335x-base0033.dts]
 
|-
 
|-
 
| style="width: 281.467px;"|IGEPv5 OMAP5432
 
| style="width: 281.467px;"|IGEPv5 OMAP5432
Line 144: Line 144:
 
| style="width: 281.467px;"|IGEP SMARC iMX6 Dual Lite
 
| style="width: 281.467px;"|IGEP SMARC iMX6 Dual Lite
 
| style="width: 588.533px;"|[https://git.isee.biz/linux-kernel/linux-imx/blob/isee-imx_4.9.11_1.0.0_ga/arch/arm/boot/dts/imx6dl-igep-base0040rd102.dts imx6dl-igep-base0040rd102.dts]
 
| style="width: 588.533px;"|[https://git.isee.biz/linux-kernel/linux-imx/blob/isee-imx_4.9.11_1.0.0_ga/arch/arm/boot/dts/imx6dl-igep-base0040rd102.dts imx6dl-igep-base0040rd102.dts]
 +
|-
 +
| style="width: 281.467px;"|IGEP SMARC iMX6 Ultra Lite
 +
||[https://git.isee.biz/linux-kernel/linux-imx/blob/isee-imx_4.9.11_1.0.0_ga/arch/arm/boot/dts/imx6ul-igep-base0040rd102.dts imx6ul-igep-base0040rd102.dts], [https://git.isee.biz/linux-kernel/linux-imx/blob/isee-imx_4.9.11_1.0.0_ga/arch/arm/boot/dts/imx6ul-igep-base0040rd102-wifi.dts imx6ul-igep-base0040rd102-wifi.dts]
 
|}
 
|}
''' '''
 
  
Finally, the last step is to install the modules inside the desired rootfs. It can be done by typing:
+
Once you have to compile the Kernel, you have to copy de Zimage and dtb in /media/user/boot.'''<br />'''
 +
 
 +
zImage example:
 +
 
 +
<span style="color: #000000;"><code class="java plain">cp arch/arm/boot/zimage /media/user/boot</code></span>
 +
 
 +
 
 +
<span style="color: #000000;"><code class="java plain">cp arch/arm/boot/dts/omap3-igep0020-rev-f.dtb /media/user/boot</code></span>
 +
 
 +
 
 +
'''Before to install the modules, you need to choose a [[IGEP Firmware set-up|rootfs]] and copy in your SDCard or Nand/MMC rootfs parition.'''
 +
 
 +
 
 +
'''Finally''', the last step is to''' install the modules inside the desired rootfs'''. 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/user/rootfs/ modules_install
 +
==<span id="Linux_kernels" class="mw-headline">Linux kernels</span>==
 +
To get more information about our Kernel and their compatibilities
 +
 
 +
* [[Linux Kernel 4.1.y|Linux Kernel 4.1]]
 +
* [[Linux Kernel 3.8.y|Linux Kernel 3.8]]
  
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
 
 
[[Category:Linux]]
 
[[Category:Linux]]
 
[[Category:Linux_Kernel]]
 
[[Category:Linux_Kernel]]

Latest revision as of 10:28, 11 March 2019

245px-Tux.svg.png
 

Contents

What is Linux?

Linux is the result of merging the computational Kernel made by Linux Torval and the scheme present in any Unix operative system, Kernel was written from scratch by Linus and a loosely-knit team of hackers across the Net. It aims towards POSIX standard 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

sudo apt-get install lzop

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- omap2plus_defconfig 
IGEPv2 DM3730 omap2plus_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- omap2plus_defconfig
IGEP COM AQUILA AM335x am335x_igep0034_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_igep0034_defconfig
IGEP COM MODULE DM3730/AM3703 omap2plus_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- omap2plus_defconfig
IGEP SMARC AM335x am335x_igep0034_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- am335x_igep0034_defconfig
IGEP SMARC iMX6S/DL/Q imx6_igep0046_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- imx6_igep0046_defconfig
IGEP SMARC iMX6UL/ULL imx6_igep0146_defconfig make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- imx6_igep0146_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-base0033.dts
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
IGEP SMARC iMX6 Ultra Lite imx6ul-igep-base0040rd102.dts, imx6ul-igep-base0040rd102-wifi.dts

Once you have to compile the Kernel, you have to copy de Zimage and dtb in /media/user/boot.

zImage example:

cp arch/arm/boot/zimage /media/user/boot


cp arch/arm/boot/dts/omap3-igep0020-rev-f.dtb /media/user/boot


Before to install the modules, you need to choose a rootfs and copy in your SDCard or Nand/MMC rootfs parition.


Finally, the last step is to install the modules inside the desired rootfs. 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/user/rootfs/ modules_install

Linux kernels

To get more information about our Kernel and their compatibilities