Source Code Compilation of OK3568 Evaluation Board

This article will introduce the process of compiling source code on OK3568-C evaluation board of Forlinx embedded.

1. Prepare source code

1.1 Create work directory

$mkdir -p ~/rk3568

1.2 Copy source code

Copy source code file OK3568-linux-source.tar.bz2.a* in user profile to ~/rk3568 of virtual machine.

There are many ways to copy files. Here uses shared folder.

[Note] The source code uses segmented compression. Each segment is up to 4G, which is convenient for copying. Because some memory support up to 4G for single file.

1.3 Unzip source code

$cat OK3568-linux-source.tar.bz2.a* >OK3568-linux-source.tar.bz2
$tar -xvf OK3568-linux-source.tar.bz2

Please be patient and wait for it to finish.

1.4 Enter source code

$cd ~/rk3568/OK3568-linux-source

Directory Structure

2. Compile SDK

2.1 configuration before compilation

In device/rockchip/ok3568/, there are configuration files for different board types, select the configuration file:


Related configuration introduction:

2.2 Compile

compile u-boot



compile kernel



[Note] After compiling for a period of time, following interface will pop up, which needs to select. Extract the information in picture. Select 1800000 for VCCIO4 and VCCIO6 and select 3300000 for the rest. Use up and down keys to select options, and press Enter to confirm selection.

compile recovery



Compile Buildroot file system


It will take a long time to make file system, please wait patiently for compilation to complete.

[Note 1] Make sure to compile Buildroot file system as a normal user to avoid unnecessary errors;

[Note 2] If don't want to compile file system, you can directly extract it from existing image and copy it to rockdev directory.

2.3 Package firmware

Update each part of image link to rockdev/:


Package firmware, and generated complete firmware will be saved to rockdev/.


[PS] Fully automatic compilation

The fully automatic compilation will perform above compilation, packaging, and generating a complete firmware.


3. Partition description

3.1 parameter partition table

parameter.txt has partition information of firmware. Take parameter-buildroot.txt as an example:



CMDLINE attribute is what should be pay attention. Taking uboot as an example, 0x00004000 in 0x00004000 (uboot) is starting position of uboot partition, 0x00002000 is size of partition.

3.2 package-file

package-file is to determine required partition image and image path when packaging firmware, and it needs to be consistent with parameter.txt.



#NAME        Relative path
#HWDEF             HWDEF
bootloader  Image/MiniLoaderAll.bin
parameter   Image/parameter.txt
#trust          Image/trust.img
uboot          Image/uboot.img
misc             Image/misc.img
#resource    Image/resource.img
#kernel        Image/kernel.img
boot            Image/boot.img
recovery      Image/recovery.img
rootfs          Image/rootfs.img
oem             Image/oem.img
userdata      Image/userdata.img 
#The file to be written to backup partition is itself (update.img)
#SELF is keyword that represents upgrade file (update.img) itself
#When generating upgrade file, the content of SELF is not added, but it is recorded in header information
#When unpacking upgrade file, do not unpack contents of SELF.
backup        RESERVED
#update-script   update-script
#recover-script   recover-script 

4. Make image

Compiling source code can get image directly. But if compilation time is too long, some parts do not need to be recompiled, just unpack from existing image, and then package it with newly compiled part. The following is method.

4.1 Tool installation

Download toolkit:

$git clone

Enter toolkit directory:

$cd rk2918_tools



Copy executable to user binary directory:

$sudo cp afptool img_unpack img_maker mkkrnlimg/usr/local/bin

4.2 Unpacking

Copy update.img into Ubuntu and unpack it with the command:

$img_unpack update.img img

Unpack it to img directory. img directory will be automatically generated. After parsing is successful, loader.img and update.img will be generated in img directory.

Then, enter img directory and use afptool-unpack to unzip it:

$afptool -unpack update.img update

Unzip to update directory

Open update directory, there are many img files in it.

Copy required files to rockdev directory.

4.3 Make update.img

use following command in source directory: