Difference between revisions of "Template:H3-KernelHeaderFile"

From FriendlyELEC WiKi
Jump to: navigation, search
(updated by API)
 
(updated by API)
 
Line 1: Line 1:
 
==Build Kernel Headers Package==
 
==Build Kernel Headers Package==
 +
The following commands need to be executed on the development board:
 +
===Software Version===
 +
The OS image file name: nanopi-XXX_sd_friendlycore-focal_4.14_armhf_YYYYMMDD.img
 +
<syntaxhighlight lang="bash">
 +
$ lsb_release -a
 +
No LSB modules are available.
 +
Distributor ID: Ubuntu
 +
Description:    Ubuntu 20.04 LTS
 +
Release:        20.04
 +
Codename:      focal
 +
 +
$ cat /proc/version
 +
Linux version 4.14.111 (root@ubuntu) (gcc version 4.9.3 (ctng-1.21.0-229g-FA)) #193 SMP Thu Jun 10 18:20:47 CST 2021
 +
</syntaxhighlight>
 +
===Install the required packages===
 +
<syntaxhighlight lang="bash">
 +
sudo apt-get update
 +
sudo apt-get install dpkg-dev libarchive-tools
 +
</syntaxhighlight>
 +
===Build Kernel Headers Package===
 +
<syntaxhighlight lang="bash">
 +
git clone https://github.com/friendlyarm/linux -b sunxi-4.14.y --depth 1 kernel-h3
 +
cd kernel-h3
 +
rm -rf .git
 +
make distclean
 +
touch .scmversion
 +
make CROSS_COMPILE= ARCH=arm sunxi_defconfig
 +
alias tar=bsdtar
 +
make CROSS_COMPILE= ARCH=arm bindeb-pkg -j4
 +
</syntaxhighlight>
 +
The following message is displayed to indicate completion:
 +
<syntaxhighlight lang="bash">
 +
dpkg-deb: building package 'linux-headers-4.14.111' in '../linux-headers-4.14.111_4.14.111-1_armhf.deb'.
 +
dpkg-deb: building package 'linux-libc-dev' in '../linux-libc-dev_4.14.111-1_armhf.deb'.
 +
dpkg-deb: building package 'linux-image-4.14.111' in '../linux-image-4.14.111_4.14.111-1_armhf.deb'.
 +
dpkg-genchanges: warning: substitution variable ${kernel:debarch} used, but is not defined
 +
dpkg-genchanges: info: binary-only upload (no source code included)
 +
</syntaxhighlight>
 +
==Installation===
 +
<syntaxhighlight lang="bash">
 +
sudo dpkg -i ../linux-headers-4.14.111_4.14.111-1_armhf.deb
 +
</syntaxhighlight>
 +
===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.
 +
<syntaxhighlight lang="bash">
 +
git clone https://github.com/ntop/PF_RING.git
 +
cd PF_RING/kernel/
 +
make
 +
</syntaxhighlight>
 +
After compiling, use insmod to try to load the module:
 +
<syntaxhighlight lang="bash">
 +
sudo insmod ./pf_ring.ko
 +
</syntaxhighlight>

Latest revision as of 10:50, 21 March 2022

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: nanopi-XXX_sd_friendlycore-focal_4.14_armhf_YYYYMMDD.img

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04 LTS
Release:        20.04
Codename:       focal
 
$ cat /proc/version
Linux version 4.14.111 (root@ubuntu) (gcc version 4.9.3 (ctng-1.21.0-229g-FA)) #193 SMP Thu Jun 10 18:20:47 CST 2021

1.2 Install the required packages

sudo apt-get update
sudo apt-get install dpkg-dev libarchive-tools

1.3 Build Kernel Headers Package

git clone https://github.com/friendlyarm/linux -b sunxi-4.14.y --depth 1 kernel-h3
cd kernel-h3
rm -rf .git
make distclean
touch .scmversion
make CROSS_COMPILE= ARCH=arm sunxi_defconfig
alias tar=bsdtar
make CROSS_COMPILE= ARCH=arm bindeb-pkg -j4

The following message is displayed to indicate completion:

dpkg-deb: building package 'linux-headers-4.14.111' in '../linux-headers-4.14.111_4.14.111-1_armhf.deb'.
dpkg-deb: building package 'linux-libc-dev' in '../linux-libc-dev_4.14.111-1_armhf.deb'.
dpkg-deb: building package 'linux-image-4.14.111' in '../linux-image-4.14.111_4.14.111-1_armhf.deb'.
dpkg-genchanges: warning: substitution variable ${kernel:debarch} used, but is not defined
dpkg-genchanges: info: binary-only upload (no source code included)

2 Installation=

sudo dpkg -i ../linux-headers-4.14.111_4.14.111-1_armhf.deb

2.1 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

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

sudo insmod ./pf_ring.ko