BPI-R4:Beginner questions for kernel building

Hello all,

So, i am running Frank’s image bpi-r4_bookworm_6.9.0-main.img.gz. I got a MT7925 wifi 7 card. But this kernel doesn’t have mt7925 modules. So, i need to compile a new kernel with new config.

I have downloaded the repo GitHub - frank-w/BPI-Router-Linux at 6.10-rc

@frank-w Does this branch have the rss and lro stuff for the sfp ports?

I am following this tutorial: [BPI-R4] SD Debian Bookworm/Bullseye images on kernel 6.8.0-dango - #12 by CRUDO_BHM

Is it really necessary to build a full system image just to change kernels? Can’t i just build and boot a new kernel on the current image i am using?

Assuming, i can just change the kernel, what are the steps for doing so and activating the new card? Do i need to edit device files or something like that?

No we do not have rss/lro running on mainline code

You can use on of my debian/ubuntu images and use build.sh to install the kernel,just add fit= to uEnv.txt like shown when install option was choosen (build.sh shows the full line and asks you to open the file)

Ok, i didn’t get email about your reply, so i built the entire image. The boots fails:

F0: 102B 0000
FA: 5100 0000
FA: 5100 0000 [0200]
F9: 1041 0000
F3: 1001 0000 [0200]
F3: 1001 0000
F6: 102C 0000
F5: 1026 0000
00: 1005 0000
FA: 5100 0000
FA: 5100 0000 [0200]
F9: 1041 0000
F3: 1001 0000 [0200]
F3: 1001 0000
F6: 102C 0000
01: 102A 0001
02: 1005 0000
BP: 0200 00C0 [0001]
EC: 0000 0000 [0000]
MK: 0000 0000 [0000]
T0: 0000 00D7 [0101]
System halt!

However, going to try your recomendation on the working image i got.

EDIT: I did zeroed the sd card before instaling/dd’ing the image.

Ok, i managed to create all the necessary dirs, mount the card* so the build.sh finds it. Also added sudo in line 449 of build.conf, so cp doesn’t fail with perrmission denied.

However:

uImage:
/media/user/BPI-BOOT/6.10.0-rc1.itb
syncing sd-card...this will take a while
run 'watch -n 1 grep -e Dirty: /proc/meminfo' to show progress
using bootfile /media/user/BPI-BOOT//uEnv.txt
by default this kernel-/dtb-file will be loaded (kernel-var in uEnv.txt):
kernel:
dtb:
change needed to boot new kernel (kernel=6.10.0-rc1/fit=6.10.0-rc1.itb)!
open boot config file (uEnv/extlinux.conf) [yn]? y
edit uEnv.txt on sd-card
file /media/user/BPI-BOOT//uEnv.txt not writable by user using sudo...

Then it opens the empty file with vi, but i have no idea what to write there.


.|

* For the uninformed:

mkdir -p /media/user/BPI-BOOT
mkdir -p /media/user/BPI-ROOT
chown -R user:user /media/user/
mount /dev/mmcblk0p5 /media/user/BPI-BOOT
mount /dev/mmcblk0p6 /media/user/BPI-ROOT

This depends on mount options…my ubuntu uses automount with user-access on fat partitions.

I guess you do this as root,right? There is

./build.sh mount

To trigger automount backend if disabled or mount of one partition was blocked

Is is printed before editir is opened:

For arm64 it is the itb part

Pardon my ignorance, so the file should only have this on it?

kernel=6.10.0-rc1/fit=6.10.0-rc1.itb

So, BTW, which branch do you recommend, 6.10-rc or 6.10-rsslro? rsslro contains fixes for the sfp ports, but 6.10rc might have improvements for the MT7925 wifi card, correct? If that’s true, that means i’ll have to pick which fixes i prefer.

Only this part

Rsslro is a dev branch (based on rc branch afair),which may cause issues due to unready rss/lro patches…which patches do you miss in 6.10-rc?

1 Like

Well, you said above that 6.10-rc does not contain rss/lro stuff for proper 10G speed. But i can live with that, for now having the wifi card working properly is priority.

Wifi card support is also on going…we had to wait for an updated firmware i’ve got last week for testing and got the be14v1 this week (not yet found time to insert it).

So do not expect too much, i’ve tested with the v0 version and got all interfaces up without running hostapd on it…much more than with public firmware from sdk.

If you already have a card or maybe someone else i can add patch and firmware to 6.10 tree for more testing…need to get/create a hostapd config for r4/be14 as next step,but also working on uboot ofupstream in limited freetime.

edit: i see that there are much patches in Mailinglist for MT7925 which not have been in 6.10…maybe in next (6.11)…

1 Like

Yeah, i got a mt7925. Even tough i do plan to get the banana wifi7 card later. Maybe i’ll copy the new mt7925 files to see if it compiles with 6.10.rc.

BTW, so you’re running Debian and not openwrt like most people here. Does hostapd support wifi7 already? Or how do you plan to run wifi7?

Have not tried wifi7 yet as i had to bring up the netdev first…this step alone needed a patch for mt76 driver and a new firmware

1 Like

Ok my procedure for MT7925. In case it helps someone.

Even tough with latest compiled hostapd, it is kind of unstable. Note: I had to get an adapter to get the card in the mpcie slot. https://www.aliexpress.com/item/1005006626211720.html (option A). Used some antennas lying around.

At first, it wasn’t working because of lame stuff on my part… Somehow, i touched the boot switch and changed it to all up so of course, it didn’t boot from sd :slight_smile:

If something wrong, just ask me. I do as root. So i commented out the first lines in build.sh.

### KERNEL for installing in a sd card with an already installed image. 6.9 dango or something. The usual compilation packages needed of course.

# will take a while to fully download
git clone -b 6.10-rc  https://github.com/frank-w/BPI-Router-Linux.git
cd BPI-Router-Linux

sed -i s/"board=bpi-r2"/"#board=bpi-r2"/g build.conf
sed -i s/"#board=bpi-r4"/"board=bpi-r4"/g build.conf

# with card inserted on the compilation machine
mkdir -p /media/root/BPI-BOOT
mkdir -p /media/root/BPI-ROOT
mount  /dev/disk/by-label/BPI-BOOT /media/root/BPI-BOOT/
mount  /dev/disk/by-label/BPI-ROOT /media/root/BPI-ROOT

 ./build.sh importconfig
echo -e "CONFIG_MT792x_LIB=m\nCONFIG_MT7921_COMMON=m\nCONFIG_MT7921E=m\nCONFIG_MT7925_COMMON=m\nCONFIG_MT7925E=m" >> ../build/.config
git config --global --add safe.directory $PWD

./build.sh #Choose 2 - Install in SD
# open boot config file (uEnv/extlinux.conf) [yn]? y

#  write and save fit=6.10.0-rc1.itb



#### FULL IMAGE
# previous steps but then these options:

./build.sh  # CHOOSE  1 - PACK
cd ..
git clone https://github.com/frank-w/BPI-Router-Images
cp SD/bpi-r4_6.10.0-rc1.tar.gz BPI-Router-Images/
cd BPI-Router-Images/
echo  -e "imgfile=bpi-r4_sdmmc.img.gz\nskipkerneldownload=1\nkernelfile=bpi-r4_6.10.0-rc1.tar.gz"  > sourcefiles_bpi-r4.conf

./buildimg.sh bpi-r4 bookworm
gunzip -c bpi-r4_bookworm_6.10.0-rc1.img.gz | dd bs=1M status=progress conv=notrunc,fsync of=/dev/mmcblk0

Right now, not perfect AP work, sometimes kind of unstable. But i don’t have much time available to keep testing. Ah, the sfp single mode bidi modules just arrived, will report if they work.

you do not need to clone/compile it works with userrights (of course it needs write-permissions for the current dir)

and it is enough in build.conf to remove the # from bpi-r2…no need to add it for r2 (last variable assignment defines content)

1 Like

@frank-w Is it possible to use the current kernel tree? 6.10 was released and new mediatek patches are in torvalds tree already.

Why do you keep a separate kernel tree? Specific patches for the R4?

Yes,there are still many patches missing (pinctrl,network,dts) in mainline. These are in my 6.10-main which is also built by my ci and can then be taken by my images script when kernelversion in script is updated…but have not verified it yet.

Do you have any specific patches for the wireless meditek drivers? Maybe i can just copy the updated mt7925 files from torvalds tree to yours 6.10 to see if it compiles.

My 6.10 bases on mainline 6.10 why do you want to copy drivers?

To see if makes the mt7925 i got more stable. The released 6.10 does not have the new patches. Your 6.10-main is the released one, right?

it based on v6.10.0, but 6.10 has some issues with usb on r4, we have not the found rootcause yet

Have posted question to mailinglist because i have no idea how to trace the error down and bisecting is tricky with additional patches needed.

https://lkml.org/lkml/2024/7/26/792

edit: fixed the usb-issue in 6.10, turned out that dts nodes were incomplete/wrong