This is a cache of https://discuss.96boards.org/t/building-kernel-module-for-hikey-running-debian-4-19-5-hikey-developer/9136. It is a snapshot of the page at 2024-11-04T12:22:31.466+0000.
Building kernel module for <strong>hikey</strong> running debian (4.19.5-<strong>hikey</strong> - developer) - <strong>hikey</strong> 960 - 96Boards Forum

Building kernel module for hikey running debian (4.19.5-hikey - developer)

Hello everyone,

I would like to build a custom kernel module for the debian that is running on my hikey960 board.
For this I would need kernel headers of the OS. What is the right option.

  1. Download the headers externally and cross-compile on a build server.
  2. Build the kernel module on the hikey device itself.
    Is there any detailed link for building modules?

Thanks, Achyut

Hi,

You could refer to below thread for the detailed steps:

@leo-yan Thank you for the link. I will try to follow along similar lines for hikey960.

Do you/anyone knows if we can build standalone module for the kernel headers and just copy them to hikey and load manually? It would be convienient to just build a module and use.
To put it other ways, Does hikey build system mandates to load the module during the boot?

Thanks,
Achyut

I would suggest to git clone the hikey960 tree and checkout the correct commit/tag to be aligned with your running kernel. Then build the kernel and module(s) you’re interested in and push it on your board via e.g. ssh. You should be able to load it manually with insmod.You may want to copy the module(s) under the standard path (/lib/modules/$(uname -r)/kernel) and run depmod to regenerate dependencies…

@Loic Thanks for the suggestion. I was looking for something faster.

I followed the steps from this page below and was able to successfully build and load kernel modules.

Next step I would like to build my own kernel images. The basic need is to update device tree to suit my needs. I downloaded rootfs and boot files from the link below:
http://snapshots.linaro.org/96boards/hikey/linaro/debian/latest/

Do you/anyone knows where I can find corresponding source code for kernel and steps to build images on our own.

Thanks,
Achyut