Openwrt compile

This chapter introduces the compilation process of Openwrt/Lede firmware. It is recommended to use Ubuntu18.04 to compile.

For how to use the Openwrt/Lede system, please check the wiki 《Openwrt User Manual

Get the source code

mkdir firefly_openwrt
cd firefly_openwrt
repo init --repo-url=https://gitlab.com/firefly-linux/git-repo -u https://gitlab.com/firefly-linux/manifests -b master -m rk356x_openwrt_release.xml --no-clone-bundle
.repo/repo/repo sync -c --no-clone-bundle

After obtaining the source code, update the code from the official website and run it directly:

.repo/repo/repo sync -c --no-clone-bundle

Configure before Compile

  • Compile Openwrt firmware

./build.sh roc-rk3566-pc-openwrt.mk
  • Compile Lede firmware

./build.sh roc-rk3566-pc-lede.mk

Auto Compile

Compile after configuration

./build.sh all
./build.sh firmware

Manual Compile

Compile uboot

./build.sh uboot

Compile kernel

./build.sh kernel

Compile openwrt

Method 1:

./build.sh openwrt

Method 2:

cd openwrt_sdk/openwrt/
# Or cd openwrt_sdk/lede/: It depends on the version you compiled
./scripts/feeds update -a
./scripts/feeds install -a
cp configs/XXXX_config .config
make defconfig
make download -j8
make -j8

Compile recovery

./build.sh recovery

Package the firmware

Prepare before package firmware

./build.sh firmware

SDK supports packaging two kinds of firmware:

The first type: flash firmware, SD card upgrade firmware

./build.sh updateimg

The second type: SD card boot firmware

./build.sh rawimg

Firmware burning

Wire flash firmware, SD card upgrade firmware

Please read the Wiki tutorials “Using USB cable to upgrade firmware” and “[Using SD card to upgrade firmware](05 -upgrade_firmware_sd.html#shi-yong-sd-ka-sheng-ji-gu-jian)”

SD card boot firmware

Use tool balenaEtcher, download link: https://www.balena.io/etcher/

Custom firmware

Take firefly-rk3568-roc-pc_openwrt.mk as an example,

# Uboot defconfig
export RK_UBOOT_DEFCONFIG=firefly-rk3568
# Kernel defconfig
export RK_KERNEL_DEFCONFIG=station_linux_defconfig
# Kernel dts
export RK_KERNEL_DTS=rk3568-firefly-roc-pc

# Openwrt version select
export RK_OPENWRT_VERSION_SELECT=openwrt
# Openwrt defconfig
export RK_OPENWRT_DEFCONFIG=ROC-3568-PC_config
  • RK_UBOOT_DEFCONFIG=firefly-rk3568

    This parameter specifies the uboot configuration file to be used, and the path is u-boot/configs/firefly-rk3568_defconfig

  • RK_KERNEL_DEFCONFIG=station_linux_defconfig

    This parameter specifies the kernel configuration file to be used, and the path is kernel/arch/arm64/configs/station_linux_defconfig

  • RK_KERNEL_DTS=rk3568-firefly-roc-pc

    This parameter specifies the kernel device tree file, and the path is kernel/arch/arm64/boot/dts/rockchip/rk3568-firefly-roc-pc.dts

  • RK_OPENWRT_VERSION_SELECT=openwrt

    This parameter indicates the Openwrt system to be compiled, if it is openwrt, compile openwrt_sdk/openwrt/

    If it is lede, compile openwrt_sdk/lede

  • RK_OPENWRT_DEFCONFIG=ROC-3568-PC_config

    This parameter specifies the configuration file used to compile openwrt, and the path is openwrt_sdk/openwrt/configs/ROC-3568-PC_config