Linux Kernel 4.9.y
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.
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 [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:
- 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:
- Clone the git from ISEE git with the latest stable version of the corresponding Linux Kernel.
- Select the corresponding branch inside the git repository.
- Select the correct default configuration (defconfig)
- Compile the Kernel Image, Device Tree and Modules of that configuration.
Prepare the environment
|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:
|OMAP5432||git clone email@example.com:linux-kernel/linux-omap-2.6.git||isee-linux-v.4.9.y|
|DM3730||git clone firstname.lastname@example.org:linux-kernel/linux-omap-2.6.git||isee-linux-v.4.9.y|
|AM335X||git clone email@example.com:linux-kernel/linux-omap-2.6.git||isee-linux-v.4.9.y|
|iMX6||git clone firstname.lastname@example.org:linux-kernel/linux-imx.git||
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:
|IGEP COM AQUILA AM335x||am335x_igep0033_defconfig|
|IGEP COM MODULE DM3730/AM3703||omap3-igep00x0_defconfig|
|IGEP SMARC iMX6||imx6_igep0046_defconfig|
|IGEP SMARC AM335x||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- zImages 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
|IGEP COM MODULE DM3730/AM3703||omap3-igep0030-rev-g.dts|
|IGEP COM AQUILA AM335x||am335x-igep0033.dtsi|
|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