{"id":2228,"date":"2020-08-15T02:03:38","date_gmt":"2020-08-14T17:03:38","guid":{"rendered":"https:\/\/rageworx.info\/?p=2228"},"modified":"2020-08-18T16:15:16","modified_gmt":"2020-08-18T07:15:16","slug":"rock960-rk3399-usb-c-peripheral-driver-1","status":"publish","type":"post","link":"https:\/\/rageworx.info\/?p=2228","title":{"rendered":"Rock960 (rk3399) Improved kernel 4.4.179"},"content":{"rendered":"<p><a href=\"https:\/\/rageworx.info\/wp-content\/uploads\/2020\/08\/board_picture_c_rageworx.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2229\" src=\"https:\/\/rageworx.info\/wp-content\/uploads\/2020\/08\/board_picture_c_rageworx.jpg\" alt=\"\" width=\"1024\" height=\"793\" srcset=\"https:\/\/rageworx.info\/wp-content\/uploads\/2020\/08\/board_picture_c_rageworx.jpg 1024w, https:\/\/rageworx.info\/wp-content\/uploads\/2020\/08\/board_picture_c_rageworx-960x743.jpg 960w, https:\/\/rageworx.info\/wp-content\/uploads\/2020\/08\/board_picture_c_rageworx-768x595.jpg 768w, https:\/\/rageworx.info\/wp-content\/uploads\/2020\/08\/board_picture_c_rageworx-624x483.jpg 624w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<h2>A short history:<\/h2>\n<p>Rock960 board is a variabtion of Rockchip RK3399 series, and supports many features as a stand-alone smallest AARCH64 system. <a href=\"http:\/\/vamrs.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">VAMRS<\/a> still providing this card sized embedded linux computer in half of year 2020.<\/p>\n<p>I love this powerful RK3399 processor, as economical AARCH64, to be used for embedded linux desktop system ( include Android, but I don&#8217;t use android platform ) with <a href=\"https:\/\/github.com\/rageworx\/rk3399_linux_kernel_4.4.179\" target=\"_blank\" rel=\"noopener noreferrer\">my tuned version of 4.4.179 kernel<\/a>.<\/p>\n<p>Rockchip provides fully open source of embedded linux uboot to kernel and filesystem in <a href=\"https:\/\/github.com\/rockchip-linux\" target=\"_blank\" rel=\"noopener noreferrer\">their github<\/a>, all source codes are up to who making what kind of system, by whom to works, or what designed for what does it.<\/p>\n<p>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&#8217;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.<\/p>\n<p>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&#8217;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.<\/p>\n<p>Also includes these drivers:<\/p>\n<ul>\n<li>Realtek semiconductor Corp. RTL815x GbE USB adapter driver<\/li>\n<li>Microchip LAN78xx GbE USB adapter driver<\/li>\n<li>Cypress GX3 GbE USB adapter driver<\/li>\n<\/ul>\n<h2>First step to do:<\/h2>\n<p><span style=\"color: #ff0000;\">&#8211;Updated&#8211;<\/span><\/p>\n<p>96board repository has some problems, it should not be able to build u-boot or kernel, or rootfs correctly by legacy sequence.<br \/>\nSo 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.<\/p>\n<p><code>git clone https:\/\/github.com\/rageworx\/rock960linux.git<\/code><\/p>\n<p>Then, prorceed this to initializing sub-modules.<\/p>\n<p><code>git submodule init;git submodule update<\/code><\/p>\n<p>Initializing sub-modules may spend minutes ( up to network speed ), take a break with a cup of coffee.<br \/>\nIt should step next when done to cloning all sub module repositories.<\/p>\n<p>My customized git-repository may helps build Rock960 board images very easily.<br \/>\nJust do these sequences:<\/p>\n<ol>\n<li>Build u-boot<br \/>\n<code>build\/mk-uboot.sh rock960ab<\/code><\/li>\n<li>Build kernel<br \/>\n<code>build\/mk-kernel.sh rock960ab<\/code><\/li>\n<li>Build rootfs\n<ol>\n<li>First time you need to do in <strong>rootfs<\/strong> directory for installing some required pacakges.<br \/>\nYou may move to rootfs directory, then &#8211;<\/p>\n<ol>\n<li><code>sudo apt-get install binfmt-support qemu-user-static<\/code><\/li>\n<li><code>sudo dpkg -i ubuntu-build-service\/packages\/*<\/code><\/li>\n<li><code>sudo apt-get install -f<\/code><\/li>\n<\/ol>\n<\/li>\n<li>First time to downloading linaro-stretch-alip-${DATETIME}-1.tar.gz<br \/>\n<code>.\/mk-base-debian.sh<\/code><br \/>\nIt should be skipped if already had base tar.gz.<\/li>\n<li>Then extract base debian tar.gz to binary, and copying overlay contents with this:<br \/>\n<code>.\/mk-rootfs-stretch-arm64.sh<\/code><\/li>\n<li>And finally do this.<br \/>\n<code>sudo .\/mk-image.sh<\/code><\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>All files will be copied into <strong>out<\/strong> directory.<br \/>\nYou can flash with wlx parameter with rkdeveloptool or, create a system.img with this.<\/p>\n<p><code>build\/mk-image.sh -c rk3399 -t system -r rootfs\/linaro-rootfs.img<\/code><\/p>\n<p>Flshing image to mask-rom mode board written detailed information should refer to <a href=\"https:\/\/rageworx.info\/?p=1610\" target=\"_blank\" rel=\"noopener noreferrer\">this page<\/a>.<\/p>\n<p><span style=\"color: #999999;\">&#8211;Previous&#8211;<\/span><\/p>\n<blockquote><p><span style=\"color: #999999;\">Check VAMRS&#8217; git repo here first: <a style=\"color: #999999;\" href=\"https:\/\/github.com\/96rocks\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/96rocks<\/a><\/span><\/p>\n<p><span style=\"color: #999999;\">To step next, prepare these things,<\/span><\/p>\n<ul>\n<li><span style=\"color: #999999;\"><strong>Ubuntu x86.64 build machine ( PC )<\/strong><\/span><br \/>\n<span style=\"color: #999999;\">linux uboot and kernel sources are cannot build on Windows, you need prepare a physical PC for build sources, flashing images onto Rock960B board.<\/span><br \/>\n<span style=\"color: #999999;\">I recommends Mint Linux 18 or higher version of x86.64.<\/span><\/li>\n<li><span style=\"color: #999999;\"><strong>Update your linux to latest updated.<\/strong><\/span><br \/>\n<span style=\"color: #999999;\">do <code>sudo apt-get update<\/code> and <code>sudo apt-get upgrade<\/code> for make your Linux being updated in latest changes.<\/span><\/li>\n<li><span style=\"color: #999999;\"><strong>Install these packages:<\/strong><\/span><br \/>\n<span style=\"color: #999999;\">You need to install these pacakges for build uboot, kernel, trust and rootfs.<\/span><br \/>\n<span style=\"color: #999999;\"><code>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<\/code><\/span><br \/>\n<span style=\"color: #999999;\">You can install &#8216;repo&#8217; with apt-get, but it seems to not availed for now ( at Linux Mint )<\/span><br \/>\n<span style=\"color: #999999;\">And additionally also requires these packages:<\/span><br \/>\n<span style=\"color: #999999;\"><code>sudo apt-get install binfmt-support qemu-user-static python-dbus python-debian python-parted python-yaml<\/code><\/span><\/li>\n<li><span style=\"color: #999999;\"><strong>One more,need to get &#8216;repo&#8217; script from google.<\/strong><\/span><br \/>\n<span style=\"color: #999999;\">do as like this, ( if apt-get shouldn&#8217;t recognize repo )<\/span><br \/>\n<span style=\"color: #999999;\"><code>curl https:\/\/storage.googleapis.com\/git-repo-downloads\/repo &gt; repo<\/code><\/span><br \/>\n<span style=\"color: #999999;\">Then change permission to 775, <code>chmod 775 repo<\/code> and move to \/usr\/local\/bin,<\/span><br \/>\n<span style=\"color: #999999;\"><code>sudo mv repo \/usr\/local\/bin<\/code><\/span><\/li>\n<li><span style=\"color: #999999;\"><strong>Make a directory to clone Rock960B source codes.<\/strong><\/span><br \/>\n<span style=\"color: #999999;\">Just make a directory what you looks easily understand what source contains like &#8216;rock960dev&#8217;.<\/span><br \/>\n<span style=\"color: #999999;\"><code>mk dir rock960dev<\/code><\/span><\/li>\n<li><span style=\"color: #999999;\"><strong>And move into just you made.<\/strong><\/span><br \/>\n<span style=\"color: #999999;\"><code>cd rock960dev<\/code><\/span><\/li>\n<li><span style=\"color: #999999;\"><strong>Clone repository with meta information.<\/strong><\/span><br \/>\n<span style=\"color: #999999;\"><code>repo init -u https:\/\/github.com\/96rocks\/manifests -m rock960.xml<\/code><\/span><\/li>\n<li><span style=\"color: #999999;\"><strong>Then synchronize your repository with these.<\/strong><\/span><br \/>\n<span style=\"color: #999999;\"><code>repo sync;repo start rock960-dev --all<\/code><\/span><br \/>\n<span style=\"color: #999999;\">Just wait for minutes until done.<\/span><\/li>\n<li><span style=\"color: #999999;\"><strong>Now you ready for build sources, but one more thing left.<\/strong><\/span><br \/>\n<span style=\"color: #999999;\">My tuned kernel should replace default rock960 board. so change original kernel to something else like this.<\/span><br \/>\n<span style=\"color: #999999;\"><code>mv kernel kernel_rock960<\/code><\/span><br \/>\n<span style=\"color: #999999;\">Then clone my kernel here.<\/span><br \/>\n<span style=\"color: #999999;\"><code>git clone https:\/\/github.com\/rageworx\/rk3399_linux_kernel_4.4.179.git kernel<\/code><\/span><br \/>\n<span style=\"color: #999999;\">Now you can see newly cloned kernel and you renamed(moved) kernel directory.<\/span><\/li>\n<li><span style=\"color: #999999;\"><strong>First build kernel.<\/strong><\/span><br \/>\n<span style=\"color: #999999;\">rock960 provides building scripts, and all building sequences up to these.<\/span><br \/>\n<span style=\"color: #999999;\"><code>build\/mk-kernel.sh rock960ab<\/code><\/span><\/li>\n<li><span style=\"color: #999999;\"><strong>Then build u-boot<\/strong><\/span><br \/>\n<span style=\"color: #999999;\">And u-boot may next turn, &#8211;update&#8211; there&#8217;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.<\/span><br \/>\n<span style=\"color: #999999;\">If you faced to build failure with these,<\/span><br \/>\n<span style=\"color: #999999;\"><code>build\/mk-uboot.sh rock960ab<\/code><\/span><br \/>\n<span style=\"color: #999999;\">do this before running mk-uboot.sh script,<\/span><br \/>\n<span style=\"color: #999999;\"><code>repo start 96rocks\/release-4.4-rock960 --all<\/code><\/span><br \/>\n<span style=\"color: #999999;\">or remove u-boot directory, and clone u-boot again with stable branch.<\/span><br \/>\n<span style=\"color: #999999;\"><code>git clone https:\/\/github.com\/96rocks\/u-boot.git -b stable-4.4-rock960<\/code><\/span><br \/>\n<span style=\"color: #999999;\">and check these files existed in u-boot directory,<\/span><\/p>\n<ul>\n<li><span style=\"color: #999999;\">configs\/rock-pi-4b-rk3399_defconfig<\/span><\/li>\n<li><span style=\"color: #999999;\">configs\/rock960-ab-rk3399_defconfig<\/span><\/li>\n<li><span style=\"color: #999999;\">configs\/rock960-c-rk3399_defconfig<\/span><\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color: #999999;\">(update) 96board git repository sucks &#8230;<\/span><br \/>\n<span style=\"color: #999999;\">If you faced again with rkbin &#8230; ddr 800Mhz 1.20.bin not existed, it will be better to replace rkbin to master branch, or clone it again.<\/span><br \/>\n<code>git clone https:\/\/github.com\/96rocks\/rkbin.git<\/code><\/li>\n<\/ul>\n<\/blockquote>\n<p>Now you have something improved kernel now, but there&#8217;s something more left to enable USB-C peripheral device driver.<br \/>\nIt should be append to next post, and please wait until then.<\/p>\n<h2>Windows driver download :<\/h2>\n<p>Here I made libusbk drivers with libusbk signature.<\/p>\n\n<a  data-e-Disable-Page-Transition=\"true\" class=\"download-link download-button aligncenter\" title=\"Version 3.0.7.0\" href=\"https:\/\/rageworx.info?tmstv=1776037248\" rel=\"nofollow\" id=\"download-link-2251\" data-redirect=\"false\" >\n\tDownload &ldquo;RaphKay's rk3399 USB peripheral device libusbk windows driver&rdquo;\t<small>RaphKay_s_rk3399_USB_peripheral_libsubk_windows_driver.zip\t\t&ndash; Downloaded 989 times\t\t&ndash; 3.79 MB<\/small>\n<\/a>\n\n","protected":false},"excerpt":{"rendered":"<p>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&#8230; <a href=\"https:\/\/rageworx.info\/?p=2228\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":2229,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,573,580,3],"tags":[715,25,714,574,610],"class_list":["post-2228","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","category-embedded","category-linux","category-raphs","tag-improved","tag-kernel","tag-modified","tag-rk3399","tag-rock960"],"_links":{"self":[{"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/posts\/2228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rageworx.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2228"}],"version-history":[{"count":0,"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/posts\/2228\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/media\/2229"}],"wp:attachment":[{"href":"https:\/\/rageworx.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rageworx.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rageworx.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}