Template:S5P6818-KernelHeaderFile

From FriendlyELEC WiKi
Jump to: navigation, search

1 Build Kernel Headers Package

The following commands need to be executed on the development board:

1.1 Software Version

The OS image file name: s5p6818-sd-friendlycore-xenial-4.4-arm64-YYYYMMDD.img, s5p6818-eflasher-friendlycore-xenial-4.4-arm64-YYYYMMDD.img

pi@NanoPC-T3:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:        16.04
Codename:       xenial
pi@NanoPC-T3:~$ cat /proc/version
Linux version 4.4.172-s5p6818 (root@jensen) (gcc version 6.4.0 (ctng-1.23.0-150g-FA) ) #1 SMP PREEMPT Thu Jan 21 18:51:13 CST 2021

1.2 Install the required packages

sudo apt-get update
sudo apt-get install -y dpkg-dev bsdtar

1.3 Build Kernel Headers Package

git clone https://github.com/friendlyarm/linux -b nanopi2-v4.4.y --depth 1 kernel-s5pxx18-arm64
cd kernel-s5pxx18-arm64
rm -rf .git
make distclean
touch .scmversion
sed -i '/^CONFIG_CROSS_COMPILE/d' ./arch/arm64/configs/nanopi3_linux_defconfig
make CROSS_COMPILE= ARCH=arm64 nanopi3_linux_defconfig
alias tar=bsdtar
make CROSS_COMPILE= ARCH=arm64 bindeb-pkg -j4

The following message is displayed to indicate completion:

dpkg-deb: building package 'linux-firmware-image-4.4.172-s5p6818' in '../linux-firmware-image-4.4.172-s5p6818_4.4.172-s5p6818-1_arm64.deb'.
dpkg-deb: building package 'linux-headers-4.4.172-s5p6818' in '../linux-headers-4.4.172-s5p6818_4.4.172-s5p6818-1_arm64.deb'.
dpkg-deb: building package 'linux-libc-dev' in '../linux-libc-dev_4.4.172-s5p6818-1_arm64.deb'.
dpkg-deb: building package 'linux-image-4.4.172-s5p6818' in '../linux-image-4.4.172-s5p6818_4.4.172-s5p6818-1_arm64.deb'.
dpkg-genchanges: binary-only upload (no source code included)

1.4 Installation

sudo rm -f /lib/modules/4.4.172-s5p6818/build
sudo rm -f /lib/modules/4.4.172-s5p6818/source
sudo dpkg -i ../linux-headers-4.4.172-s5p6818_4.4.172-s5p6818-1_arm64.deb

1.5 Testing

To compile the pf_ring module as an example, refer to the documentation: https://www.ntop.org/guides/pf_ring/get_started/git_installation.html.

git clone https://github.com/ntop/PF_RING.git
cd PF_RING/kernel/
make CROSS_COMPILE=

After compiling, use insmod to try to load the module:

sudo insmod ./pf_ring.ko