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>
This commit is contained in:
@@ -53,22 +53,41 @@ core-y += arch/microblaze/platform/
|
|||||||
|
|
||||||
boot := arch/microblaze/boot
|
boot := arch/microblaze/boot
|
||||||
|
|
||||||
|
# Are we making a simpleImage.<boardname> target? If so, crack out the boardname
|
||||||
|
DTB:=$(subst simpleImage.,,$(filter simpleImage.%, $(MAKECMDGOALS)))
|
||||||
|
|
||||||
|
ifneq ($(DTB),)
|
||||||
|
core-y += $(boot)/
|
||||||
|
endif
|
||||||
|
|
||||||
# defines filename extension depending memory management type
|
# defines filename extension depending memory management type
|
||||||
ifeq ($(CONFIG_MMU),)
|
ifeq ($(CONFIG_MMU),)
|
||||||
MMU := -nommu
|
MMU := -nommu
|
||||||
endif
|
endif
|
||||||
|
|
||||||
export MMU
|
export MMU DTB
|
||||||
|
|
||||||
all: linux.bin
|
all: linux.bin
|
||||||
|
|
||||||
|
BOOT_TARGETS = linux.bin linux.bin.gz simpleImage.%
|
||||||
|
|
||||||
archclean:
|
archclean:
|
||||||
$(Q)$(MAKE) $(clean)=$(boot)
|
$(Q)$(MAKE) $(clean)=$(boot)
|
||||||
|
|
||||||
linux.bin linux.bin.gz: vmlinux
|
$(BOOT_TARGETS): vmlinux
|
||||||
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
|
$(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
|
||||||
|
|
||||||
define archhelp
|
define archhelp
|
||||||
echo '* linux.bin - Create raw binary'
|
echo '* linux.bin - Create raw binary'
|
||||||
echo ' linux.bin.gz - Create compressed raw binary'
|
echo ' linux.bin.gz - Create compressed raw binary'
|
||||||
|
echo ' simpleImage.<dt> - ELF image with $(arch)/boot/dts/<dt>.dts linked in'
|
||||||
|
echo ' - stripped elf with fdt blob
|
||||||
|
echo ' simpleImage.<dt>.unstrip - full ELF image with fdt blob'
|
||||||
|
echo ' *_defconfig - Select default config from arch/microblaze/configs'
|
||||||
|
echo ''
|
||||||
|
echo ' Targets with <dt> embed a device tree blob inside the image'
|
||||||
|
echo ' These targets support board with firmware that does not'
|
||||||
|
echo ' support passing a device tree directly. Replace <dt> with the'
|
||||||
|
echo ' name of a dts file from the arch/microblaze/boot/dts/ directory'
|
||||||
|
echo ' (minus the .dts extension).'
|
||||||
endef
|
endef
|
||||||
|
@@ -2,10 +2,24 @@
|
|||||||
# arch/microblaze/boot/Makefile
|
# arch/microblaze/boot/Makefile
|
||||||
#
|
#
|
||||||
|
|
||||||
targets := linux.bin linux.bin.gz
|
obj-y += linked_dtb.o
|
||||||
|
|
||||||
|
targets := linux.bin linux.bin.gz simpleImage.%
|
||||||
|
|
||||||
OBJCOPYFLAGS_linux.bin := -O binary
|
OBJCOPYFLAGS_linux.bin := -O binary
|
||||||
|
|
||||||
|
# Where the DTS files live
|
||||||
|
dtstree := $(srctree)/$(src)/dts
|
||||||
|
|
||||||
|
# Ensure system.dtb exists
|
||||||
|
$(obj)/linked_dtb.o: $(obj)/system.dtb
|
||||||
|
|
||||||
|
# Generate system.dtb from $(DTB).dtb
|
||||||
|
ifneq ($(DTB),system)
|
||||||
|
$(obj)/system.dtb: $(obj)/$(DTB).dtb
|
||||||
|
$(call if_changed,cp)
|
||||||
|
endif
|
||||||
|
|
||||||
$(obj)/linux.bin: vmlinux FORCE
|
$(obj)/linux.bin: vmlinux FORCE
|
||||||
[ -n $(CONFIG_INITRAMFS_SOURCE) ] && [ ! -e $(CONFIG_INITRAMFS_SOURCE) ] && \
|
[ -n $(CONFIG_INITRAMFS_SOURCE) ] && [ ! -e $(CONFIG_INITRAMFS_SOURCE) ] && \
|
||||||
touch $(CONFIG_INITRAMFS_SOURCE) || echo "No CPIO image"
|
touch $(CONFIG_INITRAMFS_SOURCE) || echo "No CPIO image"
|
||||||
@@ -16,4 +30,27 @@ $(obj)/linux.bin.gz: $(obj)/linux.bin FORCE
|
|||||||
$(call if_changed,gzip)
|
$(call if_changed,gzip)
|
||||||
@echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
|
@echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
|
||||||
|
|
||||||
clean-kernel += linux.bin linux.bin.gz
|
quiet_cmd_cp = CP $< $@$2
|
||||||
|
cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
|
||||||
|
|
||||||
|
quiet_cmd_strip = STRIP $@
|
||||||
|
cmd_strip = $(STRIP) -K _start -K _end -K __log_buf -K _fdt_start vmlinux -o $@
|
||||||
|
|
||||||
|
$(obj)/simpleImage.%: vmlinux FORCE
|
||||||
|
$(call if_changed,cp,.unstrip)
|
||||||
|
$(call if_changed,strip)
|
||||||
|
@echo 'Kernel: $@ is ready' ' (#'`cat .version`')'
|
||||||
|
|
||||||
|
# Rule to build device tree blobs
|
||||||
|
DTC = $(objtree)/scripts/dtc/dtc
|
||||||
|
|
||||||
|
# Rule to build device tree blobs
|
||||||
|
quiet_cmd_dtc = DTC $@
|
||||||
|
cmd_dtc = $(DTC) -O dtb -o $(obj)/$*.dtb -b 0 -p 1024 $(dtstree)/$*.dts
|
||||||
|
|
||||||
|
$(obj)/%.dtb: $(dtstree)/%.dts FORCE
|
||||||
|
$(call if_changed,dtc)
|
||||||
|
|
||||||
|
clean-kernel += linux.bin linux.bin.gz simpleImage.*
|
||||||
|
|
||||||
|
clean-files += *.dtb
|
||||||
|
1
arch/microblaze/boot/dts/system.dts
Symbolic link
1
arch/microblaze/boot/dts/system.dts
Symbolic link
@@ -0,0 +1 @@
|
|||||||
|
../../platform/generic/system.dts
|
3
arch/microblaze/boot/linked_dtb.S
Normal file
3
arch/microblaze/boot/linked_dtb.S
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.section __fdt_blob,"a"
|
||||||
|
.incbin "arch/microblaze/boot/system.dtb"
|
||||||
|
|
Reference in New Issue
Block a user