Building debian-buster-rootfs for RK3399

RK3399 is one of most of powerful open source based Cortex-A72 and A53 as Big-Little architecture. Rockchip of its manufacturer, continuously updates their open source as they can, but all sources are not being updated for latest changes – specially rootfs about debian based is not.

EOL of ‘stretch’

Debian ‘stretch’ is another name of debian-9. And its support term has been ended at July 2022 as LTS, and no longer updated by debian update server.

Update ’till 2027, but –

Stretch is still being supported by plan of ELTS, but need to change your apt update server source as like this,

Change “sources.list” file in /etc/apt with any of your favorite editor – like vim or Emacs, whatever – to comment all default debian “http-based” URLs to archive address. Yes, official debian update server no longer supports apt updating via their default address.

deb http://archive.debian.org/debian/ stretch contrib main non-free
deb http://archive.debian.org/debian-security stretch/updates contrib main non-free

Prepare build ‘buster’

Simply, you need Debian based Linux, not Windows or macOS. Because building rootfs requires virtually mounted ext-4 file-system and binding root with /dev overriding with QEMU.

And refer to my GitHub repo : https://github.com/rageworx/rk3399-debian-rootfs-buster

Before you go, need to check what version of QEMU on your system, try these:

  • Type which qemu-aarch64-static, or whch qemu-aarch64 to check where your QEMU placed.
    If you don’t have any QEMU, building rootfs not availed for now, see next chapter of ‘Case of QEMU required’.
  • If you have one for qemu-aarch64, just copy or make a symlink to qemu-aarch64 to qemu-aarch64-static

Before you going next, remind it is only support AARCH64

RK3399 support armhf (32 bit) and aarch64 (64 bit) as well, but my debian-buster is only targeted to supporting aarch64.
Please check your current kernel type to using 64-bit Linux image before going next step.

Case of QEMU required

If you don’t have QEMU, just download a version 4.1.0 for your system, and step to build it.
* Higher version should be okay, but not guaranteed to build debian-10 image on your current Linux.

Before you build it, must be configured QEMU as target for aarch64-linux-user and static build.
Just configure QEMU with this,

./configure --target-list=aarch64-linux-user --static

Then, move to “aarch64-linux-user”, and make it all.
If it successfully built, qemu-aarch64 ELF image may be generated as “qemu-aarch64”.

You can install by sudo make install or manually copy to your favorite directory.
And don’t forget to make a copy or symlink of qemu-aarch64 to qemu-aarch64-static in destination directory.

Step to make base archive

A debian-buster base image may need to be downloaded at the first time to make your customize or generic type.
Check your directory that file exists mk-*.sh files for linaro-buster-alip-{DATE+TIME}-1.tar.gz as almost 1.1 GiB.
If you don’t have one, need to step of run a script file of “mk-base-bebian.sh” as sudoer.
It will take about 30 minutes for formal internet speed of 1Gbps LAN.

Customize overlay directories

There’s all three overlay types – each ‘overlay’, ‘overlay-debug’ and ‘overlay-firmware’.
Either two ‘debug’ and ‘firmware’ overlay directory may not be needed for formal users.
Just copy something you needed to be preinstalled in root file system in ‘overlay’, all files may copy as ‘root’ user permission.

Customize preinstall packages

Should be modified ‘mk-rootfs-buster.sh’ script to adjust what preinstall packages with apt-get in final rootfs image.
See 101st line of script file, there’s beginning of preinstallation script section.

It is really easy way to make your own preinstalled root file system image before flash into rk3399 storage.

Know about Wayland is not working for rk3399

It is still on working issue of Wayland not working by failure of EGL.
My repository using xfce-4 and LXDE desktop with X11.

Build a final base of rootfs image

By run a scripting ‘mk-rootfs-buster.sh’ will be doing these steps on current directory.

  1. Extract latest of linaro-buster-alip-{DATE+TIME}-1.tar.gz to ‘binary’ directory.
  2. Then copy ‘overlay*’ directories into ‘binary’.
  3. Doing apt update, and install user scripted packages.

These step may be taking minutes, and speed depends on your storage type.

Build final ‘linaro-rootfs.img’

Now one step left for final image, run mk-image.sh as sudoer.
It’s done, only your flashing image step be left for next.

Leave a Reply