Banana Pi BPI-R2 new image:Gentoo image 2019-10-27

BPI-R2 Gentoo Image Kernel Frank-FW 4.14.149

(Many thanks to Frank!)

needed 32GB SD

rootFS: f2fs

user: bpi; pass: bananapi

user: root; pass: Bpi-R2!#

wan: dhcpcd br0: lan0,lan1,lan2,lan3

AP should working, but is not configured

ntpd -> chronyd,

time configured for Poland

The kernel has built-in drivers f2fs, ext4 and btrfs, so you can run from any of them IFB, HW-NAT, load in default.

Almost all network modules compiled

kernel sources:

cd /opt/kernel

git clone BPI-R2-4.14

then it will be linked to /usr/src/linux

1 Like

Hello Dear,

Great work.

Is it a Server Image or DE? Just to confirm. I also have some concern over the size of the img file and also 32gb sd requirement.

Did you make image of the sd card you used? If so then can you shrink it to remove the empty space? As 4GB for a distro is quite big, Actually I would like to try it but the file size is quite big for me. Also a guide on how to flash it will be helpful for normal users.


hi, the trgmii-setting in 4.14 is basicly wrong, but with right config (trgmii for gmac0 and rgmii for gmac1) packets on gmac 0 are damaged so it is defined this way in dts…just drop this “feature” from your list :wink:

for size of image:

  • remove cache-files (paketmanager)
  • clean logfiles
  • write a 0-file (/dev/zero) till your partition is full and remove it (best is to do it inside the image not in running system)
1 Like

I have reduced the 1.6GB image package - kernel sources dumped for download separately, zero unused FS space. This is in line with the Gentoo basic system philosophy for further software installation.

Ultimately, I’m going to create a router with shaping, squid - censorship for underage users, NAS, DLNA, samba - hence the size of the file system. (Actually, I am currently using rootFS on HDD myself, because my EMMC is dead). Maybe something else will come out during use.

Short instruction (for beginners) on how to build your own kernel:

cd /opt/kernel

git clone BPI-R2-4.14

cd BPI-R2-4.14

then it will be linked to /usr/src/linux

the first time you use the git archive

make mt7623n_evb_fwu_defconfig

if we’ve already compiled something:

make clean


make menuconfig

make -j3

-j3 - to leave some resources for another job. If we do nothing, on R2 you can give -j4 or even -j5

make modules_install

modules are installed in the directory /lib/modules/$kernelver_$localver

cat arch/arm/boot/zImage arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dtb > arch/arm/boot/zImage-dtb

mkimage -A arm -O linux -T kernel -C none -a 80008000 -e 80008000 -n “Linux Kernel $kernver” -d arch/arm/boot/zImage-dtb ./uImage

cp ./uImage /boot/bananapi/bpi-r2/linux/uImage

nano /boot/bananapi/bpi-r2/linux/uEnv.txt





Not importing defconfig? I also guess $kernver,$localver not existing outside of…

Btw. should also work on r2 directly…if not please drop me a messge

Thank you for paying attention to defconfig, I added


$localver = CONFIG_LOCALVERSION (menuconfig: General setup) requires Debian-specific dependencies:


#Check Dependencies


PACKAGES=$(dpkg -l | awk ‘{print $2}’)


You can change the dpkg-line to match your gentoo :slight_smile: if we found a way to check for other system (e.g. /etc/issue) the function can be made universal…thats why i had moved the code to a function :slight_smile:

as workaround you can patch it to return 0 on gentoo at beginning of function…

checkdep_only_debian.patch (382 Bytes)

patch -p1 < checkdep_only_debian.patch

@mt_werty can you please test if you can use with this patch? we can add depency checks later, if wanted

Have added thus patch to 5.4-merged tree:

btw. where is the linking to /usr/src/linux? where have you added the values of variables? - dependency checking is not in a function - so

return 0

doesn’t work. It would only be possible to

exit 0


echo "currently script working only on debian / ubuntu … "

Or create a “check” function and call it in the right places … I did it and then ./ works (in terms of compiling and installing the kernel).

Of course the “function deb” does not work either :slight_smile:

Have you used 5.4-merged tree for testing? There is depency-checking in function…

No. I’m using 4.14.

My goal is not to play with the kernel, but to configure specific functions on BPI-R2: NAS, routing, QoS … etc. And the kernel 4.14 in the description at has the most useful functions.

Btw A better approach in Gentoo would be to write an ebuild to do

emerge frank_sources


Just to test the depency-check…if it works for you i update in all lts-branches (4.14,4.19)

It’s OK.

Build Kernel

depency-check currently only on debian/ubuntu…

generate branch vars…

you can do all (importconfig,config,build,pack)?

the link you have already in your image fixed (and have not be done by user)? does it work with additional modules (afair link needs name of current running kernel = $(uname -r) )

KERNELVERSION is defined in Makefile

CONFIG_LOCALVERSION is defined in .config

/usr/src/linux -> /opt/kernel/BPI-R2-4.14

I downloaded from the 5.4-mdf-fix branch: and build.conf, and applied it to my 4.14: importconfig — working OK config ----------- working OK build ------------- working OK pack ------------- working OK install ------------ problem:

What if you want to rename the kernel file? - Failed. Should be:


  •      echo "actual Kernel not /boot mounted?"
  •      cp ./uImage $kernelfile
  •      sudo make modules_install


Moreover, I still have some problems with write permissions for “install”, but this is not today … :-:sleeping:

Oh,thats wrong…message should only appear for backup…install (cp+make) should be done after that if-section…

There are not many users afaik using without crosscompile (including me).

is kernel installed in same directory? Should i make cp also with sudo?

@mt_werty could you try this patch over your current version (5.4-merged): (1,1 KB) ?

@mt_werty have you tested the Patch? i have it now included in my 5.4-merged tree

./ help OK ./ config OK (*) ./ importconfig OK ./ install OK ./ pack - Fail? “./ line 589: …/SD/BPI-ROOT//etc/modprobe.d/cryptodev.conf: No such fil e or directory” ./ uenv - Fail - open new file??

/* - The graphics ncurses menuconfig crumble, when I give the usual “make menuconfig” it looks much better. Why?

Good file as it is, gentoo’s ebuild system handles dependencies. I’m still struggling with the install to be sufficiently automated.