summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2015-05-11 09:08:33 +0000
committerFelix Fietkau <nbd@openwrt.org>2015-05-11 09:08:33 +0000
commit6ceb1b03581eda64eb9285bdc7d23f109cfb1e4e (patch)
treec8e1ad57295ac445a622c0627a2983feda7c02e1
parentc05f9b9c23605c74100a5be9ec355d78873e23ea (diff)
downloadmtk-20170518-6ceb1b03581eda64eb9285bdc7d23f109cfb1e4e.zip
mtk-20170518-6ceb1b03581eda64eb9285bdc7d23f109cfb1e4e.tar.gz
mtk-20170518-6ceb1b03581eda64eb9285bdc7d23f109cfb1e4e.tar.bz2
ar71xx: convert tl-wr741nd v1/v2 to new image building code, add infrastructure for building the loader
Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 45672
-rw-r--r--target/linux/ar71xx/image/Makefile72
1 files changed, 68 insertions, 4 deletions
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index d6e6285..71d6c91 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -13,7 +13,7 @@ JFFS2_BLOCKSIZE = 64k 128k 256k
KERNEL_LOADADDR = 0x80060000
-DEVICE_VARS += NETGEAR_KERNEL_MAGIC NETGEAR_BOARD NETGEAR_ID CMDLINE CONSOLE IMAGE_SIZE
+DEVICE_VARS += NETGEAR_KERNEL_MAGIC NETGEAR_BOARD NETGEAR_ID CMDLINE CONSOLE IMAGE_SIZE BOARDNAME LOADER_FLASH_OFFS
define Build/netgear-squashfs
rm -rf $@.fs $@.squashfs
@@ -72,6 +72,36 @@ define Build/mktplinkfw-initramfs
@mv $@.new $@
endef
+define Build/loader-common
+ rm -rf $@.src
+ $(MAKE) -C lzma-loader \
+ PKG_BUILD_DIR="$@.src" \
+ TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \
+ KERNEL_CMDLINE="$(CMDLINE)" BOARD="$(BOARDNAME)" \
+ LZMA_TEXT_START=0x80a00000 LOADADDR=0x80060000 \
+ $(1) compile loader.gz
+ mv "$@.gz" "$@"
+ rm -rf $@.src
+endef
+
+define Build/loader-okli-compile
+ $(call Build/loader-common,FLASH_OFFS=$(LOADER_FLASH_OFFS) FLASH_MAX=0)
+endef
+
+define Build/loader-kernel
+ $(call Build/loader-common,LOADER_DATA="$@")
+endef
+
+define Build/loader-okli
+ dd if=$(KDIR)/loader-$(1).gz bs=7680 conv=sync of="$@.new"
+ cat "$@" >> "$@.new"
+ mv "$@.new" "$@"
+endef
+
+define Build/copy-file
+ cat "$(1)" > "$@"
+endef
+
DEVICE_VARS += TPLINK_HWID TPLINK_HWREV TPLINK_FLASHLAYOUT
define Device/Default
@@ -85,6 +115,7 @@ define Device/Default
CONSOLE = ttyS0,115200
CMDLINE = $$(if $$(BOARDNAME),board=$$(BOARDNAME)) $$(if $$(MTDPARTS),mtdparts=$$(MTDPARTS)) $$(if $$(CONSOLE),console=$$(CONSOLE))
KERNEL := kernel-bin | patch-cmdline | lzma | uImage lzma
+ COMPILE :=
IMAGES := sysupgrade.bin
IMAGE/sysupgrade.bin = append-kernel $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE)
endef
@@ -153,6 +184,27 @@ define Device/tplink
IMAGE/factory.bin := append-rootfs | mktplinkfw factory
endef
+define Device/tplink-nolzma
+$(Device/tplink)
+ LOADER_FLASH_OFFS := 0x22000
+ COMPILE := loader-$(1).gz
+ COMPILE/loader-$(1).gz := loader-okli-compile
+ KERNEL := copy-file $(KDIR)/vmlinux.bin.lzma | uImage lzma -M 0x4f4b4c49 | loader-okli $(1)
+ KERNEL_INITRAMFS := copy-file $(KDIR)/vmlinux-initramfs.bin.lzma | loader-kernel | mktplinkfw-initramfs
+endef
+
+define Device/tplink-4m
+$(Device/tplink-nolzma)
+ TPLINK_FLASHLAYOUT := 4M
+ IMAGE_SIZE := 3904k
+endef
+
+define Device/tplink-8m
+$(Device/tplink-nolzma)
+ TPLINK_FLASHLAYOUT := 8M
+ IMAGE_SIZE := 7936k
+endef
+
define Device/tplink-4mlzma
$(Device/tplink)
TPLINK_FLASHLAYOUT := 4Mlzma
@@ -391,6 +443,20 @@ define Device/tl-wr740n-v4
CONSOLE := ttyATH0,115200
endef
+define Device/tl-wr741nd-v1
+ $(Device/tplink-4m)
+ BOARDNAME := TL-WR741ND
+ DEVICE_PROFILE := TLWR741
+ TPLINK_HWID := 0x07410001
+endef
+
+define Device/tl-wr741nd-v2
+ $(Device/tplink-4m)
+ BOARDNAME := TL-WR741ND
+ DEVICE_PROFILE := TLWR741
+ TPLINK_HWID := 0x07410001
+endef
+
define Device/tl-wr741nd-v4
$(Device/tplink-4mlzma)
BOARDNAME := TL-WR741ND-v4
@@ -406,7 +472,7 @@ define Device/tl-wr743nd-v2
TPLINK_HWID := 0x07430002
CONSOLE := ttyATH0,115200
endef
-TARGET_DEVICES += tl-wr740n-v4 tl-wr741nd-v4 tl-wr743nd-v2
+TARGET_DEVICES += tl-wr740n-v4 tl-wr741nd-v1 tl-wr741nd-v2 tl-wr741nd-v4 tl-wr743nd-v2
define Device/tl-wr841n-v8
$(Device/tplink-4mlzma)
@@ -1809,8 +1875,6 @@ $(eval $(call SingleProfile,TPLINK,64kraw,TLWA901NV1,tl-wa901nd-v1,TL-WA901ND,tt
$(eval $(call SingleProfile,TPLINK,64kraw,TLWA901NV2,tl-wa901nd-v2,TL-WA901ND-v2,ttyS0,115200,0x09010002,1,4M))
$(eval $(call SingleProfile,TPLINK,64kraw,TLWR740NV1,tl-wr740n-v1,TL-WR741ND,ttyS0,115200,0x07400001,1,4M))
$(eval $(call SingleProfile,TPLINK,64kraw,TLWR740NV3,tl-wr740n-v3,TL-WR741ND,ttyS0,115200,0x07400003,1,4M))
-$(eval $(call SingleProfile,TPLINK,64kraw,TLWR741NV1,tl-wr741nd-v1,TL-WR741ND,ttyS0,115200,0x07410001,1,4M))
-$(eval $(call SingleProfile,TPLINK,64kraw,TLWR741NV2,tl-wr741nd-v2,TL-WR741ND,ttyS0,115200,0x07410001,1,4M))
$(eval $(call SingleProfile,TPLINK,64kraw,TLWR743NV1,tl-wr743nd-v1,TL-WR741ND,ttyS0,115200,0x07430001,1,4M))
$(eval $(call SingleProfile,TPLINK,64kraw,TLWR841NV3,tl-wr841nd-v3,TL-WR941ND,ttyS0,115200,0x08410003,3,4M))
$(eval $(call SingleProfile,TPLINK,64kraw,TLWR841NV5,tl-wr841nd-v5,TL-WR741ND,ttyS0,115200,0x08410005,1,4M))