Before one starts any deployment, you need to set an environment up. The environment dedicated to Linux development is quite simple, at least, on Debian based systems:
$ sudo apt-get update$ sudo apt-get install gawk wget git diffstat unzip texinfo gcc-multilib build-essesntial chrpatch socat libsdl1.2-dev \xterm ncurses-dev lzopI f you are working with ARM System On Chip (SoC), you should install gcc-arm as well:
$ sudo apt-get install gcc-arm gcc-arm-linux-gnueabihfIn early kernel days (until 2003), ood-even versioning styles were used; where odd numbers were stable, even numbers were unstable. When the 2.6 was released, the versioning scheme switched to X.Y.Z, where:
This is called semantic versioning, and has been used until the 2.6.39 version; when Linux Trovalds decided to bump the version 3.0, which also meant the end of the semantic versioning in 2011, and then, an X.Y scheme was adopted.
Now the kernel uses an arbitrary X.Y versioning scheme, which has nothing to do with semantic versioning.
An easy way it is to use Linux Torvald's Github repository: https://github.com/torvalds/linux
$ git clone https://github.com/torvalds/linux$ git checkout last_releaseIn most of the cases, there will be no need to start a configuration from scratch. There are default and useful configuration files available in each arch directory, which you can use as a start point:
$ ls arch/<your:arch>/configs/Example:
$ make x86_64_defconfig$ make zImage -j16$ make modules$ sudo make INSTALL_MOD_PATH="/where/to/install" madules_installIf you want to use xconfig, first af all you will have to install QT4 tools:
$ sudo apt-get install qt4-dev-tools qt4-qmakeBuilding your kernel requires you to specify the architecture for which it is built for, as well as the compiler. That says, it is not necessary for a native build.
$ ARCH=arm make imx_v6_v7_defconfig$ ARCH= arm CROSS_COMPILE=arm-linux-gnueabihf- make zImage -j16From the kernel build, the result will be a single binary image, located in arch/arm/boot/. Modules are built with the following command:
$ ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make modulesYou can install them using the following command:
$ sudo ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make modules_installThe modules_install target expects an enviroment variable, INSTALL_MOD_PATH, which specifies where you should install the modules. If not set, the modules will be installed at /lib/modules/$(KERNELRELEASE)/kernel/.
i.MX6 processors support device trees, which are files you use to describe the hardware. However, to compile every ARCH device tree, you can run the following command:
$ sudo ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make dtbsThe dtbs option, is not available on all platforms that support device tree. To build a standalone DTB, you should use:
$ sudo ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- make imx6-sabrelite.dtbYuo should always refere to the kernel codig style manual, at Documentation/CodingStyle in the kernel source tree. Most popular ones are:
$ scrpits/cleanfile my_module.c$ sudo apt-get install indent$ scripts/indent mymodule.c