Compiling Linux Kernel


Hello,

I was trying to compile the Linux kernel for Colibri T20 from source by following the guide at Build U-Boot and Linux Kernel from Source Code | Toradex Developer Center



I will be using the tools provided in Toradex Linux 2.6.1 BSP for the flashing step.
All commands were executed in the home directory, unless explicitly specified. I have performed the following steps:


1) Git clone the required repositories:

git clone -b 2015.04-toradex git://git.toradex.com/u-boot-toradex.git
git clone -b tegra git://git.toradex.com/linux-toradex.git


2) Get and extract the required toolchain

cd ~
wget -c https://releases.linaro.org/components/toolchain/binaries/5.2-2015.11-2/arm-inux-gnueabihf/gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf.tar.xz
tar xvf gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf.tar.xz
ln -s gcc-linaro-5.2-2015.11-2-x86_64_arm-linux-gnueabihf gcc-linaro


3) Setup the required environment variables (I have added them permanently to ~/.bashrc)

export ARCH=arm
export PATH=~/gcc-linaro/bin/:$PATH
export CROSS_COMPILE=arm-linux-gnueabihf-


4) Run the make for configuration

adwait@adwait-Lenovo-ideapad-100-15IBD:~/$ cd linux-toradex
adwait@adwait-Lenovo-ideapad-100-15IBD:~/linux-toradex$ make clean
adwait@adwait-Lenovo-ideapad-100-15IBD:~/linux-toradex$ make colibri_t20_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
adwait@adwait-Lenovo-ideapad-100-15IBD:~/linux-toradex$


5) Kernel Compilation (I have attached my build.log in this post)

make -j3 uImage 2>&1 | tee build.log

As per my understanding, at this point a new zImage should be found at ~/linux-toradex/arch/arm/boot/zImage

What steps do I need to take after this to flash the newly compiled kernel?
Also, how do I figure out which modules were compiled and which were not during the build process?

I know that my question is slightly vague, but I will be obliged if any one can guide me.

Thank you.link text

On the Tegras we currently use uImage. (Which you tried to build with make uImage …)
So you shouldn’t expect a zImage.

The last lines of your build log shows the following

"mkimage" command not found - U-Boot images will not be built
make[1]: *** [arch/arm/boot/uImage] Error 1
make: *** [uImage] Error 2

which means your build did fail because you don’t have the U-Boot mkimage utility in your path.
Please revisit here do get the instructions on how to get the tool.

Note that you did not yet compile the kernel modules. This includes the explanation of what gets compiled as a kernel module.

The following explains how you deploy the kernel and the kernel modules onto a module.

Max


Thanks for the answer, I see that I didn’t have mkimage so the make failed.
Just a clarification, I am right to assume that building U-Boot is not necessary for building the kernel? Is it sufficient for now to use mkimage from u-boot-tools using
sudo apt-get install u-boot-tools

Yes, the Linux kernel can be built completely independent of the U-Boot boot loader.

Please note that on the Colibri T20 we do nowadays actually use the zImage so no mkimage is required at all.