(precompiled) Kernels for BPI-R2

4.9 is a branch (4.9-patched) in 4.14 github-repo…build is similar to 4.14 with build.sh

But 4.9 is not updated yet to current version. And i have not uploaded a compiled version yet

It is maintained by xbgmsharp…

frank-w when I build with command build.sh I get the kernel ver 4.14 but no 4.9 with which command or parameter I can get kernel ver 4.9 ?

You have to change the branch first after clone

git checkout 4.9_patched
./build.sh importconfig
./build.sh build

i have down+upgraded the 4.9-branch, so you can use the branch 4.9 which is the upgraded 4.9_patched

uploaded a actual version of 4.9-branch here: https://drive.google.com/open?id=1V2hQm422q1KbBwIK2-ztEeFaFv8wa6r0

also uploaded 4.14.32-version to 4.14-folder and 4.4.126 to 4.4-folder

1 Like

Following @frank-w (precompiled) Kernels for BPI-R2, i have create debian/ubuntu kernel image. All kernel image include hardware crypto devices, eg: cryptodev module. I also provide opensll with cryto engines to allow hardware crypto with SSL and SSH, eg: openvpn.

  • libssl1.1_1.1.0f-3+deb9u2+crypto_armhf.deb
  • openssl_1.1.0f-3+deb9u2+crypto_armhf.deb
# openssl engine
(cryptodev) BSD cryptodev engine
(dynamic) Dynamic engine loading support

The deb package does not overwrite the kernel-file (uImage). It will create a separate one (uImage-). You can check the package details and list of file with the command dpkg:

$ dpkg -I DEBIAN/bananapi-r2-image_4.9.44_armv7l.deb l
 new debian package, version 2.0.
 size 24282724 bytes: control archive=284 bytes.
     199 bytes,     9 lines      control              
 Package: bananapi-r2-image
 Version: 4.9.44
 Section: custom
 Priority: optional
 Architecture: armv7l
 Multi-Arch: no
 Essential: no
 Maintainer: [email protected]
 Description: BPI-R2 linux image 4.9.44-4.9_patched-00038-g802d746fa030
$ dpkg --contents bananapi-r2-image_4.4.70_armv7l.deb | less
drwxr-xr-x root/root         0 2018-04-04 07:08 ./
drwxr-xr-x root/root         0 2018-04-04 03:53 ./boot/
drwxr-xr-x root/root         0 2018-04-04 03:53 ./boot/bananapi/
drwxr-xr-x root/root         0 2018-04-04 03:53 ./boot/bananapi/bpi-r2/
drwxr-xr-x root/root         0 2018-04-04 07:03 ./boot/bananapi/bpi-r2/linux/
-rwxr-xr-x root/root   8395442 2018-04-04 07:03 ./boot/bananapi/bpi-r2/linux/uImage_4.4.70-BPI-R2-Kernel
drwxr-xr-x root/root         0 2018-04-04 03:53 ./lib/
drwxr-xr-x root/root         0 2018-04-04 07:04 ./lib/modules/
drwxr-xr-x root/root         0 2018-04-04 07:04 ./lib/modules/4.4.70-BPI-R2-Kernel/
drwxr-xr-x root/root         0 2018-04-04 07:04 ./lib/modules/4.4.70-BPI-R2-Kernel/kernel/
drwxr-xr-x root/root         0 2018-04-04 07:04 ./lib/modules/4.4.70-BPI-R2-Kernel/kernel/arch/
drwxr-xr-x root/root         0 2018-04-04 07:04 ./lib/modules/4.4.70-BPI-R2-Kernel/kernel/arch/arm/
drwxr-xr-x root/root         0 2018-04-04 07:04 ./lib/modules/4.4.70-BPI-R2-Kernel/kernel/arch/arm/crypto/
...

Official 4.4.70 (only repackage as deb).

  • Features: hdmi, Mali450
  • missing features: port-separation, hw-nat
  • Kernel: /boot/bananapi/bpi-r2/linux/uImage_4.4.70-BPI-R2-Kernel
  • Modules: /lib/modules/4.4.70-BPI-R2-Kernel/

4.4-version

  • Features: Port-Separation of lan-Ports, Mali450
  • missing features: hmdi, 2nd GMAC, hw-nat

4.9-version

4.14-version:

Download URL https://admin.julmay.eu/deb/

I believe we should all concentrate our effort on kernel 4.14. Openwrt as move to the 4.14 with include 2gmac and HNAT. https://git.openwrt.org/?p=openwrt/openwrt.git;a=commitdiff;h=1f068588efddf0175e954ffc07ec8478bddd52c7#patch96

  • i tried lede-patches for 4.14, but at least 2nd gmac does not work correctly, btw. your link goes to 4.9-patches, discussion about the 4.14-lede-patches here: Adding second gmac to 4.14
  • 4.16-branches in my repo are only a basic kernel, nothing changed for bpi-r2 yet…also internalwifi-driver is missing
  • 4.4 is in separate repo (forked from official repo)

can you add infos how to compile openssl (for openvpn) and how-to create the deb so i can compile it myself?

cryptodev and openssl are dependent each other. From your kernel i always remove “CONFIG_LOCALVERSION” and select “CONFIG_LOCALVERSION_AUTO”

cryptodev

  • cross compile with openssl-1.1.0f
"cryptodev")
  echo "cryptodev"
  export CFLAGS=-I${KDIR}/openssl-1.1.0f/debian/tmp/usr/include/arm-linux-gnueabihf
  export LDFLAGS+=' -L${KDIR}/openssl-1.1.0f/debian/tmp/usr/lib/arm-linux-gnueabihf'
  cd cryptodev-linux-1.9
  make KERNEL_DIR=${KDIR}
  cd tests
  make CC=arm-linux-gnueabihf-gcc ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

openssl

  • Fetch the debian source
  • Update changelog to add “+crypto”
  • Update debian/rules to compile with crypto engine
  • cross build package
"openssl")
  echo openssl
  # Update package list before, sudo apt-get update
  apt-get source openssl
  cd openssl-1.1.0f
  head -1 debian/changelog | sed -i 's/)/+crypto)/' debian/changelog
  sed -i 's/\tdh_shlibdeps/dh_shlibdeps -l\/usr\/arm-linux-gnueabihf\/lib:$(pwd)\/debian\/libssl1.1\/usr\/lib\/arm-linux-gnueabihf/' debian/rules
  LANG=C ARCH=arm DEB_BUILD_OPTIONS=nocheck CROSS_COMPILE=arm-linux-gnueabihf- \
        DEB_CFLAGS_APPEND='-DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS' \
        DEB_CPPFLAGS_APPEND="-I$(pwd)/../cryptodev-linux-1.9" \
        dpkg-buildpackage -us -uc -aarmhf

debian package

"deb")
  echo "deb package ${ver}"
  # uImage_4.9.44-4.9_patched-00030-g328e50a6cb09
  mkdir -p debian/bananapi-r2-image/boot/bananapi/bpi-r2/linux/
  mkdir -p debian/bananapi-r2-image/lib/modules/
  rm debian/bananapi-r2-image/boot/bananapi/bpi-r2/linux/*
  rm -rf debian/bananapi-r2-image/lib/modules/*
  if test -e ./uImage && test -d mod/lib/modules/${ver}; then
     cp ./uImage debian/bananapi-r2-image/boot/bananapi/bpi-r2/linux/uImage_${ver}
     cp -r mod/lib/modules/${ver} debian/bananapi-r2-image/lib/modules/
     rm debian/bananapi-r2-image/lib/modules/${ver}/{build,source}
     mkdir debian/bananapi-r2-image/lib/modules/${ver}/kernel/extras
     cp cryptodev-linux-1.9/cryptodev.ko debian/bananapi-r2-image/lib/modules/${ver}/kernel/extras
     cat > debian/bananapi-r2-image/DEBIAN/control << EOF
Package: bananapi-r2-image
Version: ${kernver}
Section: custom
Priority: optional
Architecture: armv7l
Multi-Arch: no
Essential: no
Maintainer: [email protected]
Description: BPI-R2 linux image ${ver}
EOF
     cd debian
     fakeroot dpkg-deb --build bananapi-r2-image ../debian
     ls -lh *.deb

why this? i added these options to get rid of the commit-id and the dirty-flag

ok, i had not seen that you have added these options to build.sh in 4.9_patched…btw. please use 4.9-branch, because this is upgraded to a newer version…i have merged most of your commits also into it

your way needs compile on bpi-r2, right (at least for the apt-get source -command)…is it possible to do this on a independed host? i don’t want compile-tools on a router for security reasons :smiley:

I personally prefer to have all info in the kernel name.

All command are run on my virtualbox debian amd64. I don’t have any compile tools on the router, everything is cross compile.

What’s the difference between 4.4-version and Official 4.4.70 ?

i guess @xbgmsharp mean with 4.4 my fork of official repo: https://github.com/frank-w/BPI-R2-4.4

  • it’s upgraded to nearly actual 4.4 version
  • uart 0/1 enabled
  • some build.sh-patches
  • added mt76-wifi-driver (for my mt7612)
  • some fixed uboot-warnings )at least not all :frowning:

details in the commits: https://github.com/frank-w/BPI-R2-4.4/commits/master

Correct the 4.4 version is an up to date kernel.

So far we are all looking for a kernel which support all the announce features, http://www.banana-pi.org/r2.html

It seem like some driver are still proprietary by MediaTek. Idealy we all work together MediaTek and BPI and us.

  • VLAN
  • DSA
  • HW NAT
  • HW QOS
  • HW Crypto
  • WIFI
  • BT
  • Video
  • IR
  • UART, I2C, SPI, PWM, I2S

There are three proprietary drivers - Video WIFI BT, but the others are supported by the mainline kernel.

HW NAT is a special case as it wouldn’t suit the current framework. Fortunately, there are some patches still under review and has been for a month now: https://patchwork.ozlabs.org/patch/865630/

Video. I manage to compile the mali450 driver and almost finish the integration with the mediatek drm instead of MaliDRM which don’t compile.

WIFI BT, this is the driver which need to more work to be stable… as proprietary drivers i expect MediaTek and BPI to release a polish driver

HW NAT, 2Gmac and other are critical part of the router feature.

I am happy to help on the testing or any other way.

1 Like

dear xbgmsharp

Installation bananapi-r2-image error

image is deb_stretch_4.14.13_SD.img date 28.03.18 from https://drive.google.com/drive/folders/1oP7jy1KrrIOifvImo2nQ59wx3_9hHkgk

when I install the package deb_stretch_4.14.13_SD.img I get the following message

пробеловroot@bpi-r2:~/r2tmp/kernel-deb# uname -a

Linux bpi-r2 4.14.13-bpi-r2 #95 SMP Fri Jan 12 17:48:42 CET 2018 armv7l GNU/Linux

root@bpi-r2:~/r2tmp/kernel-deb# dpkg -i bananapi-r2-image_4.14.32_armv7l.deb

dpkg: error processing archive bananapi-r2-image_4.14.32_armv7l.deb (–install):

package architecture (armv7l) does not match system (armhf)

Errors were encountered while processing: bananapi-r2-image_4.14.32_armv7l.deb

what should I do to fix this?

Hello please use the latest, there was some build issue. bananapi-r2-image_4.14.33-b4301e0dcba8_armhf.deb

The new deb package works but it does have a bug. After installation, use the dpkg -i command. The kernel image file uImage_4.14.33-4.14_main-00137-gb4301e0dcba8 is copied to the boot partition but not renamed to uImage. After renaming manually, everything works fine.

CPU in BPI-R2 has armv7l architecture . So you can install the kernel built for architecture armv7l . just need to add to drkg armv7l architecture with command:

dpkg --add-architecture armv7l

That is correct, the kernel image file uImage is copied to the boot partition but not renamed to uImage. I did not want to overwrite the current kernel. In regards to the architecture, most package come from the arch armhf. I will see how to change it.

# dpkg -l | grep linux
ii  bananapi-r2-image                    4.14.33-b4301e0dcba8           armhf        BPI-R2 linux image 4.14.33-4.14_main-00137-gb4301e0dcba8
# uname -a
Linux bpi-r2-emmc 4.14.33-4.14_main-00137-gb4301e0dcba8 #33 SMP Thu Apr 5 02:37:21 CEST 2018 armv7l GNU/Linux