Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

microblaze: Support simpleImage.dts make target

Instead of remembering to specify DTB= on the make commandline, this commit
allows the much friendlier make simpleImage.<dts>
where <dts>.dts is expected to be found in arch/microblaze/boot/dts/
The resulting vmlinux, with the compiled DTS linked in, will be copied to
boot/simpleImage.<dts>

This mirrors the same functionality as on PowerPC,
albeit achieving it in a slightly different way.

+ strip simpleImage file
The size of output file is very similar to linux.bin.

vmlinux - full elf without fdt blob
simpleImage.<dtb name>.unstrip - full elf with fdt blob
simpleImage.<dtb name> - stripped elf with fdt blob

Add symlink to generic system.dts in platform folder

Signed-off-by: John Williams <john.williams@petalogix.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>

+65 -6
+23 -4
arch/microblaze/Makefile
··· 53 53 54 54 boot := arch/microblaze/boot 55 55 56 + # Are we making a simpleImage.<boardname> target? If so, crack out the boardname 57 + DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS))) 58 + 59 + ifneq ($(DTB),) 60 + core-y += $(boot)/ 61 + endif 62 + 56 63 # defines filename extension depending memory management type 57 64 ifeq ($(CONFIG_MMU),) 58 65 MMU := -nommu 59 66 endif 60 67 61 - export MMU 68 + export MMU DTB 62 69 63 70 all: linux.bin 71 + 72 + BOOT_TARGETS = linux.bin linux.bin.gz simpleImage.% 64 73 65 74 archclean: 66 75 $(Q)$(MAKE) $(clean)=$(boot) 67 76 68 - linux.bin linux.bin.gz: vmlinux 77 + $(BOOT_TARGETS): vmlinux 69 78 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@ 70 79 71 80 define archhelp 72 - echo '* linux.bin - Create raw binary' 73 - echo ' linux.bin.gz - Create compressed raw binary' 81 + echo '* linux.bin - Create raw binary' 82 + echo ' linux.bin.gz - Create compressed raw binary' 83 + echo ' simpleImage.<dt> - ELF image with $(arch)/boot/dts/<dt>.dts linked in' 84 + echo ' - stripped elf with fdt blob 85 + echo ' simpleImage.<dt>.unstrip - full ELF image with fdt blob' 86 + echo ' *_defconfig - Select default config from arch/microblaze/configs' 87 + echo '' 88 + echo ' Targets with <dt> embed a device tree blob inside the image' 89 + echo ' These targets support board with firmware that does not' 90 + echo ' support passing a device tree directly. Replace <dt> with the' 91 + echo ' name of a dts file from the arch/microblaze/boot/dts/ directory' 92 + echo ' (minus the .dts extension).' 74 93 endef
+39 -2
arch/microblaze/boot/Makefile
··· 2 2 # arch/microblaze/boot/Makefile 3 3 # 4 4 5 - targets := linux.bin linux.bin.gz 5 + obj-y += linked_dtb.o 6 + 7 + targets := linux.bin linux.bin.gz simpleImage.% 6 8 7 9 OBJCOPYFLAGS_linux.bin := -O binary 10 + 11 + # Where the DTS files live 12 + dtstree := $(srctree)/$(src)/dts 13 + 14 + # Ensure system.dtb exists 15 + $(obj)/linked_dtb.o: $(obj)/system.dtb 16 + 17 + # Generate system.dtb from $(DTB).dtb 18 + ifneq ($(DTB),system) 19 + $(obj)/system.dtb: $(obj)/$(DTB).dtb 20 + $(call if_changed,cp) 21 + endif 8 22 9 23 $(obj)/linux.bin: vmlinux FORCE 10 24 [ -n $(CONFIG_INITRAMFS_SOURCE) ] && [ ! -e $(CONFIG_INITRAMFS_SOURCE) ] && \ ··· 30 16 $(call if_changed,gzip) 31 17 @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' 32 18 33 - clean-kernel += linux.bin linux.bin.gz 19 + quiet_cmd_cp = CP $< $@$2 20 + cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false) 21 + 22 + quiet_cmd_strip = STRIP $@ 23 + cmd_strip = $(STRIP) -K _start -K _end -K __log_buf -K _fdt_start vmlinux -o $@ 24 + 25 + $(obj)/simpleImage.%: vmlinux FORCE 26 + $(call if_changed,cp,.unstrip) 27 + $(call if_changed,strip) 28 + @echo 'Kernel: $@ is ready' ' (#'`cat .version`')' 29 + 30 + # Rule to build device tree blobs 31 + DTC = $(objtree)/scripts/dtc/dtc 32 + 33 + # Rule to build device tree blobs 34 + quiet_cmd_dtc = DTC $@ 35 + cmd_dtc = $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 -p 1024 $(dtstree)/$*.dts 36 + 37 + $(obj)/%.dtb: $(dtstree)/%.dts FORCE 38 + $(call if_changed,dtc) 39 + 40 + clean-kernel += linux.bin linux.bin.gz simpleImage.* 41 + 42 + clean-files += *.dtb
+3
arch/microblaze/boot/linked_dtb.S
··· 1 + .section __fdt_blob,"a" 2 + .incbin "arch/microblaze/boot/system.dtb" 3 +