Skip to content

Commit 4e98569

Browse files
committed
Makefile: prefer mkimage for sunxi images
U-Boot's mkimage supports generating Allwinner eGON boot images with the sunxi_egon image type. Prefer that when available, since mkimage is maintained and commonly packaged with U-Boot tools. Keep mksunxiboot as a fallback for setups with older mkimage versions or without mkimage installed. Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
1 parent 5d552bc commit 4e98569

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,17 @@ TARGET_TOOLS = sunxi-meminfo
5151
MISC_TOOLS = phoenix_info sunxi-nand-image-builder
5252

5353
# ARM binaries and images
54-
# Note: To use this target, set/adjust CROSS_COMPILE and MKSUNXIBOOT if needed
54+
# Note: To use this target, set/adjust CROSS_COMPILE, MKIMAGE and MKSUNXIBOOT if needed
5555
BINFILES = jtag-loop.sunxi fel-sdboot.sunxi uart0-helloworld-sdboot.sunxi
5656
BINFILE_ELFS = $(BINFILES:.sunxi=.elf)
5757
BINFILE_BINS = $(BINFILES:.sunxi=.bin)
5858
BOOT_HEAD_ELFS = boot_head_sun3i.elf boot_head_sun4i.elf boot_head_sun5i.elf
5959
CLEANFILES = $(BINFILES) $(BINFILE_ELFS) $(BINFILE_BINS) $(BOOT_HEAD_ELFS)
6060

6161
MKSUNXIBOOT ?= mksunxiboot
62+
MKIMAGE ?= mkimage
63+
MKIMAGE_SUNXI_EGON = $(shell $(MKIMAGE) -T list 2>&1 | grep -q 'sunxi_egon' && echo y)
64+
SUNXI_BOOT_IMAGE = $(if $(MKIMAGE_SUNXI_EGON),$(MKIMAGE) -T sunxi_egon -d,$(MKSUNXIBOOT))
6265
PATH_DIRS := $(shell echo $$PATH | sed -e 's/:/ /g')
6366
# Try to guess a suitable default ARM cross toolchain
6467
CROSS_DEFAULT := arm-none-eabi-
@@ -164,7 +167,7 @@ phoenix_info: phoenix_info.c
164167
$(CROSS_COMPILE)objcopy -O binary $< $@
165168

166169
%.sunxi: %.bin
167-
$(MKSUNXIBOOT) $< $@
170+
$(SUNXI_BOOT_IMAGE) $< $@
168171

169172
ARM_ELF_FLAGS = -Os -marm -fpic -Wall
170173
ARM_ELF_FLAGS += -fno-common -fno-builtin -ffreestanding -nostdinc -fno-strict-aliasing

0 commit comments

Comments
 (0)