Building a Kernel is an advanced process for most beginners. We suggest people to read this article first to understand kernel bootup on ARM devices. https://people.kernel.org/linusw/how-the-arm32-kernel-starts I'd also recommend reading Jay Carlson's excellent notes on Embedded Linux here - https://jaycarlson.net/embedded-linux/ as an overview.
Download and unpack the kernel and open the directory in terminal
tar -xf linux-5.10.10.tar.xz
./arch/arm/boot/dts, this is the devicetree directory
Add the new devicetree to the build system by a adding:
dtb-$(CONFIG_ARCH_TEGRA_3x_SOC) +=(see image)
A basic configuration for Tegra SoC's can be loaded by using tegra_defconfig
make ARCH=arm tegra_defconfig
This will place a
.config file in the kernel root directory with the default config for Tegra CPUs.
At the moment we use a "all inclusive" kernel. It consists of the kernel, devicetree and command-line parameters. This reduces amount of work the bootloader has to do and reduces the amount of error the bootloader could make. e.g. loading devicetree to wrong address.
This can be done with [g|x|menu]config or by simply modifying the lines below in the
CONFIG_ARM_APPENDED_DTB=yCONFIG_CMDLINE="root=/dev/mmcblk0p2 console=tty0 console=ttyS0,115200n8 [email protected] clk_ignore_unused earlyprintk initcall_debug"CONFIG_CMDLINE_FROM_BOOTLOADER=y# CONFIG_HIDRAW=yCONFIG_I2C_HID=y# CONFIG_TEGRA_DEBUG_UART_AUTO_ODMDATA is not setCONFIG_TEGRA_DEBUG_UARTA=y
#define DEBUG in the top of
arch/arm/boot/compressed/head.S to enable decompressor output to see uart ouput as soon as possible
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j $(nproc)
$(nproc) sets the number of threads to your CPU core count
It asks for some further configuration:
Supplement the appended DTB with traditional ATAG information (ARM_ATAG_DTB_COMPAT) [N/y/?] (NEW) nKernel command line type> 1. Use bootloader kernel arguments if available (CMDLINE_FROM_BOOTLOADER) (NEW)choice[1-3?]: 1
If compiling was successful you should see some output similar to this:
(This doesn't need to be a the end of the log. Scroll up a bit ;) )
Kernel: arch/arm/boot/Image is ready
Kernel: arch/arm/boot/zImage is ready
Append the devicetree to zImage to make a single Image which contains the kernel and the devicetree. This allows to use simpler bootloaders and minimizes errors that the bootloader can make.
cat ./arch/arm/boot/zImage ./arch/arm/boot/dts/tegra30-microsoft-surfaceRT.dtb > ./arch/arm/boot/zImageSRT
Your kernel with appended devicetree should be located at
You can create a .sh script in kernel root to speed up your workflow
plsMake.sh#!/bin/bashmake ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j $(nproc)sleep 1cat ./arch/arm/boot/zImage ./arch/arm/boot/dts/tegra30-microsoft-surfaceRT.dtb > ./arch/arm/boot/zImageSRT