<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.radxa.com/mw/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.radxa.com/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Artt</id>
		<title>Radxa Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.radxa.com/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Artt"/>
		<link rel="alternate" type="text/html" href="https://wiki.radxa.com/Special:Contributions/Artt"/>
		<updated>2026-06-13T11:37:47Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.23.3</generator>

	<entry>
		<id>https://wiki.radxa.com/Rockpi4/dev/Debian</id>
		<title>Rockpi4/dev/Debian</title>
		<link rel="alternate" type="text/html" href="https://wiki.radxa.com/Rockpi4/dev/Debian"/>
				<updated>2018-12-11T23:59:01Z</updated>
		
		<summary type="html">&lt;p&gt;Artt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{rockpi4_header}}&lt;br /&gt;
&lt;br /&gt;
{{Languages|rockpi4/dev/Debian}}&lt;br /&gt;
&lt;br /&gt;
    [[rockpi4 | ROCK Pi 4]] &amp;gt; [[rockpi4/dev | Development]] &amp;gt; [[rockpi4/dev/Debian | Build Debian]]&lt;br /&gt;
&lt;br /&gt;
= Rockchip Debian SDK =&lt;br /&gt;
&lt;br /&gt;
Below is the instructions of how to build image for ROCK Pi 4.&lt;br /&gt;
&lt;br /&gt;
== Get the source code ==&lt;br /&gt;
&lt;br /&gt;
You need Git to get multiple git repositories to build the image.&lt;br /&gt;
&lt;br /&gt;
Install Git if you don't have it.&lt;br /&gt;
&lt;br /&gt;
    sudo apt-get update&lt;br /&gt;
    sudo apt-get install git&lt;br /&gt;
&lt;br /&gt;
Clone the source code&lt;br /&gt;
&lt;br /&gt;
    git clone --recursive https://github.com/radxa/rockchip-bsp.git&lt;br /&gt;
&lt;br /&gt;
You will get &lt;br /&gt;
&lt;br /&gt;
    build  kernel  README.md  rkbin  rootfs  u-boot&lt;br /&gt;
&lt;br /&gt;
Directories usage introductions:&lt;br /&gt;
&lt;br /&gt;
* build:&lt;br /&gt;
** Some script files and configuration files for building u-boot, kernel and rootfs.&lt;br /&gt;
* kernel: &lt;br /&gt;
** kernel source code, current version is 4.4&lt;br /&gt;
* rkbin: &lt;br /&gt;
** Prebuilt Rockchip binaries, include first stage loader and ATF(Arm Trustzone Firmware).&lt;br /&gt;
* rootfs: &lt;br /&gt;
** Bootstrap a Debian based rootfs, support architechture armhf and arm64, support Debian Jessie and Stretch.&lt;br /&gt;
* u-boot: &lt;br /&gt;
** u-boot as the second stage bootloader&lt;br /&gt;
&lt;br /&gt;
== Install toolchain and other build tools ==&lt;br /&gt;
&lt;br /&gt;
    sudo apt-get install gcc-aarch64-linux-gnu device-tree-compiler libncurses5 libncurses5-dev build-essential libssl-dev mtools&lt;br /&gt;
    sudo apt-get install bc python dosfstools&lt;br /&gt;
&lt;br /&gt;
== Build u-boot ==&lt;br /&gt;
&lt;br /&gt;
    ./build/mk-uboot.sh rockpi4b     #For ROCK Pi 4 Mode B&lt;br /&gt;
&lt;br /&gt;
The generated images will be copied to out/u-boot folder&lt;br /&gt;
&lt;br /&gt;
    ls out/u-boot/&lt;br /&gt;
    idbloader.img  rk3399_loader_v1.12.112.bin  trust.img  uboot.img&lt;br /&gt;
&lt;br /&gt;
== Build kernel ==&lt;br /&gt;
Build kernel with default '''rockchip_linux_defconfig'''&lt;br /&gt;
&lt;br /&gt;
    ./build/mk-kernel.sh rockpi4b    #For ROCK Pi 4 Mode B&lt;br /&gt;
&lt;br /&gt;
=== Change kernel config(optional)===&lt;br /&gt;
&lt;br /&gt;
Optionally, if you want to change the default kernel config&lt;br /&gt;
&lt;br /&gt;
    cd kernel&lt;br /&gt;
    export ARCH=arm64&lt;br /&gt;
    export CROSS_COMPILE=aarch64-linux-gnu-&lt;br /&gt;
    make rockchip_linux_defconfig&lt;br /&gt;
    make menuconfig&lt;br /&gt;
    cd ..&lt;br /&gt;
    ./build/mk-kernel.sh rockpi4b    #For ROCK Pi 4 Mode B&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You will get the kernel image and dtb file&lt;br /&gt;
&lt;br /&gt;
    ls out/kernel/&lt;br /&gt;
    Image  rockpi-4b-linux.dtb&lt;br /&gt;
&lt;br /&gt;
== Make rootfs image ==&lt;br /&gt;
&lt;br /&gt;
To build 32bit rootfs:&lt;br /&gt;
 &lt;br /&gt;
    export ARCH=armhf&lt;br /&gt;
&lt;br /&gt;
To build 64bit rootfs:&lt;br /&gt;
&lt;br /&gt;
    export ARCH=arm64&lt;br /&gt;
&lt;br /&gt;
Building a base debian system by ubuntu-build-service from linaro.&lt;br /&gt;
&lt;br /&gt;
    cd rootfs&lt;br /&gt;
    sudo apt-get install binfmt-support qemu-user-static cpio gdisk&lt;br /&gt;
    sudo dpkg -i ubuntu-build-service/packages/*        # ignore the broken dependencies, we will fix it next step&lt;br /&gt;
    sudo apt-get install -f&lt;br /&gt;
    RELEASE=stretch TARGET=desktop ARCH=$ARCH ./mk-base-debian.sh&lt;br /&gt;
&lt;br /&gt;
This will bootstrap a Debian stretch image, you will get a rootfs tarball named '''linaro-stretch-alip-xxxx.tar.gz'''. &lt;br /&gt;
&lt;br /&gt;
Building the rk-debain rootfs with debug:&lt;br /&gt;
&lt;br /&gt;
    VERSION=debug ARCH=$ARCH ./mk-rootfs-stretch.sh  &amp;amp;&amp;amp; ./mk-image.sh&lt;br /&gt;
&lt;br /&gt;
This will install Rockchip specified packages and hooks on the standard Debian rootfs and generate an ext4 format rootfs image at '''rootfs/linaro-rootfs.img'''.&lt;br /&gt;
&lt;br /&gt;
== Combine everything into one image ==&lt;br /&gt;
&lt;br /&gt;
    build/mk-image.sh -c rk3399 -t system -r rootfs/linaro-rootfs.img&lt;br /&gt;
&lt;br /&gt;
This will combine u-boot, kernel and rootfs into one image and generate GPT partition table. Output is &lt;br /&gt;
&lt;br /&gt;
    out/system.img&lt;br /&gt;
&lt;br /&gt;
== Flash the image ==&lt;br /&gt;
&lt;br /&gt;
For normal users, follow instructions [[Rockpi4/install | here]]. You will need the generated '''out/system.img''' only.&lt;br /&gt;
&lt;br /&gt;
For developers, flash from USB OTG port, follow instructions [[Rockpi4/dev/usb-install |here]]. You will need the flash helper '''rk3399_loader_xxx.bin''' and generated '''out/system.img''' files.&lt;br /&gt;
&lt;br /&gt;
== Troubleshooting ==&lt;br /&gt;
&lt;br /&gt;
Check [[Rockpi4/FAQs |ROCK Pi 4 FAQs]] first, if it doesn't help, start a new post on the forum https://forum.radxa.com/c/dev&lt;/div&gt;</summary>
		<author><name>Artt</name></author>	</entry>

	</feed>