Buster Kernel compile

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.

This process will generate a tar that can be extracted over an image to update the kernel.

Enter the cross compile environment:

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

Inside the docker run:

git clone https://github.com/embeddedarm/linux-a38x.git --depth 1 -b linux-4.14.y linux-4.14
cd linux-4.14

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

make tsa38x_defconfig

# Make source or config customizations here

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

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

tar -xf kernel.tar.gz -C /

This will extract the kernel/modules/firmware over the existing image. On the next boot, the system will use the new kernel.

This can also be added to an tar 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 .