dir825b1: Add image for DIR-825-B1 that uses the whole flash (must first be flashed with the 'standard' image) and an image to revert the change to allow reversion to stock firmware.

SVN-Revision: 33326
v19.07.3_mercusys_ac12_duma
Daniel Dickinson 12 years ago
parent 31e063d212
commit c3b7139ab2

@ -64,7 +64,9 @@ get_status_led() {
dir-615-c1)
status_led="d-link:green:status"
;;
dir-825-b1)
dir-825-b1 |\
dir-825-b1-openwrt |\
dir-825-b1-stock)
status_led="d-link:orange:power"
;;
eap7660d)

@ -0,0 +1,66 @@
#!/bin/sh
#
# Copyright (C) 2011 OpenWrt.org
#
. /lib/functions/uci-defaults.sh
. /lib/ar71xx.sh
board=$(ar71xx_board_name)
findmtd() {
local partname="$1"
grep "\"$partname\"" /proc/mtd | awk -F: '{ print $1 }'
}
getcalmac() {
local partname="$1"
local offset="$2"
hexdump -e '17/1 "%c"' -s $offset -n 17 /dev/$(findmtd $partname) | tr -d : | tr 'A-Z' 'a-z'
}
calcmacX() {
local mac="$1"
local X="$2"
local oui="$(expr substr "$mac" 1 6)"
local end="$(expr substr "$mac" 7 12)"
echo -n $oui
expr substr "$(printf "%6lx" "$(($(printf "%lu" 0x${end}) + $X))")" 1 6
}
getifmac() {
local ifname="$1"
local ifmac
ifmac="$(ifconfig "$ifname" | grep HWaddr)"
ifmac="${ifmac#*HWaddr }"
ifmac="${ifmac%% *}"
echo "$ifmac" | tr -d : | tr 'A-Z' 'a-z'
}
case "$board" in
dir-825-b1)
mac1="$(getcalmac caldata 65440)"
mac1="$(calcmacX "$mac1" 2)"
mac2="$(calcmacX "$mac1" 1)"
if grep -q '"owrt_caldata"' /proc/mtd && [ "$mac1" = "$(getifmac eth0)" ] && [ "$mac2" = "$(getifmac eth1)" ]; then
dd if=/dev/$(findmtd caldata) of=/dev/$(findmtd owrt_caldata) bs=65536 count=1
fi
;;
dir-825-b1-tostock)
mac1="$(getcalmac owrt_caldata 65440)"
mac1="$(calcmacX "$mac1" 2)"
mac2="$(calcmacX "$mac1" 1)"
if grep -q '"owrt_caldata"' /proc/mtd && [ "$mac1" = "$(getifmac eth0)" ] && [ "$mac2" = "$(getifmac eth1)" ]; then
dd if=/dev/$(findmtd owrt_caldata) of=/dev/$(findmtd caldata) bs=65536 count=1
fi
;;
esac
return 0

@ -31,6 +31,8 @@ db120)
;;
dir-825-b1|\
dir-825-b1-openwrt|\
dir-825-b1-tostock|\
tew-673gru)
ucidef_set_interfaces_lan_wan "eth0.1" "eth1"
ucidef_add_switch "rtl8366s" "1" "1"

@ -201,6 +201,12 @@ ar71xx_board_detect() {
*"DIR-825 rev. B1")
name="dir-825-b1"
;;
*"DIR-825 rev. B1 OpenWrt")
name="dir-825-b1-openwrt"
;;
*"DIR-825 rev. B1 TOSTOCK")
name="dir-825-b1-tostock"
;;
*EAP7660D)
name="eap7660d"
;;

@ -101,6 +101,8 @@ platform_check_image() {
dir-615-c1 | \
dir-615-e4 | \
dir-825-b1 | \
dir-825-b1-openwrt | \
dir-825-b1-tostock | \
ew-dorin | \
ew-dorin-router | \
mzk-w04nu | \

@ -50,6 +50,16 @@ endef
$(eval $(call Profile,DIR615E4))
define Profile/DIR825B1_ALL
NAME:=D-Link DIR-825 rev. B1 - all flavours
PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev
endef
define Profile/DIR825B1_ALL/Description
Build all D-Link DIR-825 rev. B1 images
endef
$(eval $(call Profile,DIR825B1_ALL))
define Profile/DIR825B1
NAME:=D-Link DIR-825 rev. B1
@ -58,6 +68,36 @@ endef
define Profile/DIR825B1/Description
Package set optimized for the D-Link DIR-825 rev. B1.
Copies the calibration data to the last erase block so that, if desired,
an image optimized for use with OpenWrt (access to full flash) can be flashed.
endef
$(eval $(call Profile,DIR825B1))
define Profile/DIR825B1_OPENWRT
NAME:=D-Link DIR-825 rev. B1 optimized for OpenWrt
PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev
endef
define Profile/DIR825B1_OPENWRT/Description
Package set optimized for the D-Link DIR-825 rev. B1. running OpenWrt
Can only be flashed from OpenWrt because it requires that the calibration data
be on the last sector of the flash (which the 'standard' version that can be flashed from
stock will ensure).
endef
$(eval $(call Profile,DIR825B1_OPENWRT))
define Profile/DIR825B1_TOSTOCK
NAME:=D-Link DIR-825 rev. B1 that undoes OpenWrt optimization
PACKAGES:=kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-ledtrig-usbdev
endef
define Profile/DIR825B1_TOSTOCK/Description
Package set optimized for the D-Link DIR-825 rev. B1. that undoes OpenWrt optimization
Copies the calibration data from the last erase block to the erase block normally used
by the stock firmware for said data.
endef
$(eval $(call Profile,DIR825B1_TOSTOCK))

@ -170,8 +170,10 @@ cameo7240_mtdlayout=mtdparts=spi0.0:192k(u-boot)ro,64k(nvram)ro,960k(kernel),275
cameo913x_mtdlayout=mtdparts=spi0.0:128k(u-boot)ro,64k(config)ro,960k(kernel),2880k(rootfs),64k(art)ro,3840k@0x30000(firmware)
cameo933x_mtdlayout=mtdparts=spi0.0:64k(u-boot)ro,64k(art)ro,64k(mac)ro,64k(nvram)ro,192k(language)ro,896k(kernel),2752k(rootfs),3648k@0x70000(firmware)
db120_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,6336k(rootfs),1408k(kernel),64k(nvram),64k(art)ro,7744k@0x50000(firmware)
dir825b1_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),5184k(rootfs),64k(caldata)ro,1600k(unknown)ro,6208k@0x50000(firmware)
dir825b1_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),5184k(rootfs),64k(caldata)ro,1536k(unknown)ro,64k(owrt_caldata),6208k@0x50000(firmware)
dir825b1_openwrt_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),6784k(rootfs),64k(caldata)ro,7808k@0x50000(firmware)
ew-dorin_mtdlayout_4M=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env),1024k(kernel),2688k(rootfs),64k(art),3712k@0x50000(firmware)
dir825b1_tostock_mtdlayout=mtdparts=spi0.0:256k(uboot)ro,64k(config)ro,1024k(kernel),5184k(rootfs),64k(caldata),1536k(unknown)ro,64k(owrt_caldata)ro,6208k@0x50000(firmware)
pb92_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,2752k(rootfs),896k(kernel),64k(nvram),64k(art)ro,3648k@0x50000(firmware)
planex_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,960k(kernel),6784k(rootfs),128k(art)ro,7744k@0x50000(firmware)
ubntxm_mtdlayout=mtdparts=spi0.0:256k(u-boot)ro,64k(u-boot-env)ro,1024k(kernel),6528k(rootfs),256k(cfg)ro,64k(EEPROM)ro,7552k@0x50000(firmware)
@ -218,6 +220,16 @@ define Image/Build/DIR825B1
fi
endef
define Image/Build/DIR825B1_OPENWRT
$(call MkuImageLzma,$(2),$(3) $(dir825b1_openwrt_mtdlayout))
$(call Sysupgrade/KRuImage,$(1),$(2),1048576,6946816)
endef
define Image/Build/DIR825B1_TOSTOCK
$(call MkuImageLzma,$(2),$(3) $(dir825b1_tostock_mtdlayout))
$(call Sysupgrade/KRuImage,$(1),$(2),1048576,5308416)
endef
define Image/Build/WZRHPG30XNH
$(call MkuImageLzma,$(2),$(3))
$(call Sysupgrade/KRuImage,$(1),$(2),1048576,31850496)
@ -757,6 +769,8 @@ $(eval $(call SingleProfile,Cameo933x,$(fs_squash),TEW712BR,tew-712br,TEW-712BR,
$(eval $(call SingleProfile,CyberTAN,$(fs_64k),WRT160NL,wrt160nl,WRT160NL,ttyS0,115200,1.00.01))
$(eval $(call SingleProfile,DIR825B1,$(fs_64k),DIR825B1,dir-825-b1,DIR-825-B1,ttyS0,115200,01AP94-AR7161-RT-080619-00,00AP94-AR7161-RT-080619-00))
$(eval $(call SingleProfile,DIR825B1_OPENWRT,$(fs_64k),DIR825B1_OPENWRT,dir-825-b1-openwrt,DIR-825-B1_OPENWRT,ttyS0,115200,01AP94-AR7161-RT-080619-00,00AP94-AR7161-RT-080619-00))
$(eval $(call SingleProfile,DIR825B1_TOSTOCK,$(fs_64k),DIR825B1_TOSTOCK,dir-825-b1-tostock,DIR-825-B1_TOSTOCK,ttyS0,115200,01AP94-AR7161-RT-080619-00,00AP94-AR7161-RT-080619-00))
$(eval $(call SingleProfile,DIR825B1,$(fs_64k),TEW673GRU,tew-637gru,TEW-673GRU,ttyS0,115200,01AP94-AR7161-RT-080619-01,00AP94-AR7161-RT-080619-01))
$(eval $(call SingleProfile,MyLoader,$(fs_64k),WP543_2M,wp543,,ttyS0,115200,0x200000,2M))
@ -847,6 +861,7 @@ $(eval $(call SingleProfile,ZyXEL,$(fs_64k),NBG_460N_550N_550NH,nbg460n_550n_550
$(eval $(call MultiProfile,AP121,AP121_2M AP121_4M))
$(eval $(call MultiProfile,DIR825B1_ALL,DIR825B1 DIR825B1_OPENWRT DIR825B1_TOSTOCK))
$(eval $(call MultiProfile,EWDORIN, EWDORINAP EWDORINRT))
$(eval $(call MultiProfile,TEW652BRP,TEW652BRP_FW TEW652BRP_RECOVERY))
$(eval $(call MultiProfile,TLWA901,TLWA901NV1 TLWA901NV2))

@ -0,0 +1,73 @@
--- a/arch/mips/ath79/mach-dir-825-b1.c
+++ b/arch/mips/ath79/mach-dir-825-b1.c
@@ -46,6 +46,12 @@
#define DIR825B1_MAC_LOCATION_0 0x1f66ffa0
#define DIR825B1_MAC_LOCATION_1 0x1f66ffb4
+#define DIR825B1_OPENWRT_CAL_LOCATION_0 0x1f7f1000
+#define DIR825B1_OPENWRT_CAL_LOCATION_1 0x1f7f5000
+
+#define DIR825B1_OPENWRT_MAC_LOCATION_0 0x1f7fffa0
+#define DIR825B1_OPENWRT_MAC_LOCATION_1 0x1f7fffb4
+
static struct gpio_led dir825b1_leds_gpio[] __initdata = {
{
.name = "d-link:blue:usb",
@@ -124,12 +130,12 @@ static void dir825b1_read_ascii_mac(u8 *
memset(dest, 0, ETH_ALEN);
}
-static void __init dir825b1_setup(void)
-{
+static void __init dir825b1_common_setup(unsigned int macloc1, unsigned int macloc2,
+ unsigned int calloc1, unsigned int calloc2) {
u8 mac1[ETH_ALEN], mac2[ETH_ALEN];
- dir825b1_read_ascii_mac(mac1, DIR825B1_MAC_LOCATION_0);
- dir825b1_read_ascii_mac(mac2, DIR825B1_MAC_LOCATION_1);
+ dir825b1_read_ascii_mac(mac1, macloc1);
+ dir825b1_read_ascii_mac(mac2, macloc2);
ath79_register_mdio(0, 0x0);
@@ -165,9 +171,27 @@ static void __init dir825b1_setup(void)
ap9x_pci_setup_wmac_led_pin(0, 5);
ap9x_pci_setup_wmac_led_pin(1, 5);
- ap94_pci_init((u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_0), mac1,
- (u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_1), mac2);
+ ap94_pci_init((u8 *) KSEG1ADDR(calloc1), mac1,
+ (u8 *) KSEG1ADDR(calloc2), mac2);
+}
+
+static void __init dir825b1_setup(void)
+{
+ dir825b1_common_setup(DIR825B1_MAC_LOCATION_0, DIR825B1_MAC_LOCATION_1,
+ DIR825B1_CAL_LOCATION_0, DIR825B1_CAL_LOCATION_1);
+}
+
+static void __init dir825b1_openwrt_setup(void)
+{
+ dir825b1_common_setup(DIR825B1_OPENWRT_MAC_LOCATION_0, DIR825B1_OPENWRT_MAC_LOCATION_1,
+ DIR825B1_OPENWRT_CAL_LOCATION_0, DIR825B1_OPENWRT_CAL_LOCATION_1);
}
MIPS_MACHINE(ATH79_MACH_DIR_825_B1, "DIR-825-B1", "D-Link DIR-825 rev. B1",
dir825b1_setup);
+
+MIPS_MACHINE(ATH79_MACH_DIR_825_B1_OPENWRT, "DIR-825-B1_OPENWRT", "D-Link DIR-825 rev. B1 OpenWrt",
+ dir825b1_openwrt_setup);
+
+MIPS_MACHINE(ATH79_MACH_DIR_825_B1_TOSTOCK, "DIR-825-B1_TOSTOCK", "D-Link DIR-825 rev. B1 TOSTOCK", dir825b1_openwrt_setup);
+
--- a/arch/mips/ath79/machtypes.h
+++ b/arch/mips/ath79/machtypes.h
@@ -35,6 +35,8 @@ enum ath79_mach_type {
ATH79_MACH_DIR_615_C1, /* D-Link DIR-615 rev. C1 */
ATH79_MACH_DIR_615_E4, /* D-Link DIR-615 rev. E4 */
ATH79_MACH_DIR_825_B1, /* D-Link DIR-825 rev. B1 */
+ ATH79_MACH_DIR_825_B1_OPENWRT, /* D-Link DIR-825 rev. B1 OpenWrt */
+ ATH79_MACH_DIR_825_B1_TOSTOCK, /* D-Link DIR-825 rev. B1 TOSTOCK */
ATH79_MACH_EW_DORIN, /* embedded wireless Dorin Platform */
ATH79_MACH_EW_DORIN_ROUTER, /* embedded wireless Dorin Router Platform */
ATH79_MACH_EAP7660D, /* Senao EAP7660D */
Loading…
Cancel
Save