This is a cache of It is a snapshot of the page at 2021-12-02T02:42:43.447+0000.
<strong>96Boards</strong>: Real time and ROS2 | Hikey<strong>970</strong> RT Setup - <strong>96Boards</strong>

96Boards: Real time and ROS2 | Hikey970 RT Setup

Servando German Serrano

Real Time enablement on 96Boards

The following is the first on a series of blogs targeting the enablement of real time capabilities on a range of 96Boards.

We’ll kick off with the Hikey970, which features the HiSilicon Kirin 970 SoC with HiAI Architecture and a dedicated NPU. In addition of 6GB LPDDR4X 1866MHz memory, 64GB UFS 2.1 storage, Bluetooth ® wireless technology, WIFI, GPS among many other features.

The post is organized as follows:

Board preparation: Bionic Builder

The Bionic Builder Tool can be used to flash the board with an Ubuntu 18.04 image for the Hikey970. This will allow installing Docker and, as of the time of writing, ROS Melodic and ROS2 Dashing.

After flashing the board with Ubuntu 18.04 we need to update the bootloader.

Bootloader update

The bootloader needs to be updated to enable PCIE power on the board.

Download the updated bootloader (fip.bin, l-loader.bin, sec_usb_xloader.img and sec_usb_xloader2.img) and the convenience script from

Set the board to Recovery Mode and follow the steps to flash the updated bootloader, e.g. (assuming the board appears as ttyUSB0):

$ sudo python -d /dev/ttyUSB0 --img1 ./sec_usb_xloader.img --img2 ./sec_usb_xloader2.img --img3 ./l-loader.bin
$ sudo fastboot flash fastboot l-loader.bin
$ sudo fastboot flash fip fip.bin

Following the board jumper pins need to be set to fastboot mode as explained in

Kernel upgrade and flash

As mentioned at the beginning of this blog, our aim is to enable real time capabilities on the Hikey970 for further development.

The PREEMPT_RT patch changes the Linux kernel into being fully preemptible which enables real time capabilities on the patched kernel.

The preempt_rt patches are released for different kernel versions. Linux kernel v4.9.78 is the supported one for the Hikey970. Since there is no preempt_rt patch for this kernel version, a number of patches have been backported to v4.14.78 following Mani’s blog posts. The modified kernel can be found in

In order to build and flash the preempt_rt enabled kernel on the Hikey970:

  • Get kernel v4.14.78 from
    $ git clone -b hi970_4.14.78 linux-4.14.78
  • Download the appropriate preempt_rt patch:
    $ wget
  • Change directory to the kernel source and apply the patch:
    $ cd linux-4.14.78
    $ xzcat ../patch-4.14.78-rt47.patch.xz | patch -p1
  • Download the kernel config:
    $ wget -O .config
  • Build the kernel:
    $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- dtbs modules Image
  • The modules can be installed into a local folder and should be copied on to the board before flashing the new kernel:
    $ mkdir hikey970_modules
    $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- modules_install INSTALL_MOD_PATH=./hikey970_modules
  • Copy the modules to the board in /lib/modules/
  • Move up one level and download the ramdisk from and convenience script from
    $ cd ..
    $ wget
    $ wget
  • With the Hikey970 in fastboot mode, run the script to flash the compiled kernel:
    $ chmod +x
    $ ./
  • After flashing the kernel reboot the board and log into it, e.g. via the serial port. Now, if everything went well doing uname -v should show ... SMP PREEMPT RT ... so we can confirm that the running kernel has been successfully patched.


It is possible that the Wifi does not connect automatically after flashing the rt enabled kernel. To enable it back again you need to log into the board via the serial interface, check that the wlan0 interface is available doing ifconfig -a and then:

$ sudo systemctl stop NetworkManager
$ sudo systemctl start NetworkManager

for it to restart.


Next week, we’ll make use of our new board setup to install ROS2 and test the pendulum demo which requires real time capabilities on the target hardware. In addition we’ll run a simple performance comparison between FastRTPS and Eclipse Cyclone DDS implementations.

This article is Part 1 in a 4-Part Series.

comments powered by Disqus

Other Posts