Commit bc752619 authored by David Boddie's avatar David Boddie

Start a guide about rebuilding and installing a new kernel

parent 2e35cf41
Rebuilding the Kernel
These instructions aim to help you rebuild the kernel for the development board
separately from the process of building a new image in its entirety. It also
covers the process of installing the kernel and other binaries on the board.
The building step can be performed without any modifications to the board.
While it is possible to replace an existing kernel with a new one, you may find
it useful to attach a :ref:`USB to serial adapter <imx8_devkit_usb_to_serial_adapter_>`_
to the board so that can interact with the bootloader and select a different
kernel to run. This makes it possible to install new kernels alongside the
original one and fall back to the original one if the new ones fail to work.
.. contents::
Installing the Toolchain
Install the necessary packages for your system. On Debian-based systems, you
can do this with the ``apt`` tool::
sudo apt install crossbuild-essential-arm64 build-essential gcc-aarch64-linux-gnu bison
On Fedora, use the ``dnf`` tool::
sudo dnf install gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu
It should now be possible to cross-compile the kernel for the development board.
Building the Kernel
Clone the `linux-emcraft`_ repository and enter the working directory::
git clone
cd linux-emcraft
For simplicity, we create a directory to hold the modules that will be built::
mkdir _modules
Compile the kernel
CROSS_COMPILE='ccache aarch64-linux-gnu-'
make ARCH=arm64 librem5-evk_defconfig all modules_install
Installing the Kernel
Connect the development board to a network and find its address.
Copy the kernel, device tree binary and modules to the board, replacing
``pureos`` with the IP address of the development board and ``$KERNEL_VERSION``
with the version of the kernel that was built::
scp arch/arm64/boot/Image root@pureos:/boot/boot2/
scp arch/arm64/boot/dts/freescale/librem5-evk.dtb root@pureos:/boot/boot2/dtbs/
rm _modules/lib/modules/$KERNEL_VERSION/source
rm _modules/lib/modules/$KERNEL_VERSION/build
scp -r _modules/lib/modules/$KERNEL_VERSION root@pureos:/lib/modules/
Booting into U-Boot
Plug in the USB to serial adapter and open a serial connection, replacing
``ttyUSB0`` with the appropriate device file if necessary::
picocom -b 115200 /dev/ttyUSB0
Reboot the development board and wait until you see the following text::
Hit any key to stop autoboot:
Press Return and enter the following commands at the U-Boot prompt::
setenv bootdir boot2/
......@@ -45,6 +45,7 @@ Each voltage is measured against ground (green circle in above image).
3. Plug in the SOM.
.. _imx8_devkit_usb_to_serial_adapter:
Attaching a USB to Serial Adapter
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment