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 10.0.0.1/255.0.0.0

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 https://github.com/frank-w/BPI-R2-4.14.git 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.

Thanks.

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 https://github.com/frank-w/BPI-R2-4.14.git 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

further:

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

Change:

kernel414=uImage_4.14.149_ext4_f2fs_btrfs

to

kernel414=uImage

Not importing defconfig? I also guess $kernver,$localver not existing outside of build.shā€¦

Btw. Build.sh should also work on r2 directlyā€¦if not please drop me a messge

Thank you for paying attention to defconfig, I added

$kernver = KERNELVERSION

$localver = CONFIG_LOCALVERSION (menuconfig: General setup)

Build.sh requires Debian-specific dependencies:

(ā€¦)

#Check Dependencies

PACKAGE_Error=0

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 build.sh with this patch? we can add depency checks later, if wanted

Have added thus patch to 5.4-merged tree: https://github.com/frank-w/BPI-R2-4.14/blob/b1fd26d53264ed0234fa0b54ad6c3bd7fd57389a/build.sh#L79

btw. where is the linking to /usr/src/linux? where have you added the values of variables?

build.sh - dependency checking is not in a function - so

return 0

doesnā€™t work. It would only be possible to

exit 0

and:

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 ./build.sh 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 https://github.com/frank-w/BPI-R2-4.14 has the most useful functions.

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

emerge frank_sources

:slight_smile:

Just to test the depency-checkā€¦if it works for you i update build.sh 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: build.sh and build.conf, and applied it to my 4.14:

build.sh importconfig ā€” working OK

build.sh config ----------- working OK

build.sh build ------------- working OK

build.sh pack ------------- working OK

build.sh install ------------ problem:

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

else

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

fi

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 build.sh 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): build.sh-install.patch (1,1 KB) ?

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

./build.sh help OK ./build.sh config OK (*) ./build.sh importconfig OK ./build.sh install OK ./build.sh pack - Fail? ā€œ./build.sh: line 589: ā€¦/SD/BPI-ROOT//etc/modprobe.d/cryptodev.conf: No such fil e or directoryā€ ./build.sh 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.