Jump to content

Armbian for TV box rk3318


lucky62

Recommended Posts

EDIT: This how-to is slightly out-of-date, because now the complete images for RK3318 boxes are available here. Thanks to community, especially to @jock.

 

Hello all,

I would like to summarize the required steps to boot armbian on device with RK3318 chip.

I have a X88 Pro device already mentioned here.

I am quite skilled but information are spread in many posts and I spent lot of time to have a clear picture.

Note that instructions below are valid at this time when I am writing it - some things can change in the time...

And hope linux is your friend...

 

You need 4 files:

  1. Armbian image (Links to download armbian image is in the first post of this thread) - thanks to @balbes150
  2. U-boot image and DTB file for RK3318 from here - thanks to @hexdump
  3. trust.img file from here - thanks to @caruso

 

 

 

As you see - actually Armbian 20.10 builds are in the file.

Select the image for installation according your needs:

  •    smaller files have no graphical desktop (only terminal/command line)
  •    bigger (desktop) files are full Graphical desktop releases
  •    buster and bullseye are the Debian releases
  •    focal and bionic are Ubuntu releases

 

I selected the Ubuntu desktop.

Uncompress selected image:

xz -d Armbian_20.10_Arm-64_focal_current_5.9.0_desktop.img.xz

 

Burn the uncompressed image to the SD card:

dd if=Armbian_20.10_Arm-64_buster_current_5.9.0.img of=/dev/<yoursdcard> bs=10M status=progress

 

Change <yoursdcard> as needed. In my case the SD card is /dev/sda so my command was:

dd if=Armbian_20.10_Arm-64_buster_current_5.9.0.img of=/dev/sda bs=10M status=progress

 

 

Then you need to burn U-boot and Trust Images:

dd if=uboot-rk3318.img of=/dev/<yoursdcard> seek=16384
dd if=trust.img of=/dev/<yoursdcard> seek=24576

 

Again change <yoursdcard> as needed...

Now flush the cached writes to the SD card.

sync

 

Now remove the SD card from computer and re-insert back.

You should see the two partitions on SD card - BOOT and ROOTFS.

 

Copy the DTB file (rk3318-t9-mainline.dtb) to the folder /dtb/rockchip/ in BOOT partition.

And edit the file /extlinux/extlinux.conf in boot partition to use this DTB.

You can remove commented lines (# at the beginning).

My file looks like this - APPEND line is taken from RK3328 part:

LABEL Armbian
LINUX /zImage
INITRD /uInitrd

# rk-3318
FDT /dtb/rockchip/rk3318-t9-mainline.dtb
APPEND root=LABEL=ROOTFS rootflags=data=writeback rw console=uart8250,mmio32,0xff130000 console=tty0 no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0

 

After editing flush the writes by sync command again, and remove the SD card from computer.

Insert SD card to your RK3318 device and boot...

 

You can experiment with different DTB files and settings... Good luck.

Link to comment
Share on other sites

I split this out into its own topic.  Even though the information is all derived from the thread "Armbian for TV box rk3328" I think it makes it easier from a forum search perspective if someone is looking for rk3318 information in a search to have a separate thread.

Link to comment
Share on other sites

Hello all,

I would like to have a WIFI/BT working on my X88 Pro 10 box.
If I understand correctly I need two things:

  1. Corect DTB file
  2. Driver for specific hardware (directly in kernel or compiled as module)

Am I right? Any other important point?

 

I have extracted the DTB from running Android - steps I done:

  • start the Android on TV box
  • install and configure the SSH Server App (Dropbear)
  • connect to Android via SSH
  • be root (su - device must be rooted, usually already is)
  • find the boot partition (ls -l /dev/block/by-name/)
  • I found this: lrwxrwxrwx 1 root root 21 1970-01-01 01:00 boot -> /dev/block/mmcblk1p11
  • dump partition to the file boot.img (dd if=/dev/block/mmcblk1p11 of=boot.img)
  • move the boot.img to the PC
  • install extract-dtb python package (pip install extract-dtb)
  • extract DTB from boot.img (extract-dtb boot.img)
  • install device-tree-compiler (apt-get install device-tree-compiler)
  • decompile DTB to DTS (dtc -I dtb -O dts -o x88_pro_10_rk3318.dts 01_dtbdump_rockchip,rk3328-box-liantong.dtb)

Some notes.

extracted DTB is quite big:

# extract-dtb boot.img
Dumped 00_kernel, start=0 end=19752960
Dumped 01_dtbdump_rockchip,rk3328-box-liantong.dtb, start=19752960 end=33554432
Extracted 1 appended dtbs + kernel to dtb

# ls -l dtb/
total 32772
-rw-r--r-- 1 root root 19752960 apr 11 16:07 00_kernel
-rw-r--r-- 1 root root 13801472 apr 11 16:07 01_dtbdump_rockchip,rk3328-box-liantong.dtb

 

It was decompiled successfully but some warning reported (not sure if this is important):
 

# dtc -I dtb -O dts -o x88_pro_10_rk3318.dts 01_dtbdump_rockchip,rk3328-box-liantong.dtb
x88_pro_10_rk3318.dts: Warning (unit_address_vs_reg): /usb@ff600000: node has a unit name, but no reg property
x88_pro_10_rk3318.dts: Warning (unit_address_vs_reg): /regulators/regulator@0: node has a unit name, but no reg property
x88_pro_10_rk3318.dts: Warning (unit_address_vs_reg): /regulators/regulator@1: node has a unit name, but no reg property
x88_pro_10_rk3318.dts: Warning (unit_address_format): /reserved-memory/drm-logo@00000000: unit name should not have leading 0s
x88_pro_10_rk3318.dts: Warning (simple_bus_reg): /regulators/regulator@0: missing or empty reg/ranges property
x88_pro_10_rk3318.dts: Warning (simple_bus_reg): /regulators/regulator@1: missing or empty reg/ranges property
x88_pro_10_rk3318.dts: Warning (avoid_unnecessary_addr_size): /syscon@ff100000: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property
x88_pro_10_rk3318.dts: Warning (avoid_unnecessary_addr_size): /regulators: unnecessary #address-cells/#size-cells without "ranges" or child "reg" property
x88_pro_10_rk3318.dts: Warning (graph_child_address): /hdmi@ff3c0000/ports/port: graph node has single child node 'endpoint@0', #address-cells/#size-cells are not necessary
x88_pro_10_rk3318.dts: Warning (graph_child_address): /tve@ff373e00/ports/port: graph node has single child node 'endpoint@0', #address-cells/#size-cells are not necessary

 

Then I compiled it back and tried to use with armian but TV box was not booting.
I was trying to use also original extracted DTB without decompile/compile with the same result.

 

What I am doing wrong? Should be DTB compiled on armbian?

Any changes required in DTS? (This is new area for me... )

 

Thanks in advance for any help.

Link to comment
Share on other sites

@lucky62 Looking at the DTB you posted on the other thread, the serial looks like it is enabled and attached to uart2 device, as much as other rk3318 I have seen.

About the hardware wiring, only another person with the same board can confirm.

Link to comment
Share on other sites

1 minute ago, lucky62 said:

Thanks for checking. Will try with 3V3 first..

Indeed it is a good idea. I never checked really if they are 5V tolerant, but 3.3v always worked for me.

Link to comment
Share on other sites

I have connected NodeMCU with ESP-Link to the TV Box. But I cannot find the proper settings of serial communication.

I am receiving some garbage characters, so connection is ok.

From booted armbian I found this:
 

$ dmesg | egrep 'serial|ttyS'
[    2.564005] ff130000.serial: ttyS2 at MMIO 0xff130000 (irq = 15, base_baud = 1500000) is a 16550A
[    2.659156] printk: console [ttyS2] enabled
[   18.253053] dw-apb-uart ff130000.serial: forbid DMA for kernel console
[   19.126182] systemd[1]: Created slice system-serial\x2dgetty.slice.
[   21.228360] systemd[1]: Found device /dev/ttyS2.

 

Is the 1500000 the right baudrate? ( In the ESP-link the max baud rate is 460800. )

Can someone help? What is the initial baud rate of U-boot?

 

Link to comment
Share on other sites

I was able to catch this at 115200 baud-rate during reboot. Seems that at some point the baud-rate is changed...

 

[  734.592947] reboot: Restarting system
INFO:    PSCI Power Domain Map:
INFO:      Domain Node : Level 2, parent_node -1, State ON (0x0)
INFO:      Domain Node : Level 1, parent_node 0, State ON (0x0)
INFO:      Domain Node : Level 0, parent_node 0, State ON (0x0)
INFO:      Domain Node : Level 0, parent_node 0, State ON (0x0)
INFO:      CPU Node : MPID 0x0, parent_node 1, State ON (0x0)
INFO:      CPU Node : MPID 0x1, parent_node 1, State ON (0x0)
INFO:      CPU Node : MPID 0x2, parent_node 1, State ON (0x0)
INFO:      CPU Node : MPID 0x3, parent_node 1, State ON (0x0)������=��؞�8������ʂҸ������<K��Z��J��J����R*�RK*��Z������]ݺ�z�=�~���ʺ�Y���ʺ�Y��}�~:�}����<�>躽���������������������~����ʺ��J�������=�����ڽzJ�K���ܲ�˲������y���
�����غ���?���ʊ�������������������*�����y�k����������|������������k~�:�����

 

Are these INFO messages from U-Boot or kernel?...

 

Link to comment
Share on other sites

4 hours ago, lucky62 said:

I was able to catch this at 115200 baud-rate during reboot. Seems that at some point the baud-rate is changed...

 




[  734.592947] reboot: Restarting system
INFO:    PSCI Power Domain Map:
INFO:      Domain Node : Level 2, parent_node -1, State ON (0x0)
INFO:      Domain Node : Level 1, parent_node 0, State ON (0x0)
INFO:      Domain Node : Level 0, parent_node 0, State ON (0x0)
INFO:      Domain Node : Level 0, parent_node 0, State ON (0x0)
INFO:      CPU Node : MPID 0x0, parent_node 1, State ON (0x0)
INFO:      CPU Node : MPID 0x1, parent_node 1, State ON (0x0)
INFO:      CPU Node : MPID 0x2, parent_node 1, State ON (0x0)
INFO:      CPU Node : MPID 0x3, parent_node 1, State ON (0x0)������=��؞�8������ʂҸ������<K��Z��J��J����R*�RK*��Z������]ݺ�z�=�~���ʺ�Y���ʺ�Y��}�~:�}����<�>躽���������������������~����ʺ��J�������=�����ڽzJ�K���ܲ�˲������y���
�����غ���?���ʊ�������������������*�����y�k����������|������������k~�:�����

 

Are these INFO messages from U-Boot or kernel?...

 

That's the TEE, which is neither u-boot nor kernel.

Default baudrate is 1.5Mbps.

 

Would you check the other thread I created for rk3318 tv boxes?

I put a couple of testing images plus the multitool for general maintenance, and I'm looking into your dts to add support for your box too.

I noticed that the wifi chip is attached to a different sdio bus, so probably it won't work on those early images.

Note that if you want to run armbian from sdcard you have to remove Android from internal flash.

 

edit: multitool is configured with serial at 115200 bps, so you should be able to read the dmesg log from serial port with ESP-link too

edit2: fixed wrong thread link

Link to comment
Share on other sites

Just now, lucky62 said:

thanks, I see - the thread is quite new.. :-)
Regarding the baud-rate - how can I change it? Need to recompile U-boot?...

 

You need to recompile u-boot and kernel, plus you need to patch the rockchip ddrbin.

Link to comment
Share on other sites

On 4/10/2021 at 11:57 PM, lucky62 said:

EDIT: This how-to is slightly out-of-date, because now the complete images for RK3318 boxes are available here. Thanks to community, especially to @jock.

 

Hello all,

I would like to summarize the required steps to boot armbian on device with RK3318 chip.

I have a X88 Pro device already mentioned here.

I am quite skilled but information are spread in many posts and I spent lot of time to have a clear picture.

Note that instructions below are valid at this time when I am writing it - some things can change in the time...

And hope linux is your friend...

 

You need 4 files:

  1. Armbian image (Links to download armbian image is in the first post of this thread) - thanks to @balbes150
  2. U-boot image and DTB file for RK3318 from here - thanks to @hexdump
  3. trust.img file from here - thanks to @caruso

 

 

 

As you see - actually Armbian 20.10 builds are in the file.

Select the image for installation according your needs:

  •    smaller files have no graphical desktop (only terminal/command line)
  •    bigger (desktop) files are full Graphical desktop releases
  •    buster and bullseye are the Debian releases
  •    focal and bionic are Ubuntu releases

 

I selected the Ubuntu desktop.

Uncompress selected image:

xz -d Armbian_20.10_Arm-64_focal_current_5.9.0_desktop.img.xz

 

Burn the uncompressed image to the SD card:

dd if=Armbian_20.10_Arm-64_buster_current_5.9.0.img of=/dev/<yoursdcard> bs=10M status=progress

 

Change <yoursdcard> as needed. In my case the SD card is /dev/sda so my command was:

dd if=Armbian_20.10_Arm-64_buster_current_5.9.0.img of=/dev/sda bs=10M status=progress

 

 

Then you need to burn U-boot and Trust Images:

dd if=uboot-rk3318.img of=/dev/<yoursdcard> seek=16384
dd if=trust.img of=/dev/<yoursdcard> seek=24576

 

Again change <yoursdcard> as needed...

Now flush the cached writes to the SD card.

sync

 

Now remove the SD card from computer and re-insert back.

You should see the two partitions on SD card - BOOT and ROOTFS.

 

Copy the DTB file (rk3318-t9-mainline.dtb) to the folder /dtb/rockchip/ in BOOT partition.

And edit the file /extlinux/extlinux.conf in boot partition to use this DTB.

You can remove commented lines (# at the beginning).

My file looks like this - APPEND line is taken from RK3328 part:

LABEL Armbian
LINUX /zImage
INITRD /uInitrd

# rk-3318
FDT /dtb/rockchip/rk3318-t9-mainline.dtb
APPEND root=LABEL=ROOTFS rootflags=data=writeback rw console=uart8250,mmio32,0xff130000 console=tty0 no_console_suspend consoleblank=0 fsck.fix=yes fsck.repair=yes net.ifnames=0

 

After editing flush the writes by sync command again, and remove the SD card from computer.

Insert SD card to your RK3318 device and boot...

 

You can experiment with different DTB files and settings... Good luck.

Good work. Thanks.

I tested it. but the wifi is not working.

there is a solution?????

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines