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
This commit is contained in:
Felix Fietkau 2015-05-11 09:08:33 +00:00
parent c05f9b9c23
commit 6ceb1b0358

View file

@ -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))