Rock960 (rk3399) Improved kernel 4.4.179

      Comments Off on Rock960 (rk3399) Improved kernel 4.4.179

A short history:

Rock960 board is a variabtion of Rockchip RK3399 series, and supports many features as a stand-alone smallest AARCH64 system. VAMRS still providing this card sized embedded linux computer in half of year 2020.

I love this powerful RK3399 processor, as economical AARCH64, to be used for embedded linux desktop system ( include Android, but I don’t use android platform ) with my tuned version of 4.4.179 kernel.

Rockchip provides fully open source of embedded linux uboot to kernel and filesystem in their github, all source codes are up to who making what kind of system, by whom to works, or what designed for what does it.

Obviously RK3399 has many feature, even supports USB-C peripheral device in hardware level, and it was basically designed to support the device mode of USB-C 3.0 as 5Gbps peripheral device, but there’s unavailed to know how to enable USB-C peripheral device, or where driver should be enabled, or how to make it running on, even nothing to read or refer to how it works on their linux kernel.

So I spent long times to know how it able to works as Super-speed USB peripheral ( as a bulk-device, with libsubk for any platforms with libusb0 or libusbk ) device from Rock960B. Eventually I’ve been changed some configs and made a driver to enable USB UDC in kernel sources with Kconfig. Now it should be able modifying owner USB Vendor ID and Product ID with adbd.sh service by simply enable device node and path, also includes high performanced device control daemon.

Also includes these drivers:

  • Realtek semiconductor Corp. RTL815x GbE USB adapter driver
  • Microchip LAN78xx GbE USB adapter driver
  • Cypress GX3 GbE USB adapter driver

First step to do:

–Updated–

96board repository has some problems, it should not be able to build u-boot or kernel, or rootfs correctly by legacy sequence.
So I made my own github repository, and it will builds Rock960 board image in simple way.Just clone repository ( download not able to get sub-modules, please use git cloning ) as this sequence.

git clone https://github.com/rageworx/rock960linux.git

Then, prorceed this to initializing sub-modules.

git submodule init;git submodule update

Initializing sub-modules may spend minutes ( up to network speed ), take a break with a cup of coffee.
It should step next when done to cloning all sub module repositories.

My customized git-repository may helps build Rock960 board images very easily.
Just do these sequences:

  1. Build u-boot
    build/mk-uboot.sh rock960ab
  2. Build kernel
    build/mk-kernel.sh rock960ab
  3. Build rootfs
    1. First time you need to do in rootfs directory for installing some required pacakges.
      You may move to rootfs directory, then –

      1. sudo apt-get install binfmt-support qemu-user-static
      2. sudo dpkg -i ubuntu-build-service/packages/*
      3. sudo apt-get install -f
    2. First time to downloading linaro-stretch-alip-${DATETIME}-1.tar.gz
      ./mk-base-debian.sh
      It should be skipped if already had base tar.gz.
    3. Then extract base debian tar.gz to binary, and copying overlay contents with this:
      ./mk-rootfs-stretch-arm64.sh
    4. And finally do this.
      sudo ./mk-image.sh

All files will be copied into out directory.
You can flash with wlx parameter with rkdeveloptool or, create a system.img with this.

build/mk-image.sh -c rk3399 -t system -r rootfs/linaro-rootfs.img

Flshing image to mask-rom mode board written detailed information should refer to this page.

–Previous–

Check VAMRS’ git repo here first: https://github.com/96rocks

To step next, prepare these things,

  • Ubuntu x86.64 build machine ( PC )
    linux uboot and kernel sources are cannot build on Windows, you need prepare a physical PC for build sources, flashing images onto Rock960B board.
    I recommends Mint Linux 18 or higher version of x86.64.
  • Update your linux to latest updated.
    do sudo apt-get update and sudo apt-get upgrade for make your Linux being updated in latest changes.
  • Install these packages:
    You need to install these pacakges for build uboot, kernel, trust and rootfs.
    sudo apt-get install git-core gitk git-gui gcc-arm-linux-gnueabihf u-boot-tools device-tree-compiler gcc-aarch64-linux-gnu mtools parted pv libssl-dev
    You can install ‘repo’ with apt-get, but it seems to not availed for now ( at Linux Mint )
    And additionally also requires these packages:
    sudo apt-get install binfmt-support qemu-user-static python-dbus python-debian python-parted python-yaml
  • One more,need to get ‘repo’ script from google.
    do as like this, ( if apt-get shouldn’t recognize repo )
    curl https://storage.googleapis.com/git-repo-downloads/repo > repo
    Then change permission to 775, chmod 775 repo and move to /usr/local/bin,
    sudo mv repo /usr/local/bin
  • Make a directory to clone Rock960B source codes.
    Just make a directory what you looks easily understand what source contains like ‘rock960dev’.
    mk dir rock960dev
  • And move into just you made.
    cd rock960dev
  • Clone repository with meta information.
    repo init -u https://github.com/96rocks/manifests -m rock960.xml
  • Then synchronize your repository with these.
    repo sync;repo start rock960-dev --all
    Just wait for minutes until done.
  • Now you ready for build sources, but one more thing left.
    My tuned kernel should replace default rock960 board. so change original kernel to something else like this.
    mv kernel kernel_rock960
    Then clone my kernel here.
    git clone https://github.com/rageworx/rk3399_linux_kernel_4.4.179.git kernel
    Now you can see newly cloned kernel and you renamed(moved) kernel directory.
  • First build kernel.
    rock960 provides building scripts, and all building sequences up to these.
    build/mk-kernel.sh rock960ab
  • Then build u-boot
    And u-boot may next turn, –update– there’s some repo bug, u-boot git repository may not branched to 96rocks/rock960-debian. So following shell command may getting failure by defconf file not existed.
    If you faced to build failure with these,
    build/mk-uboot.sh rock960ab
    do this before running mk-uboot.sh script,
    repo start 96rocks/release-4.4-rock960 --all
    or remove u-boot directory, and clone u-boot again with stable branch.
    git clone https://github.com/96rocks/u-boot.git -b stable-4.4-rock960
    and check these files existed in u-boot directory,

    • configs/rock-pi-4b-rk3399_defconfig
    • configs/rock960-ab-rk3399_defconfig
    • configs/rock960-c-rk3399_defconfig
  • (update) 96board git repository sucks …
    If you faced again with rkbin … ddr 800Mhz 1.20.bin not existed, it will be better to replace rkbin to master branch, or clone it again.
    git clone https://github.com/96rocks/rkbin.git

Now you have something improved kernel now, but there’s something more left to enable USB-C peripheral device driver.
It should be append to next post, and please wait until then.

Windows driver download :

Here I made libusbk drivers with libusbk signature.

Download “RaphKay's rk3399 USB peripheral device libusbk windows driver”

RaphKay_s_rk3399_USB_peripheral_libsubk_windows_driver.zip – Downloaded 553 times – 3.79 MB