2009-08-31 03:15:51 +08:00
|
|
|
#
|
2011-10-31 17:23:44 +08:00
|
|
|
# Copyright (C) 2008-2011 OpenWrt.org
|
2009-08-31 03:15:51 +08:00
|
|
|
#
|
|
|
|
|
# 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
|
|
|
|
|
|
2017-01-23 21:41:15 +08:00
|
|
|
DEVICE_VARS += DTS IMAGE_SIZE NETGEAR_BOARD_ID NETGEAR_HW_ID
|
2017-01-29 00:05:56 +08:00
|
|
|
DEVICE_VARS += BUFFALO_TAG_PLATFORM BUFFALO_TAG_VERSION BUFFALO_TAG_MINOR
|
2018-12-30 02:25:00 +08:00
|
|
|
DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
|
2019-05-16 03:11:01 +08:00
|
|
|
DEVICE_VARS += SERCOMM_HWID SERCOMM_HWVER SERCOMM_SWVER
|
2019-05-20 11:15:24 +08:00
|
|
|
DEVICE_VARS += JCG_MAXSIZE
|
2015-01-10 23:26:53 +08:00
|
|
|
|
2015-01-10 23:26:38 +08:00
|
|
|
loadaddr-y := 0x80000000
|
|
|
|
|
loadaddr-$(CONFIG_TARGET_ramips_rt288x) := 0x88000000
|
|
|
|
|
loadaddr-$(CONFIG_TARGET_ramips_mt7621) := 0x80001000
|
2009-08-31 03:15:51 +08:00
|
|
|
|
2015-01-10 23:26:53 +08:00
|
|
|
KERNEL_LOADADDR := $(loadaddr-y)
|
|
|
|
|
|
2018-08-30 16:51:09 +08:00
|
|
|
KERNEL_DTB = kernel-bin | patch-dtb | lzma
|
2015-01-10 23:26:53 +08:00
|
|
|
define Device/Default
|
2016-04-09 18:24:40 +08:00
|
|
|
PROFILES = Default $$(DTS)
|
2016-01-07 02:39:06 +08:00
|
|
|
KERNEL_DEPENDS = $$(wildcard ../dts/$$(DTS).dts)
|
2015-01-10 23:26:53 +08:00
|
|
|
KERNEL := $(KERNEL_DTB) | uImage lzma
|
2016-12-21 20:56:16 +08:00
|
|
|
DEVICE_DTS_DIR := ../dts
|
2015-01-10 23:26:53 +08:00
|
|
|
IMAGES := sysupgrade.bin
|
|
|
|
|
IMAGE_SIZE := $(ralink_default_fw_size_8M)
|
2017-12-17 07:30:21 +08:00
|
|
|
SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
|
2016-11-17 20:02:26 +08:00
|
|
|
sysupgrade_bin := append-kernel | append-rootfs | pad-rootfs
|
|
|
|
|
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
|
2015-01-10 23:26:53 +08:00
|
|
|
endef
|
|
|
|
|
|
2018-12-30 02:25:00 +08:00
|
|
|
define Device/seama
|
|
|
|
|
SEAMA_MTDBLOCK := 2
|
|
|
|
|
IMAGES += factory.bin
|
|
|
|
|
|
|
|
|
|
# 64 bytes offset:
|
|
|
|
|
# - 28 bytes seama_header
|
|
|
|
|
# - 36 bytes of META data (4-bytes aligned)
|
|
|
|
|
IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs
|
|
|
|
|
IMAGE/sysupgrade.bin := \
|
|
|
|
|
$$(IMAGE/default) | seama | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
|
|
|
|
|
IMAGE/factory.bin := \
|
|
|
|
|
$$(IMAGE/default) | pad-rootfs -x 64 | seama | seama-seal | check-size $$$$(IMAGE_SIZE)
|
|
|
|
|
SEAMA_SIGNATURE :=
|
|
|
|
|
endef
|
|
|
|
|
|
2019-05-20 11:15:24 +08:00
|
|
|
define Build/jcg-header
|
|
|
|
|
$(STAGING_DIR_HOST)/bin/jcgimage -v $(1) $(if $(JCG_MAXSIZE), -m $(JCG_MAXSIZE),) -u $@ -o $@.new
|
|
|
|
|
mv $@.new $@
|
|
|
|
|
endef
|
|
|
|
|
|
2015-01-10 23:26:53 +08:00
|
|
|
define Build/patch-dtb
|
2015-12-10 20:39:32 +08:00
|
|
|
$(call Image/BuildDTB,../dts/$(DTS).dts,$@.dtb)
|
2015-01-10 23:26:53 +08:00
|
|
|
$(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define Build/trx
|
2017-01-29 00:05:56 +08:00
|
|
|
$(STAGING_DIR_HOST)/bin/trx $(1) \
|
2015-01-10 23:26:53 +08:00
|
|
|
-o $@ \
|
|
|
|
|
-m $(IMAGE_SIZE) \
|
2016-07-30 20:19:11 +08:00
|
|
|
-f $(IMAGE_KERNEL) \
|
|
|
|
|
-a 4 -f $(IMAGE_ROOTFS)
|
2015-01-10 23:26:53 +08:00
|
|
|
endef
|
|
|
|
|
|
2018-05-04 00:44:27 +08:00
|
|
|
define Build/loader-common
|
|
|
|
|
rm -rf $@.src
|
|
|
|
|
$(MAKE) -C lzma-loader \
|
|
|
|
|
PKG_BUILD_DIR="$@.src" \
|
|
|
|
|
TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \
|
|
|
|
|
BOARD="$(BOARDNAME)" PLATFORM="$(PLATFORM)" \
|
|
|
|
|
LZMA_TEXT_START=0x82000000 LOADADDR=$(KERNEL_LOADADDR) \
|
|
|
|
|
$(1) compile loader.$(LOADER_TYPE)
|
|
|
|
|
mv "$@.$(LOADER_TYPE)" "$@"
|
|
|
|
|
rm -rf $@.src
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define Build/loader-kernel
|
|
|
|
|
$(call Build/loader-common,LOADER_DATA="$@")
|
|
|
|
|
endef
|
|
|
|
|
|
2015-01-18 05:20:05 +08:00
|
|
|
define Build/relocate-kernel
|
2018-11-30 15:57:03 +08:00
|
|
|
rm -rf $@.relocate
|
|
|
|
|
$(CP) ../../generic/image/relocate $@.relocate
|
|
|
|
|
$(MAKE) -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
|
2015-01-18 05:20:05 +08:00
|
|
|
( \
|
2018-11-30 15:57:03 +08:00
|
|
|
dd if=$@.relocate/loader.bin bs=32 conv=sync && \
|
2015-01-18 05:20:05 +08:00
|
|
|
perl -e '@s = stat("$@"); print pack("V", @s[7])' && \
|
|
|
|
|
cat $@ \
|
|
|
|
|
) > $@.new
|
|
|
|
|
mv $@.new $@
|
2018-11-30 15:57:03 +08:00
|
|
|
rm -rf $@.relocate
|
2015-01-18 05:20:05 +08:00
|
|
|
endef
|
|
|
|
|
|
2016-08-20 07:17:16 +08:00
|
|
|
define Build/umedia-header
|
|
|
|
|
fix-u-media-header -T 0x46 -B $(1) -i $@ -o $@.new && mv $@.new $@
|
|
|
|
|
endef
|
|
|
|
|
|
2016-09-27 13:38:08 +08:00
|
|
|
define Build/edimax-header
|
|
|
|
|
$(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1)
|
|
|
|
|
@mv $@.new $@
|
|
|
|
|
endef
|
|
|
|
|
|
2016-11-21 15:46:48 +08:00
|
|
|
define Build/poray-header
|
|
|
|
|
$(STAGING_DIR_HOST)/bin/mkporayfw $(1) -f $@ -o $@.new
|
|
|
|
|
mv $@.new $@
|
|
|
|
|
endef
|
|
|
|
|
|
2016-11-25 20:03:01 +08:00
|
|
|
define Build/wrg-header
|
|
|
|
|
mkwrgimg -i $@ -d "/dev/mtdblock/2" -s $(1) -o $@.new
|
|
|
|
|
mv $@.new $@
|
|
|
|
|
endef
|
|
|
|
|
|
2018-01-20 16:27:03 +08:00
|
|
|
# combine kernel and rootfs into one image
|
|
|
|
|
# mkdlinkfw <type> <optional extra arguments to mkdlinkfw binary>
|
|
|
|
|
|
|
|
|
|
define Build/mkdlinkfw
|
|
|
|
|
-$(STAGING_DIR_HOST)/bin/mkdlinkfw \
|
|
|
|
|
-k $(IMAGE_KERNEL) \
|
|
|
|
|
-r $(IMAGE_ROOTFS) \
|
|
|
|
|
-o $@ \
|
2018-04-20 01:36:55 +08:00
|
|
|
$(if $(DLINK_IMAGE_OFFSET), -O $(DLINK_IMAGE_OFFSET)) \
|
2018-01-20 16:27:03 +08:00
|
|
|
-s $(DLINK_FIRMWARE_SIZE)
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define Build/mkdlinkfw-factory
|
|
|
|
|
-$(STAGING_DIR_HOST)/bin/mkdlinkfw \
|
|
|
|
|
-m $(DLINK_ROM_ID) -f $(DLINK_FAMILY_MEMBER) \
|
|
|
|
|
-F $@ \
|
|
|
|
|
-o $@.new \
|
2018-04-20 01:36:55 +08:00
|
|
|
$(if $(DLINK_IMAGE_OFFSET), -O $(DLINK_IMAGE_OFFSET)) \
|
2018-01-20 16:27:03 +08:00
|
|
|
-s $(DLINK_FIRMWARE_SIZE)
|
|
|
|
|
mv $@.new $@
|
|
|
|
|
endef
|
|
|
|
|
|
2018-06-28 13:26:39 +08:00
|
|
|
define Build/zyimage
|
|
|
|
|
$(STAGING_DIR_HOST)/bin/zyimage $(1) $@
|
|
|
|
|
endef
|
|
|
|
|
|
2019-05-16 03:11:01 +08:00
|
|
|
define Build/sercom-seal
|
|
|
|
|
$(STAGING_DIR_HOST)/bin/mksercommfw \
|
|
|
|
|
-i $@ \
|
|
|
|
|
-b $(SERCOMM_HWID) \
|
|
|
|
|
-r $(SERCOMM_HWVER) \
|
|
|
|
|
-v $(SERCOMM_SWVER) \
|
|
|
|
|
$(1)
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
|
|
define Build/sercom-footer
|
|
|
|
|
$(call Build/sercom-seal,-f)
|
|
|
|
|
endef
|
|
|
|
|
|
2013-04-03 17:59:51 +08:00
|
|
|
ralink_default_fw_size_4M=3866624
|
|
|
|
|
ralink_default_fw_size_8M=8060928
|
2013-07-26 00:01:58 +08:00
|
|
|
ralink_default_fw_size_16M=16121856
|
2015-10-19 18:07:38 +08:00
|
|
|
ralink_default_fw_size_32M=33226752
|
2013-08-01 22:30:46 +08:00
|
|
|
|
2013-04-03 17:59:51 +08:00
|
|
|
ifeq ($(SUBTARGET),rt288x)
|
2016-04-01 15:11:48 +08:00
|
|
|
include rt288x.mk
|
2012-02-24 03:58:15 +08:00
|
|
|
endif
|
2011-07-28 18:56:32 +08:00
|
|
|
|
2013-04-03 17:59:51 +08:00
|
|
|
ifeq ($(SUBTARGET),rt305x)
|
2016-04-01 15:11:48 +08:00
|
|
|
include rt305x.mk
|
2010-04-12 01:47:28 +08:00
|
|
|
endif
|
|
|
|
|
|
2013-04-03 17:59:51 +08:00
|
|
|
ifeq ($(SUBTARGET),rt3883)
|
2016-04-01 15:11:48 +08:00
|
|
|
include rt3883.mk
|
2012-04-21 20:30:44 +08:00
|
|
|
endif
|
|
|
|
|
|
2014-11-19 17:19:38 +08:00
|
|
|
ifeq ($(SUBTARGET),mt7620)
|
2016-04-01 15:11:48 +08:00
|
|
|
include mt7620.mk
|
2013-11-17 04:28:52 +08:00
|
|
|
endif
|
|
|
|
|
|
2013-12-13 18:53:34 +08:00
|
|
|
ifeq ($(SUBTARGET),mt7621)
|
2016-04-01 15:11:48 +08:00
|
|
|
include mt7621.mk
|
2013-12-13 18:53:34 +08:00
|
|
|
endif
|
|
|
|
|
|
2017-08-26 09:49:45 +08:00
|
|
|
ifeq ($(SUBTARGET),mt76x8)
|
|
|
|
|
include mt76x8.mk
|
2015-07-24 17:11:56 +08:00
|
|
|
endif
|
|
|
|
|
|
2009-08-31 03:15:51 +08:00
|
|
|
$(eval $(call BuildImage))
|