]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
kbuild: Move U-Boot .incbin rules to Makefile.lib-u-boot
authorSimon Glass <sjg@chromium.org>
Mon, 13 Apr 2026 13:15:37 +0000 (07:15 -0600)
committerTom Rini <trini@konsulko.com>
Tue, 21 Apr 2026 21:56:54 +0000 (15:56 -0600)
The font, splash-screen and EFI .incbin wrapper rules are U-Boot
additions that do not exist in the upstream Linux kbuild. Keeping them
in scripts/Makefile.lib makes re-syncing with Linux harder than it needs
to be, as every sync must manually preserve the U-Boot additions.

Move these rules into a new scripts/Makefile.lib-u-boot and include it
from Makefile.build and Makefile.xpl, right after the existing
Makefile.lib include.

This is a pure code-move with no functional change.

Suggested-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Rasmus Villemoes <ravi@prevas.dk>
scripts/Makefile.build
scripts/Makefile.lib
scripts/Makefile.lib-u-boot [new file with mode: 0644]
scripts/Makefile.xpl

index 8da9851d43082ec386d4343c08755d288750eed7..e625f99986ecabd97bd9a40174681b80883aeaca 100644 (file)
@@ -65,6 +65,7 @@ ccflags-y  += $(PLATFORM_CPPFLAGS)
 cppflags-y += $(PLATFORM_CPPFLAGS)
 
 include $(srctree)/scripts/Makefile.lib
+include $(srctree)/scripts/Makefile.lib-u-boot
 
 # Do not include hostprogs rules unless needed.
 # $(sort ...) is used here to remove duplicated words and excessive spaces.
index 7386353e0cceb55a437be607ffb3398fb03ad7cc..b8969b7de54cbe7201ce652563a9d4b67a0a242a 100644 (file)
@@ -508,100 +508,6 @@ $(multi-dtb-y): FORCE
        $(call if_changed,fdtoverlay)
 $(call multi_depend, $(multi-dtb-y), .dtb, -dtbs)
 
-# Fonts
-# ---------------------------------------------------------------------------
-
-# Generate an assembly file to wrap the font data
-quiet_cmd_S_ttf= TTF     $@
-# Modified for U-Boot
-cmd_S_ttf=                                             \
-(                                                      \
-       echo '.section .rodata.ttf.init,"a"';           \
-       echo '.balign 16';                              \
-       echo '.global __ttf_$(*F)_begin';               \
-       echo '__ttf_$(*F)_begin:';                      \
-       echo '.incbin "$<" ';                           \
-       echo '__ttf_$(*F)_end:';                        \
-       echo '.global __ttf_$(*F)_end';                 \
-       echo '.balign 16';                              \
-) > $@
-
-$(obj)/%.S: $(src)/%.ttf
-       $(call cmd,S_ttf)
-
-# Splash logos
-# ---------------------------------------------------------------------------
-
-# Generate an assembly file to wrap the splash data
-quiet_cmd_S_splash= TTF     $@
-# Modified for U-Boot
-cmd_S_splash=                                          \
-(                                                      \
-       echo '.section .rodata.splash.init,"a"';                \
-       echo '.balign 16';                              \
-       echo '.global __splash_$(*F)_begin';            \
-       echo '__splash_$(*F)_begin:';                   \
-       echo '.incbin "$<" ';                           \
-       echo '__splash_$(*F)_end:';                     \
-       echo '.global __splash_$(*F)_end';                      \
-       echo '.balign 16';                              \
-) > $@
-
-$(obj)/%.S: $(src)/%.bmp
-       $(call cmd,S_splash)
-
-# EFI applications
-# A Makefile target *.efi is built as EFI application.
-# A Makefile target *_efi.S wraps *.efi as built-in EFI application.
-# ---------------------------------------------------------------------------
-
-# Generate an assembly file to wrap the EFI app
-cmd_S_efi=                                     \
-(                                              \
-       echo '.section .rodata.$*.init,"a"';    \
-       echo '.balign 16';                      \
-       echo '.global __efi_$*_begin';          \
-       echo '__efi_$*_begin:';                 \
-       echo '.incbin "$<" ';                   \
-       echo '__efi_$*_end:';                   \
-       echo '.global __efi_$*_end';            \
-       echo '.balign 16';                      \
-) > $@
-
-$(obj)/%_efi.S: $(obj)/%.efi
-       $(call cmd,S_efi)
-
-quiet_cmd_efi_objcopy = OBJCOPY $@
-cmd_efi_objcopy = $(OBJCOPY) -j .header -j .text -j .sdata -j .data \
-               -j .dynamic -j .dynstr  -j .dynsym -j .rel* -j .reloc \
-               $(if $(EFI_TARGET),$(EFI_TARGET),-O binary) $^ $@
-
-$(obj)/%.efi: $(obj)/%_efi.so
-       $(call cmd,efi_objcopy)
-
-KBUILD_EFILDFLAGS = -nostdlib -zexecstack -znocombreloc -znorelro
-KBUILD_EFILDFLAGS += $(call ld-option,--no-warn-rwx-segments)
-quiet_cmd_efi_ld = LD      $@
-cmd_efi_ld = $(LD) $(KBUILD_EFILDFLAGS) -L $(srctree) -T $(EFI_LDS_PATH) \
-               -shared -Bsymbolic -s $^ $(PLATFORM_LIBGCC) -o $@
-
-EFI_LDS_PATH = arch/$(ARCH)/lib/$(EFI_LDS)
-
-$(obj)/efi_crt0.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_CRT0:.o=.S) FORCE
-       $(call if_changed_dep,as_o_S)
-
-$(obj)/efi_reloc.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_RELOC:.o=.c) $(recordmcount_source) FORCE
-       $(call cmd,force_checksrc)
-       $(call if_changed_rule,cc_o_c)
-
-$(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
-       $(call cmd,efi_ld)
-
-targets += $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
-
-CFLAGS_REMOVE_efi_reloc.o := $(LTO_CFLAGS)
-CFLAGS_REMOVE_efi_freestanding.o := $(LTO_CFLAGS)
-
 # ACPI
 # ---------------------------------------------------------------------------
 #
diff --git a/scripts/Makefile.lib-u-boot b/scripts/Makefile.lib-u-boot
new file mode 100644 (file)
index 0000000..c55f8d8
--- /dev/null
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# U-Boot-specific rules for embedding binary data via .incbin
+# These are split out of Makefile.lib to simplify kbuild re-syncs.
+
+# Fonts
+# ---------------------------------------------------------------------------
+
+# Generate an assembly file to wrap the font data
+quiet_cmd_S_ttf= TTF     $@
+cmd_S_ttf=                                             \
+(                                                      \
+       echo '.section .rodata.ttf.init,"a"';           \
+       echo '.balign 16';                              \
+       echo '.global __ttf_$(*F)_begin';               \
+       echo '__ttf_$(*F)_begin:';                      \
+       echo '.incbin "$<" ';                           \
+       echo '__ttf_$(*F)_end:';                        \
+       echo '.global __ttf_$(*F)_end';                 \
+       echo '.balign 16';                              \
+) > $@
+
+$(obj)/%.S: $(src)/%.ttf
+       $(call cmd,S_ttf)
+
+# Splash logos
+# ---------------------------------------------------------------------------
+
+# Generate an assembly file to wrap the splash data
+quiet_cmd_S_splash= TTF     $@
+cmd_S_splash=                                          \
+(                                                      \
+       echo '.section .rodata.splash.init,"a"';        \
+       echo '.balign 16';                              \
+       echo '.global __splash_$(*F)_begin';            \
+       echo '__splash_$(*F)_begin:';                   \
+       echo '.incbin "$<" ';                           \
+       echo '__splash_$(*F)_end:';                     \
+       echo '.global __splash_$(*F)_end';              \
+       echo '.balign 16';                              \
+) > $@
+
+$(obj)/%.S: $(src)/%.bmp
+       $(call cmd,S_splash)
+
+# EFI applications
+# A Makefile target *.efi is built as EFI application.
+# A Makefile target *_efi.S wraps *.efi as built-in EFI application.
+# ---------------------------------------------------------------------------
+
+# Generate an assembly file to wrap the EFI app
+cmd_S_efi=                                     \
+(                                              \
+       echo '.section .rodata.$*.init,"a"';    \
+       echo '.balign 16';                      \
+       echo '.global __efi_$*_begin';          \
+       echo '__efi_$*_begin:';                 \
+       echo '.incbin "$<" ';                   \
+       echo '__efi_$*_end:';                   \
+       echo '.global __efi_$*_end';            \
+       echo '.balign 16';                      \
+) > $@
+
+$(obj)/%_efi.S: $(obj)/%.efi
+       $(call cmd,S_efi)
+
+quiet_cmd_efi_objcopy = OBJCOPY $@
+cmd_efi_objcopy = $(OBJCOPY) -j .header -j .text -j .sdata -j .data \
+               -j .dynamic -j .dynstr  -j .dynsym -j .rel* -j .reloc \
+               $(if $(EFI_TARGET),$(EFI_TARGET),-O binary) $^ $@
+
+$(obj)/%.efi: $(obj)/%_efi.so
+       $(call cmd,efi_objcopy)
+
+KBUILD_EFILDFLAGS = -nostdlib -zexecstack -znocombreloc -znorelro
+KBUILD_EFILDFLAGS += $(call ld-option,--no-warn-rwx-segments)
+quiet_cmd_efi_ld = LD      $@
+cmd_efi_ld = $(LD) $(KBUILD_EFILDFLAGS) -L $(srctree) -T $(EFI_LDS_PATH) \
+               -shared -Bsymbolic -s $^ $(PLATFORM_LIBGCC) -o $@
+
+EFI_LDS_PATH = arch/$(ARCH)/lib/$(EFI_LDS)
+
+$(obj)/efi_crt0.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_CRT0:.o=.S) FORCE
+       $(call if_changed_dep,as_o_S)
+
+$(obj)/efi_reloc.o: $(srctree)/arch/$(ARCH)/lib/$(EFI_RELOC:.o=.c) $(recordmcount_source) FORCE
+       $(call cmd,force_checksrc)
+       $(call if_changed_rule,cc_o_c)
+
+$(obj)/%_efi.so: $(obj)/%.o $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
+       $(call cmd,efi_ld)
+
+targets += $(obj)/efi_crt0.o $(obj)/efi_reloc.o $(obj)/efi_freestanding.o
+
+CFLAGS_REMOVE_efi_reloc.o := $(LTO_CFLAGS)
+CFLAGS_REMOVE_efi_freestanding.o := $(LTO_CFLAGS)
index c5ddf64c73fe4b37a5f5ee368211836e56d1fde2..862a8e6f2315b3e723bb055c84b7b3a26cf2c7d0 100644 (file)
@@ -88,6 +88,7 @@ include $(srctree)/config.mk
 include $(srctree)/arch/$(ARCH)/Makefile
 
 include $(srctree)/scripts/Makefile.lib
+include $(srctree)/scripts/Makefile.lib-u-boot
 
 # Enable garbage collection of un-used sections for SPL
 KBUILD_CFLAGS += -ffunction-sections -fdata-sections