2 # Copyright (C) 2016 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
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 before generation of uImage.
13 define Build/calculate-ep
14 $(eval KERNEL_ENTRY=$(shell $(KERNEL_CROSS)readelf -h $(LINUX_DIR)/vmlinux | grep "Entry point address" | grep -o 0x.*))
17 define Build/patch-dtb
18 $(call Image/BuildDTB,../dts/$(DEVICE_DTS).dts,$@.dtb)
19 $(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
22 # Shared device definition: applies to every defined device
24 PROFILES = Default $$(DEVICE_PROFILE)
25 KERNEL_DEPENDS = $$(wildcard ../dts/$$(DEVICE_DTS).dts)
28 DEVICE_VARS += DEVICE_PROFILE
32 KERNEL_INITRAMFS := kernel-bin | patch-dtb
33 KERNEL_INITRAMFS_NAME = vmlinux-initramfs.elf
38 KERNEL_INITRAMFS := kernel-bin | patch-dtb | calculate-ep | uImage none
39 KERNEL_LOADADDR := 0x80000000
42 define add_archs38_uImage
43 define Device/$(1)-uImage
45 DEVICE_PROFILE := $(1)
48 TARGET_DEVICES += $(1)-uImage
51 define add_archs38_vmlinux
52 define Device/$(1)-vmlinux
53 $(call Device/vmlinux)
54 DEVICE_PROFILE := $(1)
57 TARGET_DEVICES += $(1)-vmlinux
61 $(eval $(call add_archs38_vmlinux,axs103_idu))
62 $(eval $(call add_archs38_uImage,axs103_idu))
65 $(eval $(call add_archs38_vmlinux,nsim_hs_idu))
66 $(eval $(call add_archs38_uImage,nsim_hs_idu))
68 $(eval $(call BuildImage))