2010-12-05 19:38:59 +08:00
|
|
|
#
|
|
|
|
# Copyright (C) 2010 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
|
|
|
|
|
2013-03-16 00:11:45 +08:00
|
|
|
define imgname
|
|
|
|
$(BIN_DIR)/$(IMG_PREFIX)-$(2)-$(patsubst jffs2-%,jffs2,$(patsubst squashfs-%,squashfs,$(1)))
|
|
|
|
endef
|
|
|
|
|
|
|
|
define sysupname
|
|
|
|
$(call imgname,$(1),$(2))-sysupgrade.bin
|
|
|
|
endef
|
|
|
|
|
|
|
|
define factoryname
|
|
|
|
$(call imgname,$(1),$(2))-factory.bin
|
|
|
|
endef
|
|
|
|
|
2014-01-23 14:55:58 +08:00
|
|
|
zImage:=$(BIN_DIR)/$(IMG_PREFIX)-zImage
|
2013-03-16 00:11:45 +08:00
|
|
|
|
2016-01-18 05:05:19 +08:00
|
|
|
DTS_TARGETS = fsl/p1010rdb-pa tl-wdr4900-v1 fsl/p1020rdb
|
2010-12-05 19:38:59 +08:00
|
|
|
|
|
|
|
define Image/BuildKernel
|
2014-12-11 23:29:39 +08:00
|
|
|
cp $(KDIR)/zImage $(BIN_DIR)/$(IMG_PREFIX)-zImage
|
2013-02-02 01:28:47 +08:00
|
|
|
$(foreach dts,$(DTS_TARGETS),
|
2016-01-18 05:05:19 +08:00
|
|
|
$(LINUX_DIR)/scripts/dtc/dtc -I dts -O dtb $(DTS_DIR)/$(dts).dts > $(BIN_DIR)/$(IMG_PREFIX)-$(notdir $(dts)).fdt
|
2013-02-02 01:28:47 +08:00
|
|
|
)
|
2010-12-05 19:38:59 +08:00
|
|
|
endef
|
|
|
|
|
2014-12-12 02:18:16 +08:00
|
|
|
define Image/BuildKernel/Initramfs
|
2014-12-11 23:29:39 +08:00
|
|
|
cp $(KDIR)/zImage-initramfs $(BIN_DIR)/$(IMG_PREFIX)-initramfs-zImage
|
2016-03-04 04:24:41 +08:00
|
|
|
ifeq ($(SUBTARGET),generic)
|
2014-12-12 01:52:12 +08:00
|
|
|
cp $(KDIR)/cuImage.tl-wdr4900-v1-initramfs $(BIN_DIR)/$(IMG_PREFIX)-tl-wdr4900-v1-initramfs.uImage
|
2016-03-04 04:24:41 +08:00
|
|
|
endif
|
2014-12-11 23:29:39 +08:00
|
|
|
endef
|
|
|
|
|
2013-03-16 00:11:45 +08:00
|
|
|
define Image/Build/TPLINK
|
|
|
|
-$(STAGING_DIR_HOST)/bin/mktplinkfw \
|
|
|
|
-H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) \
|
|
|
|
-k $(KDIR)/$(3) \
|
|
|
|
-r $(KDIR)/root.$(1) \
|
|
|
|
-o $(call factoryname,$(1),$(2))
|
|
|
|
-$(STAGING_DIR_HOST)/bin/mktplinkfw \
|
|
|
|
-H $(4) -W $(5) -F $(6) -N OpenWrt -V $(REVISION) $(7) -s \
|
|
|
|
-k $(KDIR)/$(3) \
|
|
|
|
-r $(KDIR)/root.$(1) \
|
|
|
|
-o $(call sysupname,$(1),$(2))
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/Profile/TLWDR4900
|
|
|
|
$(call Image/Build/TPLINK,$(1),tl-wdr4900-v1,cuImage.tl-wdr4900-v1,0x49000001,1,16Mppc)
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Image/Build/Profile/Default
|
|
|
|
$(call Image/Build/Profile/TLWDR4900,$(1))
|
|
|
|
endef
|
|
|
|
|
2010-12-05 19:38:59 +08:00
|
|
|
define Image/Build/ext2
|
|
|
|
cp $(KDIR)/root.$(1) $(BIN_DIR)/$(IMG_PREFIX)-ext2.img
|
|
|
|
endef
|
|
|
|
|
2013-02-19 22:53:15 +08:00
|
|
|
define Image/Build/squashfs
|
|
|
|
$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
|
|
|
|
cp $(KDIR)/root.squashfs $(BIN_DIR)/$(IMG_PREFIX)-root.squashfs
|
|
|
|
endef
|
|
|
|
|
2013-03-16 00:11:45 +08:00
|
|
|
PROFILE ?= Default
|
|
|
|
|
2010-12-05 19:38:59 +08:00
|
|
|
define Image/Build
|
|
|
|
$(call Image/Build/$(1),$(1))
|
2013-03-16 00:11:45 +08:00
|
|
|
$(call Image/Build/Profile/$(PROFILE),$(1))
|
2010-12-05 19:38:59 +08:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(call BuildImage))
|