Build root filesystem

Preparation

System configuration requirement for compiling Buildroot

  • 64 bit CPU

  • 8GB physical+swap memory

  • 30GB free disk space for building, the source tree requires about an another 10GB

We recommend you developing the system based on Ubuntu 64ibt, such as Ubuntu 14.04 64ibt, Ubuntu 16.04 64ibt and etc., since other system versions may have problems.

Initialization for the compiling environment

You need a 64 bit Ubuntu. Please note that the older Ubuntu versions may not be compatible with the package.

  • Ubuntu 14.04 software package installation:

$ sudo apt-get install git gnupg flex bison gperf build-essential \
zip tar curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib mingw32 cmake tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386 lzop
$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gn
u/libGL.so
  • Install the ARM cross compiler toolchain and related software packages for compiling the kernel.

$ sudo apt-get install gcc-arm-linux-gnueabihf \
gcc-aarch64-linux-gnu device-tree-compiler lzop libncurses5-dev \
libssl1.0.0 libssl-dev
  • Currently, Buildroot supports Qt5.9.1 by default. Qt5.9.1 requires the host compiler tool GCC and G++ version to be 4.8 and above. Therefore, if the GCC and G++ version in the current compiling environment is lower than 4.8, please update them first before compiling.

Download SDK

Since the SDK is a larger file, we provide a packed .git for downloading:

Once downloaded successfully, please verify the MD5 code first:

$ md5sum Firefly-PX3-SE_Buildroot_git_180421.7z
21b8c26d61731ce7bacc9000d39f33ed  Firefly-PX3-SE_Buildroot_git_180421.7z

If the above verification is ok, please decompress the package:

mkdir -p ~/proj/Firefly-PX3-SE
cd ~/proj/Firefly-PX3-SE
7zr x Firefly-PX3-SE_Buildroot_git_180421.7z
git reset --hard

Update remote address to resolve permissions issues when updating the repository

git remote set-url gitlab https://gitlab.com/TeeFirefly/px3se-buildroot.git

And then you can update it via gitlab directly:

git pull gitlab firefly-px3se:firefly-px3se

You can also go to https://gitlab.com/TeeFirefly/px3se-buildroot to read the source code online.

Building uboot

Building uboot:

cd ~/proj/Firefly-PX3-SE/u-boot
make px3se_linux_defconfig
make -j8

Building kernel

Building kernel:

cd ~/proj/Firefly-PX3-SE/kernel
make ARCH=arm px3se_linux_defconfig
make ARCH=arm px3se-fireprime.img -j8

Building rootfs and app

Building rootfs and app:

cd ~/proj/Firefly-PX3-SE
. envsetup.sh
cd ~/proj/Firefly-PX3-SE/buildroot/
make rockchip_px3se_defconfig && cd ..
./build_all.sh && ./mkfirmware.sh

In the above code, envsetup.sh is a script for setting the terminal environment variables, which is required to singlely compile some modules via rk_make.sh.

Note: Buildroot is a framework for building embedded Linux system on Linux platform. The whole Buildroot is consisted of Makefile scripts and Kconfig configuration files. In the buildroot/dl/ library, you can find the open source software packages downloaded from their official websites. You can just download it only once and don’t need to download it again, because for the next time to use the package, the system will pick up it directly from the dl/ directory. Therefore, due to the national network limitation, it takes a long time to compile the first compiling. To save your time, we provide the basic software packages for you, you can just download and decompress it, and then copy the dl directory under buildroot/.

  • Open source software package: dl.7z

Firmware compile script

Firefly provides convenient tools for compiling.

  • Building uboot:

cd ~/proj/Firefly-PX3-SE
./FFTools/make.sh -u
  • Building kernel:

cd ~/proj/Firefly-PX3-SE
./FFTools/make.sh -k -d px3se-fireprime

Note: [-d] dts_file_name,use px3se-fireprime.dts by default.

  • Building rootfs and app:

cd ~/proj/Firefly-PX3-SE
./FFTools/make.sh -a
  • Building all:

cd ~/proj/Firefly-PX3-SE
./FFTools/make.sh

Burn partition image

The ./mkimage.sh in the last step will repack the rootfs.img and copy its image files to rockimg/. Frequently used image files for general firmware are as below:

  • kernel.img: kernel image

  • recovery.img: recover mode image

  • resource.img: resource image, containing the bootup logo and the Device Tree for kernel

  • rootfs.img: root filesystem in ext4 filesystem format

Please refer to the article Update firmware to upgrade the partition iamge files.

If you are using Windows, please copy the above image files to the path rockdev\Image of AndroidTool (the firmware upgrade tool for Windows). And then follow the instruction in the above article to burn the partition image. In this way, you do every thing with default configurations and don’t need to modify the file paths.

Package the images into unified firmware

  • If you are using the ubuntu to package the images into unified firmware, once compling the SDK successfully, please run ./FFTools/mkupdate/mkupdate.sh in the SDK root directory to generate a unified firmware with the name like Firefly-PX3SE_Buildroot_DEFAULT_xxxxxx.img.

  • In Windows, it’s easy to package the images into unified firmware. Follow the last step to copy the file into rockdev\Image of AndroidTool, and then run mkupdate.bat batch filing tool under rockdev to create the unified firmware name “update.img” and save it under rockdev\Image.

For firmware release, you can choose update.img since it is designed for end-users to upgrade system, while for developpers, we recommend you to use partition image in the developing process.