Template:S5P4418-KernelHeaderFile/zh
From FriendlyELEC WiKi
1 编译内核头文件安装包
以下操作在在开发板上进行:
1.1 本文适用于如下版本的固件
固件文件名: s5p4418-sd-friendlycore-xenial-4.4-armhf-YYYYMMDD.img, s5p4418-eflasher-friendlycore-xenial-4.4-armhf-YYYYMMDD.img 具体信息:
pi@NanoPC-T2:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 16.04.6 LTS Release: 16.04 Codename: xenial pi@NanoPC-T2:~$ cat /proc/version Linux version 4.4.172-s5p4418 (root@jensen) (gcc version 7.5.0 (ctng-1.24.0-108g-FA) ) #1 SMP PREEMPT Wed Mar 24 15:17:25 CST 2021
1.2 安装所需软件包
sudo apt-get update sudo apt-get install -y dpkg-dev bsdtar
1.3 制作内核头文件安装包
git clone https://github.com/friendlyarm/linux -b nanopi2-v4.4.y --depth 1 kernel-s5pxx18-arm cd kernel-s5pxx18-arm rm -rf .git make distclean touch .scmversion make CROSS_COMPILE= ARCH=arm nanopi2_linux_defconfig alias tar=bsdtar make CROSS_COMPILE= ARCH=arm bindeb-pkg -j4
显示如下信息表示成功:
dpkg-deb: building package 'linux-firmware-image-4.4.172-s5p4418' in '../linux-firmware-image-4.4.172-s5p4418_4.4.172-s5p4418-1_armhf .deb'. dpkg-deb: building package 'linux-headers-4.4.172-s5p4418' in '../linux-headers-4.4.172-s5p4418_4.4.172-s5p4418-1_armhf.deb'. dpkg-deb: building package 'linux-libc-dev' in '../linux-libc-dev_4.4.172-s5p4418-1_armhf.deb'. dpkg-deb: building package 'linux-image-4.4.172-s5p4418' in '../linux-image-4.4.172-s5p4418_4.4.172-s5p4418-1_armhf.deb'. dpkg-genchanges: binary-only upload (no source code included)
1.4 安装
sudo rm -f /lib/modules/4.4.172-s5p4418/build sudo rm -f /lib/modules/4.4.172-s5p4418/source sudo dpkg -i ../linux-headers-4.4.172-s5p4418_4.4.172-s5p4418-1_armhf.deb
1.5 测试
以编译pf_ring模块为例, 参考文档 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=
编译完成后, 使用insmod尝试加载模块:
sudo insmod ./pf_ring.ko