This is a cache of https://discuss.96boards.org/t/how-to-build-linux4-20-for-hikey970/6913. It is a snapshot of the page at 2024-10-31T10:25:12.653+0000.
How to build Linux4.20 for Hikey970? - HiKey970 - 96Boards Forum

How to build Linux4.20 for Hikey970?

I had a Hikey970 running Linux 4.9 (ubuntu built by myself) and I want to build a 4.20 kernel for this board.
I’ve tried use menconfig myself but the kernel won’t boot up ( no console message after "Machine : Hikey970 ".
I’ve tried copy hikey970_defconfig from 4.9 kernel and it won’t boot up ether.
But according to the patch message and I quote

Add devicetree support for HiKey970 development board which
based on Hi3670 SoC and is also one of the 96Boards Consumer
Edition and AI platform.

Only UART6 is enabled which is the default console required
by the 96Boards Consumer Edition Specification.

This patch has been tested on HiKey970 Board.
LKML: Manivannan Sadhasivam: [PATCH 4/4] arm64: dts: Add devicetree support for HiKey970 board

No luck asking for tutorial from this Xu Wei guy.

Hi @mengzhuo,

We only provide support for 4.19.5 kernel as it is used in our Debian snapshot image. But you can boot whatever kernel version > 4.19.5 once the necessary commits for HiKey970 are cherrypicked.

Coming to kernel build, you have 2 options:

  1. Build it as a debian package: https://github.com/96boards/documentation/blob/master/consumer/hikey/hikey620/build/linux-kernel.md
  2. Use defconfig with all UFS and MMC related drivers as =y and build and flash the kernel as below:
$ make Image dtbs
$ wget http://releases.linaro.org/96boards/dragonboard410c/linaro/debian/18.01/initrd.img-4.14.0-qcomlt-arm64 -O initrd.img
$ cat arch/arm64/boot/Image arch/arm64/boot/dts/hisilicon/hi3670-hikey970.dtb > Image-dtb
$ mkbootimg --kernel Image-dtb --ramdisk initrd.img --cmdline "earlycon=pl011,0xfff32000 console=ttyS0,115200n8 root=/dev/disk/by-partlabel/rootfs rw rootwait" --base 0x0 --tags_offset 0x07A00000 --kernel_offset 0x00080000 --ramdisk_offset 0x07c00000 --output boot.img
# Prepare the board in fastboot mode
$ sudo fastboot flash boot boot.img

Where do we find that 4.19.5 kernel source that you refer to?
The debian package link seems to relate to an old build package for an even older board.
And in the wget from the example it seems a kernel 4.14.0 is referred?

Would be nice if the references actually refer to that 4.19.5 kernel.

Thanks for your reply
I’ve tried build your 4.19.5 kernel and it works!
However the Ethernet and LEDs are not working, but console and eMMC works fine.

Hope you can fix it and those patches merged into mainline soon.

HDMI is working well too?

@janrinze

Kernel: manivannan.sadhasivam/hikey.git - [no description]
Branch: master
Revision: 4.19.5

Thanks,
Mani

No, not yet! It will take some time.

Saw the UFS patches coming in.
@Mani have you tried kexec yet on hikey970? Would have been a nice way to test new kernels if it worked. I could not get it working yet.

Hi Mani,

Thanks for your work. I built and booted this kernel but I seem to have problems getting the network to work. Have you experienced problems with this before?

Cheers,
Babis

Hi @bchalios,

Sorry for the misleading previous post from me. There is no on-board WiFi or Ethernet support exist for HiKey970 in mainline. You can try the vendor kernel for network support.

Thanks,
Mani

I am running the Leubuntu on the HK970.
I want to add the pcie support to the kernel and i am a bit confused.

What kernel source should i use for the ubuntu build?
Is the kernel like dragonboard and uses the same source as AOSP Kernel?
Where is the Vendor Kernel source that you reference?

Thank You for any help.