mvebu: new subtarget cortex A53
[openwrt/openwrt.git] / target / linux / mvebu / image / Makefile
1 #
2 # Copyright (C) 2012-2016 OpenWrt.org
3 # Copyright (C) 2016 LEDE-project.org
4 #
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
7 #
8
9 JFFS2_BLOCKSIZE = 128k
10
11 include $(TOPDIR)/rules.mk
12 include $(INCLUDE_DIR)/image.mk
13
14 KERNEL_LOADADDR := 0x00008000
15
16 SIGNATURE:=$(shell printf "%.8s" $(SOURCE_DATE_EPOCH))
17
18 define Build/dtb
19 $(call Image/BuildDTB,$(DTS_DIR)/$(DEVICE_DTS).dts,$@.dtb)
20 endef
21
22 # SD-Card Images:
23 # these values are optimized for a 4GB labeled sdcard that actually holds 7744512 sectors of 512 byte
24 # MBR: 2048 sectors
25 # Partition 1: 32768 sectors
26 # Partition 2: 98304 sectors (configurable)
27
28 define Build/boot-scr
29 rm -f $@-boot.scr
30 sed -e 's#@ROOT@#$(SIGNATURE)#g' \
31 $(DEVICE_NAME).bootscript > $@-new.bootscript
32 mkimage -A arm -O linux -T script -C none -a 0 -e 0 -d $@-new.bootscript $@-boot.scr
33 endef
34
35 define Build/boot-img
36 rm -f $@.boot
37 mkfs.fat -C $@.boot 16384
38 $(foreach dts,$(DEVICE_DTS), mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb ::$(dts).dtb;)
39 mcopy -i $@.boot $(IMAGE_KERNEL) ::$(KERNEL_NAME)
40 -mcopy -i $@.boot $@-boot.scr ::boot.scr
41 endef
42
43 define Build/boot-img-ext4
44 rm -fR $@.boot
45 mkdir -p $@.boot
46 $(foreach dts,$(DEVICE_DTS), $(CP) $(DTS_DIR)/$(dts).dtb $@.boot;)
47 $(CP) $(IMAGE_KERNEL) $@.boot/$(KERNEL_NAME)
48 -$(CP) $@-boot.scr $@.boot/boot.scr
49 make_ext4fs -J -l 16384K $@.bootimg $@.boot
50 endef
51
52 define Build/sdcard-img
53 if [ -n "$(UBOOT)" ]; then UBOOT="$(STAGING_DIR_IMAGE)/$(UBOOT)"; fi; \
54 ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
55 SIGNATURE="$(SIGNATURE)" \
56 ./gen_mvebu_sdcard_img.sh $@ \
57 $$UBOOT \
58 c 32768 $@.boot \
59 83 $$ROOTFS_SIZE $(IMAGE_ROOTFS)
60 endef
61
62 define Build/sdcard-img-ext4
63 if [ -n "$(UBOOT)" ]; then UBOOT="$(STAGING_DIR_IMAGE)/$(UBOOT)"; fi; \
64 ROOTFS_SIZE=$$(( $(CONFIG_TARGET_ROOTFS_PARTSIZE) * 1024 * 2 )); \
65 SIGNATURE="$(SIGNATURE)" \
66 ./gen_mvebu_sdcard_img.sh $@ \
67 $$UBOOT \
68 83 32768 $@.bootimg \
69 83 $$ROOTFS_SIZE $(IMAGE_ROOTFS)
70 endef
71
72 define Build/omnia-medkit-initramfs
73 $(TAR) -c -T /dev/null -f $@
74 rm -rf $(dir $(IMAGE_KERNEL))boot
75 mkdir -p $(dir $(IMAGE_KERNEL))boot/boot/
76 cp $(KDIR)/zImage-initramfs $(dir $(IMAGE_KERNEL))boot/boot/zImage
77 cp $(DTS_DIR)/$(DEVICE_DTS).dtb $(dir $(IMAGE_KERNEL))boot/boot/dtb
78 $(TAR) -rp --numeric-owner --owner=0 --group=0 --sort=name \
79 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
80 --file=$@ -C $(dir $(IMAGE_KERNEL))boot/ .
81 endef
82
83 define Device/Default
84 PROFILES := Default
85 DEVICE_DTS := $(1)
86 BOARD_NAME = $$(DEVICE_DTS)
87 KERNEL_NAME := zImage
88 KERNEL := kernel-bin | append-dtb | uImage none
89 SUPPORTED_DEVICES = $$(DEVICE_DTS)
90 endef
91
92 define Device/UBI
93 IMAGES := sysupgrade.bin
94 IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
95 endef
96
97 define Device/UBI-factory
98 $(Device/UBI)
99 UBINIZE_OPTS := -E 5
100 IMAGES += factory.img
101 IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | pad-to $$$$(PAGESIZE)
102 endef
103
104 define Device/NAND-128K
105 $(Device/UBI)
106 BLOCKSIZE := 128k
107 PAGESIZE := 2048
108 SUBPAGESIZE := 512
109 VID_HDR_OFFSET := 2048
110 endef
111
112 define Device/NAND-256K
113 $(Device/UBI)
114 BLOCKSIZE := 256k
115 PAGESIZE := 4096
116 endef
117
118 define Device/NAND-512K
119 $(Device/UBI)
120 BLOCKSIZE := 512k
121 PAGESIZE := 4096
122 endef
123
124 include cortex-a9.mk
125 include cortex-a53.mk
126
127 $(eval $(call BuildImage))