From 5064c81457129bf430db18f372199f6e9892b524 Mon Sep 17 00:00:00 2001
From: Luka Perkov <luka@openwrt.org>
Date: Thu, 15 Aug 2013 00:57:47 +0000
Subject: [PATCH] ar71xx: add support for hornet-ub-x2

The hornet-ub-x2 is hornet-ub variant with double more flash and ram.

Signed-off-by: Luka Perkov <luka@openwrt.org>

SVN-Revision: 37788
---
 target/linux/ar71xx/base-files/lib/ar71xx.sh  | 11 ++++++++-
 .../ar71xx/base-files/lib/upgrade/platform.sh |  1 +
 target/linux/ar71xx/generic/profiles/alfa.mk  | 23 +++++++++++++++----
 target/linux/ar71xx/image/Makefile            |  2 ++
 4 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 1554a51e95..e7fbfbe58a 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -280,7 +280,16 @@ ar71xx_board_detect() {
 		name="jwap003"
 		;;
 	*"Hornet-UB")
-		name="hornet-ub"
+		local size
+		size=$(awk '/firmware/ { print $2 }' /proc/mtd)
+
+		if [ "x$size" = "x00790000" ]; then
+			name="hornet-ub"
+		fi
+
+		if [ "x$size" = "x00f90000" ]; then
+			name="hornet-ub-x2"
+		fi
 		;;
 	*LS-SR71)
 		name="ls-sr71"
diff --git a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
index 1b3273d19f..8294fa43c8 100755
--- a/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ar71xx/base-files/lib/upgrade/platform.sh
@@ -113,6 +113,7 @@ platform_check_image() {
 	dir-835-a1 | \
 	ew-dorin | \
 	ew-dorin-router | \
+	hornet-ub-x2 | \
 	mzk-w04nu | \
 	mzk-w300nh | \
 	tew-632brp | \
diff --git a/target/linux/ar71xx/generic/profiles/alfa.mk b/target/linux/ar71xx/generic/profiles/alfa.mk
index 06baf240c2..97c843ace1 100644
--- a/target/linux/ar71xx/generic/profiles/alfa.mk
+++ b/target/linux/ar71xx/generic/profiles/alfa.mk
@@ -1,12 +1,12 @@
 #
-# Copyright (C) 2011 OpenWrt.org
+# Copyright (C) 2011-2013 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 #
 
 define Profile/ALFAAP96
-	NAME:=ALFA Network AP96  board
+	NAME:=ALFA Network AP96 board
 	PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-rtc-pcf2123
 endef
 
@@ -18,17 +18,31 @@ $(eval $(call Profile,ALFAAP96))
 
 
 define Profile/HORNETUB
-	NAME:=ALFA Network Hornet-UB board
+	NAME:=ALFA Network Hornet-UB board (8MB flash, 32MB ram)
 	PACKAGES:=kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev
 endef
 
 define Profile/HORNETUB/Description
-	Package set optimized for the ALFA Network Hornet-UB board.
+	Package set optimized for the ALFA Network Hornet-UB board with 8MB
+	flash and 32MB ram.
 endef
 
 $(eval $(call Profile,HORNETUB))
 
 
+define Profile/HORNETUBx2
+	NAME:=ALFA Network Hornet-UB-x2 board (16MB flash, 64MB ram)
+	PACKAGES:=kmod-usb-core kmod-usb2 kmod-ledtrig-usbdev
+endef
+
+define Profile/HORNETUBx2/Description
+	Package set optimized for the ALFA Network Hornet-UB board with 16MB
+	flash and 64MB ram.
+endef
+
+$(eval $(call Profile,HORNETUBx2))
+
+
 define Profile/ALFANX
 	NAME:=ALFA Network N2/N5 board
 	PACKAGES:=
@@ -39,4 +53,3 @@ define Profile/ALFANX/Description
 endef
 
 $(eval $(call Profile,ALFANX))
-
diff --git a/target/linux/ar71xx/image/Makefile b/target/linux/ar71xx/image/Makefile
index 90f0ef1496..f5650c9afe 100644
--- a/target/linux/ar71xx/image/Makefile
+++ b/target/linux/ar71xx/image/Makefile
@@ -151,6 +151,7 @@ endef
 
 alfa_ap96_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env)ro,13312k(rootfs),2048k(kernel),512k(caldata)ro,15360k@0x80000(firmware)
 alfa_mtdlayout_8M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1600k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
+alfa_mtdlayout_16M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,15936k(firmware),64k(nvram),64k(art)ro
 all0258n_mtdlayout=mtdparts=spi0.0:256k(u-boot),64k(u-boot-env),6272k(firmware),1536k(failsafe),64k(art)
 all0315n_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,256k(u-boot-env),13568k(firmware),2048k(failsafe),256k(art)ro
 ap96_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(u-boot-env)ro,6144k(rootfs),1728k(kernel),64k(art)ro,7872k@0x40000(firmware)
@@ -894,6 +895,7 @@ $(eval $(call SingleProfile,AthLzma,$(fs_64k),CAP4200AG,cap4200ag,CAP4200AG,ttyS
 $(eval $(call SingleProfile,AthLzma,$(fs_64k),DB120,db120,DB120,ttyS0,115200,$$(db120_mtdlayout),1441792,6488064,RKuImage))
 $(eval $(call SingleProfile,AthLzma,$(fs_64k),EWDORINAP,ew-dorin,EW-DORIN,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),65536,2752512,KRuImage))
 $(eval $(call SingleProfile,AthLzma,$(fs_64k),EWDORINRT,ew-dorin-router,EW-DORIN-ROUTER,ttyATH0,115200,$$(ew-dorin_mtdlayout_4M),65536,2752512,KRuImage))
+$(eval $(call SingleProfile,AthLzma,$(fs_64k),HORNETUBx2,hornet-ub-x2,HORNET-UB,ttyATH0,115200,$$(alfa_mtdlayout_16M),65536,16318464,KRuImage))
 $(eval $(call SingleProfile,AthLzma,$(fs_64k),PB92,pb92,PB92,ttyS0,115200,$$(pb92_mtdlayout),917504,2818048,KRuImage))
 
 $(eval $(call SingleProfile,Cameo7240,$(fs_64k),DIR600A1,dir-600-a1,DIR-600-A1,ttyS0,115200,"AP91-AR7240-RT-090223-00"))
-- 
GitLab