#!/bin/bash -x
[COLOR="Gray"]# Go to DS-Mod base dir (replace by your directory name)[/COLOR]
cd ~/ds/ds26-15.2
[COLOR="Blue"]# --- Part 1: create self-made firmware image -----------------------[/COLOR]
[COLOR="gray"]# Create temp-dir for self-made kernel image[/COLOR]
rm -rf var/tmp
mkdir -p var/tmp
[COLOR="Gray"]# Cut out kernel image from recover EXE (must be in 'dl' dir!)
# Never mind how I found out those numbers. It can also be done
# automatically, but I did not want to make the script more
# complicated than necessary.[/COLOR]
cat dl/FRITZ.Box_Fon_WLAN_7170.AnnexA.en.04.34.recover-image.exe \
| tail -c 4849512 \
| head -c 4641280 \
> var/tmp/kernel.image
[COLOR="gray"]# Add CRC checksum to self-made kernel image[/COLOR]
tools/tichksum var/tmp/kernel.image
[COLOR="gray"]# Abuse 29.04.40 AVM firmware image as a template for ours[/COLOR]
cp \
dl/fritz.box_fon_wlan_7170.29.04.40.image \
dl/fritz.box_fon_wlan_7170.58.04.34-selfmade.image
[COLOR="gray"]# Replace kernel image[/COLOR]
tools/tar \
-f dl/fritz.box_fon_wlan_7170.58.04.34-selfmade.image \
--owner=0 --group=0 --mode=0755 --format=oldgnu \
--delete ./var/tmp/kernel.image
tools/tar \
-f dl/fritz.box_fon_wlan_7170.58.04.34-selfmade.image \
--owner=0 --group=0 --mode=0755 --format=oldgnu \
--append ./var/tmp/kernel.image
[COLOR="gray"]# Clean up temp-dir[/COLOR]
rm -rf var
[COLOR="Blue"]# --- Part 2: patch ds26-15.2 ---------------------------------------[/COLOR]
[COLOR="gray"]# Create dummy patch for English 7170 firmware.
# By the way: we do not port the German web page patches,
# we are in "quick & dirty mode".[/COLOR]
mkdir -p patches/7170/en
touch patches/7170/en/dummy.patch
[COLOR="gray"]# Modify definition for menuconfig so as to support annex A,
# English language and self-made firmware name[/COLOR]
cat << 'EOF' | patch -p0
--- Config.in (Revision 1132)
+++ Config.in (Arbeitskopie)
@@ -163,7 +163,7 @@
config DS_TYPE_LANG_EN
bool "en - international"
- depends on DS_TYPE_FON_WLAN_7140
+ depends on DS_TYPE_FON_WLAN_7140 || DS_TYPE_FON_WLAN_7170
endchoice
@@ -176,8 +176,9 @@
choice
prompt "Annex"
- depends on DS_TYPE_FON_WLAN_7140 && DS_TYPE_LANG_EN
- default DS_TYPE_ANNEX_B
+ depends on (DS_TYPE_FON_WLAN_7140 || DS_TYPE_FON_WLAN_7170) && DS_TYPE_LANG_EN
+ default DS_TYPE_ANNEX_B if DS_TYPE_FON_WLAN_7140 && DS_TYPE_LANG_EN
+ default DS_TYPE_ANNEX_A if DS_TYPE_FON_WLAN_7170 && DS_TYPE_LANG_EN
config DS_TYPE_ANNEX_A
bool "A"
@@ -917,7 +918,8 @@
default "ftp://ftp.avm.de/fritz.box/fritzbox.fon_wlan_7140/firmware/english/annex_b" if DS_TYPE_FON_WLAN_7140 && DS_TYPE_LANG_EN && DS_TYPE_ANNEX_B
default "ftp://ftp.avm.de/fritz.box/fritzbox.fon_wlan_7141/firmware/deutsch" if DS_TYPE_FON_WLAN_7141
default "ftp://ftp.avm.de/fritz.box/fritzfon.7150/firmware" if DS_TYPE_FON_WLAN_7150
- default "ftp://ftp.avm.de/fritz.box/fritzbox.fon_wlan_7170/firmware/deutsch" if DS_TYPE_FON_WLAN_7170
+ default "ftp://ftp.avm.de/fritz.box/fritzbox.fon_wlan_7170/firmware/deutsch" if DS_TYPE_FON_WLAN_7170 && DS_TYPE_LANG_DE
+ default "ftp://ftp.avm.de/fritz.box/fritzbox.fon_wlan_7170/firmware/english" if DS_TYPE_FON_WLAN_7170 && DS_TYPE_LANG_EN
default "ftp://ftp.avm.de/fritz.box/fritzbox.sl_wlan/firmware" if DS_TYPE_WLAN_3020
default "ftp://ftp.avm.de/fritz.box/fritzbox.wlan_3030/firmware" if DS_TYPE_WLAN_3030
default "ftp://ftp.avm.de/fritz.box/fritzbox.wlan_3130/firmware" if DS_TYPE_WLAN_3130
@@ -936,7 +938,8 @@
default "fritz.box_fon_5140.43.04.37.image" if DS_TYPE_FON_5140
default "fritz.box_fon_wlan.08.04.34.image" if DS_TYPE_FON_WLAN
default "fritz.box_fon_wlan_7050.14.04.33.image" if DS_TYPE_FON_WLAN_7050
- default "fritz.box_fon_wlan_7170.29.04.37.image" if DS_TYPE_FON_WLAN_7170 && ! DS_TYPE_LABOR
+ default "fritz.box_fon_wlan_7170.29.04.37.image" if DS_TYPE_FON_WLAN_7170 && ! DS_TYPE_LABOR && DS_TYPE_LANG_DE
+ default "fritz.box_fon_wlan_7170.58.04.34-selfmade.image" if DS_TYPE_FON_WLAN_7170 && ! DS_TYPE_LABOR && DS_TYPE_LANG_EN
default "fritz.box_fon_wlan_7140.annexb.30.04.33.image" if DS_TYPE_FON_WLAN_7140 && DS_TYPE_LANG_DE
default "fritz.box_fon_wlan_7140.annexa.en.39.04.34.image" if DS_TYPE_FON_WLAN_7140 && DS_TYPE_LANG_EN && DS_TYPE_ANNEX_A
default "fritz.box_fon_wlan_7140.annexb.en.30.04.34.image" if DS_TYPE_FON_WLAN_7140 && DS_TYPE_LANG_EN && DS_TYPE_ANNEX_B
EOF