aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/arc770
diff options
context:
space:
mode:
authorAlexey Brodkin <Alexey.Brodkin@synopsys.com>2016-05-31 20:12:21 +0300
committerJohn Crispin <john@phrozen.org>2016-06-05 23:23:57 +0200
commit668dbec3f4e50f9689ddfdfb4e84818fa736aa9f (patch)
tree11fc3bcfa7564fc8ddf82448e03efed5aa60aa5f /target/linux/arc770
parent9363259abe034cf8d16a9b542c4de6db0bdc192d (diff)
downloadupstream-668dbec3f4e50f9689ddfdfb4e84818fa736aa9f.tar.gz
upstream-668dbec3f4e50f9689ddfdfb4e84818fa736aa9f.tar.bz2
upstream-668dbec3f4e50f9689ddfdfb4e84818fa736aa9f.zip
arc: Build uImage as well as vmlinux output files
Initially for ARC we were building vmlinux images because it was both simpler and more convenient to debug Linux kernel in runt-time via JTAG. Now when base system works quite nice we may finally use U-Boot for loading the system image as well. Still we keep building vmlinux images as some of our boards are development boards and loading images with JTAG could be at some points very beneficial. Note for U-Boot header it's required to specify 2 values: * loading address * entry point (if it doesn't match loading address) and in case of ARC entry point (EP) not only differs from loading address but also changes from build to build due to initramfs being placed between loading address and text section. To accommodate that feature we have to calculate EP after vmlinux gets built and before call to mkimage. Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
Diffstat (limited to 'target/linux/arc770')
-rw-r--r--target/linux/arc770/image/Makefile44
1 files changed, 36 insertions, 8 deletions
diff --git a/target/linux/arc770/image/Makefile b/target/linux/arc770/image/Makefile
index 6b9c5e4524..47c936e556 100644
--- a/target/linux/arc770/image/Makefile
+++ b/target/linux/arc770/image/Makefile
@@ -7,6 +7,13 @@
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/$(DEVICE_DTS).dts,$@.dtb)
$(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
@@ -16,26 +23,47 @@ endef
define Device/Default
PROFILES = Default $$(DEVICE_PROFILE)
KERNEL_DEPENDS = $$(wildcard ../dts/$$(DEVICE_DTS).dts)
- KERNEL_SUFFIX := .elf
- KERNEL_INITRAMFS := kernel-bin | patch-dtb
- KERNEL_INITRAMFS_NAME = $$(KERNEL_NAME)-initramfs.elf
DEVICE_PROFILE :=
DEVICE_DTS :=
endef
DEVICE_VARS += DEVICE_PROFILE DEVICE_DTS
-define add_arc770
- define Device/$(1)
+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)
+ TARGET_DEVICES += $(1)-vmlinux
endef
# DesignWare AXS101
-$(eval $(call add_arc770,axs101))
+$(eval $(call add_arc770_vmlinux,axs101))
+$(eval $(call add_arc770_uImage,axs101))
# nSIM with ARC770
-$(eval $(call add_arc770,nsim_700))
+$(eval $(call add_arc770_vmlinux,nsim_700))
+$(eval $(call add_arc770_uImage,nsim_700))
$(eval $(call BuildImage))