(precompiled) Kernels for BPI-R2


(Frank W.) #1

Hi,

i’ve added some Infos for my precompiled Kernel-Archives in my Wiki:

the archives have 2 folders (BPI-BOOT,BPI-ROOT) which content must be copied to the partition with same name. BPI-BOOT contains the kernel-file (uImage), which should be backed up first (before overwriting)

every actual archive have also a md5 in same gdrive-folder to check if it is damaged (unpack-problems).

On top of wiki-page i started an overview. Please report me which features are working (mainly for 4.4,because i’m currently have only 4.14 running)


BPI-R2 new image: BPI-R2 OpenWrt(LEDE) Souce code : 2018-05-09
Control On-board LEDs
(gary) #2

Thanks a lot, Frank.

Can you please let us know What is the difference between your BPI-R2-4.4 and one we released? I’d like to merge the change to official release.


(Frank W.) #3

It’s a fork of your repo…you see the changes in the commits: https://github.com/frank-w/BPI-R2-4.4/commits/master/?

The important changes are upgrades to higher versions, uart0/1 enable,spi-patch,some build.sh-patches


(victors) #4

dear Frank In in your wiki there is information about the kernel 4.9 with support for hw-nat and port separtion. How can I build such a kernel? Maybe there is a ready precompiled Kernel ?


(Frank W.) #5

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…


(victors) #6

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 ?


(Frank W.) #7

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


(xbgmsharp) #8

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: xbgmsharp@gmail.com
 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/


(xbgmsharp) #9

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


(Frank W.) #10
  • 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?


(xbgmsharp) #11

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: xbgmsharp@gmail.com
Description: BPI-R2 linux image ${ver}
EOF
     cd debian
     fakeroot dpkg-deb --build bananapi-r2-image ../debian
     ls -lh *.deb

(Frank W.) #12

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:


(xbgmsharp) #13

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.


#14

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


(Frank W.) #15

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


(xbgmsharp) #16

Correct the 4.4 version is an up to date kernel.


(xbgmsharp) #17

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

#18

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/


(xbgmsharp) #19

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.


(victors) #20

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?