Configure & Build

Configure and build Linux kernel for Surface RT

Editing kernel build configuration

First run the command make ARCH=arm tegra_defconfig This will create a standard kernel config for tegra SoC's.

Open the file .config in the kernel source directory with your favorite text editor and paste the following at the end of the file

CONFIG_EFI_STUB=y CONFIG_EFI=y CONFIG_I2C_HID_OF=y CONFIG_I2C_HOTPLUG_GPIO=y CONFIG_BATTERY_CHARGER_SURFACE_RT=y CONFIG_MWIFIEX=m CONFIG_MWIFIEX_SDIO=m CONFIG_SND_SOC_TEGRA_WM8962=y CONFIG_HID_MICROSOFT=y

Note that some drivers (Wi-Fi) are built as modules. See exporting modules below to use them.

Build the kernel

To build the kernel use the command make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j $(nproc) - $(nproc) sets the number of threads to your CPU core count This command can take a while depending on your computer's speed. (5+ minutes)

Note: If you get asked what configuration you want to choose, just press enter, this will take the standard value.

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 ;) ) CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh CHK include/generated/compile.h Kernel: arch/arm/boot/Image is ready Kernel: arch/arm/boot/zImage is ready

The output kernel image is located at arch/arm/boot/zImage

The output device tree is located at EFI:arch/arm/boot/dts/tegra30-microsoft-surface-rt-efi.dtb. APX:arch/arm/boot/dts/tegra30-microsoft-surface-rt.dtb.

Build the kernel using shell script

You can create a .sh script in kernel root to speed up your workflow

plsMake.sh
#!/bin/bash
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j $(nproc)

Using modules

Some drivers will be built as modules. This reduces the kernel image size.

The module folder needs to be placed on the rootfilesystem in /lib/modules.

Some drivers need to be built as module. For example the Wi-Fi driver. Wi-Fi needs a firmware which will be send to the Wi-Fi SoC at the time the hardware is probed. This can happen before the root filesystem is mounted. Therefore the driver can't load the firmware. If wifi is built as module it won't be loaded before the root filesystem was mounted.

Exporting modules

make INSTALL_MOD_PATH=../ modules_install > /dev/null

This command will place the modules folder next to your Linux kernel folder.

You need to copy the modules after: - Modifying the kernel source for the first time - Every git commit - Editing a driver which is built as module (obvious?)

Last updated