mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-20 22:23:27 +00:00
8e40fbff0b
Beside one exception, no one took care of these two remaining boards still using the legacy image build code during the last two years. Since OpenWrt 14.07 the ALLNET ALL0239-3G image building is broken. The Sitecom WL-341 v3 image build code looks pretty hackish and broken. It's questionable if the legacy image works as all. Signed-off-by: Mathias Kresin <dev@kresin.me>
156 lines
3.6 KiB
Makefile
156 lines
3.6 KiB
Makefile
#
|
|
# Copyright (C) 2008-2011 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
|
|
|
|
DEVICE_VARS += DTS IMAGE_SIZE NETGEAR_BOARD_ID NETGEAR_HW_ID
|
|
DEVICE_VARS += BUFFALO_TAG_PLATFORM BUFFALO_TAG_VERSION BUFFALO_TAG_MINOR
|
|
|
|
loadaddr-y := 0x80000000
|
|
loadaddr-$(CONFIG_TARGET_ramips_rt288x) := 0x88000000
|
|
loadaddr-$(CONFIG_TARGET_ramips_mt7621) := 0x80001000
|
|
|
|
KERNEL_LOADADDR := $(loadaddr-y)
|
|
|
|
KERNEL_DTB = kernel-bin | patch-dtb | lzma
|
|
define Device/Default
|
|
PROFILES = Default $$(DTS)
|
|
KERNEL_DEPENDS = $$(wildcard ../dts/$$(DTS).dts)
|
|
KERNEL := $(KERNEL_DTB) | uImage lzma
|
|
DEVICE_DTS_DIR := ../dts
|
|
IMAGES := sysupgrade.bin
|
|
IMAGE_SIZE := $(ralink_default_fw_size_8M)
|
|
SUPPORTED_DEVICES := $(subst _,$(comma),$(1))
|
|
sysupgrade_bin := append-kernel | append-rootfs | pad-rootfs
|
|
IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size $$$$(IMAGE_SIZE)
|
|
endef
|
|
|
|
define Build/patch-dtb
|
|
$(call Image/BuildDTB,../dts/$(DTS).dts,$@.dtb)
|
|
$(STAGING_DIR_HOST)/bin/patch-dtb $@ $@.dtb
|
|
endef
|
|
|
|
define Build/trx
|
|
$(STAGING_DIR_HOST)/bin/trx $(1) \
|
|
-o $@ \
|
|
-m $(IMAGE_SIZE) \
|
|
-f $(IMAGE_KERNEL) \
|
|
-a 4 -f $(IMAGE_ROOTFS)
|
|
endef
|
|
|
|
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
|
|
|
|
define Build/relocate-kernel
|
|
rm -rf $@.relocate
|
|
$(CP) ../../generic/image/relocate $@.relocate
|
|
$(MAKE) -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS)
|
|
( \
|
|
dd if=$@.relocate/loader.bin bs=32 conv=sync && \
|
|
perl -e '@s = stat("$@"); print pack("V", @s[7])' && \
|
|
cat $@ \
|
|
) > $@.new
|
|
mv $@.new $@
|
|
rm -rf $@.relocate
|
|
endef
|
|
|
|
define Build/umedia-header
|
|
fix-u-media-header -T 0x46 -B $(1) -i $@ -o $@.new && mv $@.new $@
|
|
endef
|
|
|
|
define Build/edimax-header
|
|
$(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1)
|
|
@mv $@.new $@
|
|
endef
|
|
|
|
define Build/poray-header
|
|
$(STAGING_DIR_HOST)/bin/mkporayfw $(1) -f $@ -o $@.new
|
|
mv $@.new $@
|
|
endef
|
|
|
|
define Build/seama
|
|
$(STAGING_DIR_HOST)/bin/seama -i $@ $(1)
|
|
mv $@.seama $@
|
|
endef
|
|
|
|
define Build/seama-seal
|
|
$(call Build/seama,-s $@.seama $(1))
|
|
endef
|
|
|
|
define Build/wrg-header
|
|
mkwrgimg -i $@ -d "/dev/mtdblock/2" -s $(1) -o $@.new
|
|
mv $@.new $@
|
|
endef
|
|
|
|
# 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 $@ \
|
|
-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 \
|
|
-s $(DLINK_FIRMWARE_SIZE)
|
|
mv $@.new $@
|
|
endef
|
|
|
|
define Build/zyimage
|
|
$(STAGING_DIR_HOST)/bin/zyimage $(1) $@
|
|
endef
|
|
|
|
ralink_default_fw_size_4M=3866624
|
|
ralink_default_fw_size_8M=8060928
|
|
ralink_default_fw_size_16M=16121856
|
|
ralink_default_fw_size_32M=33226752
|
|
|
|
ifeq ($(SUBTARGET),rt288x)
|
|
include rt288x.mk
|
|
endif
|
|
|
|
ifeq ($(SUBTARGET),rt305x)
|
|
include rt305x.mk
|
|
endif
|
|
|
|
ifeq ($(SUBTARGET),rt3883)
|
|
include rt3883.mk
|
|
endif
|
|
|
|
ifeq ($(SUBTARGET),mt7620)
|
|
include mt7620.mk
|
|
endif
|
|
|
|
ifeq ($(SUBTARGET),mt7621)
|
|
include mt7621.mk
|
|
endif
|
|
|
|
ifeq ($(SUBTARGET),mt76x8)
|
|
include mt76x8.mk
|
|
endif
|
|
|
|
$(eval $(call BuildImage))
|