xref: /openbmc/linux/arch/arc/boot/Makefile (revision a72594ca)
1# SPDX-License-Identifier: GPL-2.0
2targets := vmlinux.bin vmlinux.bin.gz uImage
3
4# uImage build relies on mkimage being availble on your host for ARC target
5# You will need to build u-boot for ARC, rename mkimage to arc-elf32-mkimage
6# and make sure it's reacable from your PATH
7
8OBJCOPYFLAGS= -O binary -R .note -R .note.gnu.build-id -R .comment -S
9
10LINUX_START_TEXT = $$(readelf -h vmlinux | \
11			grep "Entry point address" | grep -o 0x.*)
12
13UIMAGE_LOADADDR    = $(CONFIG_LINUX_LINK_BASE)
14UIMAGE_ENTRYADDR   = $(LINUX_START_TEXT)
15
16suffix-y := bin
17suffix-$(CONFIG_KERNEL_GZIP)	:= gz
18suffix-$(CONFIG_KERNEL_LZMA)	:= lzma
19
20targets += uImage
21targets += uImage.bin
22targets += uImage.gz
23targets += uImage.lzma
24extra-y += vmlinux.bin
25extra-y += vmlinux.bin.gz
26extra-y += vmlinux.bin.lzma
27
28$(obj)/vmlinux.bin: vmlinux FORCE
29	$(call if_changed,objcopy)
30
31$(obj)/vmlinux.bin.gz: $(obj)/vmlinux.bin FORCE
32	$(call if_changed,gzip)
33
34$(obj)/vmlinux.bin.lzma: $(obj)/vmlinux.bin FORCE
35	$(call if_changed,lzma)
36
37$(obj)/uImage.bin: $(obj)/vmlinux.bin FORCE
38	$(call if_changed,uimage,none)
39
40$(obj)/uImage.gz: $(obj)/vmlinux.bin.gz FORCE
41	$(call if_changed,uimage,gzip)
42
43$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma FORCE
44	$(call if_changed,uimage,lzma)
45
46$(obj)/uImage: $(obj)/uImage.$(suffix-y)
47	@ln -sf $(notdir $<) $@
48	@echo '  Image $@ is ready'
49