ophub / amlogic-s9xxx-armbian

Support for Armbian in Amlogic, Rockchip and Allwinner boxes. Support a311d, s922x, s905x3, s905x2, s912, s905d, s905x, s905w, s905, s905l, rk3588, rk3568, rk3399, rk3328, h6, etc.
GNU General Public License v2.0
5.77k stars 1.85k forks source link

H96MAX M2 RK3528 - New box #2404

Closed d5stick closed 4 weeks ago

d5stick commented 2 months ago

Device Information |

**Armbian Version |

**Describe the bug: I wanted to add a new box to the armbian/ophub collection. It runs Android 13. Chipset Rockchip RK3258. WIFI6 + BT: B-LINK BL-M8800DS1. 1000M LAN: Realtek RTL8211F Bought it: https://nl.aliexpress.com/item/1005005843644900.html Info: https://www.h96tvbox.com/product/h96-max-m2-android-tv-box/ Recovery image: https://boxput.notion.site/H96-Series-Frieware-b314bb2353ba4f08979edfca10db54fe H96 Max 3528 -> IMG file.

The DTB i extracted from the android image can be found in: DTB

I have issues with the DTB running on Armbian, hopefully you could help me with that, to see if anything needs to be modified.

Please provide a detailed description of the issue and, if necessary, attach a screenshot.

Photos: Voorkant Achterkant PCB2 pcb Chip2 Chip1 Portrs

d5stick commented 2 months ago

Well it was an adventure; I compiled on my Ubuntu laptop a version of Armbian: git clone --depth=1 https://github.com/armbian/build armbian-build

-Used the following patches from ilyakurdyukov and included them in the armbian-build user patches. u-boot: rk3528-tvbox-defconfig.patch u-boot: no_read_limit.patch u-boot: gray_square_logo.patch Kernel: fix_drm_getunique_crash.patch Kernel: sai_clk_auto_on.patch

./compile.sh build BOARD=mangopi-m28k BRANCH=vendor BUILD_DESKTOP=no BUILD_MINIMAL=yes KERNEL_CONFIGURE=no KERNEL_GIT=shallow RELEASE=bookworm

Extract the u-boot img from Armbian to get the value "CONFIG_ROCKCHIP_USB_BOOT=y" in the u-boot. dd if=armbian_version_.img bs=1M count=4 skip=8 > uboot.img

Flash the uboot.img to the device with rkdeveloptool (install with apt install) Hold the pin in the AV port, connect a USB A to USB A cable and check for connectivity: rkdeveloptool list

When the device is present and in "loader" mode. Use the following to see which partitions are active on the device, search for uboot or u-boot. rkdeveloptool list-partitions

Fllash the uboot file. rkdeveloptool write-partition uboot uboot.img

Burn the armbianversion.img with BalenaEtcher on a flashdrive (USB2!) Boot the device, it will show the boot logo of the box and after a minute it boots Armbian. The DTB used now is from Mangopi M28k, i hoped @ophub could help me create a DTB for this device.

image

image

image

What is working on this box? Ethernet is working. HDMI is working USB is working, as it boots from there.

What is not working? WLAN is not working. Ophub's build of Armbian. Install to EMMC.

ophub commented 1 month ago

Based on your description, you are using the linux-rockchip kernel. You can check if there are wireless drivers available. https://github.com/armbian/linux-rockchip/tree/rk-6.1-rkr1/drivers/net/wireless

d5stick commented 1 month ago

The u-boot i flashed on the device: u-boot

### About the Wifi/BT chipset; AIC8800D chipset Brand LB-LINK Product: BL-M8800DS1

I checked the drivers on the RockChip tree, but no luck: Chipset info The same chipset, different vendor

RADXA is reporting of drivers: Forum link On their Github there is info about the chipset: Radxa-pkg

Rockchip Kernel

Is there a way to include this into the Ophub builds as I really enjoy the extras your image provide.

I deployed ophubs armbian-software script with the release file to install a desktop environment. Everything seems to be working just fine, except the wifi and bt as expected. Sound and HDMI are working without any issue.

ophub commented 1 month ago

A single u-boot should be 16M, not 4M. According to armbian's compilation, the u-boot you are using should be in a directory like /usr/lib/u-boot-m28k-xxx. Please copy and upload the files in this u-boot directory. Are you using the default dtb file https://github.com/armbian/linux-rockchip/blob/rk-6.1-rkr1/arch/arm64/boot/dts/rockchip/rk3528-mangopi-m28k.dts?

d5stick commented 1 month ago

The box with stock Android image does not boot from USB. What I did is I compiled Armbian and extracted the u-boot file from the image. dd if=armbian_version_.img bs=1M count=4 skip=8 > uboot.img The output 4mb u-boot file i flashed in the u-boot partition of the android box. rkdeveloptool write-partition u-boot uboot.img The full image that i compiled with the armbian compile.sh is burned with BalenaEtcher to a USB drive and from there i booted from the USB drive.

The u-boot of Armbian itself is not changed or modified after creating the image. Only the file i flashed on the box itself to enable booting from USB. More info is described here: USBBoot

I did however (in the second post) used some patches for this SoC to modify the u-boot while creating the Armbian image. Location of the patches i used: Patches Thanks to: ilyakurdyukov

The DTB used to boot the device: rockchip/rk3528-mangopi-m28k.dtb As it is compiled from the Armbian repository i would say yes to your question.

ophub commented 1 month ago

Please upload the u-boot from the /usr/lib/u-boot-xxxx directory in the Armbian.img build you created using compile.sh. I need it to rebuild Armbian.

d5stick commented 1 month ago

I exported files from usr/lib/u-boot hinlink_rk3528_defconfig LICENSE platform_install.sh

I exported files from usr/lib/linux-u-boot-vendor-mangopi-m28k u-boot.itb idbloader.img

Files

Let me know if this is sufficient.

ophub commented 1 month ago

I compiled the firmware for h96-max-m2 in releases. Please test it when you have time.

I have uploaded the u-boot to the following link: https://github.com/ophub/u-boot/tree/main/u-boot/rockchip/h96-max-m2 The uboot.img used for USB booting is also in this directory.

I have uploaded the Android system to the following link: https://github.com/ophub/kernel/releases/tag/tools

d5stick commented 1 month ago

The android image, i do not see in the tag/tools.

About the testing; The u-boot i extracted from my Armbian image that i flashed on the device is using kernel 6.1. The compiled one you created uses kernel 5.10.160. I flashed it to my usb drive but it will not boot.

Could it be that the patches i shared from ilyakurdyukov should be applied too? Or is the kernel version the issue?

Besides that, could the drivers be included for the wireless? Radxa-pkg

To make things easy, i shared the image i have working on the USB drive: Armbian 6.1

ophub commented 1 month ago

Android System Backup Name: https://github.com/ophub/kernel/releases/tag/tools Snip20240710_1

Both kernels, 5.10.160 and 6.1.43, belong to the linux-rockchip series and should theoretically work with the rk3528. I'm using the kernel repository maintained by Flippy: https://github.com/unifreq/linux-5.10.y-rk35xx. I tested and successfully compiled this DTS locally yesterday and already submitted it to their repository: https://github.com/unifreq/linux-5.10.y-rk35xx/commit/1af20a7a0aa4a26da13bf69493b23096ae5798e1.

I've updated the boot files. Could you please try this new 5.10.160 build I made and see if it boots: https://github.com/ophub/amlogic-s9xxx-armbian/releases/download/Armbian_bookworm_save_2024.07/Armbian_24.8.0_rockchip_h96-max-m2_bookworm_5.10.160_server_2024.07.09.img.gz

d5stick commented 1 month ago

The H96MAX M2 is able to boot to the new image you compiled; 5.10.160 with the mangopi_m28k DTB.

HDMI does not work at first boot. SSH was working at first boot. After a reboot the HDMI starts working. After several reboots HDMI stays working.

As expected no bt and wifi

Ethernet stops working after first reboot, i tried to activate the connection with nmtui; image Removed the connection in nmtui, rebooted, Cleared blocked connections with armbian-config. Tried to clear possible blocked interfaces and configure static. Seems to be working. Reboot again, connection broken again. nmtui does not show a connection to activate anymore.

ophub commented 1 month ago

armbian-update -u rk35xx -k 6.1.43-rk35xx-rkr1

Try this linux-rockchip kernel

d5stick commented 1 month ago

The kernel 6.1.43-rk35xx-rkr1 works better. HDMI responds, Ethernet responds even after multiple reboots. I have not tried the install emmc methods for Rockchip tho, need to verify that one.

Ethernet info in dmesg:

[   38.395281] rk_gmac-dwmac ffbe0000.ethernet end0: PHY [stmmac-0:01] driver [RTL8211F Gigabit Ethernet] (irq=POLL)
[   38.399273] dwmac4: Master AXI performs any burst length
[   38.402374] rk_gmac-dwmac ffbe0000.ethernet end0: No Safety Features support found
[   38.405859] rk_gmac-dwmac ffbe0000.ethernet end0: PTP not supported by HW
[   38.417331] rk_gmac-dwmac ffbe0000.ethernet end0: configuring for phy/rgmii-rxid link mode
[   42.512889] rk_gmac-dwmac ffbe0000.ethernet end0: Link is Up - 1Gbps/Full - flow control off

HDMI works, sound works, there is some lag in displaying video but am not sure if this is due to the USB drive being too slow or the codec not working due to driver issues.

Within dmesg the following error popped up:

[   47.846118] dwhdmi-rockchip ff8d0000.hdmi: Rate 85750000 missing; compute N dynamically
[   47.847008] dwhdmi-rockchip ff8d0000.hdmi: Rate 85750000 missing; compute N dynamically
[   47.894030] hdmi-audio-codec hdmi-audio-codec.3.auto: Not able to map channels to speakers (-22)
[   47.894951] hdmi-audio-codec hdmi-audio-codec.3.auto: ASoC: error at snd_soc_dai_hw_params on i2s-hifi: -22
[   47.895850]  ffb70000.sai-i2s-hifi: ASoC: error at __soc_pcm_hw_params on ffb70000.sai-i2s-hifi: -22
[   47.897006] hdmi-audio-codec hdmi-audio-codec.3.auto: Not able to map channels to speakers (-22)
[   47.897831] hdmi-audio-codec hdmi-audio-codec.3.auto: ASoC: error at snd_soc_dai_hw_params on i2s-hifi: -22
[   47.898824]  ffb70000.sai-i2s-hifi: ASoC: error at __soc_pcm_hw_params on ffb70000.sai-i2s-hifi: -22
[   47.899794] hdmi-audio-codec hdmi-audio-codec.3.auto: Not able to map channels to speakers (-22)

I checked the dmesg and i saw it tries to open wlan/bluetooth: ap6275s Is this within the DTB for MangoPi? Is this changeable to the 8800 chip? If so, we could have a working DTB specifically for the M98MAX M2.

[   21.778795] [WLAN_RFKILL]: Enter rfkill_wlan_init
[   21.779388] [WLAN_RFKILL]: Enter rfkill_wlan_probe
[   21.779453] [WLAN_RFKILL]: wlan_platdata_parse_dt: wifi_chip_type = ap6275s
[   21.779460] [WLAN_RFKILL]: wlan_platdata_parse_dt: enable wifi power control.
[   21.779466] [WLAN_RFKILL]: wlan_platdata_parse_dt: wifi power controled by gpio.
[   21.779503] [WLAN_RFKILL]: wlan_platdata_parse_dt: WIFI,host_wake_irq = 39, flags = 0.
[   21.779517] [WLAN_RFKILL]: wlan_platdata_parse_dt: The ref_wifi_clk not found !
[   21.779522] [WLAN_RFKILL]: rfkill_wlan_probe: init gpio
[   21.779529] [WLAN_RFKILL]: rfkill_set_wifi_bt_power: 1
[   21.779536] [WLAN_RFKILL]: Exit rfkill_wlan_probe
[   21.780324] [BT_RFKILL]: bluetooth_platdata_parse_dt: get property: uart_rts_gpios = 42.
[   21.780357] [BT_RFKILL]: bluetooth_platdata_parse_dt: get property: BT,reset_gpio = 49.
[   21.780372] [BT_RFKILL]: bluetooth_platdata_parse_dt: get property: BT,wake_gpio = 44.
[   21.780386] [BT_RFKILL]: bluetooth_platdata_parse_dt: get property: BT,wake_host_irq = 50.
[   21.780396] [BT_RFKILL]: bluetooth_platdata_parse_dt: clk_get failed!!!.
[   21.780455] [BT_RFKILL]: Request irq for bt wakeup host
[   21.780566] [BT_RFKILL]: ** disable irq

GPU bus errors:

[   21.766890] rockchip,bus gpu-bus: Looking up bus-supply from device tree
[   21.767229] rockchip,bus gpu-bus: bin=0
[   21.767277] rockchip,bus gpu-bus: Failed to get leakage
[   21.767314] rockchip,bus gpu-bus: Looking up pvtm-supply from device tree
[   21.767322] rockchip,bus gpu-bus: Looking up pvtm-supply property in node /gpu-bus failed
[   21.767344] rockchip,bus gpu-bus: error -ENODEV: _opp_set_regulators: no regulator (pvtm) found
[   21.767381] rockchip,bus gpu-bus: failed to set opp config
[   21.767387] rockchip,bus gpu-bus: failed to init opp info
[   21.767392] rockchip,bus gpu-bus: failed to get OPP table
[   21.767397] rockchip,bus gpu-bus: failed to init power control
[   21.770075] rockchip-saradc ffae0000.saradc: Looking up vref-supply from device tree
[   21.770965] SPI driver inv-icm42600-spi has no spi_device_id for invensense,icm42600
[   21.770983] SPI driver inv-icm42600-spi has no spi_device_id for invensense,icm42602
[   21.770988] SPI driver inv-icm42600-spi has no spi_device_id for invensense,icm42605
[   21.770994] SPI driver inv-icm42600-spi has no spi_device_id for invensense,icm42622
[   21.771633] optee: probing for conduit method.
ophub commented 1 month ago

https://github.com/armbian/linux-rockchip/blob/rk-6.1-rkr1/arch/arm64/boot/dts/rockchip/rk3528-mangopi-m28k.dts

The drivers for Bluetooth and wireless can both be defined in the dts. You can modify them based on this, and after debugging, you can rebuild a dedicated dts.

d5stick commented 1 month ago

i tried to recompile the DTS i made but it did not work. The bluetooth and wifi will not come up. I have asked the H96MAX manufacturing of the original ROM to extract the DTS from. The image i originally used was for the H96MAX m1, which uses another WIFI/BT module.

d5stick commented 1 month ago

For the DTS part, i failed to get wifi/bt working. Original android DTS: Link Mangopi DTS: Link What i tried to do: Link

The correct firmware's i got from the supplier H96MAX got 8800 chipset in the name. But when i extracted the DTBs from the ZIPs and IMG, it referes to a realtek chipset.. not sure whats going on there.

The mango_mod.dts compiles and it boots, but wifi and bluetooth do not work. For the Wireless-LAN, i also tried with the AIC8800 from the mangoPI, but it wont come up.

Not sure if i missed something in the DTS.. it is not my expertise.

The kernel you mentioned works; 6.1.43-rk35xx-rkr1, it is stable. I have ran multiple tests including docker. Could this be used in future ophub/armbian releases instead of the 5.10? The 5.10 has booting issues with displaying HDMI and the LAN disconnects.

The android ROM for the H96MAX-M2 is; Link

ophub commented 1 month ago

Have you tried if the latest version 6.1.75 can be used?

armbian-sync
armbian-update -k 6.1.75
d5stick commented 1 month ago

image image

Verified the DTBs i had modified and the Mango, still no wifi.

The CPU temp is removed from the welcome message? After some testing, the sensors are not working with this kernel.

image

ophub commented 1 month ago

Was the display normal when you used 6.1.43 before? I removed the 6.1.43 kernel from the kernel repository today. Please send me the backup, and I will re-upload it to the repository. The current rebuild does not support specifying kernel versions for rk35xx/rk3588, only supports selecting stable and other branches. I will think about how to elegantly support this setting.

6.1.43 backup kernel in: /ddbr/backup/6.1.43

d5stick commented 1 month ago

The files:

Is there a way to use armbian-update to use the backup files to go back to the previous kernel stored locally? LINK

ophub commented 1 month ago

https://github.com/ophub/amlogic-s9xxx-armbian/tree/main/documents#10-updating-armbian-kernel

# Enter the backup kernel directory, such as 6.6.12
cd /ddbr/backup/6.6.12
# Execute the kernel update command, which will automatically install the kernel in the current directory
armbian-update
ophub commented 1 month ago

https://github.com/ophub/kernel/releases/tag/kernel_rk35xx

I have uploaded the kernel version 6.1.43 here. You can download it and upload it to Armbian for your use. Follow the method above to update locally. Alternatively, you can also update it online directly. armbian-update -k 6.1.43

d5stick commented 1 month ago

Screenshot_20240727-075908_Termius

I performed the restore of the kernel by local method.

Sensors are now there.

ophub commented 1 month ago

I added some configuration options for temperature sensors in the settings. Can you try compiling 6.1.75 and 6.1.43 that were compiled today to see if they work properly?

armbian-update -k 6.1.75
armbian-update -k 6.1.43
d5stick commented 1 month ago

I updated both kernels, didn't see any change: Screenshot_20240727-144817_Termius Screenshot_20240727-143727_Termius

ophub commented 1 month ago

sudo sensors-detect

d5stick commented 1 month ago

The mango dtb is used. Screenshot_20240727-150904_Termius

ophub commented 1 month ago

I compared the config files of 6.1.43 and 6.1.75, but couldn't find any missing options related to sensors.

2ndMessiah commented 2 weeks ago

Hi folks,

May I know whether h96 max m2 is usable now? Does BT&Wifi work?

Thx!

d5stick commented 1 week ago

If you flash my created uboot with the flasher mentioned in this post, you are able to boot from usb. Using the mangopi dtb and rockchip 6.x kernel provided by ophub in the image you can boot. Everything works except wifi and bt. I couldn't get it working but I dont use these so for my use case thats fine.

I didn't test the install to emmc, that's something to explore if you want.

I used a USB dongle to connect the flash drive and keyboard/mouse as it only has 1 USB. And it works fine.

-------- Oorspronkelijk bericht -------- Van: 2ndMessiah @.> Datum: 23-08-2024 16:24 (GMT+01:00) Aan: ophub/amlogic-s9xxx-armbian @.> Cc: d5stick @.>, Author @.> Onderwerp: Re: [ophub/amlogic-s9xxx-armbian] H96MAX M2 RK3528 - New box (Issue #2404)

Hi folks,

May I know whether h96 max m2 is usable now? Does BT&Wifi work?

Thx!

— Reply to this email directly, view it on GitHubhttps://github.com/ophub/amlogic-s9xxx-armbian/issues/2404#issuecomment-2307204601, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMVHYIN6ET2POLBTEMYSYBLZS5A2VAVCNFSM6AAAAABKIJWHM6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMBXGIYDINRQGE. You are receiving this because you authored the thread.Message ID: @.***>

myallten commented 1 week ago

大家好,请问H96MAX M2 RK3528 或者芯片是RK3528的盒子是如何把armbian安装到EMMC的

ophub commented 1 week ago

用rockchip写固件工具或dd命令,在仓库的文档里有说明

myallten commented 6 days ago

用TF卡烧录h28k这个镜像到TF卡,把TF卡插到盒子上,正常启动,然后我把h28k这个镜像解压后上传到armbian系统(TF卡的系统) 然后执行

root@armbian:~# dd if=/root/armbian.img  of=/dev/mmcblk2  bs=1M status=progress
3217031168 bytes (3.2 GB, 3.0 GiB) copied, 88 s, 36.6 MB/s
3088+0 records in
3088+0 records out
3238002688 bytes (3.2 GB, 3.0 GiB) copied, 93.909 s, 34.5 MB/s
root@armbian:~# lsblk 
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk2      179:0    0 58.2G  0 disk 
├─mmcblk2p1  179:1    0  511M  0 part 
└─mmcblk2p2  179:2    0  2.5G  0 part 
mmcblk2boot0 179:32   0    4M  1 disk 
mmcblk2boot1 179:64   0    4M  1 disk 
mmcblk1      179:96   0 59.5G  0 disk 
├─mmcblk1p1  179:97   0  511M  0 part /boot
└─mmcblk1p2  179:98   0   59G  0 part /
zram0        254:0    0  1.9G  0 disk [SWAP]
zram1        254:1    0   50M  0 disk /var/log
root@armbian:~# poweroff 

执行完之后我用命令 lsblk 查看了一下,其中mmcblk1是TF卡。就是这样,然后关闭,再打开机器的时候 无法进入系统,不知道哪里出问题。还是说直接把 TF卡系统dd到盒子EMMC上 比如这样 dd if=/dev/mmcblk1 of=/dev/mmcblk2 bs=1M status=progress

ophub commented 6 days ago

你的操作看不出错误。 你看这个帖子的内容,贡献者是使用的rk工具写入的,你试试这种方法,可以把盒子先还原回安卓系统,再使用rk工具写入。安卓系统在kernel仓库有备份。