Jump to content

CSC Armbian for RK3318/RK3328 TV box boards


jock

Recommended Posts

Can someone help me with compilation of openvfd driver?

There is also available openvfd package, so it will be nice to have everything together.I was asking for help directly from author here, but still I don't know what to do exactly.

 

I have downloaded the armbian sources from Paolo's repository, switched to rk3318 branch and compiled.

Where need I to place the driver and package sources and how to compile?

 

Link to comment
Share on other sites

4 hours ago, lucky62 said:

Can someone help me with compilation of openvfd driver?

There is also available openvfd package, so it will be nice to have everything together.I was asking for help directly from author here, but still I don't know what to do exactly.

 

I have downloaded the armbian sources from Paolo's repository, switched to rk3318 branch and compiled.

Where need I to place the driver and package sources and how to compile?

 

I spent some time on openvfd driver, and it works on my box.

I forked Arthur's repository to make my own modifications, because I wanted to add some more standard things like the capability to use the linux triggers to make the indicators blink on mmc access or during ethernet/wifi transfer, etc... and the ability to invoke the driver module specifying the right entry in the dtb.

 

The thing requires some bits in the dtb and can be compiled directly on the board, but you need the kernel headers to do that.

If I have time tomorrow I can push the deb packages for a newer kernel + kernel headers and some source code to let you compile an work in progress version.

 

 

Link to comment
Share on other sites

5 hours ago, Dragao said:

yes, but the Multitool does not do that :) 

You don't need the multitool to write an image on a sdcard.

Instructions on how to run armbian from sdcard are, as usual, on the first page under the paragraph Quick installation instructions to boot from SD Card

 

5 hours ago, Dragao said:

Besides with writing to an SD I have to set the correct dtb / uboot which is not a hard thing but with Multitool this is perhaps done directly/automatically.

Instructions will tell you to run rk3318-config to further configure the board, no need to deal manually with dtbs.

Link to comment
Share on other sites

8 hours ago, jock said:

Instructions will tell you to run rk3318-config to further configure the board, no need to deal manually with dtbs.

This instruction is when using Multitool. I was explaining when I put an image on an SD I have to deal with this myself. (or maybe I am wrong)

Link to comment
Share on other sites

38 minutes ago, Dragao said:

This instruction is when using Multitool. I was explaining when I put an image on an SD I have to deal with this myself. (or maybe I am wrong)

You're wrong, read better. Plus, there are no DTB files to exchange or replace, there never have been.

Link to comment
Share on other sites

9 hours ago, jock said:

I spent some time on openvfd driver, and it works on my box.

I forked Arthur's repository to make my own modifications, because I wanted to add some more standard things like the capability to use the linux triggers to make the indicators blink on mmc access or during ethernet/wifi transfer, etc... and the ability to invoke the driver module specifying the right entry in the dtb.

 

The thing requires some bits in the dtb and can be compiled directly on the board, but you need the kernel headers to do that.

If I have time tomorrow I can push the deb packages for a newer kernel + kernel headers and some source code to let you compile an work in progress version.

I am glad with this... Will wait.

I the meantime, Arthur Liberman told me, that in the DTB I need only this:

openvfd {
	compatible = "open,vfd";
	dev_name = "openvfd";
	status = "okay";
};

 

So I created small overlay file and successfully added to the DTB.

 

openvfd.dts

Link to comment
Share on other sites

4 hours ago, jock said:

You're wrong, read better. Plus, there are no DTB files to exchange or replace, there never have been.

I am confused.. What you are saying is with Multitool right ?

 

if not then please point me to the correct post because I must be reading a different one

 

Link to comment
Share on other sites

4 minutes ago, Dragao said:

I am confused.. What you are saying is with Multitool right ?

 

if not then please point me to the correct post because I must be reading a different one

 

Dunno what are reading, first post of this thread explains everything in a series of simple steps.

It looks also a little dumb to me that I have to post a link to, but here it is: https://forum.armbian.com/topic/17597-csc-armbian-for-rk3318-tv-box-boards/?do=findComment&comment=122715

 

Link to comment
Share on other sites

@Dragao, for better understanding - you have a two options:

 

1) Boot from external media (SD Card or USB key) - in this case you need only to write the distro image to the media and put it into box and boot. After booting you can run rk3318-config to configure additional devices (wifi, led, ...) In this case MultiTool is not required.

 

2) Boot from internal eMMC - in this case you can use MultiTool to flash the distro image to the internal eMMC, and boot.. Again you can use rk3318-config for further tuning.
 

Both options are described in the first post.

 

I think, you don't need to manipulate dtb/dtbo manually, also I think MultiTool do nothing with dtb/dtbo..

 

Link to comment
Share on other sites

@lucky62

 

I have followed the steps in the first post to the letter.. 

I can run Multitool from SD and backup /restore flash (with the original firmware/android)

 

When I try to flash armbian the device does not boot. 

 

Also when I flash an sd with armbian and erase the eMMC the device does not boot. 

I am not changing anything. So my best guess is that the image i am using (the ubuntu focal desktop image from post 1) is not working with my tvbox. 

(H96Max running android 10 / non root)

Link to comment
Share on other sites

18 minutes ago, Dragao said:

@lucky62

 

When I try to flash armbian the device does not boot. 

Also when I flash an sd with armbian and erase the eMMC the device does not boot. 

I am not changing anything. So my best guess is that the image i am using (the ubuntu focal desktop image from post 1) is not working with my tvbox. 

(H96Max running android 10 / non root)

 

hmm, ok. Good point is that MultiTool is booting... Are you able to retrieve the DTB from Android backup?

Someone from this forum can look into, to find the problem.


Also best would be to have the serial console...

 

EDIT: also you can look at LibreELEC, if there is something for your box and if yes, then you can try to combine the u-boot/dtb from LibreELEC with armbian distro.

Something is here:
https://forum.libreelec.tv/thread/20813-step-by-step-tutorial-libreelec-on-h96-max-also-ir-remote-support/

But I am not sure if this box is compatible with your.

When you will be experimenting, don't flash to the internal memory. Always use the SD card.
Otherwise there is a big risk that your device will be bricked.

Link to comment
Share on other sites

31 minutes ago, Dragao said:

I am not changing anything. So my best guess is that the image i am using (the ubuntu focal desktop image from post 1) is not working with my tvbox. 

Yes, because it is clearly explained in the first post that this is work in progress.

Again: in the first post it is explained what to provide to help people help you.

Again: in the first post there are three images published. You tried just one. What about trying the other two and report if they work?

Link to comment
Share on other sites

On 4/16/2021 at 12:30 PM, jock said:

­Building:
You can build your own image follow the common steps to build armbian for other tv boxes devices: when you are in the moment to choose the target board, switch to /TVB/ boards and select "rk3318-box" from the list.

Maybe I'm doing something wrong, but I can't find an option to build "rk3318-box". I've cloned repo: https://github.com/paolosabatino/armbian-build/tree/rk3318, and started

./compile.sh 

and there are 5 TVBs to choose from (there is no "rk3319-box"), which is the correct one?

image.thumb.png.d5254f25739e1dfbfd8c6d2948897133.png

z28pro would be ok?

 

Ok, solved, I had to switch branch to rk3318

Edited by kruzer
I found how to change branch
Link to comment
Share on other sites

@lucky62

Here it is the linux kernel + dtb + headers for latest 5.10.37: https://drive.google.com/drive/folders/1OOpjb3L-bFcabKkQKO4GS-hTVzIvKeXo?usp=sharing

Install all the three packages via dpgk -i and then reboot.

Backup your dtb/dtbo changed files because the directory may be wiped out during the process!

 

This is the kernel module source code modified by me: vfd.tgz

And this is the OpenVFDService executable compiled as-is by me from Arthur's original source code: OpenVFDService

 

I modified the kernel module to compile both manually and as a kernel-tree module, but also fixed some dtb nomenclature.

To compile, first run this command to create a symlink that may be missing (just run this once):

sudo ln -sf /boot/System.map-$(uname -r) /lib/modules/$(uname -r)/build/System.map

 

Then to compile and install:

make -j4
sudo make install

make install will complain about missing signature, but don't worry, the module will load anyway.

 

Then your dtbo should look like this:

/dts-v1/;
/plugin/;
/ {
   fragment@0 {
      target-path = "/";
      __overlay__ {
         openvfd {
            compatible = "openvfd,tm1628";
            gpio-clk = <&gpio2 0x13 0x00>;
            gpio-dat = <&gpio2 0x16 0x00>;
            gpio-stb = <&gpio2 0x12 0x00>;
            openvfd,chars = [00 04 03 02 01];
            openvfd,dot-bits = [00 01 03 02 04 05 06];
            openvfd,display-type = <0x00>;
            status = "okay";
         };
      };
   };
};

Now I took the gpios from the dtb of the X88 you posted some time ago. I hope they are right.

 

The openvfd,* properties are described on Arthur's page and documentation. Those are those which I'm using, but most probably you will need to change them to fit the led configuration of your box. The most evident problem is that the segments turn on wrong displaying unreadable numbers or maybe the indicators (usb/wifi/ethernet/...) are wrongly associated.

 

Each character is controller by a byte, so each led of the 7 segment character is turned on and off by a bit of this byte.

openvfd,chars is a map: the first byte is the indicators byte, then comes the first, second, third and fourth characters. On my configuration the indicator byte is the 00, then the first character is mapped to byte 04, second character to byte 03, and so on...

openvfd,dot-bits is the map of the indicators: every bit in the indicator byte controls an indicator, there you map which bit is usb, which one is wifi, and so on...

openvfd,display-type usually is 00 (normal) or 01 if your display translate by 180 degrees (ie: characters are flipped down and specular)

 

Once you set up the dtbo and activate it in armbianEnv.txt, you can run the OpenVFDService executable:

./OpenVFDService &

 

that will hopefully turn on the display and show you the current time

Link to comment
Share on other sites

45 minutes ago, kruzer said:

Maybe I'm doing something wrong, but I can't find an option to build "rk3318-box". I've cloned repo: https://github.com/paolosabatino/armbian-build/tree/rk3318, and started


./compile.sh 

and there are 5 TVBs to choose from (there is no "rk3319-box"), which is the correct one?

image.thumb.png.d5254f25739e1dfbfd8c6d2948897133.png

z28pro would be ok?

 

Ok, solved, I had to switch branch to rk3318

How did you switch branch?

 

Link to comment
Share on other sites

6 minutes ago, Dragao said:

How did you switch branch?

 

Script compile.sh is changing the branch to the master and trying to update local repository from remote. This can be disabled by creating the empty file .ignore_changes in the root directory of local repo.
However, I also not see the rk3318-box... I don't know why.

Link to comment
Share on other sites

18 minutes ago, kruzer said:

after clone, i did:


cd armbian-build
git checkout -t origin/rk3318

 

 

$ git checkout -t origin/rk3318
fatal: 'origin/rk3318' is not a commit and a branch 'rk3318' cannot be created from it

Link to comment
Share on other sites

3 minutes ago, lucky62 said:

 

$ git checkout -t origin/rk3318
fatal: 'origin/rk3318' is not a commit and a branch 'rk3318' cannot be created from it

i did full git clone, not --depth 1

git clone https://github.com/paolosabatino/armbian-build.git
cd armbian-build
git checkout -t origin/rk3318

 

Link to comment
Share on other sites

10 minutes ago, kruzer said:

i did full git clone, not --depth 1

 

I did the same... will try again, will see..

 

Edit: Now with newly cloned repo it is ok. I cloned the repository 10-15 day ago and tried to compile.. maybe it is somehow corrupted... But git checkout rk3318 is working...

 

Quote

$ git clone https://github.com/paolosabatino/armbian-build.git
Cloning into 'armbian-build'...
remote: Enumerating objects: 64949, done.
remote: Counting objects: 100% (220/220), done.
remote: Compressing objects: 100% (124/124), done.
remote: Total 64949 (delta 109), reused 166 (delta 83), pack-reused 64729
Receiving objects: 100% (64949/64949), 361.58 MiB | 3.42 MiB/s, done.
Resolving deltas: 100% (44609/44609), done.
Updating files: 100% (3448/3448), done.
$ cd armbian-build/
$ git checkout -t origin/rk3318
Branch 'rk3318' set up to track remote branch 'rk3318' from 'origin'.
Switched to a new branch 'rk3318'

 

Link to comment
Share on other sites

2 hours ago, jock said:

Then to compile and install:


make -j4
sudo make install

make install will complain about missing signature, but don't worry, the module will load anyway.

 

Hi @jock

during compilation I got one warning:

Quote

# make -j4
make -C /lib/modules/`uname -r`/build M=$PWD CONFIG_LEDS_FD628=m
make[1]: Entering directory '/usr/src/linux-headers-5.10.37-rockchip64'
  CC [M]  /WORK/openvfd_driver/vfd/protocols/i2c_sw.o
  CC [M]  /WORK/openvfd_driver/vfd/protocols/i2c_hw.o
  CC [M]  /WORK/openvfd_driver/vfd/protocols/spi_sw.o
  CC [M]  /WORK/openvfd_driver/vfd/controllers/dummy.o
  CC [M]  /WORK/openvfd_driver/vfd/controllers/seg7_ctrl.o
  CC [M]  /WORK/openvfd_driver/vfd/controllers/fd628.o
  CC [M]  /WORK/openvfd_driver/vfd/controllers/fd650.o
  CC [M]  /WORK/openvfd_driver/vfd/controllers/hd44780.o
  CC [M]  /WORK/openvfd_driver/vfd/controllers/gfx_mono_ctrl.o
  CC [M]  /WORK/openvfd_driver/vfd/controllers/ssd1306.o
  CC [M]  /WORK/openvfd_driver/vfd/controllers/pcd8544.o
  CC [M]  /WORK/openvfd_driver/vfd/controllers/il3829.o
  CC [M]  /WORK/openvfd_driver/vfd/openvfd_drv.o
/WORK/openvfd_driver/vfd/openvfd_drv.c:43:7: warning: "CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND" is not defined, evaluates to 0 [-Wundef]
 #elif CONFIG_AMLOGIC_LEGACY_EARLY_SUSPEND
       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  LD [M]  /WORK/openvfd_driver/vfd/openvfd.o
  MODPOST /WORK/openvfd_driver/vfd/Module.symvers
  CC [M]  /WORK/openvfd_driver/vfd/openvfd.mod.o
  LD [M]  /WORK/openvfd_driver/vfd/openvfd.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.10.37-rockchip64'

 

However the module was created.

But I cannot install it nor load it directly by insmod:

Quote

# make install
# To fulfill depmod, be sure to have System.map
# in your build directory, eg:
#
# ln -sf /boot/System.map-$(uname -r) System.map
#
make -C /lib/modules/`uname -r`/build M=$PWD modules_install
make[1]: Entering directory '/usr/src/linux-headers-5.10.37-rockchip64'
  INSTALL /WORK/openvfd_driver/vfd/openvfd.ko
At main.c:160:
- SSL error:02001002:system library:fopen:No such file or directory: ../crypto/bio/bss_file.c:69
- SSL error:2006D080:BIO routines:BIO_new_file:no such file: ../crypto/bio/bss_file.c:76
sign-file: certs/signing_key.pem: No such file or directory
  DEPMOD  5.10.37-rockchip64
Warning: modules_install: missing 'System.map' file. Skipping depmod.
make[1]: Leaving directory '/usr/src/linux-headers-5.10.37-rockchip64'

 

Quote

# modprobe openvfd
modprobe: FATAL: Module openvfd not found in directory /lib/modules/5.10.37-rockchip64

# modprobe openvfd.ko
modprobe: FATAL: Module openvfd.ko not found in directory /lib/modules/5.10.37-rockchip64

# insmod openvfd.ko

Message from syslogd@rk3318-box at May 18 19:34:20 ...
 kernel:[ 1206.035790] Internal error: Oops: 96000004 [#1] PREEMPT SMP

Message from syslogd@rk3318-box at May 18 19:34:20 ...
 kernel:[ 1206.062082] Code: 32000000 39016420 f9401a60 f9404be1 (f9406022)
Segmentation fault

 

 

Link to comment
Share on other sites

Most probably there is also problem with DTB. DT compiler reported errors. I used the -f (force) flag:

 

Quote

# dtc -@ -Hepapr -I dts -O dtb -o openvfd.dtbo -f openvfd.dts
openvfd.dtbo: ERROR (phandle_references): /fragment@0/__overlay__/openvfd: Reference to non-existent node or label "gpio2"

openvfd.dtbo: ERROR (phandle_references): /fragment@0/__overlay__/openvfd: Reference to non-existent node or label "gpio2"

openvfd.dtbo: ERROR (phandle_references): /fragment@0/__overlay__/openvfd: Reference to non-existent node or label "gpio2"

Warning: Input tree has errors, output forced

 

DTBO was loaded, I see it in the /proc/device-tree, but the missing &gpio2 was translated to 0xFFFFFFFF, which is not ok, I think:

Quote

# hexdump /proc/device-tree/openvfd/gpio-clk
0000000 ffff ffff 0000 1300 0000 0000          
000000c
# hexdump /proc/device-tree/openvfd/gpio-dat
0000000 ffff ffff 0000 1600 0000 0000          
000000c
# hexdump /proc/device-tree/openvfd/gpio-stb
0000000 ffff ffff 0000 1200 0000 0000          
000000c

 

I was looking for gpio2 in /proc/device-tree, but it is only in __symbols__ (not directly in root, not in aliases):

 

Quote

# hexdump /proc/device-tree/__symbols__/gpio2
0000000 702f 6e69 7463 6c72 672f 6970 326f 6640
0000010 3266 3033 3030 0030                    
0000018

 

EDIT: maybe version of DTC is important:
 

Quote

# dtc --version
Version: DTC 1.4.7

 

Link to comment
Share on other sites

1 hour ago, lucky62 said:

But I cannot install it nor load it directly by insmod:

You forgot to do the symlink, thus depmod -a is not run. You can run depmod -a manually, but if you create the symlink it will be run automatically.

Usually I prefer modprobe to load modules, because it handles dependencies too, but insmod should be fine with openvfd since it has no dependencies at all.

 

1 hour ago, lucky62 said:

Most probably there is also problem with DTB. DT compiler reported errors. I used the -f (force) flag:

Yes you're right, my fault! I was missing /plugin/; line just after the header. I updated the post above with the correct dts.

Anyway this syntax should suffice: dtc -@ -I dts -O dtb input.dts -o output.dtbo

Link to comment
Share on other sites

12 minutes ago, jock said:

You forgot to do the symlink,

nooo, i did it.

Quote

# ln -sf /boot/System.map-$(uname -r) /lib/modules/$(uname -r)/System.map

# ls -l /lib/modules/5.10.37-rockchip64/Sy*
lrwxrwxrwx 1 root root 35 May 18 19:29 /lib/modules/5.10.37-rockchip64/System.map -> /boot/System.map-5.10.37-rockchip64

also I created the symlink in the build directory, as instructed by make install:
 

Quote

# ln -sf /boot/System.map-$(uname -r) System.map

# ls -l
total 608
drwxrwxr-x 3 lucky62 lucky62   4096 May 18 19:29 controllers
-rw-rw-r-- 1 lucky62 lucky62  13141 May  9 11:38 glyphs.h
-rw-rw-r-- 1 lucky62 lucky62    361 May  9 11:38 Kbuild
-rw-rw-r-- 1 lucky62 lucky62    135 May  9 11:38 Kconfig
-rw-rw-r-- 1 lucky62 lucky62  35149 May  9 10:33 LICENSE
-rw-rw-r-- 1 lucky62 lucky62    373 May  9 15:08 Makefile
-rw-r--r-- 1 root    root        36 May 18 19:29 modules.order
-rw-r--r-- 1 root    root         0 May 18 19:29 Module.symvers
-rw-rw-r-- 1 lucky62 lucky62  36307 May 12 19:02 openvfd_drv.c
-rw-rw-r-- 1 lucky62 lucky62   6384 May  9 16:28 openvfd_drv.h
-rw-r--r-- 1 root    root     51984 May 18 19:29 openvfd_drv.o
-rw-r--r-- 1 root    root    216688 May 18 19:29 openvfd.ko
-rw-r--r-- 1 root    root       596 May 18 19:29 openvfd.mod
-rw-r--r-- 1 root    root      1584 May 18 19:29 openvfd.mod.c
-rw-r--r-- 1 root    root      4632 May 18 19:29 openvfd.mod.o
-rw-r--r-- 1 root    root    212680 May 18 19:29 openvfd.o
drwxrwxr-x 2 lucky62 lucky62   4096 May 18 19:29 protocols
lrwxrwxrwx 1 root    root        35 May 18 19:31 System.map -> /boot/System.map-5.10.37-rockchip64

 

EDIT: manual depmod -a solved the problem.

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