This guide will show you how to build the kernel for the imx8mminievk from source natively on the board. It will assume that you are on a Debian system (see my guidedebootstrap Debian Buster on imx8mminievk). Please note that you will need about 3GB of free disk space.
First off we need to install some tools:
sudo apt install git build-essential bc
Clone the imx_4.14.78_1.0.0_ga branch from the linux-imx git repository:
git clone http://source.codeaurora.org/external/imx/linux-imx --branch imx_4.14.78_1.0.0_ga --single-branch linux-imx_4.14.78_1.0.0_ga
Copy the running linux configuration:
cd linux-imx_4.14.78_1.0.0_ga zcat /proc/config.gz > .config
Blank the CONFIG_LOCALVERSION, Debian packaging does not accept underscores:
sed -i 's/CONFIG_LOCALVERSION=.*/CONFIG_LOCALVERSION=""/' .config
Optional, Reconfigure the kernel:
sudo apt install libncurses5-dev make menuconfig
Build kernel and debian packages:
make -j$(nproc) bindeb-pkg
Install the Debian kernel packages:
sudo dpkg -i ../linux-image-4.14.78-*deb ../linux-headers-4.14.78-*deb
Backup old kernel and install new:
sudo mkdir /mnt/boot && sudo mount /dev/mmcblk1p1 /mnt/boot sudo cp /mnt/boot/Image /mnt/boot/Image.bak sudo sh -c "zcat $(ls -t /boot/vmlinuz* | head -n1) > /mnt/boot/Image"
Reboot system:
sudo reboot
Verify your kernel version with:
uname -a
If the new kernel won't boot, you can connect via serial console (usb-uart) and interrupt the u-boot booting and boot old kernel with:
setenv image Image.bak boot