build icon indicating copy to clipboard operation
build copied to clipboard

BeagleV-Ahead: New Community support

Open Kreyren opened this issue 1 year ago • 17 comments

REVIEWERS: Squash using GitHub UI with message from the first commit

beaglev-ahead: Official support

Adds community support for the board

Includes a kernel config for thead edge thus the high count of changes

Description

Implement a community support for BeagleV-Ahead

Depends on changes from https://github.com/armbian/build/pull/5689

Progress from https://github.com/armbian/build/pull/5684

The original work is on https://github.com/Kreyren/armbian-build-kreyren/compare/6cd581c96c0b7b800b6549afe23112d4a662d2a0..811288169004dccacab964129ecaf8cfe891b22d i tried to shorten it as much as possible for the easy merge request review

  • The image boots and seems to work without major issues

  • If the fans doesn't work then invoke following from userland:

echo 1 > /sys/class/pwm/pwmchip0/export
echo 1000000 > /sys/class/pwm/pwmchip0/pwm1/period
echo 1000000 > /sys/class/pwm/pwmchip0/pwm1/duty_cycle
echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable

Making fans to spin is implemented in the DTS and they should work, mentioned just in case to avoid overheating of the chip

  • The audio has issues with playback e.g. crab rave from youtube has lot of popping sounds on both the HDMI output and headphones through JACK, same observed on the official image

Tracked in https://github.com/armbian/build/issues/5692 for the optimized toolchain

  • UEFI was not implemented and i try to submit that in next patch, TODO tracking

  • Complains about:

[🐳|🔨]   ===================== WARNING ======================
[🐳|🔨]   This board does not use CONFIG_DM_USB. Please update
[🐳|🔨]   the board to use CONFIG_DM_USB before the v2019.07 release.
[🐳|🔨]   Failure to update by the deadline may result in board removal.
[🐳|🔨]   See doc/driver-model/MIGRATION.txt for more info.
[🐳|🔨]   ====================================================
[🐳|🔨]   ===================== WARNING ======================
[🐳|🔨]   CONFIG_OF_EMBED is enabled. This option should only
[🐳|🔨]   be used for debugging purposes. Please use
[🐳|🔨]   CONFIG_OF_SEPARATE for boards in mainline.
[🐳|🔨]   See doc/README.fdt-control for more info.
[🐳|🔨]   ====================================================

I try to address it in next merge request

  • The GPU and NPU are not usable, context in Figure out the GPU and NPU https://github.com/ryan4yin/nixos-licheepi4a/issues/11.. blame the manufacturer

  • GNOME doesn't compile as it's currently broken for riscv64 in debian repositories

  • I didn't work on ubuntu compatibility, @chainsx seems to be better option for that as it seems to be his main distro and the OS configuration is shared from SiPeed LicheePi 4A

  • Debian claims that bookworm will never support riscv so should be flagged

  • Trixie doesn't build because:

[🐳|🚸] Could not find package filename for 'base-files' in 'https://packages.debian.org/bookworm/riscv64/base-files/download' [ looking for base-files ]

Debian upstream informed and working on the issue, i try to submit patch if they take long time

  • Complains about:
[    2.563670]
[    2.565219] ********************************************************************
[    2.572714] **     NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE           **
[    2.580204] **                                                                **
[    2.587680] **  WRITEABLE clk DebugFS SUPPORT HAS BEEN ENABLED IN THIS KERNEL **
[    2.595150] **                                                                **
[    2.602619] ** This means that this kernel is built to expose clk operations  **
[    2.610105] ** such as parent or rate setting, enabling, disabling, etc.      **
[    2.617589] ** to userspace, which may compromise security on your system.    **
[    2.625091] **                                                                **
[    2.632561] ** If you see this message and you are not debugging the          **
[    2.640030] ** kernel, report this immediately to your vendor!                **
[    2.647498] **                                                                **
[    2.654967] **     NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE           **
[    2.662433] ********************************************************************
[    2.669998] random: fast init done

I try to address that in upcoming merge, TODO tracking

  • The flashing is not implemented and needs to be done manually as i and the riscv community ware unable to find any documentation or data on how to make it bootable through the sdcard, needs to be flashed through fastboot:
  1. Hold the BOOT button and connect the USB-C cable to your system
  2. Verify that the Android Downloader shows up in # dmesg
  3. Verify that fastboot can see the device with # fastboot devices
  4. Invoke:
# fastboot flash rom ./path/to/uboot/binary # Flash the binary in the tempfs so that we can flash it
# fastboot reboot # Reboot the device to the binary
# fastboot flash uboot ./path/to/uboot/binary # Flash the uboot on the board
# fastboot flash root ./path/to/rootfs.tar # Flash the rootfs
  1. Remove the USB-C and try to boot the device, you should be greeted with armbian

Jira reference number: Ehwww jira

How Has This Been Tested?

By a community member on his device As a part of https://github.com/armbian/build/pull/5689 and https://github.com/armbian/build/pull/5714

Built using:

$ ./compile.sh build BOARD=beaglev-ahead BRANCH=edge BUILD_DESKTOP=no BUILD_MINIMAL=yes EXPERT=yes KERNEL_CONFIGURE=no RELEASE=sid

Checklist:

  • [X] git revert https://github.com/armbian/build/pull/5691
  • [X] My code follows the style guidelines of this project
  • [X] I have performed a self-review of my own code
  • [X] I have commented my code, particularly in hard-to-understand areas
  • [X] I have made corresponding changes to the documentation
  • [X] My changes generate no new warnings
  • [X] Any dependent changes have been merged and published in downstream modules

Kreyren avatar Sep 14 '23 00:09 Kreyren

Too many changes, closing for the time being until dependent changes are merged

Kreyren avatar Sep 14 '23 00:09 Kreyren

BeagleBoard provided the Hardware Files in https://git.beagleboard.org/beaglev-ahead/beaglev-ahead/-/commit/3b72a86f4856ca7dd90391a2a381b9385039fb86

It's still not open-source as it depends on proprietary ecad software, but i can import this in kicad and work on my own design so it's fine by me. -> Re-Opening

Kreyren avatar Sep 21 '23 15:09 Kreyren

@Kreyren I think you missed to commit lib/functions/compilation/opensbi.sh file

My bad, I see there is a different merge request for that. However I am not seeing the option to undo the change request

viraniac avatar Sep 26 '23 22:09 viraniac

Saw the presentation at ER2023. Seems like this doesn't support vector extensions, and would require an external toolchain? Yes/no, how are you handling this?

rpardini avatar Sep 29 '23 16:09 rpardini

@Kreyren I think you missed to commit lib/functions/compilation/opensbi.sh file

My bad, I see there is a different merge request for that. However I am not seeing the option to undo the change request -- @viraniac (https://github.com/armbian/build/pull/5712#issuecomment-1736396195)

Sorry didn't get a notification, elaborate what do you mean?

Saw the presentation at ER2023. Seems like this doesn't support vector extensions, and would require an external toolchain? Yes/no, how are you handling this? -- @rpardini (https://github.com/armbian/build/pull/5712#issuecomment-1741158665)

yes i am handling this - Not recognized as a major issue, tester didn't report any issues including the audio.

No idea what do you mean by ER2023, the TH1520 is using C910 cores and the addition of standard V extension is called C920 cores by t-head used in e.g. the SOPHON SG2042 which is just stupid marketing and as far as i know it doesn't really need that extension for runtime.

It would benefit from the t-head optimized toolchain mainly in performance as proposed in https://github.com/armbian/build/issues/5692 where @chainsx claims in https://github.com/armbian/build/pull/5689#issuecomment-1712415913 that not using the optimized toolchain causes various issues such as with audio that was observed by me using the revyOS build, but @Rabenda claims in https://github.com/ryan4yin/nixos-licheepi4a/issues/14#issuecomment-1716597806 that the toolchain is not relevant to the audio issue. The cause of the audio issue is currently unknown and not reported to be affected in beaglev likely due to using a newer kernel in comparison to licheepi 4a or possible issue in the blob itself as the C906 audio is proprietary atm.

So the optimized toolchain should be a subject by next merge request as igor requested me to try to shorted the merge requests as much as possible.

Kreyren avatar Sep 29 '23 17:09 Kreyren

@rpardini Maybe you are confusing that with this issue? https://github.com/revyos/revyos/issues/17

The scope of that is not yet understood, worst case scenario TH1520 is franken ISA not-complying with RISCV afaik.

Kreyren avatar Sep 29 '23 18:09 Kreyren

The cause of the audio issue is currently unknown and not reported to be affected in beaglev likely due to using a newer kernel in comparison to licheepi 4a or possible issue in the blob itself as the C906 audio is proprietary atm.

So the optimized toolchain should be a subject by next merge request as igor requested me to try to shorted the merge requests as much as possible.

audio problem

The audio problem affects two cases

  1. load firmware failed
  • Latest thead-u-boot needs to be used with the latest c906 audio firmware
  1. alsa buffer problem.
  • pulseaudio need config file https://github.com/revyos/mkimg-th1520/blob/6225cffeb277ea14ffc7e9893b72663199ec2863/mkrootfs.sh#L171C95-L171C95 Also need to add tsched=0 to solve the buffer problem

vector problem

Requires the kernel to add vector register contexts https://github.com/sophgo/linux-riscv/commit/1ae9f2d08b58afbcf44e0051af2f58d4b63f2853 thead-kernel has a similar commit.

compiler extension

Chinese docs: https://revyos.github.io/docs/en/build/debian/%E7%BC%96%E8%AF%91%E5%99%A8%E7%9B%B8%E5%85%B3%E8%AF%B4%E6%98%8E/ c910 has v0p7 and xtheadc (xthead vendor extension) Both can be used independently

thead-gcc has vector and xtheadc gcc-13.2 has xthead extension(xtheadba_xtheadbb_xtheadbs_xtheadcmo_xtheadcondmov_xtheadfmemidx_xtheadfmv_xtheadint_xtheadmac_xtheadmemidx_xtheadmempair_xtheadsync)

Because the range of use is not very wide, so we have to consider whether to use it or not.

RevySR avatar Sep 30 '23 05:09 RevySR

thead-gcc (v2.6.1) prebuilt: https://occ-oss-prod.oss-cn-hangzhou.aliyuncs.com/resource//1663142514282/Xuantie-900-gcc-linux-5.10.4-glibc-x86_64-V2.6.1-20220906.tar.gz

RevySR avatar Sep 30 '23 05:09 RevySR

Any interest to rework this?

igorpecovnik avatar Mar 06 '24 07:03 igorpecovnik

Any interest to rework this? -- @igorpecovnik (https://github.com/armbian/build/pull/5712#issuecomment-1980243378)

Yes, i am monitoring the development and i am currently unsure how should this be implemented in downstream. I try to brainstorm it with beagles and revyOS devs as they are working on linux 6.0+ support

Kreyren avatar Mar 06 '24 17:03 Kreyren

https://lore.kernel.org/linux-riscv/20230722-upstream-beaglev-ahead-dts-v1-0-ccda511357f4@baylibre.com/T/#t

beaglev-ahead is getting the dts mainlined

https://lore.kernel.org/linux-riscv/[email protected]/T/#t eMMC is pending

I guess i can adjust this merge request to track with upstream changes and we could merge it as community support with a disclaimer of functionality, RFC @igorpecovnik

Kreyren avatar Mar 07 '24 14:03 Kreyren

neat...

I gave up, picked it back up, and gave up again. I am about to start from scratch!

Seth

P.S. Thank you guys for posting, i.e. gals too. I bet with a little hoopla from thead marketing, things will transpire just fine. Too bad about the NPU and GPU though. Anyway, off to another day of luxury grass mowing. I cannot wait to see what happens!

silver2row avatar Mar 20 '24 02:03 silver2row

neat...

I gave up, picked it back up, and gave up again. I am about to start from scratch!

Seth

P.S. Thank you guys for posting, i.e. gals too. I bet with a little hoopla from thead marketing, things will transpire just fine. Too bad about the NPU and GPU though. Anyway, off to another day of luxury grass mowing. I cannot wait to see what happens! -- @silver2row (https://github.com/armbian/build/pull/5712#issuecomment-2008587145)

Huh?

Kreyren avatar Mar 20 '24 07:03 Kreyren

@Kreyren ,

Hello...it is me. I posted some hastebin ideas on the forums... I directed the build at you. Are you still trying things?

I have no clue about RevyOS and/or could care less about the GPU support. Currently, since the headers are there allocated from chip to headers, I am more worried about makers like myself making things with this board. Selfish maybe but I enjoy building in time...

Okay... https://forum.armbian.com/topic/29298-beaglev-ahead-and-armbian-support/#comment-187147

I built the docker image with:

./compile.sh build BOARD=beaglev-ahead BRANCH=edge BUILD_DESKTOP=no BUILD_MINIMAL=yes EXPERT=yes KERNEL_CONFIGURE=no RELEASE=sid

I received an error about no board file.

I do not have the board file. If you need support on building, I know less than you about Armbian for sure, I can try alternatives and builds around the OpenSBI, different cross_compilers, toolchains, and so on...

Please let me know where I can fit in?

Seth

silver2row avatar Apr 08 '24 02:04 silver2row

https://forum.armbian.com/topic/29298-beaglev-ahead-and-armbian-support/#comment-187147

I didn't see you trying to reach me on forum, sorry about that!


Lot has changed since me making this merge request i am working on adjusting this merge request to use mainline and will give you a new instructions to test, currently researching them through LicheePi 4A

Kreyren avatar Apr 08 '24 18:04 Kreyren

   The following packages have unmet dependencies:
    mtd-utils : Depends: libssl3 (>= 3.0.0) but it is not installable
   E: Unable to correct problems, you have held broken packages.

So, it seems that libssl3 is not installable on the debian distro I am using...

Okay...so. Ubuntu is welcomed due to the libssl3 error. I will attempt this build again with Ubuntu and not Debian.

Seth

silver2row avatar Apr 14 '24 00:04 silver2row

I don't think it's a good idea to try to build this and run it on the device as too many things have changed since this was submitted, wait for me to adjust the contribution for you to test.

Kreyren avatar Apr 14 '24 23:04 Kreyren