Lab 04 Kern - Cross
Lab 04 Kern - Cross
Kernel - Cross-compiling
Objective: Learn how to cross-compile a kernel for an ARM target
platform.
Setup
Go to the $HOME/embedded-linux-qemu-labs/kernel directory.
Kernel sources
We will re-use the kernel sources downloaded and patched in the previous lab.
$ export PATH=$HOME/x-tools/arm-training-linux-uclibcgnueabihf/bin:$PATH
Cross compiling
At this stage, you need to install the libssl-dev package to compile the kernel.
You’re now ready to cross-compile your kernel. Simply run:
$ make
and wait a while for the kernel to compile. Don’t forget to use make -j<n> if you have
multiple cores on your machine!
Look at the end of the kernel build output to see which file contains the kernel image. You
can also see the Device Tree .dtb files which got compiled. Find which .dtb file corresponds
to your board.
Copy the linux kernel image and DTB files to the TFTP server home directory.
You should see Linux boot and finally panicking. This is expected: we haven’t provided a
working root filesystem for our device yet.
You can now automate all this every time the board is booted or reset. Reset the board,
and customize bootcmd:
=> setenv bootcmd 'tftp 0x61000000 zImage; tftp 0x62000000
vexpress-v2p-ca9.dtb; bootz 0x61000000- 0x62000000'
=> saveenv
Restart the board to make sure that booting the kernel is now automated.