BPI-R2 (MT7623N) BPI-Router-Linux-5.15 main config restarts?

Apparently, I can no longer post topics under the BPI-R2 (MT7623N) Category?

Anyway, I’m compiling a newer kernel for my BPI-R2 (MT7623N) using the BPI-Router-Linux-5.15 main source from frank w, with my Slackware 15.0 ARMv7 BPI-R2, system and I have some questions.

After downloading and unpacking the kernel source, I used the mt7623n_evb_fwu_defconfig to configure the kernel - issuing:

 $ make mt7623n_evb_fwu_defconfig

The make deconfig went just fine, and I remembered from my previous compiles that I needed to update the …

 CONFIG_MTK_PLATFORM="" 

with

 CONFIG_MTK_PLATFORM="mt7623" 

So I issued the following sed command.

 sed -i "s:CONFIG_MTK_PLATFORM=\"\":CONFIG_MTK_PLATFORM=\"mt7623\":g" .config

Anyway, after I updated the CONFIG_MTK_PLATFORM string, I started to compile it …

 $ make -j5 all

After compiling for a few minutes, I got the following? …

* Restart config...
*
* Mediatek Peripherals
*
MTK platform name (MTK_PLATFORM) [] (NEW) mt7623
MediaTek BTIF Driver (MTK_BTIF) [Y/?] y

So I was wondering if anyone else has encountered a “Restart config” while compiling their kernel?

Oh, and I am now also curious as to why I’m not allowed to start topics under the Banana Pi R2 category? I was able to do so in the past.

Plus, is there a way to create a printer friendly version of posts? As some appear to have helpful instruction and information. Such as, the tutorial …

[Tutorial] Build, customize and use MediaTek open-source U-Boot and ATF"

As it would be nice to have a printed copy - if and/or when, I ever get around to working on my BPI-R64.

Where do you compile? I do not see crosscompiler definition that is needed for importing defconfig,menuconfig and build.

Why not use build.ah?

Question - Where do you compile?

Answer: I compile on native operating systems. If I am building a kernel for an ARMv7, I typically use a native ARMv7 operating systems to compile the kernels for that systems.

$ readelf /usr/bin/gcc -A
Attribute Section: aeabi
File Attributes
  Tag_CPU_name: "7-A"
  Tag_CPU_arch: v7
  Tag_CPU_arch_profile: Application
  Tag_ARM_ISA_use: Yes
  Tag_THUMB_ISA_use: Thumb-2
  Tag_FP_arch: VFPv3-D16
  Tag_ABI_PCS_wchar_t: 4
  Tag_ABI_FP_rounding: Needed
  Tag_ABI_FP_denormal: Needed
  Tag_ABI_FP_exceptions: Needed
  Tag_ABI_FP_number_model: IEEE 754
  Tag_ABI_align_needed: 8-byte
  Tag_ABI_align_preserved: 8-byte, except leaf SP
  Tag_ABI_enum_size: int
  Tag_ABI_VFP_args: VFP registers
  Tag_CPU_unaligned_access: v6

Here is what I export from my .bashrc, so these are set at login.

# Automatically determine the architecture we're building on:
if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    arm*) export ARCH=arm ;;
    # Unless $ARCH is already set, use uname -m for all other archs:
       *) export ARCH=$( uname -m ) ;;
  esac
fi

export LD="ld"
export CC="gcc"
export CFLAGS="-O2 -march=native"
export CXXFLAGS="-O2 -march=native"

If I need to compile in something other than a native environment, for example a bare-metal compiler, then I set cross compiling to something like arm-none-eabi, or aarch64-none-elf, otherwise I just compile native, and the kernel compile knows how to set aarch64 to arm64.

Question - Why not use build.ah?

Answer: While I do like using build scripts, and often use them for many programs; I also do a lot of stuff manually, so that I can learn the process, and teach that process to others.

In fact, I have used your build script; however, not to compile my kernel for the Banana Pi R2, but to learn how the kernel is compiled for the Banana Pi R2.

In the image below, I am teaching a group of kids how to use Slackware64 14.1 Linux at my old learning facility in Plymouth back in 2021. Indiana Non-Profit Information Technology Organization. At that time, I only knew how to use x86, and x86_64 systems, so that is what I taught x86 and x86_64 OS.

20210724A-BoyzHangingOutInTheMinistryG

If I ever get the money to start another learning facility again, I would like to teach ARM32 and ARM64 development too. As ARM32 and ARM64 use far less power and would allow for lower electric bills.

I also wanted to know if the creators of this website forum could add a “Printer Friendly” option on posts, as there is a lot of great information for learning shared on the posts in this forum.

it is ok, but make sure your system is always bootable (or at least keep last working kernel)…if your new kernel does not boot you have a problem :slight_smile:

but i do not know why your config is restarting…i also imported my defconfig, which should work as is without modification. Maybe the config-restart is because you started compile with the var set to mt7623 and then continue with empty because you changed .config after compiling some parts.

so maybe modify defconfig (but this should not be needed) and import this again or do a make clean after the .config change

The mt6625l driver (where the btif afair belongs to and the option you changed) is really huge and dirty (and so hard to debug). i could not manage to port this driver from 5.19 to 6.0 because the wifi-framework changed much.

afaik arm32 is EOL…new boards are mostly (or all) arm64.

Blockquote “it is ok, but make sure your system is always bootable (or at least keep last working kernel)…if your new kernel does not boot you have a problem.”

Yes, I totally agree. :+1: It is always a good ideal to keep backups.

Blockquote “i also imported my defconfig”

Oh? I though mt7623n_evb_fwu_defconfig was your defconfig? I thought that it meant fwu referred to Frank W Update? Either that or Firmware Update? One of the two.

If you have another or better defined 5.15 main defconfig, where can I find it?

Blockquote “The mt6625l driver (where the btif afair belongs to and the option you changed) is really huge and dirty (and so hard to debug). i could not manage to port this driver from 5.19 to 6.0 because the wifi-framework changed much.”

I’m still using the 5.15 main, when recompiling new kernels, as 5.15 has not reached its eol at kernels.org. Until SlackwareARM-15.1 comes out, I’ll probably stick with the 5.15 main, SlackwareARM-15.0 was released with the 5.15.21 kernel.

Or, I may continue to use SlackwareARM-15.0 as I have heard that SlackwareARM-15.0 is the last ARM32 bit that Slackware will release and all SlackwareARM releases starting with SlackwareARM-15.1 will only be Aarch64 from that time forward.

fwu stands for my name :slight_smile: “wu” is from my last name. No update. And it is the defconfig i use and also my ci pipeline

Slack will maybe not support r2 or at least miss the internal wifi driver. If you do not need this you can also use 6.6 or 6.12

I’m thinking about taking the time to read and learn the following book, so I can start writing my own drivers for Linux. Chapter 6 on page 129 talks about how to write devices for Linux. The book may be a bit old, so I might have to find updates, but at least it is a place to start.

I have already downloaded it, I just need some time to read and learn it, and figure out what needs to be updated.

Oh,this is from 2001…imho you should use an actual one as most subsystems have changed in the last 24 years :stuck_out_tongue:

Some basics may be the same but when it comes to coding itself it will not work.

Methods of how computers function often change all the time, but the principles that underline computers rarely change.

Example: I started learned how to do event driven programming on a TI-99/4A computer back in 1984, and I’m still using - event driven logic - in programs that I write today. IF, THEN, ELSE, CASE, FOR, WHILE none of these things have changed. I use it in bash all the time.

Their basic principles continue, although they use different languages, now. Sure, a lot has changed in the way of syntax, but their basic principles remain.

Plus, you also have Object-Oriented Programming now too, but once again, once you learn the principles of OOP programming, they haven’t really changed either.

If I can learn the principles behind Linux device programming - I’ll have to metaphorically update my syntax.

Many of the reference the book makes are still used in Linux today /proc /sys block devices, character devices, system calls. ect … Once I learn the principles, the methods are much easier to understand, even when they change.

Oh, Yeah! Also, I made this is to help calculate address locations in kernel.its files for my Aarch64 boards.

#!/bin/bash

if [ "$#" -ne 4 ]; then
  echo "Usage: $0 kernel_filename load_address dtb_filename initrd_filename"
  exit 1
fi

# Input parameters 
# Note: Even if you use a compressed kernel use the uncompressed kernel
# to calculate the amount of memory the kernel uses in memory.
KERNEL_FILE=$1
LOAD_ADDRESS=$2
DTB_FILE=$3
INITRD_FILE=$4

# Get the sizes of the kernel, dtb, and initrd files
KERNEL_SIZE=$(stat -c%s "$KERNEL_FILE")
DTB_SIZE=$(stat -c%s "$DTB_FILE")
INITRD_SIZE=$(stat -c%s "$INITRD_FILE")

# Convert sizes to hexadecimal
KERNEL_SIZE_HEX=$(printf "0x%X" $KERNEL_SIZE)
DTB_SIZE_HEX=$(printf "0x%X" $DTB_SIZE)
INITRD_SIZE_HEX=$(printf "0x%X" $INITRD_SIZE)

# Calculate dtb load address (after kernel)
DTB_LOAD_ADDRESS=$((LOAD_ADDRESS + KERNEL_SIZE + 0x10000))  # Add padding for safety
DTB_LOAD_ADDRESS_HEX=$(printf "0x%X" $DTB_LOAD_ADDRESS)

# Calculate initrd load address (after dtb)
INITRD_LOAD_ADDRESS=$((DTB_LOAD_ADDRESS + DTB_SIZE + 0x10000))  # Add padding for safety
INITRD_LOAD_ADDRESS_HEX=$(printf "0x%X" $INITRD_LOAD_ADDRESS)

# Output the results
echo "Output:"
echo "Kernel @ $LOAD_ADDRESS"
echo "Device Tree Blob @ $DTB_LOAD_ADDRESS_HEX"
echo "Initrd @ $INITRD_LOAD_ADDRESS_HEX"
1 Like

Looks useful,thanks

For the other part (programming structures and so on) this is what i meant with basics not change (much),but when it comeas to apis/frameworks in the kernel there is much change.

But back to your issue,was it working after change defconfig an reimporting?

Oh, the new kernel works great! I haven’t attempted to get wifi up and working yet, but all the rest of the stuff seems to be working well. The only issue I have had is when I am at the terminal, I have to unplug my keyboard and plug it back in to use it, after each reboot, then it works great too. It’s not a major problem, as I spend most of the time ssh-ing into the device and only rarely access it via keyboard and terminal.

But, yeah so far everything else is looking great!

I thank you for all the work you do on Banana Pi’s, I’ve read a ton of your posts as they are very informative, and used a lot of your git downloads, and tools to get Slackware up and running on my Banana Pi R2. Thank You!

You work over hdmi on fbcon? Or in xorg/wayland? May be different.

Any errors in dmesg about usb/hi(d) devices? You use 6.6 or 6.12 now? As i said they miss internal wifi driver so it will not work. Latest port should be in 5.19-main (idk if i upped attempt for 6.0)

As far that the keyboard goes … here is the dmesg output.

dmesg | grep usb
[    2.921978] usbcore: registered new interface driver usbfs
[    2.922049] usbcore: registered new interface driver hub
[    2.922115] usbcore: registered new device driver usb
[    5.010183] xhci-mtk 1a1c0000.usb: xHCI Host Controller
[    5.015471] xhci-mtk 1a1c0000.usb: new USB bus registered, assigned bus number 1
[    5.026891] xhci-mtk 1a1c0000.usb: hcc params 0x01401198 hci version 0x96 quirks 0x0000000000290010
[    5.036045] xhci-mtk 1a1c0000.usb: irq 223, io mem 0x1a1c0000
[    5.042018] xhci-mtk 1a1c0000.usb: xHCI Host Controller
[    5.047310] xhci-mtk 1a1c0000.usb: new USB bus registered, assigned bus number 2
[    5.054738] xhci-mtk 1a1c0000.usb: Host supports USB 3.0 SuperSpeed
[    5.070623] usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
[    5.089060] xhci-mtk 1a240000.usb: xHCI Host Controller
[    5.094339] xhci-mtk 1a240000.usb: new USB bus registered, assigned bus number 3
[    5.105648] xhci-mtk 1a240000.usb: hcc params 0x01401198 hci version 0x96 quirks 0x0000000000290010
[    5.114841] xhci-mtk 1a240000.usb: irq 224, io mem 0x1a240000
[    5.120824] xhci-mtk 1a240000.usb: xHCI Host Controller
[    5.126105] xhci-mtk 1a240000.usb: new USB bus registered, assigned bus number 4
[    5.133533] xhci-mtk 1a240000.usb: Host supports USB 3.0 SuperSpeed
[    5.149384] usb usb4: We don't know the algorithms for LPM for this host, disabling LPM.
[    5.167171] usbcore: registered new interface driver usb-storage
[    5.173319] usbcore: registered new interface driver usbserial_generic
[    5.179986] usbserial: USB Serial support registered for generic
[    5.187024] usb-conn-gpio 11200000.usb:connector: GPIO lookup for consumer id
[    5.194192] usb-conn-gpio 11200000.usb:connector: using device tree for GPIO lookup
[    5.201927] of_get_named_gpiod_flags: parsed 'id-gpios' property of node '/usb@11200000/connector[0]' - status (0)
[    5.218510] usb-conn-gpio 11200000.usb:connector: GPIO lookup for consumer vbus
[    5.225831] usb-conn-gpio 11200000.usb:connector: using device tree for GPIO lookup
[    5.233521] of_get_named_gpiod_flags: can't parse 'vbus-gpios' property of node '/usb@11200000/connector[0]'
[    5.243406] of_get_named_gpiod_flags: can't parse 'vbus-gpio' property of node '/usb@11200000/connector[0]'
[    5.253189] usb-conn-gpio 11200000.usb:connector: using lookup tables for GPIO lookup
[    5.261046] usb-conn-gpio 11200000.usb:connector: No GPIO consumer vbus found
[    5.268248] usb-conn-gpio 11200000.usb:connector: supply vbus not found, using dummy regulator
[    5.277731] usb_phy_generic usb_phy_generic.3.auto: GPIO lookup for consumer reset
[    5.285338] usb_phy_generic usb_phy_generic.3.auto: using lookup tables for GPIO lookup
[    5.293403] usb_phy_generic usb_phy_generic.3.auto: No GPIO consumer reset found
[    5.300840] usb_phy_generic usb_phy_generic.3.auto: GPIO lookup for consumer vbus-detect
[    5.308961] usb_phy_generic usb_phy_generic.3.auto: using lookup tables for GPIO lookup
[    5.316991] usb_phy_generic usb_phy_generic.3.auto: No GPIO consumer vbus-detect found
[    5.324956] usb_phy_generic usb_phy_generic.3.auto: supply vcc not found, using dummy regulator
[    5.334741] musb-hdrc musb-hdrc.4.auto: MUSB HDRC host driver
[    5.340586] musb-hdrc musb-hdrc.4.auto: new USB bus registered, assigned bus number 5
[    5.684482] usbcore: registered new interface driver usbhid
[    5.690102] usbhid: USB HID core driver
[    8.182612] usb-conn-gpio 11200000.usb:connector: GPIO lookup for consumer id
[    8.195045] usb-conn-gpio 11200000.usb:connector: using device tree for GPIO lookup
[    8.208040] of_get_named_gpiod_flags: parsed 'id-gpios' property of node '/usb@11200000/connector[0]' - status (0)
[    8.235480] usb-conn-gpio 11200000.usb:connector: GPIO lookup for consumer vbus
[    8.248349] usb-conn-gpio 11200000.usb:connector: using device tree for GPIO lookup
[    8.261596] of_get_named_gpiod_flags: can't parse 'vbus-gpios' property of node '/usb@11200000/connector[0]'
[    8.277026] of_get_named_gpiod_flags: can't parse 'vbus-gpio' property of node '/usb@11200000/connector[0]'
[    8.292365] usb-conn-gpio 11200000.usb:connector: using lookup tables for GPIO lookup
[    8.305698] usb-conn-gpio 11200000.usb:connector: No GPIO consumer vbus found
[    8.318419] usb-conn-gpio 11200000.usb:connector: supply vbus not found, using dummy regulator
[   38.916204] vusb: disabling

After I unplug and plug the keyboard back in …

[  156.666752] usb 1-1: new low-speed USB device number 2 using xhci-mtk
[  156.871985] input: SINO WEALTH USB KEYBOARD as /devices/platform/1a1c0000.usb/usb1/1-1/1-1:1.0/0003:258A:0001.0001/input/input2
[  157.060182] hid-generic 0003:258A:0001.0001: input,hidraw0: USB HID v1.10 Keyboard [SINO WEALTH USB KEYBOARD] on usb-1a1c0000.usb-1/input0
[  157.072616] input: SINO WEALTH USB KEYBOARD System Control as /devices/platform/1a1c0000.usb/usb1/1-1/1-1:1.1/0003:258A:0001.0002/input/input3
[  157.140281] input: SINO WEALTH USB KEYBOARD Consumer Control as /devices/platform/1a1c0000.usb/usb1/1-1/1-1:1.1/0003:258A:0001.0002/input/input4
[  157.145521] hid-generic 0003:258A:0001.0002: input,hiddev96,hidraw1: USB HID v1.10 Device [SINO WEALTH USB KEYBOARD] on usb-1a1c0000.usb-1/input1

It works great from here …

I’m using the 5.15.175 kernel - I am currently working through the process of making a Slackware ARMv7 15.0 installer for the Banana Pi R2, and taking notes, hopefully I’ll be able to post it in the near future.

Mhm,so basicly the device is not detected…maybe the musb driver puts xhci controller in a mode where it cannot detect the type or does not switch back from otg mode. You could try disabling the musb driver and look if the issue is gone.

I went to plug in another keyboard to see if the problem was the keyboard, and I felt a small electrical tingle from the metal casing around the ethernet ports.

I unplugged the power adapter from the outlet, and the tingle went away, so I checked the power connection socket, where the cord connects to the board and the socket is loose, and I can wiggle it. I’ll have to replace the socket, before I turn the board back on again.

The solder connections looked good, it is just the plastic around the socket and the metal pin inside the socket that move. I’ll have to unsolder this socket and replace it with a new one.

You wouldn’t happen to know the part number and where to buy a new power socket connector, would you?