arc: use patched .dts from sources
[openwrt/openwrt.git] / target / linux / arc770 / image / Makefile
1 #
2 # Copyright (C) 2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 # On ARC initramfs is put before entry point and so entry point moves
11 # in memory from build to built. Thus we need to extract EP from vmlinux
12 # every time late in building process.
13 define Build/calculate-ep
14 $(eval KERNEL_ENTRY=$(shell $(KERNEL_CROSS)readelf -h $(LINUX_DIR)/vmlinux | grep "Entry point address" | grep -o 0x.*))
15 endef
16
17 define Build/patch-dtb
18 $(call Image/BuildDTB,$(DTS_DIR)/$(DEVICE_DTS).dts,$@.dtb)
19 $(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
20 endef
21
22 # Shared device definition: applies to every defined device
23 define Device/Default
24 PROFILES = Default $$(DEVICE_PROFILE)
25 KERNEL_DEPENDS = $$(wildcard ../dts/$$(DEVICE_DTS).dts)
26 DEVICE_PROFILE :=
27 endef
28 DEVICE_VARS += DEVICE_PROFILE
29
30 define Device/vmlinux
31 KERNEL_SUFFIX := .elf
32 KERNEL_INITRAMFS := kernel-bin | patch-dtb
33 KERNEL_INITRAMFS_NAME = vmlinux-initramfs.elf
34 endef
35
36 define Device/uImage
37 KERNEL_SUFFIX := .bin
38 KERNEL_INITRAMFS := kernel-bin | patch-dtb | calculate-ep | uImage none
39 KERNEL_LOADADDR := 0x80000000
40 endef
41
42 define add_arc770_uImage
43 define Device/$(1)-uImage
44 $(call Device/uImage)
45 DEVICE_PROFILE := $(1)
46 DEVICE_DTS := $(1)
47 endef
48 TARGET_DEVICES += $(1)-uImage
49 endef
50
51 define add_arc770_vmlinux
52 define Device/$(1)-vmlinux
53 $(call Device/vmlinux)
54 DEVICE_PROFILE := $(1)
55 DEVICE_DTS := $(1)
56 endef
57 TARGET_DEVICES += $(1)-vmlinux
58 endef
59
60 # DesignWare AXS101
61 $(eval $(call add_arc770_vmlinux,axs101))
62 $(eval $(call add_arc770_uImage,axs101))
63
64 # nSIM with ARC770
65 $(eval $(call add_arc770_vmlinux,nsim_700))
66 $(eval $(call add_arc770_uImage,nsim_700))
67
68 $(eval $(call BuildImage))