xref: /openbmc/linux/arch/nios2/boot/Makefile (revision 01623627)
12fc8483fSLey Foon Tan#
22fc8483fSLey Foon Tan# arch/nios2/boot/Makefile
32fc8483fSLey Foon Tan#
42fc8483fSLey Foon Tan# This file is subject to the terms and conditions of the GNU General Public
52fc8483fSLey Foon Tan# License.  See the file "COPYING" in the main directory of this archive
62fc8483fSLey Foon Tan# for more details.
72fc8483fSLey Foon Tan#
82fc8483fSLey Foon Tan
92fc8483fSLey Foon TanUIMAGE_LOADADDR = $(shell $(NM) vmlinux | awk '$$NF == "_stext" {print $$1}')
102fc8483fSLey Foon TanUIMAGE_ENTRYADDR = $(shell $(NM) vmlinux | awk '$$NF == "_start" {print $$1}')
112fc8483fSLey Foon TanUIMAGE_COMPRESSION = gzip
122fc8483fSLey Foon Tan
132fc8483fSLey Foon TanOBJCOPYFLAGS_vmlinux.bin := -O binary
142fc8483fSLey Foon Tan
152fc8483fSLey Foon Tantargets += vmlinux.bin vmlinux.gz vmImage
162fc8483fSLey Foon Tan
172fc8483fSLey Foon Tan$(obj)/vmlinux.bin: vmlinux FORCE
182fc8483fSLey Foon Tan	$(call if_changed,objcopy)
192fc8483fSLey Foon Tan
202fc8483fSLey Foon Tan$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
212fc8483fSLey Foon Tan	$(call if_changed,gzip)
222fc8483fSLey Foon Tan
232fc8483fSLey Foon Tan$(obj)/vmImage: $(obj)/vmlinux.gz
242fc8483fSLey Foon Tan	$(call if_changed,uimage)
252fc8483fSLey Foon Tan	@$(kecho) 'Kernel: $@ is ready'
262fc8483fSLey Foon Tan
2701623627SLey Foon Tan$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
2801623627SLey Foon Tan	$(call if_changed,objcopy)
2901623627SLey Foon Tan	@$(kecho) 'Kernel: $@ is ready'
3001623627SLey Foon Tan
3101623627SLey Foon Tan$(obj)/compressed/vmlinux: $(obj)/vmlinux.gz FORCE
3201623627SLey Foon Tan	$(Q)$(MAKE) $(build)=$(obj)/compressed $@
3301623627SLey Foon Tan
342fc8483fSLey Foon Tan# Rule to build device tree blobs
352fc8483fSLey Foon TanDTB_SRC := $(patsubst "%",%,$(CONFIG_NIOS2_DTB_SOURCE))
362fc8483fSLey Foon Tan
372fc8483fSLey Foon Tan# Make sure the generated dtb gets removed during clean
382fc8483fSLey Foon Tanextra-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += system.dtb
392fc8483fSLey Foon Tan
402fc8483fSLey Foon Tan$(obj)/system.dtb: $(DTB_SRC) FORCE
412fc8483fSLey Foon Tan	$(call cmd,dtc)
422fc8483fSLey Foon Tan
432fc8483fSLey Foon Tan# Ensure system.dtb exists
442fc8483fSLey Foon Tan$(obj)/linked_dtb.o: $(obj)/system.dtb
452fc8483fSLey Foon Tan
462fc8483fSLey Foon Tanobj-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += linked_dtb.o
472fc8483fSLey Foon Tan
482fc8483fSLey Foon Tantargets += $(dtb-y)
492fc8483fSLey Foon Tan
502fc8483fSLey Foon Tan# Rule to build device tree blobs with make command
512fc8483fSLey Foon Tan$(obj)/%.dtb: $(src)/dts/%.dts FORCE
522fc8483fSLey Foon Tan	$(call if_changed_dep,dtc)
532fc8483fSLey Foon Tan
542fc8483fSLey Foon Tan$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
552fc8483fSLey Foon Tan
562fc8483fSLey Foon Tanclean-files := *.dtb
572fc8483fSLey Foon Tan
582fc8483fSLey Foon Taninstall:
592fc8483fSLey Foon Tan	sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
60