18c2ecf20Sopenharmony_ci# SPDX-License-Identifier: GPL-2.0
28c2ecf20Sopenharmony_citargets := vmlinux.bin vmlinux.bin.gz
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci# uImage build relies on mkimage being availble on your host for ARC target
58c2ecf20Sopenharmony_ci# You will need to build u-boot for ARC, rename mkimage to arc-elf32-mkimage
68c2ecf20Sopenharmony_ci# and make sure it's reacable from your PATH
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ciOBJCOPYFLAGS= -O binary -R .note -R .note.gnu.build-id -R .comment -S
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciLINUX_START_TEXT = $$(readelf -h vmlinux | \
118c2ecf20Sopenharmony_ci			grep "Entry point address" | grep -o 0x.*)
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciUIMAGE_LOADADDR    = $(CONFIG_LINUX_LINK_BASE)
148c2ecf20Sopenharmony_ciUIMAGE_ENTRYADDR   = $(LINUX_START_TEXT)
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_citargets += uImage.bin
178c2ecf20Sopenharmony_citargets += uImage.gz
188c2ecf20Sopenharmony_citargets += uImage.lzma
198c2ecf20Sopenharmony_ciextra-y += vmlinux.bin
208c2ecf20Sopenharmony_ciextra-y += vmlinux.bin.gz
218c2ecf20Sopenharmony_ciextra-y += vmlinux.bin.lzma
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin: vmlinux FORCE
248c2ecf20Sopenharmony_ci	$(call if_changed,objcopy)
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
278c2ecf20Sopenharmony_ci	$(call if_changed,gzip)
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
308c2ecf20Sopenharmony_ci	$(call if_changed,lzma)
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci$(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE
338c2ecf20Sopenharmony_ci	$(call if_changed,uimage,none)
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
368c2ecf20Sopenharmony_ci	$(call if_changed,uimage,gzip)
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma FORCE
398c2ecf20Sopenharmony_ci	$(call if_changed,uimage,lzma)
40