162306a36Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci
362306a36Sopenharmony_ci# uImage build relies on mkimage being availble on your host for ARC target
462306a36Sopenharmony_ci# You will need to build u-boot for ARC, rename mkimage to arc-elf32-mkimage
562306a36Sopenharmony_ci# and make sure it's reacable from your PATH
662306a36Sopenharmony_ci
762306a36Sopenharmony_ciOBJCOPYFLAGS= -O binary -R .note -R .note.gnu.build-id -R .comment -S
862306a36Sopenharmony_ci
962306a36Sopenharmony_ciLINUX_START_TEXT = $$($(READELF) -h vmlinux | \
1062306a36Sopenharmony_ci			grep "Entry point address" | grep -o 0x.*)
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ciUIMAGE_LOADADDR    = $(CONFIG_LINUX_LINK_BASE)
1362306a36Sopenharmony_ciUIMAGE_ENTRYADDR   = $(LINUX_START_TEXT)
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_citargets += vmlinux.bin
1662306a36Sopenharmony_citargets += vmlinux.bin.gz
1762306a36Sopenharmony_citargets += vmlinux.bin.lzma
1862306a36Sopenharmony_citargets += uImage.bin
1962306a36Sopenharmony_citargets += uImage.gz
2062306a36Sopenharmony_citargets += uImage.lzma
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci$(obj)/vmlinux.bin: vmlinux FORCE
2362306a36Sopenharmony_ci	$(call if_changed,objcopy)
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
2662306a36Sopenharmony_ci	$(call if_changed,gzip)
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
2962306a36Sopenharmony_ci	$(call if_changed,lzma)
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci$(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE
3262306a36Sopenharmony_ci	$(call if_changed,uimage,none)
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
3562306a36Sopenharmony_ci	$(call if_changed,uimage,gzip)
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma FORCE
3862306a36Sopenharmony_ci	$(call if_changed,uimage,lzma)
39