xref: /linux/arch/nios2/boot/Makefile (revision 2fc8483fdcde767795402a38a53e647811dc9abf)
1*2fc8483fSLey Foon Tan#
2*2fc8483fSLey Foon Tan# arch/nios2/boot/Makefile
3*2fc8483fSLey Foon Tan#
4*2fc8483fSLey Foon Tan# This file is subject to the terms and conditions of the GNU General Public
5*2fc8483fSLey Foon Tan# License.  See the file "COPYING" in the main directory of this archive
6*2fc8483fSLey Foon Tan# for more details.
7*2fc8483fSLey Foon Tan#
8*2fc8483fSLey Foon Tan
9*2fc8483fSLey Foon TanUIMAGE_LOADADDR = $(shell $(NM) vmlinux | awk '$$NF == "_stext" {print $$1}')
10*2fc8483fSLey Foon TanUIMAGE_ENTRYADDR = $(shell $(NM) vmlinux | awk '$$NF == "_start" {print $$1}')
11*2fc8483fSLey Foon TanUIMAGE_COMPRESSION = gzip
12*2fc8483fSLey Foon Tan
13*2fc8483fSLey Foon TanOBJCOPYFLAGS_vmlinux.bin := -O binary
14*2fc8483fSLey Foon Tan
15*2fc8483fSLey Foon Tantargets += vmlinux.bin vmlinux.gz vmImage
16*2fc8483fSLey Foon Tan
17*2fc8483fSLey Foon Tan$(obj)/vmlinux.bin: vmlinux FORCE
18*2fc8483fSLey Foon Tan	$(call if_changed,objcopy)
19*2fc8483fSLey Foon Tan
20*2fc8483fSLey Foon Tan$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
21*2fc8483fSLey Foon Tan	$(call if_changed,gzip)
22*2fc8483fSLey Foon Tan
23*2fc8483fSLey Foon Tan$(obj)/vmImage: $(obj)/vmlinux.gz
24*2fc8483fSLey Foon Tan	$(call if_changed,uimage)
25*2fc8483fSLey Foon Tan	@$(kecho) 'Kernel: $@ is ready'
26*2fc8483fSLey Foon Tan
27*2fc8483fSLey Foon Tan# Rule to build device tree blobs
28*2fc8483fSLey Foon TanDTB_SRC := $(patsubst "%",%,$(CONFIG_NIOS2_DTB_SOURCE))
29*2fc8483fSLey Foon Tan
30*2fc8483fSLey Foon Tan# Make sure the generated dtb gets removed during clean
31*2fc8483fSLey Foon Tanextra-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += system.dtb
32*2fc8483fSLey Foon Tan
33*2fc8483fSLey Foon Tan$(obj)/system.dtb: $(DTB_SRC) FORCE
34*2fc8483fSLey Foon Tan	$(call cmd,dtc)
35*2fc8483fSLey Foon Tan
36*2fc8483fSLey Foon Tan# Ensure system.dtb exists
37*2fc8483fSLey Foon Tan$(obj)/linked_dtb.o: $(obj)/system.dtb
38*2fc8483fSLey Foon Tan
39*2fc8483fSLey Foon Tanobj-$(CONFIG_NIOS2_DTB_SOURCE_BOOL) += linked_dtb.o
40*2fc8483fSLey Foon Tan
41*2fc8483fSLey Foon Tantargets += $(dtb-y)
42*2fc8483fSLey Foon Tan
43*2fc8483fSLey Foon Tan# Rule to build device tree blobs with make command
44*2fc8483fSLey Foon Tan$(obj)/%.dtb: $(src)/dts/%.dts FORCE
45*2fc8483fSLey Foon Tan	$(call if_changed_dep,dtc)
46*2fc8483fSLey Foon Tan
47*2fc8483fSLey Foon Tan$(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
48*2fc8483fSLey Foon Tan
49*2fc8483fSLey Foon Tanclean-files := *.dtb
50*2fc8483fSLey Foon Tan
51*2fc8483fSLey Foon Taninstall:
52*2fc8483fSLey Foon Tan	sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
53