diff mbox

[OpenWrt-Devel,2/5] ltq-vdsl-app: load the vrx200 firmware or patch it

Message ID 1456613992-31998-2-git-send-email-hauke@hauke-m.de
State Superseded
Headers show

Commit Message

Hauke Mehrtens Feb. 27, 2016, 10:59 p.m. UTC
This checks for the VRX firmware provided in the OpenWrt package.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 .../network/config/ltq-vdsl-app/files/dsl_control  | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)

Comments

Felix Fietkau Feb. 28, 2016, 7:40 a.m. UTC | #1
On 2016-02-27 23:59, Hauke Mehrtens wrote:
> This checks for the VRX firmware provided in the OpenWrt package.
> 
> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Shouldn't this add a dependency on the bspatch package?
By the way, where is that package? ;)

- Felix
Felix Fietkau Feb. 28, 2016, 7:42 a.m. UTC | #2
On 2016-02-28 08:40, Felix Fietkau wrote:
> On 2016-02-27 23:59, Hauke Mehrtens wrote:
>> This checks for the VRX firmware provided in the OpenWrt package.
>> 
>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
> Shouldn't this add a dependency on the bspatch package?
> By the way, where is that package? ;)
Ah, overlooked the commit that added it. I still think there should be a
dependency here though.

- Felix
Felix Fietkau Feb. 28, 2016, 7:44 a.m. UTC | #3
On 2016-02-28 08:42, Felix Fietkau wrote:
> On 2016-02-28 08:40, Felix Fietkau wrote:
>> On 2016-02-27 23:59, Hauke Mehrtens wrote:
>>> This checks for the VRX firmware provided in the OpenWrt package.
>>> 
>>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>> Shouldn't this add a dependency on the bspatch package?
>> By the way, where is that package? ;)
> Ah, overlooked the commit that added it. I still think there should be a
> dependency here though.
Haven't had my morning tea yet. Sorry for the noise.

- Felix
John Crispin Feb. 28, 2016, 7:53 a.m. UTC | #4
On 28/02/2016 08:44, Felix Fietkau wrote:
> On 2016-02-28 08:42, Felix Fietkau wrote:
>> On 2016-02-28 08:40, Felix Fietkau wrote:
>>> On 2016-02-27 23:59, Hauke Mehrtens wrote:
>>>> This checks for the VRX firmware provided in the OpenWrt package.
>>>>
>>>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>>> Shouldn't this add a dependency on the bspatch package?
>>> By the way, where is that package? ;)
>> Ah, overlooked the commit that added it. I still think there should be a
>> dependency here though.
> Haven't had my morning tea yet. Sorry for the noise.
> 
> - Felix
> 

i was going to reply aswell, but then realized i ran out of milk so i
could not have my hot chocolate and decided to wait :-)
Hauke Mehrtens Feb. 28, 2016, 11:17 a.m. UTC | #5
On 02/28/2016 08:53 AM, John Crispin wrote:
> 
> 
> On 28/02/2016 08:44, Felix Fietkau wrote:
>> On 2016-02-28 08:42, Felix Fietkau wrote:
>>> On 2016-02-28 08:40, Felix Fietkau wrote:
>>>> On 2016-02-27 23:59, Hauke Mehrtens wrote:
>>>>> This checks for the VRX firmware provided in the OpenWrt package.
>>>>>
>>>>> Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
>>>> Shouldn't this add a dependency on the bspatch package?
>>>> By the way, where is that package? ;)
>>> Ah, overlooked the commit that added it. I still think there should be a
>>> dependency here though.
>> Haven't had my morning tea yet. Sorry for the noise.
>>
>> - Felix
>>
> 
> i was going to reply aswell, but then realized i ran out of milk so i
> could not have my hot chocolate and decided to wait :-)
> 
Currently the dependency to the bspatch tool is in the firmware package.
In case the user wants to use his own firmware or not the bspatched
version we do not have to include the bspatch utile. The bspatch binary
should only be called in case there is a binary patch.

Hauke
diff mbox

Patch

diff --git a/package/network/config/ltq-vdsl-app/files/dsl_control b/package/network/config/ltq-vdsl-app/files/dsl_control
index fc100cf..d7ba622 100644
--- a/package/network/config/ltq-vdsl-app/files/dsl_control
+++ b/package/network/config/ltq-vdsl-app/files/dsl_control
@@ -153,6 +153,47 @@  start_service() {
 		;;
 	esac
 
+	if [ -z "${firmware}" ]; then
+		if grep -qE "system type.*: (VR9|xRX200)" /proc/cpuinfo; then
+			case "${annex}" in
+			a|l|m)
+				if [ -f "/lib/firmware/lantiq-vrx200-a.bin" ]; then
+					firmware="/lib/firmware/lantiq-vrx200-a.bin"
+				elif [ -f "/tmp/lantiq-vrx200-a.bin" ]; then
+					firmware="/tmp/lantiq-vrx200-a.bin"
+				elif [ -f "/lib/firmware/lantiq-vrx200-b.bin" ] && [ -f "/lib/firmware/lantiq-vrx200-b-to-a.bspatch" ]; then
+					bspatch /lib/firmware/lantiq-vrx200-b.bin \
+						/tmp/lantiq-vrx200-a.bin \
+						/lib/firmware/lantiq-vrx200-b-to-a.bspatch
+					firmware="/tmp/lantiq-vrx200-a.bin"
+				else
+					echo "firmware for annex a not found"
+					return -1
+				fi
+				;;
+			b|j)
+				if [ -f "/lib/firmware/lantiq-vrx200-b.bin" ]; then
+					firmware="/lib/firmware/lantiq-vrx200-b.bin"
+				elif [ -f "/tmp/lantiq-vrx200-b.bin" ]; then
+					firmware="/tmp/lantiq-vrx200-b.bin"
+				elif [ -f "/lib/firmware/lantiq-vrx200-a.bin" ] && [ -f "/lib/firmware/lantiq-vrx200-a-to-b.bspatch" ]; then
+					bspatch /lib/firmware/lantiq-vrx200-a.bin \
+						/tmp/lantiq-vrx200-b.bin \
+						/lib/firmware/lantiq-vrx200-a-to-b.bspatch
+					firmware="/tmp/lantiq-vrx200-b.bin"
+				else
+					echo "firmware for annex b not found"
+					return -1
+				fi
+				;;
+			*)
+				echo "annex type not supported use a or b"
+				return -1
+				;;
+			esac
+		fi
+	fi
+
 	[ -z "${firmware}" ] && firmware=/lib/firmware/vdsl.bin
 	[ -f "${firmware}" ] || {
 		echo failed to find $firmware