Skip to content

Commit d4ea881

Browse files
committed
Merge branch 'for-next/kbuild' into for-next/core
* for-next/kbuild: arm64: boot: Support Flat Image Tree arm64: Add BOOT_TARGETS variable
2 parents b2b7cc6 + 7a23b02 commit d4ea881

File tree

7 files changed

+337
-3
lines changed

7 files changed

+337
-3
lines changed

Documentation/process/changes.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ Sphinx\ [#f1]_ 2.4.4 sphinx-build --version
6262
cpio any cpio --version
6363
GNU tar 1.28 tar --version
6464
gtags (optional) 6.6.5 gtags --version
65+
mkimage (optional) 2017.01 mkimage --version
6566
====================== =============== ========================================
6667

6768
.. [#f1] Sphinx is needed only to build the Kernel documentation
@@ -189,6 +190,14 @@ The kernel build requires GNU GLOBAL version 6.6.5 or later to generate
189190
tag files through ``make gtags``. This is due to its use of the gtags
190191
``-C (--directory)`` flag.
191192

193+
mkimage
194+
-------
195+
196+
This tool is used when building a Flat Image Tree (FIT), commonly used on ARM
197+
platforms. The tool is available via the ``u-boot-tools`` package or can be
198+
built from the U-Boot source code. See the instructions at
199+
https://docs.u-boot.org/en/latest/build/tools.html#building-tools-for-linux
200+
192201
System utilities
193202
****************
194203

MAINTAINERS

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3051,6 +3051,13 @@ F: drivers/mmc/host/sdhci-of-arasan.c
30513051
N: zynq
30523052
N: xilinx
30533053

3054+
ARM64 FIT SUPPORT
3055+
M: Simon Glass <[email protected]>
3056+
L: [email protected] (moderated for non-subscribers)
3057+
S: Maintained
3058+
F: arch/arm64/boot/Makefile
3059+
F: scripts/make_fit.py
3060+
30543061
ARM64 PORT (AARCH64 ARCHITECTURE)
30553062
M: Catalin Marinas <[email protected]>
30563063
M: Will Deacon <[email protected]>

arch/arm64/Makefile

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ libs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a
154154
# Default target when executing plain make
155155
boot := arch/arm64/boot
156156

157+
BOOT_TARGETS := Image vmlinuz.efi image.fit
158+
159+
PHONY += $(BOOT_TARGETS)
160+
157161
ifeq ($(CONFIG_EFI_ZBOOT),)
158162
KBUILD_IMAGE := $(boot)/Image.gz
159163
else
@@ -162,8 +166,10 @@ endif
162166

163167
all: $(notdir $(KBUILD_IMAGE))
164168

165-
vmlinuz.efi: Image
166-
Image vmlinuz.efi: vmlinux
169+
image.fit: dtbs
170+
171+
vmlinuz.efi image.fit: Image
172+
$(BOOT_TARGETS): vmlinux
167173
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
168174

169175
Image.%: Image
@@ -215,6 +221,7 @@ virtconfig:
215221
define archhelp
216222
echo '* Image.gz - Compressed kernel image (arch/$(ARCH)/boot/Image.gz)'
217223
echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
224+
echo ' image.fit - Flat Image Tree (arch/$(ARCH)/boot/image.fit)'
218225
echo ' install - Install uncompressed kernel'
219226
echo ' zinstall - Install compressed kernel'
220227
echo ' Install using (your) ~/bin/installkernel or'

arch/arm64/boot/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
Image
33
Image.gz
44
vmlinuz*
5+
image.fit

arch/arm64/boot/Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616

1717
OBJCOPYFLAGS_Image :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
1818

19-
targets := Image Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo Image.zst
19+
targets := Image Image.bz2 Image.gz Image.lz4 Image.lzma Image.lzo \
20+
Image.zst image.fit
2021

2122
$(obj)/Image: vmlinux FORCE
2223
$(call if_changed,objcopy)
@@ -39,6 +40,9 @@ $(obj)/Image.lzo: $(obj)/Image FORCE
3940
$(obj)/Image.zst: $(obj)/Image FORCE
4041
$(call if_changed,zstd)
4142

43+
$(obj)/image.fit: $(obj)/Image $(obj)/dts/dtbs-list FORCE
44+
$(call if_changed,fit)
45+
4246
EFI_ZBOOT_PAYLOAD := Image
4347
EFI_ZBOOT_BFD_TARGET := elf64-littleaarch64
4448
EFI_ZBOOT_MACH_TYPE := ARM64

scripts/Makefile.lib

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,22 @@ quiet_cmd_uimage = UIMAGE $@
504504
-a $(UIMAGE_LOADADDR) -e $(UIMAGE_ENTRYADDR) \
505505
-n '$(UIMAGE_NAME)' -d $< $@
506506

507+
# Flat Image Tree (FIT)
508+
# This allows for packaging of a kernel and all devicetrees files, using
509+
# compression.
510+
# ---------------------------------------------------------------------------
511+
512+
MAKE_FIT := $(srctree)/scripts/make_fit.py
513+
514+
# Use this to override the compression algorithm
515+
FIT_COMPRESSION ?= gzip
516+
517+
quiet_cmd_fit = FIT $@
518+
cmd_fit = $(MAKE_FIT) -o $@ --arch $(UIMAGE_ARCH) --os linux \
519+
--name '$(UIMAGE_NAME)' \
520+
$(if $(findstring 1,$(KBUILD_VERBOSE)),-v) \
521+
--compress $(FIT_COMPRESSION) -k $< @$(word 2,$^)
522+
507523
# XZ
508524
# ---------------------------------------------------------------------------
509525
# Use xzkern to compress the kernel image and xzmisc to compress other things.

0 commit comments

Comments
 (0)