diff options
| author | Michal Simek <[email protected]> | 2026-05-11 10:31:52 +0200 |
|---|---|---|
| committer | Leo Yu-Chi Liang <[email protected]> | 2026-07-26 19:39:21 -0700 |
| commit | d8810e1d4f82b8064e4b9e0a52b352670d79ae06 (patch) | |
| tree | ae6ab9a78f0feada391070d0c1831fd88d555dc9 /doc/develop | |
| parent | be256bd560dc3bd19ee42b821d2590fd25f92179 (diff) | |
riscv: Skip riscv_cpu_setup() when CPU driver is disabled
Building on commit c64fc632a86a ("riscv: cpu: Use CONFIG_IS_ENABLED(CPU)
instead of plain ifdef"), add an early return in riscv_cpu_setup() when
CONFIG_CPU is not enabled. This allows platforms to save code space in
SPL by disabling CONFIG_SPL_CPU.
Without this patch, building U-Boot with CONFIG_CPU=n and CONFIG_EVENT=y
is broken: riscv_cpu_setup() is registered as an EVT_DM_POST_INIT_F event
spy, and when the CPU uclass is unavailable uclass_find_first_device()
returns no device, so the function returns -ENODEV. That in turn makes
event_notify_null() in dm_init_and_scan() fail and triggers a boot hang
("initcall initf_dm() failed"). Returning 0 early avoids that failure.
The compiler's dead-code elimination combined with --gc-sections
removes the unreachable code and all associated static data,
achieving significant size reduction without preprocessor guards:
spl/u-boot-spl:all -4332 spl/u-boot-spl:rodata -2872
spl/u-boot-spl:text -1460
Signed-off-by: Michal Simek <[email protected]>
Reviewed-by: Yao Zi <[email protected]>
Diffstat (limited to 'doc/develop')
0 files changed, 0 insertions, 0 deletions
