2009-08-30 19:15:51 +00:00
|
|
|
#
|
2011-10-31 09:23:44 +00:00
|
|
|
# Copyright (C) 2008-2011 OpenWrt.org
|
2009-08-30 19:15:51 +00: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 13:41:15 +00:00
|
|
|
DEVICE_VARS += DTS IMAGE_SIZE NETGEAR_BOARD_ID NETGEAR_HW_ID
|
2017-01-28 16:05:56 +00:00
|
|
|
DEVICE_VARS += BUFFALO_TAG_PLATFORM BUFFALO_TAG_VERSION BUFFALO_TAG_MINOR
|
2018-12-29 18:25:00 +00:00
|
|
|
DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
|
2019-05-15 19:11:01 +00:00
|
|
|
DEVICE_VARS += SERCOMM_HWID SERCOMM_HWVER SERCOMM_SWVER
|
2019-05-20 03:15:24 +00:00
|
|
|
DEVICE_VARS += JCG_MAXSIZE
|
2015-01-10 15:26:53 +00:00
|
|
|
|
2015-01-10 15:26:38 +00:00
|
|
|
loadaddr-y := 0x80000000
|
|
|
|
loadaddr-$(CONFIG_TARGET_ramips_rt288x) := 0x88000000
|
|
|
|
loadaddr-$(CONFIG_TARGET_ramips_mt7621) := 0x80001000
|
2009-08-30 19:15:51 +00:00
|
|
|
|
2015-01-10 15:26:53 +00:00
|
|
|
KERNEL_LOADADDR := $(loadaddr-y)
|
|
|
|
|
2019-06-27 12:44:27 +00:00
|
|
|
KERNEL_DTB = kernel-bin | append-dtb | lzma
|
2015-01-10 15:26:53 +00:00
|
|
|
define Device/Default
|
2019-06-27 12:44:27 +00:00
|
|
|
PROFILES = Default
|
2015-01-10 15:26:53 +00:00
|
|
|
KERNEL := $(KERNEL_DTB) | uImage lzma
|
2019-07-03 21:22:22 +00:00
|
|
|
MTK_SOC :=
|
2016-12-21 12:56:16 +00:00
|
|
|
DEVICE_DTS_DIR := ../dts
|
2019-07-03 21:22:22 +00:00
|
|
|
DEVICE_DTS = $$(MTK_SOC)_$(1)
|
2015-01-10 15:26:53 +00:00
|
|
|
IMAGES := sysupgrade.bin
|
|
|
|
IMAGE_SIZE := $(ralink_default_fw_size_8M)
|
2017-12-16 23:30:21 +00:00
|
|
|
SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
|
2016-11-17 12:02:26 +00: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 15:26:53 +00:00
|
|
|
endef
|
|
|
|
|
2018-12-29 18:25:00 +00: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 03:15:24 +00: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 15:26:53 +00:00
|
|
|
define Build/trx
|
2017-01-28 16:05:56 +00:00
|
|
|
$(STAGING_DIR_HOST)/bin/trx $(1) \
|
2015-01-10 15:26:53 +00:00
|
|
|
-o $@ \
|
|
|
|
-m $(IMAGE_SIZE) \
|
2016-07-30 12:19:11 +00:00
|
|
|
-f $(IMAGE_KERNEL) \
|
|
|
|
-a 4 -f $(IMAGE_ROOTFS)
|
2015-01-10 15:26:53 +00:00
|
|
|
endef
|
|
|
|
|
2018-05-03 16:44:27 +00: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-17 21:20:05 +00:00
|
|
|
define Build/relocate-kernel
|
2018-11-30 07:57:03 +00:00
|
|
|
rm -rf $@.relocate
|
|
|
|
$(CP) ../../generic/image/relocate $@.relocate
|
|
|
|
$(MAKE) -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
|
2015-01-17 21:20:05 +00:00
|
|
|
( \
|
2018-11-30 07:57:03 +00:00
|
|
|
dd if=$@.relocate/loader.bin bs=32 conv=sync && \
|
2015-01-17 21:20:05 +00:00
|
|
|
perl -e '@s = stat("$@"); print pack("V", @s[7])' && \
|
|
|
|
cat $@ \
|
|
|
|
) > $@.new
|
|
|
|
mv $@.new $@
|
2018-11-30 07:57:03 +00:00
|
|
|
rm -rf $@.relocate
|
2015-01-17 21:20:05 +00:00
|
|
|
endef
|
|
|
|
|
2016-08-19 23:17:16 +00:00
|
|
|
define Build/umedia-header
|
|
|
|
fix-u-media-header -T 0x46 -B $(1) -i $@ -o $@.new && mv $@.new $@
|
|
|
|
endef
|
|
|
|
|
2016-09-27 05:38:08 +00:00
|
|
|
define Build/edimax-header
|
|
|
|
$(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1)
|
|
|
|
@mv $@.new $@
|
|
|
|
endef
|
|
|
|
|
2016-11-21 07:46:48 +00:00
|
|
|
define Build/poray-header
|
|
|
|
$(STAGING_DIR_HOST)/bin/mkporayfw $(1) -f $@ -o $@.new
|
|
|
|
mv $@.new $@
|
|
|
|
endef
|
|
|
|
|
2016-11-25 12:03:01 +00:00
|
|
|
define Build/wrg-header
|
|
|
|
mkwrgimg -i $@ -d "/dev/mtdblock/2" -s $(1) -o $@.new
|
|
|
|
mv $@.new $@
|
|
|
|
endef
|
|
|
|
|
2018-01-20 08:27:03 +00: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-19 17:36:55 +00:00
|
|
|
$(if $(DLINK_IMAGE_OFFSET), -O $(DLINK_IMAGE_OFFSET)) \
|
2018-01-20 08:27:03 +00: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-19 17:36:55 +00:00
|
|
|
$(if $(DLINK_IMAGE_OFFSET), -O $(DLINK_IMAGE_OFFSET)) \
|
2018-01-20 08:27:03 +00:00
|
|
|
-s $(DLINK_FIRMWARE_SIZE)
|
|
|
|
mv $@.new $@
|
|
|
|
endef
|
|
|
|
|
2018-06-28 05:26:39 +00:00
|
|
|
define Build/zyimage
|
|
|
|
$(STAGING_DIR_HOST)/bin/zyimage $(1) $@
|
|
|
|
endef
|
|
|
|
|
2019-05-15 19:11:01 +00: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 09:59:51 +00:00
|
|
|
ralink_default_fw_size_4M=3866624
|
|
|
|
ralink_default_fw_size_8M=8060928
|
2019-07-15 12:55:02 +00:00
|
|
|
ralink_default_fw_size_16M=16449536
|
2015-10-19 10:07:38 +00:00
|
|
|
ralink_default_fw_size_32M=33226752
|
2013-08-01 14:30:46 +00:00
|
|
|
|
2013-04-03 09:59:51 +00:00
|
|
|
ifeq ($(SUBTARGET),rt288x)
|
2016-04-01 07:11:48 +00:00
|
|
|
include rt288x.mk
|
2012-02-23 19:58:15 +00:00
|
|
|
endif
|
2011-07-28 10:56:32 +00:00
|
|
|
|
2013-04-03 09:59:51 +00:00
|
|
|
ifeq ($(SUBTARGET),rt305x)
|
2016-04-01 07:11:48 +00:00
|
|
|
include rt305x.mk
|
2010-04-11 17:47:28 +00:00
|
|
|
endif
|
|
|
|
|
2013-04-03 09:59:51 +00:00
|
|
|
ifeq ($(SUBTARGET),rt3883)
|
2016-04-01 07:11:48 +00:00
|
|
|
include rt3883.mk
|
2012-04-21 12:30:44 +00:00
|
|
|
endif
|
|
|
|
|
2014-11-19 09:19:38 +00:00
|
|
|
ifeq ($(SUBTARGET),mt7620)
|
2016-04-01 07:11:48 +00:00
|
|
|
include mt7620.mk
|
2013-11-16 20:28:52 +00:00
|
|
|
endif
|
|
|
|
|
2013-12-13 10:53:34 +00:00
|
|
|
ifeq ($(SUBTARGET),mt7621)
|
2016-04-01 07:11:48 +00:00
|
|
|
include mt7621.mk
|
2013-12-13 10:53:34 +00:00
|
|
|
endif
|
|
|
|
|
2017-08-26 01:49:45 +00:00
|
|
|
ifeq ($(SUBTARGET),mt76x8)
|
|
|
|
include mt76x8.mk
|
2015-07-24 09:11:56 +00:00
|
|
|
endif
|
|
|
|
|
2009-08-30 19:15:51 +00:00
|
|
|
$(eval $(call BuildImage))
|