{"id":2584,"date":"2023-06-19T14:20:08","date_gmt":"2023-06-19T05:20:08","guid":{"rendered":"https:\/\/rageworx.info\/?p=2584"},"modified":"2023-06-19T14:20:08","modified_gmt":"2023-06-19T05:20:08","slug":"building-debian-buster-rootfs-for-rk3399","status":"publish","type":"post","link":"https:\/\/rageworx.info\/?p=2584","title":{"rendered":"Building debian-buster-rootfs for RK3399"},"content":{"rendered":"\r\n<p>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 \u2013 specially rootfs about debian based is not.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">EOL of &#8216;stretch&#8217;<\/h2>\r\n\r\n\r\n\r\n<p>Debian &#8216;stretch&#8217; is another name of debian-9. And i<a href=\"https:\/\/wiki.debian.org\/DebianReleases\" target=\"_blank\" rel=\"noopener\">ts support term has been ended at July 2022<\/a> as LTS, and no longer updated by debian update server.<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"776\" height=\"613\" class=\"wp-image-2585\" src=\"https:\/\/rageworx.info\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-18-at-14-03-26-DebianReleases-Debian-Wiki.png\" alt=\"\" srcset=\"https:\/\/rageworx.info\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-18-at-14-03-26-DebianReleases-Debian-Wiki.png 776w, https:\/\/rageworx.info\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-18-at-14-03-26-DebianReleases-Debian-Wiki-768x607.png 768w, https:\/\/rageworx.info\/wp-content\/uploads\/2023\/05\/Screenshot-2023-05-18-at-14-03-26-DebianReleases-Debian-Wiki-624x493.png 624w\" sizes=\"auto, (max-width: 776px) 100vw, 776px\" \/><\/figure>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">Update &#8217;till 2027, but &#8211;<\/h2>\r\n\r\n\r\n\r\n<p>Stretch is still being supported by plan of ELTS, but need to change your apt update server source as like this,<\/p>\r\n\r\n\r\n\r\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\r\n<figure class=\"wp-block-image size-full\">\r\n<div id=\"attachment_2586\" style=\"width: 584px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-2586\" data-id=\"2586\" class=\"wp-image-2586\" src=\"https:\/\/rageworx.info\/wp-content\/uploads\/2023\/05\/image-2023-5-10_12-20-24.png\" alt=\"\" width=\"574\" height=\"141\" \/><p id=\"caption-attachment-2586\" class=\"wp-caption-text\">\/etc\/apt\/sources.list<\/p><\/div>\r\n<\/figure>\r\n<\/figure>\r\n\r\n\r\n\r\n<p>Change \u201csources.list\u201d file in \/etc\/apt with any of your favorite editor \u2013 like vim or Emacs, whatever \u2013 to comment all default debian \u201chttp-based\u201d URLs to archive address. Yes, official debian update server no longer supports apt updating via their default address.<\/p>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">deb http:\/\/archive.debian.org\/debian\/ stretch contrib main non-free<br \/>deb http:\/\/archive.debian.org\/debian-security stretch\/updates contrib main non-free<\/pre>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading\">Prepare build &#8216;buster&#8217;<\/h2>\r\n\r\n\r\n\r\n<p>Simply, you need Debian based Linux, not Windows or macOS. Because building rootfs requires virtually mounted ext-4 file-system and binding root with <code>\/dev<\/code> overriding with QEMU.<\/p>\r\n\r\n\r\n\r\n<p>And refer to my GitHub repo : <a href=\"https:\/\/github.com\/rageworx\/rk3399-debian-rootfs-buster\" target=\"_blank\" rel=\"noopener\">https:\/\/github.com\/rageworx\/rk3399-debian-rootfs-buster<\/a><\/p>\r\n\r\n\r\n\r\n<p>Before you go, need to check what version of QEMU on your system, try these:<\/p>\r\n<ul>\r\n<li>Type <code>which qemu-aarch64-static<\/code>, or <code>whch qemu-aarch64<\/code> to check where your QEMU placed.<br \/>If you don&#8217;t have any QEMU, building rootfs not availed for now, see next chapter of &#8216;Case of QEMU required&#8217;.<\/li>\r\n<li>If you have one for qemu-aarch64, just copy or make a symlink to qemu-aarch64 to qemu-aarch64-static<\/li>\r\n<\/ul>\r\n<h3><span style=\"color: #ff0000;\">Before you going next, remind it is only support AARCH64<\/span><\/h3>\r\n<p><span style=\"color: #ff0000;\">RK3399 support armhf (32 bit) and aarch64 (64 bit) as well, but my debian-buster is only targeted to supporting aarch64.<\/span><br \/><span style=\"color: #ff0000;\">Please check your current kernel type to using 64-bit Linux image before going next step.<\/span><\/p>\r\n<h3>Case of QEMU required<\/h3>\r\n<p><span style=\"color: #ff9900;\">If you don&#8217;t have QEMU<\/span>, just download a <a href=\"https:\/\/www.qemu.org\/2019\/08\/16\/qemu-4-1-0\/\" target=\"_blank\" rel=\"noopener\">version 4.1.0<\/a> for your system, and step to build it.<br \/><span style=\"color: #ff0000;\"><em>* Higher version should be okay, but not guaranteed to build debian-10 image on your current Linux.<\/em><\/span><\/p>\r\n<p>Before you build it, must be configured QEMU as target for aarch64-linux-user and static build.<br \/>Just configure QEMU with this,<\/p>\r\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"raw\">.\/configure --target-list=aarch64-linux-user --static<\/pre>\r\n<p>Then, move to \u201caarch64-linux-user\u201d, and make it all.<br \/>If it successfully built, qemu-aarch64 ELF image may be generated as \u201cqemu-aarch64\u201d.<\/p>\r\n<p>You can install by sudo make install or manually copy to your favorite directory.<br \/>And don&#8217;t forget to make a copy or symlink of <strong>qemu-aarch64<\/strong> to <strong>qemu-aarch64-static<\/strong> in destination directory.<\/p>\r\n<h2>Step to make base archive<\/h2>\r\n<p>A debian-buster base image may need to be downloaded at the first time to make your customize or generic type.<br \/>Check your directory that file exists <code>mk-*.sh<\/code> files for <code>linaro-buster-alip-{DATE+TIME}-1.tar.gz<\/code> as almost 1.1 GiB.<br \/>If you don&#8217;t have one, need to step of run a script file of \u201cmk-base-bebian.sh\u201d as sudoer.<br \/>It will take about 30 minutes for formal internet speed of 1Gbps LAN.<\/p>\r\n<h2>Customize overlay directories<\/h2>\r\n<p>There&#8217;s all three overlay types \u2013 each &#8216;overlay&#8217;, &#8216;overlay-debug&#8217; and &#8216;overlay-firmware&#8217;.<br \/>Either two &#8216;debug&#8217; and &#8216;firmware&#8217; overlay directory may not be needed for formal users.<br \/>Just copy something you needed to be preinstalled in root file system in &#8216;overlay&#8217;, all files may copy as &#8216;root&#8217; user permission.<\/p>\r\n<h2>Customize preinstall packages<\/h2>\r\n<p>Should be modified &#8216;mk-rootfs-buster.sh&#8217; script to adjust what preinstall packages with apt-get in final rootfs image.<br \/>See 101st line of script file, there&#8217;s beginning of preinstallation script section.<\/p>\r\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2589\" src=\"https:\/\/rageworx.info\/wp-content\/uploads\/2023\/06\/2023-06-19-13-50-07.png\" alt=\"\" width=\"581\" height=\"591\" srcset=\"https:\/\/rageworx.info\/wp-content\/uploads\/2023\/06\/2023-06-19-13-50-07.png 581w, https:\/\/rageworx.info\/wp-content\/uploads\/2023\/06\/2023-06-19-13-50-07-60x60.png 60w\" sizes=\"auto, (max-width: 581px) 100vw, 581px\" \/><\/p>\r\n<p>It is really easy way to make your own preinstalled root file system image before flash into rk3399 storage.<\/p>\r\n<h2>Know about Wayland is not working for rk3399<\/h2>\r\n<p>It is still on working issue of Wayland not working by failure of EGL.<br \/>My repository using xfce-4 and LXDE desktop with X11.<\/p>\r\n<h2>Build a final base of rootfs image<\/h2>\r\n<p>By run a scripting &#8216;mk-rootfs-buster.sh&#8217; will be doing these steps on current directory.<\/p>\r\n<ol>\r\n<li>Extract latest of <code>linaro-buster-alip-{DATE+TIME}-1.tar.gz<\/code> to &#8216;binary&#8217; directory.<\/li>\r\n<li>Then copy &#8216;overlay*&#8217; directories into &#8216;binary&#8217;.<\/li>\r\n<li>Doing apt update, and install user scripted packages.<\/li>\r\n<\/ol>\r\n<p>These step may be taking minutes, and speed depends on your storage type.<\/p>\r\n<h2>Build final &#8216;linaro-rootfs.img&#8217;<\/h2>\r\n<p>Now one step left for final image, run <code>mk-image.sh<\/code> as sudoer.<br \/>It&#8217;s done, only your flashing image step be left for next.<\/p>\r\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>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 \u2013 specially rootfs about debian based is not. EOL of &#8216;stretch&#8217; Debian&#8230; <a href=\"https:\/\/rageworx.info\/?p=2584\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":2592,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[573,735,3],"tags":[786,576,787,785,153,574,636,716],"class_list":["post-2584","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-embedded","category-linux-development","category-raphs","tag-786","tag-aarch64","tag-buster","tag-debian","tag-linux","tag-rk3399","tag-rockchip","tag-rootfs"],"_links":{"self":[{"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/posts\/2584","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=2584"}],"version-history":[{"count":0,"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/posts\/2584\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rageworx.info\/index.php?rest_route=\/wp\/v2\/media\/2592"}],"wp:attachment":[{"href":"https:\/\/rageworx.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rageworx.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rageworx.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}