[OpenWrt-Devel] [PATCH 3/3 v2] gemini: Fix MAC address assignment for DIR-685

Michael Heimpold mhei at heimpold.de
Thu Jun 13 16:02:28 EDT 2019


Hi,

Am Dienstag, 11. Juni 2019, 23:06:55 CEST schrieb Linus Walleij:
> The DIR-685 has the MAC addresses in the RedBoot code just like
> DNS-313. Check some magic numbers to determine that the MAC
> address is where we want it and extract it from RedBoot.
> 
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
> ChangeLog v1->v2:
> - Rebase on the other patches
> - Use library functions to get partition and hex MAC address
> - Use ip to set up mac address
> ---
>  .../lib/preinit/05_set_ether_mac_gemini           | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
> 
> diff --git
> a/target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini
> b/target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini index
> a51c223d85c9..f702e0458c2e 100644
> --- a/target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini
> +++ b/target/linux/gemini/base-files/lib/preinit/05_set_ether_mac_gemini
> @@ -18,6 +18,21 @@ set_ether_mac() {
>  			fi
>  		fi
>  		;;
> +	dlink,dir-685)
> +		# The DIR-685 has a special field in its RedBoot
> +		# binary that we need to check
> +		part=$(find_mtd_part RedBoot)
> +		if [ ! -z $part ] ; then

missing quotes here? and is "! -z " not equal to "-n" ?

> +			DEVID="$(dd if=$part bs=1 skip=81516 count=7 2>/dev/null)"
> +			if [ "x$DEVID" = "xILI9322" ] ; then

not sure whether we have a style guide for shell, but personally I don't like
the x in front of the values: since you already quote properly, it seems
not to be necessary.

> +				MAC1=$(mtd_get_mac_binary RedBoot 95040)
> +				MAC2=$(mtd_get_mac_binary RedBoot 95046)
> +				ifconfig eth0 hw ether $MAC1 2>/dev/null
> +				ifconfig eth1 hw ether $MAC2 2>/dev/null

missing quotes? just to be sure?

Best regards,
mhei

> +				return 0
> +			fi
> +		fi
> +		;;
>  	esac
> 
>  	# Most devices have a standard "VCTL" partition

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20190613/e1a2dfc6/attachment.sig>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list