Jump to content

CSC Armbian for RK322x TV box boards


jock

Recommended Posts

On 10/14/2023 at 12:00 PM, n3o said:

Hi, I was thinking that @jock and @fabiobassa doesn't know for the existing of your nand driver. If You don't want that is made an armbian image with your driver no problem.

Yeah, we live in the clouds and sometimes we land to go to the grocery store ...

Link to comment
Share on other sites

Quote

No typo. Armbian image has all the things in the right places to boot as explained in the instructions.

Supposing you have eMMC/eMCP, to boot from SD card you need one of these:

  • to clean the internal flash memory, or
  • install Armbian on internal flash memory

Thank you @jock for this hint! I was trying Armbian_23.8.1_Rk322x-box_jammy_current_6.1.50_minimal.img directly from the SD without installing to check if it would work before burning the unit (just getting blue and red LEDs shine very tiny at each attempt) and was wondering why multitool would run from the SD and the image, won't.

 

My unit is the cheap MXQ Pro 4k 5g with R329Q_V8 board. It has 4 H5TC2G43BFR-H9A DDR3L DRAM, 512MX4 memory chips (1GB RAM total), a KLM8G1GETF-B041 eMMC 5.1 (8GB) and the SV6256P wireless. After installing it successfully booted, I plug a spare USB WIFI dongle I had and enabled internet access using nmtui to apt update && apt upgrade

 

I select on rk322x-config rk3228 no pins and overlays=emmc led-conf2, are these the right settings for this board?

 

My goal was to setup a cheap print server for an old non-wifi printer I have and thanks to you guys awesome work I succeed

 

While preparing I managed to get some info from the board using the shell from multitool
 

# hexdump -C /sys/bus/nvmem/devices/rockchip-efuse0/nvmem
00000000  52 4b 23 82 81 d4 70 55  52 4b 4e 30 39 30 32 35  |RK#...pURKN09025|
00000010  00 00 00 00 01 2c 15 03  00 03 81 00 00 80 00 00  |.....,..........|

--> 3228 chip

 

(I was not able to remove the heatsink to check if the RK3228 is a or b, it is very well glued)

 

# cat /sys/class/devfreq/dmc/trans_stat
cat: /sys/class/devfreq/dmc/trans_stat: No such file or directory

--> shows that unit is not using frequency scaling

 

# cat "/sys/bus/mmc/devices/mmc1:0001/mmc1:0001:1/modalias"
sdio:c07v3030d3030

 

Some pictures of the board and from the android that came with it attached (system's and Aida64). There are R T and GND points on the board but I didn't try a serial there

 

I made a backup of the android that came installed, if anyone wants just tell and I'll post a link

 

Thank you @jock @fabiobassa @hexdump @knaerzche Igor Pecovnik, Justin Swartz and all others that contributed so much for Ambiam project and to this port.

 

Cheers

!3runo

from Brazil

 

(As a side note, I was able to get rid of the annoying adware that popups every time android booted - the video at /system/media/bootanimation.ts - by adding to /system/build.prop the following single line using adb or an file manager app capable of editing files. The box came factory rooted and with adb network enabled - beware of that if you use its android!)

 

debug.sf.nobootanimation=1

 

photo_2023-10-28_09-47-34.jpg

photo_2023-10-28_09-47-29.jpg

photo_2023-10-28_09-47-18.jpg

photo_2023-10-28_09-47-12.jpg

photo_2023-10-28_10-03-07.jpg

photo_2023-10-28_10-02-45.jpg

photo_2023-10-28_10-02-37.jpg

photo_2023-10-28_10-10-50.jpg

photo_2023-10-28_10-08-59.jpg

photo_2023-10-28_10-08-55.jpg

Link to comment
Share on other sites

Quote

any suggestions the best way to install home assistant?

Quote

What version of Armbian do I need to install in order for Home Assistant to work? I tried 2 different versions and always got this kind of error

@chrisrer My box is running so well that I managed to write a procedure to install HA on it.

@Scmel  I find a fix for the error you reported, check bellow

 

Spoiler

1) Dependencies

sudo apt install apparmor cifs-utils nfs-common systemd-journal-remote udisks2 -y
# no need to install systemd-resolved on my Ubuntu system, it doesnt have a package but it is running.

systemctl status systemd-resolved

# If you are using Debian perhaps you need to install it with sudo apt install systemd-resolved
# these bellow may already be installed. YMMV
sudo apt install curl dbus jq libglib2.0-bin lsb-release network-manager wget -y

 

2) Docker

# Docker dependencies
sudo apt install python3-pip python3-dev libffi-dev libssl-dev

 

(This procedure is for Ubuntu - I don't have a Debian to test)
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
# Verify that you now have the key with the fingerprint 9DC8 5822 9FC7 DD38 854A  E2D8 8D81 803C 0EBF CD88 - you may skip this
apt-key fingerprint 0EBFCD88
# Docker PPA
add-apt-repository "deb [arch=armhf] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get install docker-ce docker-ce-cli containerd.io
sudo docker run --rm hello-world # test - you may skip
docker --version

 

3) OS-Agent installation

# download and install home assistant os-agent (you may check if there is a newer one there)
wget https://github.com/home-assistant/os-agent/releases/download/1.6.0/os-agent_1.6.0_linux_armv7.deb
sudo dpkg -i ./os-agent_1.6.0_linux_armv7.deb

 

# You can test if the installation was successful by running:

gdbus introspect --system --dest io.hass.os --object-path /io/hass/os

# This should not return an error. If you get an object introspection with interface etc. OS Agent is working as expected.

 

4) Home assistant supervised installation

 

# Please add the following line to /boot/armbianEnv.txt extraargs line and reboot before continuing

systemd.unified_cgroup_hierarchy=false

 

# Get the HA Supervised deb

wget -O homeassistant-supervised.deb https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb

 

# If you are using Debian 11 or 12 just install it

sudo dpkg -i homeassistant-supervised.deb

 

# If you are using Ubuntu (like me), the deb file tests $(lsb_release -d) (/etc/os-release $PRETTY_NAME) seeking for Debian 11 or 12 presence. I read suggestions about modifying /etc/os-release, changing the /usr/bin/lsb_release script for a fake one telling my Ubuntu system is debian but <i>here</i> homeassistant-supervised.deb's preinst script always got the real Ubuntu version name I am using. Perhaps modifying /etc/os-release needs a reboot - which I didn't do-, I really don't know, so I just fix and repack the deb -- instructions bellow

 

mkdir -p newpack oldpack/DEBIAN
dpkg-deb -x ./homeassistant-supervised.deb oldpack
dpkg-deb -e ./homeassistant-supervised.deb oldpack/DEBIAN
sed -i 's/os_supported=false/os_supported=true/' oldpack/DEBIAN/preinst
sed -i 's/, systemd-resolved//' oldpack/DEBIAN/control

dpkg-deb -Z xz -b oldpack/ newpack/
sudo dpkg -i newpack/homeassistant-supervised_1.5.0_all.deb

# you may delete oldpack dir and original homeassistant-supervised.deb file now

 

# For BOTH Debiand and Ubuntu, when in the installation type selection window, select "qemuarm" for armv7, <b>this is important</b>!

 

5) After this installation, the services for deploying the docker container will immediately load automatically. Note that it took me ~15 minutes! You can see what is happening through a browser

 

6) For autoload, you need to activate autoload services:

sudo systemctl enable hassio-apparmor.service
sudo systemctl enable hassio-supervisor.service

# For Bluetooth integration to work, you must install "sudo apt-get -y install bluez" into the system beforehand.

 

7) The default path for our $DATA_SHARE is /usr/share/hassio. This path is used to store all home assistant related things.

 

😎 Almost done

Open a web browser and navigate to http://yourDNSorIP:8123/
Wait while Home Assistant initializes
Enter a Name, Username and Password to create a Home Assistant user account > Click Create Account
Enter a Name for this Home Assistant installation (ie Home)
Click Detect to set the installation geolocation
Select any anonymous data to share with the Home Assistant development team > Click Next
Click Finish
Welcome to Home Assistant

 

9) Troubleshooting
If something's going wrong, use journalctl -f to get your system logs. I am no HA expert so I problably would not be able to help.

Hope this helps

!3runo

from Brazil

Link to comment
Share on other sites

For the journalctl  problem reinstalling the package restart the system and reinstall HA as is written in the HA hint and its working.

The large problem is if having less RAM its braking the zram logging but its one other story.

For install download one older HA installer and its working without local mode.

Link to comment
Share on other sites

while you can do a supervised install of Home Assistant on this box, I recommend getting a 2GB RAM variants specially if your going to run esphome to compile the firmware, 1GB RAM will literally crash the box during firmware compilation, all of that because of the very limited 1GB RAM. Else, if you can run HA without esphome, it works fine. Make sure to use a high endurance SD card as your storage for all the database logs, configurations. etc... just spare the eMMC for system use. Heck there are times that its actually much better to run armbian on SD card with home assistant because eMMC on these cheap boxes are really slow, specially the eMCP variants.

Link to comment
Share on other sites

@remlei very true 1/8G can running but best mounting one SD-card for docker data so all HA containers is being out of the eMMC then its being full then HA is installed and booting up for the first time also USB is tricky and need repower for getting disconnected device being reconiced after some time but they is working pretty good for no production systems.

Link to comment
Share on other sites

Hey guys

 

I need the driver for Ps3 Eye usb webcam and it's not avaliable on legacy kernel (4.4.194-rk322x).

 

I found it on version 5.10.60-rk322:

 

/usr/lib/modules/5.10.60-rk322x/kernel/drivers/media/usb/gspca/gspca_ov534.ko

 

modinfo gspca_ov534
filename:       /lib/modules/5.10.60-rk322x/kernel/drivers/media/usb/gspca/gspca_ov534.ko
license:        GPL
description:    GSPCA/OV534 USB Camera Driver
author:         Antonio Ospite <ospite@studenti.unina.it>
alias:          usb:v06F8p3002d*dc*dsc*dp*ic*isc*ip*in*
alias:          usb:v1415p2000d*dc*dsc*dp*ic*isc*ip*in*
depends:        gspca_main
intree:         Y
name:           gspca_ov534
vermagic:       5.10.60-rk322x SMP preempt mod_unload ARMv7 p2v8 

 

lsmod |grep gspca_ov534
gspca_ov534            20480  0
gspca_main             24576  1 gspca_ov534

 

Do you have already installed a new driver on Armbian's  kernel?

 

How to get the kernel's source?

 

Thx!

Edited by primoitt
Link to comment
Share on other sites

hi all.

 

does anybody have rk322x loader with ddr init module v1.11? I have board with 1.5GB RAM (eMCP 1.5/8G), loader with 1.10 saw it as 2GB and fails on load.

 

or is there a simple way to extract it from stored fw dump?

 

UPD:

I extracted loader from firmware update, it's attached here:

 

Edited by Andrii Denysenko
Link to comment
Share on other sites

19.08.2023 в 07:55, occams razor сказал:

For the H20_221_v1.71 board I have worked out the uart connections and maskrom enable point.   For maskrom, this is shorting out either the data or clock line. 

It doesn't work for me on same board, but shorting any data lines to each other pushed chip to mask rom on boot.

 

I have 1.5G/8G version, and it doesn't boot armbian or multitool from sd/emmc - it just hangs on boot with no output to console (1500000 and 115200 speed)

Link to comment
Share on other sites

13 часов назад, jock сказал:

I will update the ddrbin ASAP

Thanks. My board has KMQN10006B-B318 eMCP chip.

 

Also, I experimented with different usbplug loader parts - board boots with v2.53 (which is in this loader) and hangs with v2.56.

Link to comment
Share on other sites

Here's log of original fw booting:

DDR Version V1.11 20200910_dbg
In
ID:0xFFF
300MHz
LPDDR3
Bus Width=32 Col=10 Bank=8 Row=15 CS=2 Die Bus-Width=32 Size=1536MB
mach:14
OUT
Boot1 Release Time: Sep 29 2018 16:04:10, version: 2.53
ChipType = 0xc, 370
mmc2:cmd19,100
SdmmcInit=2 0
BootCapSize=2000
UserCapSize=7456MB
FwPartOffset=2000 , 2000
SdmmcInit=0 NOT PRESENT
StorageInit ok = 18165
SecureMode = 0
SecureInit ret = 0, SecureMode = 0
GPT 0x632d7e08 signature is wrong
LOADER Check OK! 0x60000000, 82244
TOS    Check OK! 0x68400000, 92952
Enter Trust OS
INF TEE-CORE:init_primary_helper:319: Initializing (1.0.1-72-gf230aa2 #2 Fri Sep 29 10:22:10 UTC 2017 arm)
INF TEE-CORE:init_primary_helper:320: Release version: 2.0
INF TEE-CORE:init_teecore:79: teecore inits done


U-Boot 2014.10-RK322X-06 (Oct 18 2022 - 16:37:01)

CPU: rk322x
cpu version = 3
CPU's clock information:
    arm pll = 600000000HZ
    periph pll = 1200000000HZ
    ddr pll = 600000000HZ
    codec pll = 500000000HZ
Board:  Rockchip platform Board
Uboot as second level loader
DRAM:  Found dram banks: 1
Adding bank:0000000060000000(0000000060000000)
Reserve memory for trust os.
dram reserve bank: base = 0x68400000, size = 0x00100000
128 MiB
GIC CPU mask = 0x00000001
rk dma pl330 version: 1.4
remotectl v0.1
pwm freq=0x47868
pwm_freq_nstime=0xd55
SdmmcInit = 0 20
SdmmcInit = 2 0
storage init OK!
Using default environment

GetParam
Load FDT from resource image.
can't find dts node for fixed
No pmic detect.
set pwm voltage ok,pwm_id =1 vol=1100000,pwm_value=66
set pwm voltage ok,pwm_id =2 vol=1200000,pwm_value=33
DRAM: dram freq:600MHz
SecureBootEn = 0, SecureBootLock = 0

#Boot ver: 0000-00-00#0.00
empty serial no.
normal boot.
checkKey
vbus = 1
Normal boot, detecting usb...
Auto detect usb timeout:978/1479/1479, return!
otg not connected!
board_fbt_key_pressed: ir_keycode = 0x0, frt = 0
no fuel gauge found
no fuel gauge found
can't find power_ctr node for lcdc0
HDMI: no pull up gpio
can't find dts node for deviceinfo
rk_hdmi_register:fail to read deviceinfo
hdmi baseparamer 0x0@0-0
left = 0, right = 0, top = 0, bottom = 0, overscan = 0
panel->left = 100 , panel->right = 100 ,panel->top = 100, panel->bottom = 100, panel->overscan = 100
tve baseparamer 0x0@0-0
Hdmi Devices Not Exist.
can't find dts node for rk312x-tve
SCREEN_TVOUT
rk3036_tve_init:use default config g_tve_pos = 1 
read logo on state from dts [1]
no fuel gauge found
checkKey
vbus = 1
board_fbt_key_pressed: ir_keycode = 0x0, frt = 0
Hit any key to stop autoboot:  0 
load fdt from resouce.
ERROR: [get_entry_ram]: Cannot find logo_kernel.bmp!
vendor read error!
Set oem_unlocked=0Secure Boot state: 0
kernel   @ 0x62000000 (0x0066db38)
ramdisk  @ 0x65bf0000 (0x001693f0)
bootrk: do_bootm_linux...
   Loading Device Tree to 65600000, end 656155bd ... OK
Add bank:0000000060000000, 0000000008400000
Add bank:0000000068500000, 0000000057b00000
WARNING: could not set reg FDT_ERR_BADOFFSET.

Starting kernel ...

<hit enter to activate fiq debugger>
[    0.000000] Booting Linux on physical CPU 0xf00
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.10.104 (hxws@gxt) (gcc version 4.6.x-google 20120106 (prerelease) (GCC) ) #76 SMP PREEMPT Mon Aug 7 10:45:16 CST 2023
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] Machine: Rockchip RK3229, model: rockchip,rk3229
[    0.000000] rockchip_uboot_logo_setup: mem: 0x02000000@0xbdc00000, offset:0x00000000
[    0.000000] hdmi init vic is 65536
[    0.000000] cvbs init tve.format is 1
[    0.000000] cvbs init tve.format is 1
[    0.000000] cvbs init tve.format is 1
[    0.000000] rockchip_uboot_mem_reserve: reserve 0x02000000@0xbdc00000 for uboot logo
[    0.000000] rockchip_ion_reserve
[    0.000000] ion heap(cma): base(0) size(0) align(0)
[    0.000000] ion heap(drm): base(0) size(0) align(0)
[    0.000000] ion heap(vmalloc): base(0) size(0) align(0)
[    0.000000] cma: CMA: reserved 16 MiB at 7f000000
[    0.000000] Memory policy: ECC disabled, Data cache writealloc
[    0.000000] system serial: c0cd2128
[    0.000000] 52 57 30 31 00 00 0b 1d
[    0.000000] 55 4b 35 30 32 00 00 21
[    0.000000] psci: probing function IDs from device-tree
[    0.000000] PERCPU: Embedded 9 pages/cpu @c1a15000 s13440 r8192 d15232 u36864
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 391936
[    0.000000] Kernel command line: vmalloc=496M psci=enable rockchip_jtag console=ttyFIQ0 androidboot.selinux=permissive androidboot.hardware=rk30board androidboot.console=ttyFIQ0 init=/init mtdparts=rk29xxnand:0x00002000@0x00002000(ub0
[    0.000000] rockchip jtag enabled
[    0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[    0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[    0.000000] allocated 3145728 bytes of page_cgroup
[    0.000000] please try 'cgroup_disable=memory' option if you don't want memory cgroups
[    0.000000] Memory: 132MB 1403MB = 1535MB total
.....

 

Link to comment
Share on other sites

quite strange; armbian fails to boot from eMMC after ddr code replacement; it hangs on

U-Boot SPL 2022.04-armbian (Jul 12 2023 - 10:46:05 +0000)
Trying to boot from MMC2
INF [0x0] TEE-CORE:init_primary_helper:377: Initializing (1.1.0-333-gc9d95d1 #2 2018年 08月 17日 星期五 03:32:22 UTC arm)

INF [0x0] TEE-CORE:init_primary_helper:378: Release version: 2.0

INF [0x0] TEE-CORE:init_primary_helper:379: Next entry point address: 0x61000000

INF [0x0] TEE-CORE:init_teecore:83: teecore inits done

multitool image boots from SD successfully only when loader is installed on EMMC.

Edited by NiTr0
Link to comment
Share on other sites

If i have understanding it right if erasing the eMMC and installing the loader in  it the its possible jump stating eternal media also USB as secondary uboot is on the media. Then the system is using the first boot bin from the eMMC and the uboot from the media.

Your try is working OK until the trust OS is starting and its getting some problems (legacy kernel need one old type and current need one newer one for working OK).

I think fabiobassa is the one that having more deep knowledge of this functions but its very deep in the RK boot code.

Link to comment
Share on other sites

yes I switched speed to 115200.

 

it seems like rockchip miniloader starts from eMMC and then boots from microSD.

 

I wrote first 128KB of eMMC content to SD card with multiboot image (except 1st sector with partition table) - and it boots OK with empty eMMC.

Link to comment
Share on other sites

@jock I finally managed to extract the firmware. Here's the trust partition https://drive.google.com/file/d/1E7mxBVE1lUshqdcjqTMfxKQMW2iLUvye/view?usp=drive_link. And here's the rest of the backup https://drive.google.com/drive/folders/165r4bV3jFj8Ptx4yY2sXmbmOUOBIMWaW?usp=drive_link. I've been trying to install Armbian via USB cable, but no luck so far, always getting Test device fail. Thanks 

Link to comment
Share on other sites

18 hours ago, H1H1 said:

@jock I finally managed to extract the firmware. Here's the trust partition https://drive.google.com/file/d/1E7mxBVE1lUshqdcjqTMfxKQMW2iLUvye/view?usp=drive_link. And here's the rest of the backup https://drive.google.com/drive/folders/165r4bV3jFj8Ptx4yY2sXmbmOUOBIMWaW?usp=drive_link. I've been trying to install Armbian via USB cable, but no luck so far, always getting Test device fail. Thanks 

 

It looks like a very old trust, I see version 1.0.1-88 from the binary; currently there's the version 1.1.0-333.

I will try to extract it from the partition and make a custom multitool with the old one!

Link to comment
Share on other sites

@H1H1 I managed to build another multitool, this time with the Trust OS coming from your image.

I noticed that your trust is one of the "bad" ones, in the sense it forces the box to sleep after a while if there is no activity. It was supposed to bring the box in suspended mode when not in use in Android, so probably after some seconds your box may become unresponsive and screen will go blank. @fabiobassa will surely remember such issue; nonetheless you can try it to see if at least multitool boots. You can download it from here

 

Also you and @NiTr0 may also give shot to the latest multitool updated with the latest ddrbin v1.11 @NiTr0 has posted in the other thread. You can download it here

 

@NiTr0 also you may send back feedback if it boots for you, so I may build an armbian image with the updated ddrbin before the official updates

Link to comment
Share on other sites

@jockThe multitool-bad booted up fine, but it had the issue you mentioned, stops responding after a few seconds. The latest multitool isn't booting at all.

From what I've been reading, there's no solution to this so far.

Tthank you very much for everything again.

Link to comment
Share on other sites

10 hours ago, H1H1 said:

From what I've been reading, there's no solution to this so far.

 

it would require more inspection to understand why your board requires that specific version of the trust, but it is something hard to do without the board at hand 🫤

Link to comment
Share on other sites

Hello guys, first of all, I'd like to thank @jock for your very powerful work, very patient with all us newbies and thanks too @fabiobassa for your always fast answer. 

I have the R29 box that didn't run HDMI neither WI-FI, so I tested the new multiboot and the new minimal firmware and as the most people, it works flawlessly boting in pendrive, I could install in internal EMMC and everything is OK. So, to go ahead I tried to install the XFCE desktop environment in armbian-config, but wen I did it, the HDMI stopped working. The system still works behind the screen with my pi-hole server, but without Image in HDMI.

I just see and it still in led7 option. There are anything I could do to try? Could a desmeg of my board help? Or is necessary both, before and after desktop installation to help?

Any test could I do to help you guys to improve this firmware? 

Link to comment
Share on other sites

@Rodrigo Campos hello; I don't think HDMI stopped working, but instead something went wrong with xfce installation via armbian-config.

 

Honestly, I never try to install a desktop enviroment via armbian-config, but instead I usually build and use images with xfce already installed.

 

Some fresh debian and ubuntu images have been built by armbian servers just yesterday: https://imola.armbian.com/dl/rk322x-box/archive/

You may want to give a chance to them perhaps? They are still command-line only, but maybe they work better.

 

In case they don't work, maybe you could post on this other forum, since I guess it is a userspace issue.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines