TS-7250-V3 kernel compile guide

From Technologic Systems Manuals

The kernel can be compiled on its own using the Debian 10 Cross Compiler. This should be run from a workstation, and not directly on the board. As with the Debian development, this requires setting up the docker for cross compiling.

Enter the cross compile environment:

# Create a place to store the kernel:
mkdir -p ~/Projects/tsimx6ul/kernel/
cd ~/Projects/tsimx6ul/kernel/
docker run -it --volume $(pwd):/work armhf-buster-toolchain bash

Inside the docker run:

cd /work/
git clone https://github.com/embeddedarm/linux-4.9.y.git --depth 1 linux
cd linux/

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-
make tsimx6ul_defconfig

# Make source or config customizations here

export TEMP=$(mktemp -d)
make -j $(nproc --all) all zImage
mkdir "$TEMP/boot/"
cp arch/arm/boot/zImage "$TEMP"/boot/zImage
cp arch/arm/boot/dts/imx6*-ts*.dtb "$TEMP"/boot/ 
INSTALL_MOD_PATH="$TEMP" make modules_install
tar czf kernel.tar.gz -C "$TEMP" .

After building this will output a kernel to ~/Projects/tsimx6ul/kernel/linux/kernel.tar.gz. This file can be copied to the board, and then installed with:

tar -xf kernel.tar.gz -C /

This can also be added to an image with:

mkdir /tmp/image/
sudo tar --numeric-owner -xf old-image.tar.bz2 -C /tmp/image/
sudo tar -xf kernel.tar.gz -C /tmp/image/
sudo tar --numeric-owner -cjf new-image.tar.bz2 -C /tmp/image .