[LEDE-DEV] [PATCH 4/4] Add bootconfig and flash script for the tew827dru

J Mo jmomo at jmomo.net
Wed Sep 7 22:04:28 PDT 2016


The tew827dru requires a u-boot hush shell script to install it's factory image. Additionally, a "bootconfig" partition blob is needed to direct the OEM's "Fail Safe" system to boot from the proper UBI partition.

Signed-off-by: jmomo <jmomo at jmomo.net>
---
 .../linux/ipq806x/image/tew827dru-bootconfig.bin   | Bin 0 -> 84 bytes
 target/linux/ipq806x/image/tew827dru-flash.scr     |  57 +++++++++++++++++++++
 2 files changed, 57 insertions(+)
 create mode 100644 target/linux/ipq806x/image/tew827dru-bootconfig.bin
 create mode 100644 target/linux/ipq806x/image/tew827dru-flash.scr

target/linux/ipq806x/image/tew827dru-flash.scr
	This u-boot hush shell script is required to install the factory image via the u-boot HTTP backup loader.
	If this file should be moved somewhere else, let me know.

target/linux/ipq806x/image/tew827dru-bootconfig.bin
	This binary blob is used by the OEM's "Fail Safe" boot system.
	This gets installed by the u-boot script above.
	If this file should be moved somewhere else, let me know.

diff --git a/target/linux/ipq806x/image/tew827dru-bootconfig.bin b/target/linux/ipq806x/image/tew827dru-bootconfig.bin
new file mode 100644
index 0000000000000000000000000000000000000000..16816a91a70ad71120c49a1ab7f13681cb023a65
GIT binary patch
literal 84
zcmZ3maPd+GAYcY!11raXfM6#d5FZQ}AyiR*eo0y}R18Ex#j{h3@=|k<#Gy<86T}JG

literal 0
HcmV?d00001

diff --git a/target/linux/ipq806x/image/tew827dru-flash.scr b/target/linux/ipq806x/image/tew827dru-flash.scr
new file mode 100644
index 0000000..3cdc42e
--- /dev/null
+++ b/target/linux/ipq806x/image/tew827dru-flash.scr
@@ -0,0 +1,57 @@
+# TRENDnet TEW-827DRU 1.0R u-boot script.
+# This script is read and executed by the uboot-HTTP recovery loader.
+# The OEM HTTP firmware upgrader does not use this file.
+# WARNING: Be extremely careful editing this script. A mistake could brick devices.
+# 
+# "setenv imgaddr 0x42000000" is automatically set for us by the recovery tool.
+# imxtract automatically sets the $fileaddr and $filesize environment variables for the extracted image.
+
+echo ""
+echo "------------------------------------------------------------"
+echo ""
+echo "LEDE TEW-827DRU script START."
+
+# imgaddr=0x42000000
+support_hw_version=V1.0R
+support_machid=1260
+rootfs_nand_addr=0x58a0000
+rootfs_nand_size=0x4000000
+rootfs_1_nand_addr=0x1340000
+rootfs_1_nand_size=0x4000000
+BOOTCONFIG_nand_addr=0x5340000
+BOOTCONFIG_nand_size=0x60000
+
+# --------------------------------------------------
+
+# Validate hardware.
+if test "${hw_version}" != "${support_hw_version}" ; then echo "Wrong Hardware Version: Quitting." ; exit 1 ; fi
+if test "${machid}" != "${support_machid}" ; then echo "Wrong machine ID: Quitting." ; exit 1 ; fi
+
+# Write the UBI image (kernel+rootfs+ubifs)
+echo ""
+echo "Flashing the UBI image..."
+ipq_nand linux || echo "Failed to set ipq_nand: Quitting." && exit 1
+imxtract ${imgaddr} ubi-image || echo "Failed to imxtract the ubi image: Quitting." && exit 1
+nand erase ${rootfs_nand_addr} ${rootfs_nand_size} || echo "Failed to nand erase: Quitting." && exit 1
+nand write ${fileaddr} ${rootfs_nand_addr} ${filesize} || echo "Failed to nand write: Quitting." && exit 1
+echo "Done flashing UBI image."
+
+# Write the bootconfig to set APPSBL/rootfs as active.
+echo ""
+echo "Flashing the BOOTCONFIG image..."
+ipq_nand linux || echo "Failed to set ipq_nand: Quitting." && exit 1
+imxtract ${imgaddr} bootconfig || echo "Failed to imxtract the bootconfig image: Quitting." && exit 1
+nand erase ${BOOTCONFIG_nand_addr} ${BOOTCONFIG_nand_size} || echo "Failed to nand erase: Quitting." && exit 1
+# We need to write 0x800 instead of filesize for the bootconfig, due to page size.
+nand write ${fileaddr} ${BOOTCONFIG_nand_addr} 0x800 || echo "Failed to nand write: Quitting." && exit 1
+echo "Done flashing BOOTCONFIG image."
+
+echo ""
+echo "LEDE TEW-827DRU script END."
+echo ""
+echo "------------------------------------------------------------"
+echo ""
+exit 0
+
+# The u-boot HTTP loader will automatically reboot the system after exit.
+
-- 
2.9.3




More information about the Lede-dev mailing list