mediatek: fix sysupgrade board detection
[openwrt/openwrt.git] / target / linux / mediatek / image / Makefile
1 # Copyright (c) 2014 The Linux Foundation. All rights reserved.
2 #
3 include $(TOPDIR)/rules.mk
4 include $(INCLUDE_DIR)/image.mk
5
6 define Image/BuilduImage
7 $(CP) $(KDIR)/zImage$(2) $(KDIR)/zImage-$(1)$(2)
8 cat $(LINUX_DIR)/arch/arm/boot/dts/mt7623-$1.dtb >> $(KDIR)/zImage-$(1)$(2)
9 mkimage -A arm -O linux -T kernel -C none -a 0x80008000 -e 0x80008000 -n 'MIPS OpenWrt Linux-$(LINUX_VERSION)' -d $(KDIR)/zImage-$(1)$(2) $(KDIR)/uImage-$(1)$(2)
10 endef
11
12 define Image/Build/SysupgradeCombined
13 $(call Image/BuilduImage,$1)
14 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
15 $(call Image/BuilduImage,$1,-initramfs)
16 $(CP) $(KDIR)/uImage-$(1)-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-$(1)-initramfs
17 endif
18 mkdir -p "$(KDIR_TMP)/sysupgrade-$(1)/"
19 echo "BOARD=$(1)" > "$(KDIR_TMP)/sysupgrade-$(1)/CONTROL"
20 $(CP) "$(KDIR)/root.$(2)" "$(KDIR_TMP)/sysupgrade-$(1)/root"
21 $(CP) "$(KDIR)/uImage-$(1)" "$(KDIR_TMP)/sysupgrade-$(1)/kernel"
22 (cd "$(KDIR_TMP)"; $(TAR) cvf \
23 "$(BIN_DIR)/$(IMG_PREFIX)-$(1)-sysupgrade.tar" sysupgrade-$(1) \
24 $(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
25 )
26 endef
27
28 COMPAT_NAND:=mediatek,mt7623-rfb-nand
29 COMPAT_NAND_EPHY:=mediatek,mt7623-rfb-nand-ephy
30
31 define Image/Build/squashfs
32 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
33 $(CP) $(KDIR)/root.squashfs $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs
34
35 $(call Image/Build/SysupgradeCombined,eMMC,squashfs)
36
37 $(call Image/BuilduImage,NAND)
38 $(call Image/BuilduImage,NAND-ePHY)
39 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),)
40 $(call Image/BuilduImage,NAND,-initramfs)
41 $(call Image/BuilduImage,NAND-ePHY,-initramfs)
42 $(CP) $(KDIR)/uImage-NAND-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-NAND-initramfs
43 $(CP) $(KDIR)/uImage-NAND-ePHY-initramfs $(BIN_DIR)/$(IMG_PREFIX)-uImage-NAND-ePHY-initramfs
44 endif
45 $(call Image/Build/SysupgradeNAND,NAND,$(1),$(KDIR)/uImage-NAND,$$(COMPAT_NAND))
46 $(call Image/Build/SysupgradeNAND,NAND-ePHY,$(1),$(KDIR)/uImage-NAND-ePHY,$$(COMPAT_NAND_EPHY))
47 endef
48
49 define Image/Build
50 $(call Image/Build/$(1),$(1))
51 endef
52
53 $(eval $(call BuildImage))