xref: /openbmc/linux/arch/microblaze/boot/Makefile (revision 1fa6ac37)
1#
2# arch/microblaze/boot/Makefile
3#
4
5MKIMAGE := $(srctree)/scripts/mkuboot.sh
6
7obj-y += linked_dtb.o
8
9targets := linux.bin linux.bin.gz simpleImage.%
10
11OBJCOPYFLAGS := -O binary
12
13# Where the DTS files live
14dtstree         := $(srctree)/$(src)/dts
15
16# Ensure system.dtb exists
17$(obj)/linked_dtb.o: $(obj)/system.dtb
18
19# Generate system.dtb from $(DTB).dtb
20ifneq ($(DTB),system)
21$(obj)/system.dtb: $(obj)/$(DTB).dtb
22	$(call if_changed,cp)
23endif
24
25$(obj)/linux.bin: vmlinux FORCE
26	$(call if_changed,objcopy)
27	$(call if_changed,uimage)
28	@echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
29
30$(obj)/linux.bin.gz: $(obj)/linux.bin FORCE
31	$(call if_changed,gzip)
32	@echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
33
34quiet_cmd_cp = CP      $< $@$2
35	cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
36
37quiet_cmd_strip = STRIP   $@
38      cmd_strip = $(STRIP) -K _start -K _end -K __log_buf -K _fdt_start vmlinux -o $@
39
40quiet_cmd_uimage = UIMAGE  $@.ub
41      cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A microblaze -O linux -T kernel \
42                   -C none -n 'Linux-$(KERNELRELEASE)' \
43                   -a $(CONFIG_KERNEL_BASE_ADDR) -e $(CONFIG_KERNEL_BASE_ADDR) \
44                   -d $@ $@.ub
45
46$(obj)/simpleImage.%: vmlinux FORCE
47	$(call if_changed,cp,.unstrip)
48	$(call if_changed,objcopy)
49	$(call if_changed,uimage)
50	$(call if_changed,strip)
51	@echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
52
53# Rule to build device tree blobs
54DTC = $(objtree)/scripts/dtc/dtc
55
56# Rule to build device tree blobs
57quiet_cmd_dtc = DTC     $@
58	cmd_dtc = $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 -p 1024 $(dtstree)/$*.dts
59
60$(obj)/%.dtb: $(dtstree)/%.dts FORCE
61	$(call if_changed,dtc)
62
63clean-files += *.dtb simpleImage.*.unstrip linux.bin.ub
64