Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BananaPi BPI-F3: Update kernel to 6.6.y and other fixups #7616

Merged
merged 12 commits into from
Jan 1, 2025

Conversation

pyavitz
Copy link
Collaborator

@pyavitz pyavitz commented Dec 26, 2024

Kernel source: https://github.com/jmontleon/linux-bianbu.git
I've been using it now for a couple weeks and works well.

U-Boot source: https://gitee.com/bianbu-linux/uboot-2022.10.git
OpenSBI source: https://gitee.com/bianbu-linux/opensbi.git
TAG="v2.0.4"

Updated config/sources/families/spacemit.conf
Made the needed adjustments and simplified the write_uboot_platform function.

Note: Bluetooth is still b0rked

Note: rfkill unblock all.

patrick@bananapif3:~$ dmesg | grep hci0
[   10.559798] Bluetooth: hci0: RTL: examining hci_ver=0b hci_rev=000b lmp_ver=0b 
lmp_subver=8852
[   10.563485] Bluetooth: hci0: RTL: rom_version status=0 version=1
[   10.563518] Bluetooth: hci0: RTL: loading rtl_bt/rtl8852bs_fw.bin
[   10.565898] Bluetooth: hci0: RTL: loading rtl_bt/rtl8852bs_config.bin
[   10.587947] Bluetooth: hci0: RTL: cfg_sz 33, total sz 46430
[   11.148639] Bluetooth: hci0: RTL: fw version 0xdec834cf
patrick@bananapif3:~$ lsmod
Module                  Size  Used by
bnep                   28672  2
lz4hc                  12288  0
hci_uart              151552  0
lz4                    12288  0
btqca                  28672  1 hci_uart
btrtl                  36864  1 hci_uart
btbcm                  32768  1 hci_uart
bluetooth             995328  26 btrtl,btqca,hci_uart,btbcm,bnep
ecdh_generic           16384  2 bluetooth
ecc                    49152  1 ecdh_generic
zram                   40960  3
zsmalloc               40960  1 zram
8852bs               7921664  0
cfg80211             1482752  1 8852bs
fuse                  233472  1
nfnetlink              24576  1
ip_tables              28672  0
x_tables               53248  1 ip_tables
uio_pdrv_genirq        16384  0
uio                    28672  1 uio_pdrv_genirq
patrick@bananapif3:~$ bluetoothctl
Waiting to connect to bluetoothd...[bluetooth]# hci0 new_settings: powered bondabl
e ssp br/edr le secure-conn cis-central cis-peripheral 
[bluetooth]# Agent registered
[bluetooth]# [CHG] Controller C0:4B:24:36:6D:C2 Pairable: yes
[bluetooth]# show
Controller C0:4B:24:36:6D:C2 (public)
	Manufacturer: 0x005d (93)
	Version: 0x0b (11)
	Name: bananapif3
	Alias: bananapif3
	Class: 0x00000000 (0)
	Powered: yes
	Discoverable: no
	DiscoverableTimeout: 0x000000b4 (180)
	Pairable: yes
	UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
	UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
	UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
	UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
	UUID: Device Information        (0000180a-0000-1000-8000-00805f9b34fb)
	Modalias: usb:v1D6Bp0246d0548
	Discovering: no
	Roles: central
	Roles: peripheral
Advertising Features:
	ActiveInstances: 0x00 (0)
	SupportedInstances: 0x04 (4)
	SupportedIncludes: tx-power
	SupportedIncludes: appearance
	SupportedIncludes: local-name
	SupportedSecondaryChannels: 1M
	SupportedSecondaryChannels: 2M
	SupportedSecondaryChannels: Coded

Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
@github-actions github-actions bot added size/large PR with 250 lines or more Needs review Seeking for review Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... labels Dec 26, 2024
Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
@The-going
Copy link
Contributor

The-going commented Dec 27, 2024

Build on board BPI-F3

leo@bananapif3:~/DATA$ git clone --depth=100 https://github.com/armbian/build -b main armbian
leo@bananapif3:~/DATA$ cd armbian/
leo@bananapif3:~/DATA/armbian$ git remote add -t BPI-F3-007 pyavitz https://github.com/pyavitz/armbian
leo@bananapif3:~/DATA/armbian$ git fetch pyavitz
git checkout -b BPI-F3-007  pyavitz/BPI-F3-007
leo@bananapif3:~/DATA/armbian$ ./compile.sh BOARD=bananapif3 KERNEL_GIT=shallow

it ended up with an error of unsatisfied build system dependencies.

I got the impression that the native build is poorly supported.

@pyavitz
Copy link
Collaborator Author

pyavitz commented Dec 27, 2024

I've never tried to build native RISCV with armbian/build. Is it even supported?

@The-going
Copy link
Contributor

I've never tried to build native RISCV with armbian/build. Is it even supported?

Swears at the C++ version. He wants 11 and 13 is installed.

I just tried to assemble it on the board.

Do not pay attention.
To be honest, I do not know how to fix all these dependencies for the build system.

The files included in u-boot are rarely changed or do not
change at all. Compare bit by bit the memory region in which
the file will be located and the file itself. If they match,
then skip the recording.
This saves the life of the memory chip.
@The-going
Copy link
Contributor

Build on QEMU KVM VM on x86_64 arch:

  ___ ___  _   ___ ___    __  __ _         _ 
 / __| _ \/_\ / __| __|__|  \/  (_)_ _  __| |
 \__ \  _/ _ \ (__| _|___| |\/| | | ' \/ _` |
 |___/_|/_/ \_\___|___|  |_|  |_|_|_||_\__,_|
                                             
 v25.02 rolling for BananaPi BPI-F3 running Armbian Linux 6.6.67-current-spacemit

 Packages:     Ubuntu stable (noble)
...
bananapif3:~# uname -r                                                                                                                      
6.6.67-current-spacemit

@The-going
Copy link
Contributor

What is the reason for this?
declare -g KERNELBRANCH='commit:d3300881e2d524fbc4f9a8c7174df910f55ab3d0'
I just didn't see this commit.
The branch has been rebased.
But the compilation is successful.

@pyavitz
Copy link
Collaborator Author

pyavitz commented Dec 27, 2024

What is the reason for this? declare -g KERNELBRANCH='commit:d3300881e2d524fbc4f9a8c7174df910f55ab3d0' I just didn't see this commit. The branch has been rebased. But the compilation is successful.

I didn't want it to just pull willy-nilly, as things could break. So I'm having it pull last tested commit as they aren't using tags. Looks like they are working on the repo now and updated it to 6.6.68.

@The-going
Copy link
Contributor

I fixed the u-boot update feature. Now she checks all the files before writing.
And it won't write/overwrite if the file is already there.

And it now meets the requirements of shellfmt, shellcheck

@pyavitz
Copy link
Collaborator Author

pyavitz commented Dec 27, 2024

I fixed the u-boot update feature. Now she checks all the files before writing. And it won't write/overwrite if the file is already there.

And it now meets the requirements of shellfmt, shellcheck

What you had in there before was busted, which is why I changed it.
It was overly complicated and why would the files not be there?

Anyway. if what you changed works. Kool.

@pyavitz
Copy link
Collaborator Author

pyavitz commented Dec 28, 2024

I fixed the u-boot update feature. Now she checks all the files before writing. And it won't write/overwrite if the file is already there.

And it now meets the requirements of shellfmt, shellcheck

This is what happens when using the armbian-config tool to transfer to eMMC. Its wrong and I also don't understand why we would want to skip anything?

Skip  bootinfo_emmc.bin, it is equal to the existing one
# Write fw_dynamic.itb to /dev/mmcblk2boot0
266+1 records in
266+1 records out
# Write FSBL.bin to /dev/mmcblk2boot0
375+1 records in
375+1 records out
# Write u-boot.itb to /dev/mmcblk2boot0
4782+1 records in
4782+1 records out

What should be happening.

echo 0 > /sys/block/mmcblk2boot0/force_ro
sleep .50
dd if="bootinfo_emmc.bin" of="/dev/mmcblk2boot0" bs=512 conv=notrunc
dd if="FSBL.bin" of="/dev/mmcblk2boot0" bs=512 seek=1 conv=notrunc
dd if="FSBL.bin" of="/dev/mmcblk2boot0" bs=512 seek=512 conv=notrunc
dd if="fw_dynamic.itb" of="/dev/mmcblk2" bs=512 seek=1280 conv=notrunc
dd if="u-boot.itb" of="/dev/mmcblk2" bs=512 seek=2048 conv=notrunc
sync

@The-going
Copy link
Contributor

What you had in there before was busted, which is why I changed it.
It was overly complicated and why would the files not be there?

This incorrect behavior has been fixed in #7554

Anyway. if what you changed works. Kool.

There are two ways to check this.
Just build the u-boot package, install it on the platform and try to burn it only using armbian-install.

The second way is to see the details using a debugging script.:

#! /bin/bash

# dd if=$1/bootinfo_emmc.bin of=$device bs=512 conv=notrunc
# dd if=$1/FSBL.bin of=$device bs=512 seek=1 conv=notrunc
# dd if=$1/fw_dynamic.itb of=${2} bs=512 seek=1280 conv=notrunc
# dd if=$1/u-boot.itb of=${2} bs=512 seek=2048 conv=notrunc

write_uboot_platform() {
        local device N

        declare -A d
        d=(
                ["bootinfo_emmc.bin"]="0:$(du -b ${1}/bootinfo_emmc.bin | awk '{print $1}')"
                ["FSBL.bin"]="1:$(du -b ${1}/FSBL.bin | awk '{print $1}')"
                [fw_dynamic.itb]="1280:$(du -b ${1}/fw_dynamic.itb | awk '{print $1}')"
                [u-boot.itb]="2048:$(du -b ${1}/u-boot.itb | awk '{print $1}')"
        )

        device=${2}
        if [ -b ${2}boot0 ]; then
                device="${2}boot0"
        #       echo 0 > /sys/block/$(basename ${device})/force_ro
                echo "# sync"
        fi

        for f in "${!d[@]}"; do

                N=$((${d[$f]%:*} * 512))
                dd "if=${device}" bs=1 "skip=$N" "count=${d[$f]#*:}" conv=notrunc status=noxfer | xxd -l120
                echo ""
                xxd -l120 "${1}/${f}"
                echo "=========================================="
                if dd "if=${device}" bs=1 "skip=$N" "count=${d[$f]#*:}" \
                        conv=notrunc status=noxfer 2>/dev/null | cmp --quiet "${1}/${f}"
                then
                        echo "Skip  $f, it is equal to the existing one"
                else
                        echo "# Write =: N=$N d=${d[$f]} f=$f to ${device} seek=${d[$f]%:*}"
                        #dd if=$1/$f of=${device} bs=512 seek="${d[$f]%:*}" conv=notrunc,fsync status=noxfer
                fi
        done
}

write_uboot_platform "/usr/lib/linux-u-boot-legacy-bananapif3" "/dev/mmcblk0"

You must first install xxd

this script doesn't record anything, it just shows what it's checking.

@The-going
Copy link
Contributor

This is what happens when using the armbian-config tool to transfer to eMMC. Its wrong and I also don't understand why we would want to skip anything?

Skip bootinfo_emmc.bin, it is equal to the existing one

Why should we record the same thing that has already been recorded?
In any case, just undo the last commit if it doesn't suit you.

@The-going
Copy link
Contributor

I'm going on New Year's holidays and will be available after January 15th.
Happy New Year!

@pyavitz
Copy link
Collaborator Author

pyavitz commented Dec 28, 2024

I'm going on New Year's holidays and will be available after January 15th. Happy New Year!

I'm just gonna REVERT until it can be sorted. I don't feel like fussing with it. The other function might not look like a coders dream, but it did work.

Enjoy and Happy New Year.

armbian/firmware@46c7dd0

Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
Signed-off-by: Patrick Yavitz <pyavitz@gmail.com>
@pyavitz
Copy link
Collaborator Author

pyavitz commented Jan 1, 2025

This is beyond the scope of this PR. The builder says RISCV isn't supported when trying to use Trixie, when in fact Trixie does have RISCV support. This should be corrected at some point.

I'm done with this PR.

@igorpecovnik igorpecovnik added Ready to merge Reviewed, tested and ready for merge 02 Milestone: First quarter release and removed Needs review Seeking for review labels Jan 1, 2025
@pyavitz pyavitz merged commit b202541 into armbian:main Jan 1, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
02 Milestone: First quarter release Hardware Hardware related like kernel, U-Boot, ... Patches Patches related to kernel, U-Boot, ... Ready to merge Reviewed, tested and ready for merge size/large PR with 250 lines or more
Development

Successfully merging this pull request may close these issues.

3 participants