How to configure uBoot build options?

I am trying to identify the root cause of why one of my NanoPi R4S units is freezing on reboot (more details here).

With UART connected, during reboot, most of the time U-Boot hangs without any error message. It only shows the initial message below and then stops (a hard power cycle is required):

U-Boot TPL 2024.10-OpenWrt-r28959-29397011cc (Oct 19 2025 - 16:37:45)

I already know that I need to add the following U-Boot configurations to enable additional debug messages:

CONFIG_LOG=y
CONFIG_LOG_CONSOLE=y
CONFIG_LOG_MAX_LEVEL=7
CONFIG_LOG_DEFAULT_LEVEL=7

However, I tried to find where these U-Boot build options should be added in the OpenWrt build system. I looked at the files /package/boot/uboot-rockchip/Makefile and ./include/u-boot.mk, but I did not find any obvious place to add these U-Boot configurations. I know that u-Boot has its own .config, but I cannot find it in OpenWrt source tree.

Question: in the OpenWrt build system, where should I add the U-Boot build options? Should they be added to the global .config file?

Any help is greatly appreciated.

Edited: adding uBoot log configurations to global .config file had no effect.

OK, after some digging, I discovered that:

  • The U-Boot .config file is generated automatically during the OpenWrt build.
  • In order to add new options to the U-Boot .config file, the U-Boot Makefile in OpenWrt source tree needs to be changed. For Rockchip, it is located at package/boot/uboot-rockchip/Makefile.
  • In this file, the U-Boot .config can be customized via UBOOT_CUSTOMIZE_CONFIG.
  • The values to be customized should not include the CONFIG_ prefix.
  • So, to enable U-Boot debug logging for Rockchip, UBOOT_CUSTOMIZE_CONFIG in package/boot/uboot-rockchip/Makefile must be changed as follows:
UBOOT_CUSTOMIZE_CONFIG := \
        --enable LOG \
        --enable LOG_CONSOLE \
        --set-val LOGLEVEL 7 \
        --set-val LOG_MAX_LEVEL 7 \
        --set-val LOG_DEFAULT_LEVEL 7 \
        --disable TOOLS_MKEFICAPSULE \
        --set-str MKIMAGE_DTC_PATH $(PKG_BUILD_DIR)/scripts/dtc/dtc

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.