CSC Armbian for RK3318/RK3328 TV box boards


jock
 Share

26 26

Recommended Posts

I have used T9 (RK3318 2G memory & 16G flash) and it works very well for several days up to now. 

By the way, I just tried to install this rk3318 firmware to H96 max RK3228 (4G+64G flash) but it is unable to boot from SD card.  I also tried to burn the "Armbian 21.11 - Debian Bullseye minimal - mainline kernel 5.14.14" firmware to USB then boot from OTG usb port (near the HDMI) but also not success. 

Have any guys got success with H96 max RK3328 yet?

I also take some search on the forum and Google and found out it seems the original Android come up with H96 max (7.1.2) is unable to boot from SD card. I'm trying to upgrade the Android firmware to 8.1 and 9.0 but still same issue.

Link to post
Share on other sites

Armbian is a community driven open source project. Do you like to contribute your code?

3 hours ago, curse said:

Ahh. So it's a HK1 thing...I got a H96 Max+ and at least it seems to have the specified RAM/eMMC size.

 

could you share the way to boot Armbian from your H96 max 4/64? I've tried to follow exactly the steps from the guide in this topic but unable to boot from SD card.

My box look like this photo below:

59a16b368ac2ad5e1d8b64403b567ae8

Link to post
Share on other sites

@chinhhut Probably Perhaps your h96 max is unable to boot from sdcard because the sdcard is allocated to the "alternative" controller. Much more important than the box name is the board name/signature though.

From what I have seen on the forums, this breaks any kind of sdcard boot or update. I guess it is just not supposed that the tvbox manufacturers use this alternative controller for sdcard, so there is the need to find an alternative solution to boot, which I'm not yet aware of.

USB boot is available only if u-boot from armbian image is installed in the eMMC. The stock u-boot does not care about USB devices.

 

This is the most serious issue that is preventing me to ask to merge rk3318/rk3328 tvbox support in main Armbian source code. :unsure:

Link to post
Share on other sites

1 hour ago, chinhhut said:

could you share the way to boot Armbian from your H96 max 4/64? I've tried to follow exactly the steps from the guide in this topic but unable to boot from SD card.

My box look like this photo below:

59a16b368ac2ad5e1d8b64403b567ae8

 

I have the plus. However, I was never able to boot Armbian from the SD card, I used Multitool from this thread. Added the Armbian ISO to it, multitool booted fine from the SD card, then took a backup of the stock ROM with multitool and then erased eMMC and installed Jock's Armbian via multitool. 

 

20211101_173147.jpg

Link to post
Share on other sites

11 hours ago, curse said:

 

I have the plus. However, I was never able to boot Armbian from the SD card, I used Multitool from this thread. Added the Armbian ISO to it, multitool booted fine from the SD card, then took a backup of the stock ROM with multitool and then erased eMMC and installed Jock's Armbian via multitool. 

Yes I guess your hardware might be different even looks similar.

My problem is our box is unable from SD card then there is no further step. 

Link to post
Share on other sites

13 hours ago, jock said:

USB boot is available only if u-boot from armbian image is installed in the eMMC. The stock u-boot does not care about USB devices.

 

This is the most serious issue that is preventing me to ask to merge rk3318/rk3328 tvbox support in main Armbian source code. :unsure:

So according to your hint, there should be a solution to install the customized u-boot to the Android firmware then try to boot from USB port, right?

 

If so, could you give me the suggestion to do? I have some experience with ADB and some Linux/shell command like dd to extract/replace the bootloader before.

 

Thank you.

Link to post
Share on other sites

2 hours ago, chinhhut said:

So according to your hint, there should be a solution to install the customized u-boot to the Android firmware then try to boot from USB port, right?

 

If so, could you give me the suggestion to do? I have some experience with ADB and some Linux/shell command like dd to extract/replace the bootloader before.

 

Thank you.

Well, the problem about the alternative controller is guesswork. Can't be sure that it is your issue. I have no such board to test and verify if the boot process with an adapted u-boot would work.

 

The only thing that can be done right now with the tools we have is to wipe the first megabyte of the eMMC via adb using dd and then use rkdeveloptool to burn an armbian image directly on the eMMC.

Yet the original dtb of the board and the serial logs would help a lot to identify the real issue.

Link to post
Share on other sites

3 hours ago, chinhhut said:

Yes I guess your hardware might be different even looks similar.

My problem is our box is unable from SD card then there is no further step. 

Did you try multitool? Oh, now when I think of it. Didn't we had to press the "reset button" while plugging in the power, the first time? Toothpick in the headphone jack. Or it might have been my other box.

Link to post
Share on other sites

30 minutes ago, curse said:

Did you try multitool? Oh, now when I think of it. Didn't we had to press the "reset button" while plugging in the power, the first time? Toothpick in the headphone jack. Or it might have been my other box.

Normally no, you don't need to push the reset button to boot the multitool.

But I totally forgot about the reset button: stock u-boot will put itself in "rockusb" mode, which is a sort of maintenance mode.

@chinhhut may connect the USB OTG port of the box to a computer (usually with a male-to-male cable). The box will show up in lsusb as in "maskrom mode".

 

More instructions will follow later...

 

Edited by jock
deleted incomple instructions
Link to post
Share on other sites

@chinhhut

Try these steps:
1) push the little switch inside the hole while inserting a male-male cable into the otg
2) on another linux machine you should have now a new device (lsusb will help you) and you can run rkdeveloptool
3) rkdeveloptool ld should List Device
4) rkdeveloptool rd 3 should Reset Device into mode 3  ( maskrom )
5) rkdeveloptool db MiniLoaderAll.bin ( of course from your path) should upload a temporary loader to recognize the internal emmc
6) if all is successfull until now you can rkdeveloptool wl 0X0 yourimage.img . This should flash the internal emmc .

DISCLAIMER: very " dangerous" approach , be ready to have the opportunity to short the emmc clock pin to ground to go back into mask rom :ph34r:
 

MiniLoaderAll.zip

Link to post
Share on other sites

3 hours ago, jock said:

Normally no, you don't need to push the reset button to boot the multitool.

But I totally forgot about the reset button: stock u-boot will put itself in "rockusb" mode, which is a sort of maintenance mode.

@chinhhut may connect the USB OTG port of the box to a computer (usually with a male-to-male cable). The box will show up in lsusb as in "maskrom mode".

 

More instructions will follow later...

 

I already tried to push reset button in the AV hole while plugging the power but got same issue. 

Actually I've upload new firmware (android 9) to the box via Male to male cable using Rkdevtool 2.5.8 on windows 10. But the box is stucked at the splash screen after flashing (may be the Android firmware is not compatible).

I will try to to connect the box with Ubuntu PC .

Link to post
Share on other sites

2 hours ago, fabiobassa said:

@chinhhut

Try these steps:
1) push the little switch inside the hole while inserting a male-male cable into the otg
2) on another linux machine you should have now a new device (lsusb will help you) and you can run rkdeveloptool
3) rkdeveloptool ld should List Device
4) rkdeveloptool rd 3 should Reset Device into mode 3  ( maskrom )
5) rkdeveloptool db MiniLoaderAll.bin ( of course from your path) should upload a temporary loader to recognize the internal emmc
6) if all is successfull until now you can rkdeveloptool wl 0X0 yourimage.img . This should flash the internal emmc .

DISCLAIMER: very " dangerous" approach , be ready to have the opportunity to short the emmc clock pin to ground to go back into mask rom :ph34r:
 

MiniLoaderAll.zip 177.8 kB · 0 downloads

I'm going to follow your guide but I just want to confirm about the whole story from your idea.

According to your guide, the MiniLoaderAll.zip contain the u-boot of the box? After flashing it to the eMMC successfully, the box may support to boot from USB and unable to boot from Android anymore? 

 

One more question, how to get the MiniLoaderAll.zip as your attachment? You extract it from similar Rk3328 box or that's built manually by yourself.

Thank you once again for detail suggestion.

Link to post
Share on other sites

6 hours ago, fabiobassa said:


Try these steps:
1) push the little switch inside the hole while inserting a male-male cable into the otg
2) on another linux machine you should have now a new device (lsusb will help you) and you can run rkdeveloptool
3) rkdeveloptool ld should List Device
4) rkdeveloptool rd 3 should Reset Device into mode 3  ( maskrom )
5) rkdeveloptool db MiniLoaderAll.bin ( of course from your path) should upload a temporary loader to recognize the internal emmc
6) if all is successfull until now you can rkdeveloptool wl 0X0 yourimage.img . This should flash the internal emmc .

DISCLAIMER: very " dangerous" approach , be ready to have the opportunity to short the emmc clock pin to ground to go back into mask rom :ph34r:
 

MiniLoaderAll.zip 177.8 kB · 1 download

@fabiobassa @jock I've followed your guide and got success. Thank you so much.

root@mybox:~/rkdeveloptool# ls
99-rk-rockusb.rules  Makefile.in   RKComm.h      RKImage.h   RKScan.h        cfg            configure.ac  main.cpp
CMakeLists.txt       Property.hpp  RKComm.o      RKImage.o   RKScan.o        config.h.in    crc.cpp       main.o
DefineHeader.h       RKBoot.cpp    RKDevice.cpp  RKLog.cpp   Readme.txt      config.ini     crc.o         parameter_gpt.txt
Endian.h             RKBoot.h      RKDevice.h    RKLog.h     aclocal.m4      config.log     gpt.h         rkdeveloptool
Makefile             RKBoot.o      RKDevice.o    RKLog.o     autom4te.cache  config.status  license.txt
Makefile.am          RKComm.cpp    RKImage.cpp   RKScan.cpp  boot_merger.h   configure      log
root@mybox:~/rkdeveloptool# ./rkdeveloptool ld
DevNo=1	Vid=0x2207,Pid=0x320c,LocationID=101	Loader
root@mybox:~/rkdeveloptool# ./rkdeveloptool rd 3
Reset Device OK.
root@mybox:~/rkdeveloptool# ./rkdeveloptool db MiniLoaderAll.bin
Opening loader failed, exiting download boot!
root@mybox:~/rkdeveloptool# ./rkdeveloptool db /root/MiniLoaderAll.bin 
Downloading bootloader succeeded.
root@mybox:~/rkdeveloptool# ./rkdeveloptool wl 0X0 /root/Armbian_21.11.0-trunk_Rk3318-box_bullseye_edge_5.14.14_minimal.img 
Write LBA from file (100%)
root@mybox:~/rkdeveloptool# ./rkdeveloptool 

---------------------Tool Usage ---------------------
Help:			-h or --help
Version:		-v or --version
ListDevice:		ld
DownloadBoot:		db <Loader>
UpgradeLoader:		ul <Loader>
ReadLBA:		rl  <BeginSec> <SectorLen> <File>
WriteLBA:		wl  <BeginSec> <File>
WriteLBA:		wlx  <PartitionName> <File>
WriteGPT:		gpt <gpt partition table>
WriteParameter:		prm <parameter>
PrintPartition:		ppt 
EraseFlash:		ef 
TestDevice:		td
ResetDevice:		rd [subcode]
ReadFlashID:		rid
ReadFlashInfo:		rfi
ReadChipInfo:		rci
ReadCapability:		rcb
PackBootLoader:		pack
UnpackBootLoader:	unpack <boot loader>
TagSPL:			tagspl <tag> <U-Boot SPL>
-------------------------------------------------------

root@mybox:~/rkdeveloptool# ./rkdeveloptool  ld
DevNo=1	Vid=0x2207,Pid=0x320c,LocationID=101	Maskrom

 

Link to post
Share on other sites

6 hours ago, fabiobassa said:

@chinhhut

Glad you got success .

Don't forget to put a like that helps @jock and myself in community reputation

@fabiobassa @jock @hexdump 

Thank you once again for your support.

 

By the way, I still confused how to get the MiniLoaderAll.bin as you suggested.

That file is built by yourself or pick up from here:

https://github.com/rockchip-linux/rkbin/tree/master/bin/rk33

 

As I checked, from the official Rockchip repo, there are several boodloader files related to RK3328 and I don't know how to choose the correct one.

 

Screen Shot 2021-11-03 at 11.04.44.png

Link to post
Share on other sites

@chinhhut
Will try to explain you what loader is with an analogy: in normal pc you have bios and master boot record. Well, maskrom is bios and is contained in the soc itself, loader is a sort of master boot record and it enables the emmc and ddr.
You can have a look here
http://opensource.rock-chips.com/wiki_Boot_option

 

Quote

By the way, I still confused how to get the MiniLoaderAll.bin as you suggested


I did extract it by a working firmware using a tool that unpacked the whole firmware. Try to google for RK3xxx_firmware_tools_5.23.1_by_SergioPoverony.zip and leave alone that github since it is just one piece of the puzzle. The detailed infos how to get a working loader are in the rockchip instructions

 

Quote

Is there a way to dump the whole eMMC to .img file then using "./rkdeveloptool wl 0X0 file.img" to clone to new box.


Of course and the command would be rkdeveloptoo rl 0x0 etc etc etc ( try rkdeveloptool -h to get the help)
But if you are lucky that works multitool, well that is the easiest way to clone and clone back

Link to post
Share on other sites

20 minutes ago, fabiobassa said:

@chinhhut
Will try to explain you what loader is with an analogy: in normal pc you have bios and master boot record. Well, maskrom is bios and is contained in the soc itself, loader is a sort of master boot record and it enables the emmc and ddr.
You can have a look here
http://opensource.rock-chips.com/wiki_Boot_option

I did extract it by a working firmware using a tool that unpacked the whole firmware. Try to google for RK3xxx_firmware_tools_5.23.1_by_SergioPoverony.zip and leave alone that github since it is just one piece of the puzzle. The detailed infos how to get a working loader are in the rockchip instructions

Thank you for detail explanation in a basic way.  I can understand the logic of booting process now.

 

Quote

But if you are lucky that works multitool, well that is the easiest way to clone and clone back

After booting from eMMC successfully, I try to boot from SD card again to try the multitool but not success. At current, my box still only can boot from eMMC.

 

Quote

Of course and the command would be rkdeveloptoo rl 0x0 etc etc etc ( try rkdeveloptool -h to get the help)

I guess using rkdevelopertool to backup will create the .img file that could be restored using "rkdeveloptool wl 0X0 yourimage.img" command, right?

I will try to backup the entire eMMC using rkdevelopetool and report the result later. 

Link to post
Share on other sites

4 hours ago, chinhhut said:

After booting from eMMC successfully, I try to boot from SD card again to try the multitool but not success. At current, my box still only can boot from eMMC.

Just one question. How did you "burn" the iso to the SD-card? did you use dd, rufus, etc? Just in case the error is there and not with the box or the iso?

Link to post
Share on other sites

1 hour ago, curse said:

Just one question. How did you "burn" the iso to the SD-card? did you use dd, rufus, etc? Just in case the error is there and not with the box or the iso?

I used Etcher to flash the Armbian image to the SD card as usual but it is unable to boot from SD card. 

Link to post
Share on other sites

8 hours ago, chinhhut said:

After booting from eMMC successfully, I try to boot from SD card again to try the multitool but not success. At current, my box still only can boot from eMMC.

That's true, because the sdcard controller is not where u-boot and kernel are told by device tree to look for.

 

Adapting the device tree for the kernel is easy, but u-boot dtb requires a recompilation.

 

When armbian is installed, u-boot is totally responsible for the boot process. It scans the devices to find a valid bootable system and the order is first sdcard, then USB and finally internal eMMC.

If you have a lucky USB stick, you could try to put the Multitool on a USB stick and see if boots from there. I say "lucky USB stick" because u-boot USB code is buggy and does not always work.

 

All kind of regular images (armbian, multitool, libreelec if available too...) can be burnt on USB stick or USB external hard drive: u-boot should prefer booting from there (if the buggy code doesn't kick in).

 

 

Link to post
Share on other sites

23 hours ago, jock said:

All kind of regular images (armbian, multitool, libreelec if available too...) can be burnt on USB stick or USB external hard drive: u-boot should prefer booting from there (if the buggy code doesn't kick in).

 

@jockI've tried but not success, may be I'm not lucky man :D. 

By the way, is there a way to restore the backup.gz from multitool to new box using "rkdeveloptool wl 0X0 yourimage.img" command? I mean change yourimage.img file with backup.gz.

Link to post
Share on other sites

7 minutes ago, chinhhut said:

@jockI've tried but not success, may be I'm not lucky man :D. 

By the way, is there a way to restore the backup.gz from multitool to new box using "rkdeveloptool wl 0X0 yourimage.img" command? I mean change yourimage.img file with backup.gz.

Maybe with another USB stick or drive it may work. Also consider to use all the USB ports of the board, since they are not all the same. u-boot is picky.

 

About the backup, indeed you can burn the multitool backup with rkdeveloptool. You just need to decompress it first.

Link to post
Share on other sites

And perhaps try with different SD cards. I first used some expensive recommended 64GB SanDisk card and nothing worked then I tried a "no-name" cheap 8GB card and it worked perfectly. I think it's up to luck when it comes to the SD cards. The recommended expensive cards might work more often than the cheap ones, but sometimes it's the other way around. 

Link to post
Share on other sites

1 hour ago, curse said:

And perhaps try with different SD cards. I first used some expensive recommended 64GB SanDisk card and nothing worked then I tried a "no-name" cheap 8GB card and it worked perfectly. I think it's up to luck when it comes to the SD cards. The recommended expensive cards might work more often than the cheap ones, but sometimes it's the other way around. 

Well, since the sd controller on his board is swapped I don't think it will ever work.

But sometimes is true, more expensive cards are not always better.

Link to post
Share on other sites

so it appears that the rk3318/rk3328 are more or less the same so it is a possibility to get lakka / libreelec to work 

use the os image with the trust file and correct dtb file and it should work pretty normal, but there needs to be more digging into the rk3318 trm and datasheet

does anyone anywhere have the technical reference manual in its entirety?

all i can find is the datasheet....

rk3318 Manual+dtb.7z

Link to post
Share on other sites

45 minutes ago, RetroFan90 said:

so it appears that the rk3318/rk3328 are more or less the same so it is a possibility to get lakka / libreelec to work 

use the os image with the trust file and correct dtb file and it should work pretty normal, but there needs to be more digging into the rk3318 trm and datasheet

does anyone anywhere have the technical reference manual in its entirety?

all i can find is the datasheet....

rk3318 Manual+dtb.7z 1.54 MB · 0 downloads

I don't have the entire TRD of rk3318/rk3328, just the partial one available on rockchip official opensource page.

 

Link to post
Share on other sites

 Share

26 26