summaryrefslogtreecommitdiff
path: root/target/linux/arc770/image/Makefile
blob: ca204a4a5543e91daaed1c0ee57cb49a8b4d1391 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/image.mk

# On ARC initramfs is put before entry point and so entry point moves
# in memory from build to built. Thus we need to extract EP from vmlinux
# every time late in building process.
define Build/calculate-ep
	$(eval KERNEL_ENTRY=$(shell $(KERNEL_CROSS)readelf -h $(LINUX_DIR)/vmlinux | grep "Entry point address" | grep -o 0x.*))
endef

define Build/patch-dtb
	$(call Image/BuildDTB,$(DTS_DIR)/$(DEVICE_DTS).dts,$@.dtb)
	$(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
endef

# Shared device definition: applies to every defined device
define Device/Default
  PROFILES = Default $$(DEVICE_PROFILE)
  KERNEL_DEPENDS = $$(wildcard ../dts/$$(DEVICE_DTS).dts)
  DEVICE_PROFILE :=
endef
DEVICE_VARS += DEVICE_PROFILE

define Device/vmlinux
  KERNEL_SUFFIX := .elf
  KERNEL_INITRAMFS := kernel-bin | patch-dtb
  KERNEL_INITRAMFS_NAME = vmlinux-initramfs.elf
endef

define Device/uImage
  KERNEL_SUFFIX := .bin
  KERNEL_INITRAMFS := kernel-bin | patch-dtb | calculate-ep | uImage none
  KERNEL_LOADADDR := 0x80000000
endef

define add_arc770_uImage
  define Device/$(1)-uImage
    $(call Device/uImage)
    DEVICE_PROFILE := $(1)
    DEVICE_DTS := $(1)
  endef
  TARGET_DEVICES += $(1)-uImage
endef

define add_arc770_vmlinux
  define Device/$(1)-vmlinux
    $(call Device/vmlinux)
    DEVICE_PROFILE := $(1)
    DEVICE_DTS := $(1)
  endef
  TARGET_DEVICES += $(1)-vmlinux
endef

# DesignWare AXS101
$(eval $(call add_arc770_vmlinux,axs101))
$(eval $(call add_arc770_uImage,axs101))

# nSIM with ARC770
$(eval $(call add_arc770_vmlinux,nsim_700))
$(eval $(call add_arc770_uImage,nsim_700))

$(eval $(call BuildImage))