CSC Armbian for RK3318/RK3328 TV box boards


jock
 Share

22 22

Recommended Posts

@chinhhut @curse

The backup made by multitool (and rkdeveloptool) is per nature a full backup of all the physical eMMC sectors. It has no knowledge of the abstract structures like filesystem and files.

The compression gives back a more manageable file which is not the entire size of the eMMC, but up to a few gigabytes, depending on how much data is stored on the eMMC and how much compressible it is.

 

Indeed if you decompress it, you get the whole size of the eMMC, it is expected and it is advisable too. If it is not so, it means the backup process didn't went right.

 

Now should be clear there is a problem about the "blank" part: how we can know if a part is "blank" and not, for example, a piece of a file which just contains a long string of 0x00 bytes? This is crucial: if you say that you skip those parts which are, supposedly, blank, you may (and probably will) fail to restore files that contains long string of 0x00 bytes. You won't get 0x00s in those places, but you will instead find there the contents of the unwritten eMMC sectors.

 

So a full restore of all sectors is essential to restore the exact previous condition when doing a full backup.

 

One helpful thing that may be helpful here is to use the native page erase feature of eMMCs, which is the thing blkdiscard program do and is at the bottom of the famous TRIM feature: flash memories are divided into "pages", ranging from several kilobytes to few megabytes usually.

Erasing those pages using the discard command is very fast, much faster than zero-filling. You can erase all the pages of a whole eMMC in a few seconds, while zero-filling all the pages would require dozens of minutes.

 

Doing an erase with blkdiscard and then restoring the backup skipping the blank parts now becomes sensible!

There is an issue though: discarding pages does not fill them with 0x00 bytes, but with 0xff bytes, so the real blank parts now are not those which contains string of 0x00s but those which contains strings of 0xff bytes. Those may or may be not so common. Surely they are common in non-programmed sectors, but results may vary.

 

As a conclusion: restoring the whole count of eMMC sectors, despite being slower, is surely the simplest and most reliable way!

Link to post
Share on other sites

Donate and support the project!

H96Max+ here.

 

Just installed following your instructions. Works amazingly well and was amazingly easy, particularly after having read around on other forums that for RK3328 there is no HDMI support and that I should have opened the box to get to the serial pins! Thank you all for this great work!

 

I am going to use the device as a micro server, so I am not testing any graphical desktop.  Quite happy to see that USB3, WIFI, Ethernet, all appear to work out of the box.

 

Have just a few questions to which someone having the same box may be able to answer:

 

1. What is the appropriate answers for the EMMC configuration in rk3318-config?

2. What is the appropriate configuration for the LED? I am puzzled by the fact that the led functionality seems to be better in the multitool than in the OS itself. In multitool the red led stays on and the blue one appears to flash to indicate activity. In the OS, the red led stays on all the time and the blue one stays off all the time.  The "conf3" seems to hang the machine at boot.

 

Furthermore, I have a question about the kernel packages.

 

- As instructed, I have put on hold the upgrade of kernel, kernel headers and dtb packages from apt. Is it expected that the official armbian kernel will include rk3318 and rk3328 support in the future? This seems important to me in terms of future maintainability of the box.

 

During the installation, I have dumped my firmware using multitool (an Android 8.something, if I remember properly). Would it be useful if I tried to extract the dtb from it, or is the dtb of the stock H96Max+ already well known to you?

 

A very minor suggestion from someone getting onto this great forum for the first time (hence something that could either be totally useless for naivety or maybe useful as representative of an initial impression, you judge). Threads regarding multiple boxes sharing the same fundamental hardware, such as this one may easily become very large and it is hard and trying to go through them it is sometimes hard to understand if something is general or if it refers to a specific box and if so which one.  Being able to tag the messages with the specific piece of hardware they are about would ease reading immensely.

Link to post
Share on other sites

8 hours ago, callegar said:

1. What is the appropriate answers for the EMMC configuration in rk3318-config?

It depends upon your actual board and how much it is well built.

Keeping all the emmc options off is the most stable but also the slowest setting.

Enabling DDR or HS200 modes may improve the eMMC throughput a lot, but may also make your eMMC not work anymore and depends upon your board quality.

Despite eMMC declare their supported modes and kernel is perfectly able to select the best suited, it is not possible to resort to automatic selection because of the board quality.

HS200 mode is preferred over DDR.

 

8 hours ago, callegar said:

What is the appropriate configuration for the LED?

rk3318-config is telling you: select the board configuration looking on the markings of the board. The right configuration solve problems with devices detection like leds, wifi, bluetooth and improve general stability

You have to open the box and look at the signature of the board: that is the "name' of the board. Most external devices of the boards (emmc, sdcard, infrared receiver, USB ports, HDMI, etc...) are usually wired to the same GPIO pins to the SoC described in the reference design. This is the base configuration.

Some manufacturers wire other devices (leds, but also wifi, and others too) in a different way, so you need to fix the configuration for specific boards, hence you need to select the right one here.

If your board is not in the list, it means that nobody (actually me) has ever made a configuration for your specific board, so use the Generic option.

There is no 'trial and error" here, you have to know the board name, otherwise stick to generic one.

 

About the leds, I don't know your setup, but after first rk3318-config run, the main led is configured as "power on".

The behavior can be easily changed setting the appropriate trigger in /sys/class/leds/working/trigger file (see google for that, "working" is the name of the led).

 

8 hours ago, callegar said:

- As instructed, I have put on hold the upgrade of kernel, kernel headers and dtb packages from apt. Is it expected that the official armbian kernel will include rk3318 and rk3328 support in the future? This seems important to me in terms of future maintainability of the box.

I hope so. I would like to merge soon, but it depends upon the compatibility reports that are posted here.

 

8 hours ago, callegar said:

During the installation, I have dumped my firmware using multitool (an Android 8.something, if I remember properly). Would it be useful if I tried to extract the dtb from it, or is the dtb of the stock H96Max+ already well known to you?

 

Could be useful, yes. Useful also are photos of the board to identify the signature and chips.

 

8 hours ago, callegar said:

A very minor suggestion from someone getting onto this great forum for the first time (hence something that could either be totally useless for naivety or maybe useful as representative of an initial impression, you judge). Threads regarding multiple boxes sharing the same fundamental hardware, such as this one may easily become very large and it is hard and trying to go through them it is sometimes hard to understand if something is general or if it refers to a specific box and if so which one.  Being able to tag the messages with the specific piece of hardware they are about would ease reading immensely.

I don't think it is possible to tag single posts. It would not useful though: the board you find inside the box is not always the same.

We have seen that tv boxes with the same commercial name may contain different boards.

That's the reason because rk3318-config does not list boards per commercial name (H96Max+, HK1, T95P, ...) but per board signature.

 

Normally you don't need to read all the posts of the thread: the first post is regularly updated with all the information needed for newcomers and board specialties are integrated into rk3318-config to make life easier as soon as new boards appear.

 

A good idea though is to read the last couple of pages of the thread to quickly get updated to the latest bits. The whole thread will give you the idea of the progress, but a post about your board of one or two years ago will probably be outdated and not so useful. First page is always the source of truth.

Link to post
Share on other sites

Good evening all,

Using the excellent instructions by @jock in Post #1, I was able to get Debian Bullseye desktop [xfce] installed on my Pulierde T9 box.

Everything is up and running, I can connect to my network, etc... So .... now what? lol

I did this mostly as an interesting little exercise, and also because I'm loathe to throw away usable tech. However, now that it's a functional little linux box, what can I do with it?

I have no need of any sort media streamer/server box, since I have a full server in my house.  I thought about maybe a pihole, or something to do with HomeAssistant, but I wouldn't know where to begin.

So here's my question: What should I do with this little beast now?

If it matters, this one is a RockChip 3328, 4GB RAM, 64GB ROM, Mali450 GPU

Thanks for all the hard work that went into making this project a possibility!

-E

Link to post
Share on other sites

7 hours ago, ak007 said:

hi Jock, Thanks for your efforts on Armbian for RK3318. I installed latest image on H96+ Max, everything works except wifi. Wifi isdetected but unable to connect(With valid credentials). Please sugges how to fix the issue.

Below are logs:

http://ix.io/3F2c

If it's a similar problem as I had with my H96 Max Plus (RK3328) 

@jock gave me a few good hints Here

Link to post
Share on other sites

@Jock

 

Regarding your reply on my H96Max+ RK3328 installation of Armbian

 

Thanks for taking the time of a detailed response!

 

> The behavior can be easily changed setting the appropriate trigger in /sys/class/leds/working/trigger file (see google for that, "working" is the name of the led).

 

Thanks for this hint, I have now selected "generic" for the led config and trying this

 

> Useful also are photos of the board to identify the signature and chips.

 

I'll try to get the dtb out of the dumped firmware. The photos shall be more difficult, because the case has no screws and I'm a bit scared of breaking it trying to force it open.

 

> I would like to merge soon, but it depends upon the compatibility reports that are posted here.

 

Is there anyway to post an *enthusiastic* report? :-)

 

Thanks again

Link to post
Share on other sites

1 hour ago, Eddy_T said:

unable to download ANY of the upgrade files using the link in @jock in post #1

is there an updated link?

try again, works for me so probs you just experienced a temporary glitch in the matrix.......just like I'm having with my sleep patterns lol

Link to post
Share on other sites

3 hours ago, Elmojo said:

 

Anyone have any ideas?

I'm in the same boat with too much hardware......I took an old AMD mb with a half decent cpu, bought a gb SSD and built a bitcoin node......check out runcitadel on twatter

I also run homeassistant on an odroid c2.....features I like:

talks to some cheap bluetooth temp monitors scattered around the house...here the temps can be high in the summer and low in the winter so that keeps me amused

runs adguard and I recently learnt about running dot and/or doh ie secure dns.......something I read recently said you don't really need a vpn with secure dns, not convinced, I dl stuff from tpb still using transmission...

also wireguard is very interesting, mainly cos of the speed which makes openvpn redundent....

opensource routers are very interesting too, mainly cos governments are using convid as a power grab and I don't want to be beholden to some corporate shysters who are in the bed with them and want to track my every move and oppress me :(

Link to post
Share on other sites

Noticed that package armbian-bsp-cli-rk3318-box installs stuff to /usr/local/bin.

 

I wonder if this is fully appropriate. According to debian guidelines, /usr/local should be left as a playground for the local administrator, so packages should not do things there. This is in the debian policy sect 9.1.2 "packages must not place any files in /usr/local, either by putting them in the file system archive to be unpacked by dpkg or by manipulating them in their maintainer scripts" and "/usr/local and its contents are for exclusive use of the local administrator, a package must not rely on the presence or absence of files or directories in /usr/local for normal operation".

 

I understand that this may be because rk3318 is not yet fully official in armbian, but being likely that rk3318-config does not name-conflict with anything else, I wonder if it could be possible to update armbian-bsp-cli-rk3318-box to install rk3318-config in /usr/bin or /usr/sbin rather than /usr/local/bin.

 

Thanks for considering this!

Link to post
Share on other sites

@Elmojo

I know is not fine answer to a question with another question but in this case
 

Quote

So here's my question: What should I do with this little beast now?

comes very natural ask  : why did you modded it ??? Just for fun ? You didn't have a defined purpose in trying linux ?

Anyway, just to answer , in my personal study case I have done on it:
voip pbx ( asterisk)
network nas
network firewall
pihole dns firewall
openvpv, wireguard and tinc vpn

home assistant
volumio
special ip cam monitoring and data acquisition

and I guess I could experiment more..... if only I would study more potential applications

Link to post
Share on other sites

4 hours ago, fabiobassa said:

why did you modded it ??? Just for fun ?

 

As noted in my earlier post, yes, mostly just for fun. Also because I had no use for the device as an Android TV box, but didn't want to throw it away, so I was looking to repurpose it as something more useful. Hence my question. :D

If you have any links, I would be interested in how you accomplished...

pihole dns firewall

wireguard

 

Thanks to everyone for the suggestions!

Link to post
Share on other sites

On 11/14/2021 at 1:09 AM, jock said:

Doing an erase with blkdiscard and then restoring the backup skipping the blank parts now becomes sensible!

There is an issue though: discarding pages does not fill them with 0x00 bytes, but with 0xff bytes, so the real blank parts now are not those which contains string of 0x00s but those which contains strings of 0xff bytes. Those may or may be not so common. Surely they are common in non-programmed sectors, but results may vary.

 

As a conclusion: restoring the whole count of eMMC sectors, despite being slower, is surely the simplest and most reliable way!

@jock

I have an idea as follow to clone an Armbian box to new one and will try this weekend if reasonable. 

For instance, we have H96 max with 64GB flash. If making full backup of 64G flash and restore, it takes a lot of time.

 

Here are major steps:

Step 1: Install the Armbian according to your guide from page 1 (only take 1 minute to finish) to the box 1.

Step 2: Boot Armbian from box 1 and using partition tool to divide the eMMC flash into 2 partitions,: partition 1 from beginning to 5GB. Partition 2 is remaining space

Step 3: Make the backup of partition 1 by rkdeveloptool or similar partition tool to the PC

Step 4: Install the fresh armbian to the box 2  like Step 1(only take 1 minute to finish)

Step 5: boot the box 2 and make 2 partitions like Step 2.

Step 6: using rkdevelopetool or similar to to restore the backup from Step 3 to partition 1 of box 2

 

I don't have much experience with partition tool on Linux and this is just idea. Please give us your any comments if any.

 

Thank you.

Link to post
Share on other sites

@callegar Thanks for spotting it out.

Actually it is my fault the package installs things in /usr/local/bin.

I will change that to install in /usr/sbin which is probably more appropriate

 

@chinhhut It could work, but it couldn't :D

The problem is shrinking the partition, you don't just need to reduce the partition size, you also need to shrink the filesystem appropriately otherwise you lose data and possibly the partition does not get mounted when restored.

Enlarging the partition (and the filesystem) is easy and almost cheap, shrinking can be painful. But you can try indeed! (And maybe realize that losing some time to restore the wholly 64Gb eMMC is better than a headache :P )

Link to post
Share on other sites

2 hours ago, chinhhut said:

@jock

I have an idea as follow to clone an Armbian box to new one and will try this weekend if reasonable. 

For instance, we have H96 max with 64GB flash. If making full backup of 64G flash and restore, it takes a lot of time.

 

Here are major steps:

Step 1: Install the Armbian according to your guide from page 1 (only take 1 minute to finish) to the box 1.

Step 2: Boot Armbian from box 1 and using partition tool to divide the eMMC flash into 2 partitions,: partition 1 from beginning to 5GB. Partition 2 is remaining space

Step 3: Make the backup of partition 1 by rkdeveloptool or similar partition tool to the PC

Step 4: Install the fresh armbian to the box 2  like Step 1(only take 1 minute to finish)

Step 5: boot the box 2 and make 2 partitions like Step 2.

Step 6: using rkdevelopetool or similar to to restore the backup from Step 3 to partition 1 of box 2

 

I don't have much experience with partition tool on Linux and this is just idea. Please give us your any comments if any.

 

Thank you.

Wouldn't it be easier to modify Armbian as you want it before installing it in the first place? I don't know how to do it, but example. Download @jock's Armbian, or compile your own. Modify the files on the .iso. write it to the SD card and install it on box 1 without the need to modify it later. Then do it on box 2, box 3, etc.

Link to post
Share on other sites

7 hours ago, curse said:

Wouldn't it be easier to modify Armbian as you want it before installing it in the first place? I don't know how to do it, but example. Download @jock's Armbian, or compile your own. Modify the files on the .iso. write it to the SD card and install it on box 1 without the need to modify it later. Then do it on box 2, box 3, etc.

That's good idea but I don't know how to modify the .iso file while keep the files system consistency. I need to install a lot of applications and library such as docker etc.

Link to post
Share on other sites

On 11/16/2021 at 5:02 AM, Elmojo said:

 

Anyone have any ideas?

You can try YUNoHost, it's cool I use it on my beelink gt-king pro with armbian-meson64 works fine and have many apps.

Today I try install of Swizzin, on my RK3328 box that's work ( install process need root user "su -" )

it's another possibility..

https://github.com/swizzin/swizzin

https://swizzin.ltd/getting-started/

Link to post
Share on other sites

@chinhhut Actually armbian provides a way to introduce user-level patch files which can modify the behaviour of the installed system.

It means that you can, to some extent, launch sudo ./compile.sh and finally produce an image customized for your needs.

 

Armbian documentation will help you further.

Link to post
Share on other sites

1 hour ago, jock said:

@chinhhut Actually armbian provides a way to introduce user-level patch files which can modify the behaviour of the installed system.

It means that you can, to some extent, launch sudo ./compile.sh and finally produce an image customized for your needs.

 

Armbian documentation will help you further.

I will study more how to patch some additional files but could you share the source code to build RK3318 image?

Thank you so much for your support.

Link to post
Share on other sites

2 hours ago, chinhhut said:

I will study more how to patch some additional files but could you share the source code to build RK3318 image?

Thank you so much for your support.

First page, github repository has always been public

Link to post
Share on other sites

many thanks to @jockand other devs for this build!

just bought a used HK1 Max (the round one) for less than 20 yuros delivered after reading jock's recommendation; the 'conversion' couldn't have been easier!

if anyone is still wondering what to do with these, get familiar with docker....the way you can just download images and then spin up containers is crazy simple

ie I've got a beta Adguard home running, been messing with Plex (which has got far too bloaty for my likes lol) so next on the list is having a go with jellyfin

I had a go with yunohost but to my mind the docker way is the future.....you just create and destroy containers at will and it's not messing with the rest of your config!

PS the device I got has 4gb! 4/32 for less than 20€!! at least the central bank induced inflation hasn't hit tv boxes yet :lol:

Link to post
Share on other sites

2 minutes ago, mkultra said:

you can just download images and then spin up containers

I use dockers extensively on my unRAID server.

On a box like this, what environment are you running the dockers in?

I mean, what's the process for doing from 'bare metal' to running Docker? I'd be very interested in hearing about this... :)

Link to post
Share on other sites

16 minutes ago, Elmojo said:

I use dockers extensively on my unRAID server.

On a box like this, what environment are you running the dockers in?

I mean, what's the process for doing from 'bare metal' to running Docker? I'd be very interested in hearing about this... :)

easy peasy!

ie

apt install docker.io apparmor

docker pull adguard/adguardhome:beta

docker run blah blah

eg https://hub.docker.com/r/adguard/adguardhome

have fun!

edit: to add a bit more...

with docker you download images then you 'create a container' which you then just stop/start

so ie I've just created a jellyfin container with

docker pull hotio/jellyfin:release

docker run --rm \ --name jellyfin \ -p 8096:8096 \ -e PUID=1000 \ -e PGID=1000 \ -e UMASK=002 \ -e TZ="Etc/UTC"  \ hotio/jellyfin

now I just point a browser to ip:8096

keep a list of useful docker commands like

docker images

docker rmi <image name> (to remove an image)

docker ps -a (to list your containers)

docker rm <container>

docker stop/start <container>

 

Link to post
Share on other sites

I finally got some time to come back on my X88PRO 10 boards. The first one had wrong RAM and ROM size, the seller sent me a new one which appears (looking at the onboard chips) to have the real RAM/ROM. (first board was 2G RAM/32G ROM, 2nd is 4G ram/64G ROM).

 

Any file attached to this post is related to the second board, but both are called X88PRO 10.

 

I've tried your new image Armbian 21.11 - Debian Bullseye desktop [xfce] - mainline kernel 5.15.2 on my old board (the one with only 2G of RAM), but running rk3318-config and rebooting keeps telling me that it'll switch to another bus.

Then I've tried the hirsute image and that one did work after switching to the other bus and rebooting. One thing tho, I can't figure out how to enable/disable overscan. Various options tested (disable_overscan=1 or 0, disp_mode=, ... didn't change anything). In brief, something like 20 pixels are out of the screen on each side.

 

Then I've switched to the new board (the 4G RAM one). Using multitool (even before the first boot without sdcard), I've done a backup and I've extracted the dtb from each partition (not only the first one had some dtb, but also the 4th, 6th and 8th partitions had some). I then used dtc tool to get the dts out of each file which I attached here if it can be useful for anyone. All pictures, dtb, kernels and dts can be found here (as well as the original eMMC image).

 

Now comes the failing part: I was expecting the board to just be the same as the other one (the 2G one) with just augmented RAM and ROM, and once my backup has been created, I've burn to flash the Armbian 21.11 - Debian Bullseye desktop [xfce] - mainline kernel 5.15.2 image directly without testing it :unsure:. Removed power, sdcard, rebooted, ....and nothing. No signal on HDMI even after 10 minutes (I was hoping it was just the partition resize taking a long time).

I've tried to boot again from sdcard but nothing more was happening. I then tried to boot with male/male USB while keeping the pin inside the jack plug, but on both USB ports I had no output in dmesg of my laptop. Tho the red led turns on as well as the light in the coaxial audio plug.

 

At that point I don't know what else I can do, as you can see on the picture without the heatsink, the pins of the eMMC aren't accessible at all so I cannot try the screwdriver trick. Any idea on what I can try/do?

 

Thanks in advance for any help even if it's a "drop it to the bin" message :D, and lemme know if you want me to send anything else from those boards.

board-front-without-heatsink.jpg

board-back.jpg

board-front-with-heatsink.jpg

case-front.jpg

p1-01_dtbdump_rockchip,rk3328-evb.dts p1-02_dtbdump_rockchip,rk3328-evb.dts p1-03_dtbdump_rockchip,rk3328-evb.dts p1-04_dtbdump_rockchip,rk3328-evb.dts p4-01_dtbdump_fragment@0.dts p6-01_dtbdump_rockchip,rk3328-box-liantong-avb.dts p6-02_dtbdump_rockchip,rk3328-box-liantong-avb.dts p6-03_dtbdump_rockchip,rk3328-box-liantong-avb.dts p8-01_dtbdump_rockchip,rk3328-box-liantong-avb.dts p8-02_dtbdump_fragment@0.dts p8-03_dtbdump_rockchip,rk3328-box-liantong-avb.dts p8-04_dtbdump_rockchip,rk3328-box-liantong-avb.dts

 

 

Update:

thanks to @enigmasphinx's post, I looked right under the board where the eMMC is in the other side, and I found not 2 but 3 pins (see 2 new attached pics)! I will try to connect some of them, I hope a wrong combination won't do some more damage ;)

board-under-emmc.thumb.jpg.ff03216251bacbad215fb297639c9afc.jpg

 

board-under-emmc-with-labels.thumb.jpg.6e7417d08e89bb8f2ee5d50d5c3ea433.jpg

 

Edited by Huafu
Added pictures of the pins behind eMMC
Link to post
Share on other sites

@Huafu Any news about getting the board in maskrom mode?

 

I read your post multiple times trying to guess where the problem could be.

As usual, when the board "bricks" that way, my first guess is always the ddrbin.

 

The worst offender is the DDR Command Rate setting: ddrbin can set the memory controller to use 1 clock cycle or 2 clock cycles as Command Rate for DDR memories.

The shipped imeages have it is set to 2T, which was hopefully more compatible, but sometimes it hangs up some boards.

Switching to 1T is the same: works on a batch, does not work on another.

 

The very bad thing is that ddrbin is the very first binary loaded, so if it fails, the bootstrap can't proceed: no sdcard, no usb stick and obviously no emmc boot can take place.

Only maskrom mode can restore board functionality.

 

If you have the chance to attach a serial adapter to the serial pins of the board below the USB3 port (TX, RX and GND), you may have some detail on what is going wrong.

In the meantime I will try to take a look into your backup and see if I can grasp some more info.

Link to post
Share on other sites

@jockI've tried all combination of the uncovered copper without success. Even tried and with each of the 3 spots...

I also tried UART, nothing just some weird chars right when I touch tx and Rx to their spots, but nothing when I give power to the board, with or without the reset button pressed...

Thanks for tour time and if you can't take a deeper look nevermind.

 

Tho if you have a solution related to the overscan of the first board I'll take it 🙂

Link to post
Share on other sites

 Share

22 22