2 2
jock

research [WIP] Armbian for RK322X devices

Recommended Posts

Hello,

 

following the recent thread on LibreElec forum about an unofficial image for rk3229 devices, I would like to make public the work made by me and @fabiobassa about bringing rk322x support to armbian.

For those which are interested, at the moment it is available on github -> here <-

It is still in a heavy work in progress status, but all the fundamentals are in place.

Most of the love has been poured into supporting and bringing up the legacy rockchip 4.4 kernel, but in the near future the goal is to fully support the mainline kernel.

 

What works now on legacy kernel:

  • Two rk3229 tv box board (the signature on the PCB says R329Q and Chiptrip xt-mx4vr-v01), as a proof of concept
  • Mainline u-boot
  • OPTEE provided as Trusted Execution Environment
  • All 4 cores are working
  • Ethernet
  • Serial UART (configured at 1.5 megabits/s, but will be switched back to 115200 bps soon)
  • Thermals and frequency scaling
  • OTG USB 2.0 port
  • EHCI/OHCI USB 2.0 ports
  • MMC subsystem (including eMMC, SD and sdio devices)
  • Hardware video acceleration (via RKMPP)
  • NAND is available (but not as boot device due to mailine u-boot missing the rockchip NAND driver)
  • SSV6051 wifi over SDIO (crappy driver, blacklist ssv6051 driver in /etc/modprobe.d/blacklist.conf in case your kernel crashes)
  • Whatever is supported for other rockchip devices in legacy kernel, including possible graphics acceleration support

 

Building:

You can build your own image follow the common steps to build armbian for other tv boxes devices (ie: when you are in the moment to choose the target board, switch to CSC/TVB/EOL boards and select "r329q" or "xt-mx4vr-v01" from the list). In case your board is not listed here, I suggest you to try with xt-mx4vr-v01 board, which has more chances to boot.

 

Prebuilt images:

If you don't want to build Armbian yourself, there are some prebuilt images already available:

 

 

As long as this is a work in progress, I suggest you to try building the image yourself for your board because every prebuilt image will become obsolete very soon.


Quick installation instructions:

  • In order to run armbian from an SD card you need to put the device in maskrom mode. To do so, follow the instructions below.
  • Flash the image on the sdcard, plug it in and plug the power cord
  • Wait some seconds, the led should start blinking soon. HDMI output during boot is not available yet, so just wait for the kernel log and login prompt; the first time the boot process will take a couple of minutes or so
  • As usual, armbian default credentials are user: root password: 1234

 

Putting the device in maskrom mode:

It is essential that the device is put in maskrom mode to let it boot from the external sd card.

In order to do so, you need to erase the internal eMMC/NAND flash memory. If you don't want to erase the existing firmware, at the moment you can't proceed.

You obviously need to do this step only once.

 

  • Obtain a copy of rkdeveloptool: a compiled binary is available in the official rockchip-linux rkbin github repository. If you prefer, you can compile it yourself from the sources available at official rockchip repository
  • Unplug the power cord from the tv box
  • Plug an end of an USB Male-to-male cable into the OTG port (normally it is the lone USB port on the same side of the Ethernet, HDMI, analog AV connectors)
  • Plug the other end of the USB Male-to-male cable into an USB port of your computer
  • If everyting went well, using lsusb you should see a device with vendor ID 2207
  • run ./rkdeveloptool -ef and wait a few seconds
  • once done, the internal eMMC is erased and the device will boot from the sdcard from now on

 

Note: rockchip devices cannot be bricked. If the internal flash does not contain a bootable system, they will always boot from the sdcard. If, for a reason, the bootable system on the internal flash corrupts or is unable to boot correctly, you can always force the maskrom mode shorting the eMMC clock pin on the PCB. Just google around if you get stuck on a faulty bootloader, the technique is pretty simple and requires a simple screwdriver.

 

I will continue to work on this project and refine both the legacy and mainline kernel and when the support will be in the same ballpark as other targets I will ask @Igor if it is a good idea to merge it into the main armbian repository.

 

Critics, suggestions and contributions are welcome!

 

Credits:

  • @fabiobassa for his ideas, inspiration, great generosity in giving the boards for development and testing. The project of bringing rk322x into armbian would not have begun without his support!
  • Justin Swartz, for his work and research to bring mainline linux on rk3229 (repository here)

Share this post


Link to post
Share on other sites

@jock

Well, simply speachless .

Great details and great work.

Personally will support this adventure as soon as I will own more and more different boards.

Hope someone will join the study and add ideas, suggestions, solutions

 

Thank you Jock

 

Share this post


Link to post
Share on other sites

Hey,

great - somebody else is working on this too - just talked about adding an armbian recpie in LE forums. I will look deeper in your work the next days (and armbian in general) - and maybe add some contribs.

Some question beforehand:
1. How far is mainline kernel support? (Saw some commits in your repo)

2. How about using wayland instead of X?

Share this post


Link to post
Share on other sites
23 hours ago, knaerzche said:

Hey,

great - somebody else is working on this too - just talked about adding an armbian recpie in LE forums. I will look deeper in your work the next days (and armbian in general) - and maybe add some contribs.

Some question beforehand:
1. How far is mainline kernel support? (Saw some commits in your repo)

2. How about using wayland instead of X?

Mainline kernel is working mostly well for headless or simple terminal-based jobs. HDMI and DRM have some issues and probably the device tree is not complete: some video-related IRQs are not caught and the kernel blames for that.

I didn't test it very much, but other devices like ethernet, mmc and USB subsystems seems to be already stable enough.

Wayland would be great and would avoid dealing with mali blobs, but at the moment just inserting the lima module causes the kernel to issue a stack dump. DRM also is not in a very usable state.

 

I can't give many more details about mainline because at the moment the focus is on the legacy kernel to see what we can get from the SoC and boards; once the situation stabilizes on the legacy 4.4 kernel I'll happily give more love to mainline.

 

Mainline u-boot instead is in good shape for rk3229, I just recently added support for USB booting from the OTG port, but it still requires some fine-tuning to be really usable.

Share this post


Link to post
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...
2 2