Re: [OpenWrt-Devel] [PATCH] mpc85xx: fix WAN/LAN-MAC for TP-LINK TL-WDR4900 v1

2014-10-25 Thread John Crispin
can you write a sentence about the bootloader issue that you are fixing ?

On 23/10/2014 22:10, Bastian Bittorf wrote:
 mpc85xx: fix WAN/LAN-MAC for TP-LINK TL-WDR4900 v1
 
 This works around a bootloader issue and reads the macs from
 config-partition during initial network setup. We have 9 valid
 macs stored in the partition, the 1st two are used for the radios,
 3 and 4 are now used for WAN/LAN.
 
 https://dev.openwrt.org/ticket/14714
 
 Signed-off-by: Bastian Bittorf bitt...@bluebottle.com
 ---
  .../mpc85xx/base-files/etc/uci-defaults/02_network |   26 
 
  1 files changed, 5 insertions(+), 21 deletions(-)
 
 diff --git a/target/linux/mpc85xx/base-files/etc/uci-defaults/02_network 
 b/target/linux/mpc85xx/base-files/etc/uci-defaults/02_network
 index 10a2cc8..e4e3566 100755
 --- a/target/linux/mpc85xx/base-files/etc/uci-defaults/02_network
 +++ b/target/linux/mpc85xx/base-files/etc/uci-defaults/02_network
 @@ -1,22 +1,5 @@
  #!/bin/sh
 -#
 -# Copyright (C) 2013 OpenWrt.org
 -#
 -
 -tplink_set_mac()
 -{
 - local cfg=$1
 - local offset=$2
 - local mac
 -
 - . /lib/functions.sh
 -
 - mac=$(mtd_get_mac_binary u-boot 326656)
 - mac=$(macaddr_add $mac $offset)
 -
 - ucidef_set_interface_macaddr $cfg $mac
 -}
 -
 +# Copyright (C) 2014 OpenWrt.org
  
  [ -e /etc/config/network ]  exit 0
  
 @@ -24,6 +7,8 @@ touch /etc/config/network
  
  . /lib/functions/uci-defaults.sh
  . /lib/mpc85xx.sh
 +. /lib/functions.sh
 +. /lib/functions/system.sh
  
  ucidef_set_interface_loopback
  
 @@ -35,10 +20,9 @@ tl-wdr4900-v1)
   ucidef_add_switch switch0 1 1
   ucidef_add_switch_vlan switch0 1 0t 2 3 4 5
   ucidef_add_switch_vlan switch0 2 0t 1
 - tplink_set_mac lan -2
 - tplink_set_mac wan 1
 + ucidef_set_interface_macaddr lan $(mtd_get_mac_binary config 338)
 + ucidef_set_interface_macaddr wan $(mtd_get_mac_binary config 344)
   ;;
 -
  *)
   ucidef_set_interfaces_lan_wan eth0 eth1
   ;;
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] [PATCH v2] kernel: update 3.10.49 to 3.10.58 (released 2014-oct-15)

2014-10-25 Thread John Crispin
sure, we can do that ...

On 24/10/2014 23:05, Daniel Petre wrote:
 
 
 On 24/10/14 23:41, Felix Fietkau wrote:
 On 2014-10-24 22:36, Bastian Bittorf wrote:
 All platforms which are using 3.10.x at the moment are
 upgraded.
 
 Changelogs: 
 https://www.kernel.org/pub/linux/kernel/v3.x/ChangeLog-3.10.58
 
 Signed-off-by: Bastian Bittorf bitt...@bluebottle.com
 Committed in r43049, thanks.
 
 Good evening, is it too much to ask for a BB refresh too? Thanks!
 
 
 - Felix ___ 
 openwrt-devel mailing list openwrt-devel@lists.openwrt.org 
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
 
 ___ openwrt-devel
 mailing list openwrt-devel@lists.openwrt.org 
 https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
 
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] mpc85xx: fix WAN/LAN-MAC for TP-LINK TL-WDR4900 v1

2014-10-25 Thread Mike Thomi
Isn't the issue is described in the bugtracker very well?

Anyway, please mind backporting this to the BB branch.

Thanks, Mike

___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] [PATCH] mpc85xx: fix WAN/LAN-MAC for TP-LINK TL-WDR4900 v1

2014-10-25 Thread Bastian Bittorf
This works around a bootloader issue where every device
has the same lan/wan-mac 00:04:9f:ef:01:01 - with this patch
we read the macs from config-partition during initial network
setup. We have 9 valid macs stored in the partition, the
1st two are used for the radios, 3 and 4 are now used for WAN/LAN.

on an already setup / running device we can get the real macs with
. /lib/functions.sh
. /lib/functions/system.sh
echo LAN = $(mtd_get_mac_binary config 338)
echo WAN = $(mtd_get_mac_binary config 344)

see:
https://dev.openwrt.org/ticket/14714

from the ticket / user klondike:
U-Boot passed this commit 
https://gitorious.org/0xlab-kernel/u-boot/commit/ecd1a09b81f2ed6e6ba7bd1d0bfb0cc3d0ea2ad0
http://u-boot.10912.n7.nabble.com/U-Boot-PATCH-mpc83xx-remove-hardcoded-network-addresses-from-config-files-td44372.html
I suppose to prevent this particular issue, but the WDR4900 may be using an old 
bootloader still affected.
   
^^

I have been checking the contents of the dtb on the flash, this particular bit 
is quite revealing:

ethernet@b {
#address-cells = 0x1;
#size-cells = 0x1;
device_type = network;
model = eTSEC;
compatible = fsl,etsec2;
fsl,num_rx_queues = 0x8;
fsl,num_tx_queues = 0x8;
local-mac-address = [00 00 00 00 00 00];
 ^

interrupt-parent = 0x2;
phy-handle = 0x3;
phy-connection-type = rgmii-id;
ptimer-handle = 0x4;

queue-group@0 {
#address-cells = 0x1;
#size-cells = 0x1;
reg = 0xb 0x1000;
rx-bit-map = 0xff;
tx-bit-map = 0xff;
interrupts = 0x1d 0x2 0x1e 0x2 0x22 0x2;
};
};

I also have been checking the live device map to find this:

root@GHS-AP3:~# hexdump -C 
/proc/device-tree/soc@ffe0/ethernet@b/local-mac-address
  00 04 9f ef 01 01 |..|
0006
root@GHS-AP3:~# hexdump -C 
/proc/device-tree/soc@ffe0/ethernet@b1000/local-mac-address
*
root@GHS-AP3:~# hexdump -C 
/proc/device-tree/soc@ffe0/ethernet@b2000/local-mac-address
*

My conclussion is that U-Boot most likely finds the device and (as no valid 
MAC-address is provided)
falls back to the default MAC provided by the old code, the kernel then 
receives thee modified
device map from U-Boot and assumes this is the correct MAC for the device 
despite it obviously isn't.

This can be seen at
target/linux/mpc85xx/patches-3.10/140-powerpc-85xx-tl-wdr4900-v1-support.patch

The enetaddr is filled up by using the device tree data by the process_boot_dtb
function and used by the platform_fixups function to set the eth0 address
(by calling dt_fixup_mac_address_by_alias(ethernet0, enetaddr); ).
But instead we should be used the device address which to my understanding is
provided in the mtd.

Signed-off-by: Bastian Bittorf bitt...@bluebottle.com
---
 .../mpc85xx/base-files/etc/uci-defaults/02_network |   26 
 1 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/target/linux/mpc85xx/base-files/etc/uci-defaults/02_network 
b/target/linux/mpc85xx/base-files/etc/uci-defaults/02_network
index 10a2cc8..e4e3566 100755
--- a/target/linux/mpc85xx/base-files/etc/uci-defaults/02_network
+++ b/target/linux/mpc85xx/base-files/etc/uci-defaults/02_network
@@ -1,22 +1,5 @@
 #!/bin/sh
-#
-# Copyright (C) 2013 OpenWrt.org
-#
-
-tplink_set_mac()
-{
-   local cfg=$1
-   local offset=$2
-   local mac
-
-   . /lib/functions.sh
-
-   mac=$(mtd_get_mac_binary u-boot 326656)
-   mac=$(macaddr_add $mac $offset)
-
-   ucidef_set_interface_macaddr $cfg $mac
-}
-
+# Copyright (C) 2014 OpenWrt.org
 
 [ -e /etc/config/network ]  exit 0
 
@@ -24,6 +7,8 @@ touch /etc/config/network
 
 . /lib/functions/uci-defaults.sh
 . /lib/mpc85xx.sh
+. /lib/functions.sh
+. /lib/functions/system.sh
 
 ucidef_set_interface_loopback
 
@@ -35,10 +20,9 @@ tl-wdr4900-v1)
ucidef_add_switch switch0 1 1
ucidef_add_switch_vlan switch0 1 0t 2 3 4 5
ucidef_add_switch_vlan switch0 2 0t 1
-   tplink_set_mac lan -2
-   tplink_set_mac wan 1
+   ucidef_set_interface_macaddr lan $(mtd_get_mac_binary config 338)
+   ucidef_set_interface_macaddr wan $(mtd_get_mac_binary config 344)
;;
-
 *)
ucidef_set_interfaces_lan_wan eth0 eth1
;;
-- 
1.7.2.5
___
openwrt-devel mailing list

[OpenWrt-Devel] [PATCH] Add /etc/shadow to list of essential files to keep in sysupgrade (bug 18206)

2014-10-25 Thread Hannu Nyman
Based on bug #18206 sysupgrade can lead to loss of password information in 
certain situations. Most likely all users who will upgrade from versions 
r43017-43040, will lose their current passwords. :-(

https://dev.openwrt.org/ticket/18206

Currently /etc/shadow is defined as a conffile in base-files:
​ https://dev.openwrt.org/browser/trunk/package/base-files/Makefile#L37

But it is not defined in the default list of essential files to keep in 
sysupgrade:
​ 
https://dev.openwrt.org/browser/trunk/package/base-files/files/lib/upgrade/keep.d/base-files-essential


If exporting conffiles info fails, /etc/shadow can get lost.

Shadow passwords are now the default, so saying that preserving /etc/passwd 
is essential while /etc/shadow is not, makes no sense.


The attached patch adds /etc/shadow to the list of essential files.

The patch should probably be also applied to BB14.07.

Signed-off-by: Hannu Nyman hannu.ny...@iki.fi

Index: package/base-files/files/lib/upgrade/keep.d/base-files-essential
===
--- package/base-files/files/lib/upgrade/keep.d/base-files-essential
(revision 43057)
+++ package/base-files/files/lib/upgrade/keep.d/base-files-essential
(working copy)
@@ -4,6 +4,7 @@
 /etc/group
 /etc/passwd
 /etc/profile
+/etc/shadow
 /etc/shells
 /etc/sysctl.conf
 /etc/rc.local
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Pogoplug V4 support

2014-10-25 Thread nwf
Salutations openwrt-devel@,

I've gotten an initial Pogoplug V4 build into good enough shape that I think
it's worth sharing.  It uses a lightly-tweaked fork of uBoot for the moment
(though I'm hoping the tweaks eventually make it back into mainline) and uses
FDT to bring up the kernel.  Thoughts are welcome.

--nwf;


diff --git a/package/boot/uboot-kirkwood-mibodhi/Makefile 
b/package/boot/uboot-kirkwood-mibodhi/Makefile
new file mode 100644
index 000..6855a91
--- /dev/null
+++ b/package/boot/uboot-kirkwood-mibodhi/Makefile
@@ -0,0 +1,103 @@
+#
+# Copyright (C) 2010-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=u-boot
+PKG_VERSION:=2014.07-mibodhi
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=g...@github.com:nwf/u-boot-kirkwood.git
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_VERSION:=23217407aab5494d7c17b0c5b0b1aabb13e4c26e
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define uboot/Default
+  TITLE:=
+  CONFIG:=
+  IMAGE:=
+endef
+
+define uboot/pogo4
+  TITLE:=U-Boot for Cloud Engines Pogoplug V4
+  CONFIG:=pogo_v4
+endef
+
+UBOOTS:= pogo4
+
+define Package/uboot/template
+define Package/uboot-kirkwood-$(1)
+  SECTION:=boot
+  CATEGORY:=Boot Loaders
+  DEPENDS:=@TARGET_kirkwood
+  TITLE:=$(2)
+  URL:=http://www.denx.de/wiki/U-Boot
+  VARIANT:=$(1)
+endef
+endef
+
+define BuildUBootPackage
+   $(eval $(uboot/Default))
+   $(eval $(uboot/$(1)))
+   $(call Package/uboot/template,$(1),$(TITLE))
+endef
+
+ifdef BUILD_VARIANT
+$(eval $(call uboot/$(BUILD_VARIANT)))
+UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
+UBOOT_IMAGE:=$(if 
$(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
+endif
+
+define Build/Configure
+   +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
+   $(UBOOT_CONFIG)_config
+endef
+
+define Build/Compile
+   +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
+   u-boot.kwb \
+   CROSS_COMPILE=$(TARGET_CROSS)
+   mkimage -A $(ARCH) -O linux -T kernel -C none \
+   -a 0x60 -e 0x60 \
+   -n 'OpenWrt Das U-Boot uImage' \
+   -d $(PKG_BUILD_DIR)/u-boot.bin $(PKG_BUILD_DIR)/u-boot.img
+endef
+
+define Package/uboot/install/default
+   $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
+   $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
+   $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.bin
+   $(CP) $(PKG_BUILD_DIR)/u-boot.kwb \
+   $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.kwb
+   $(CP) $(PKG_BUILD_DIR)/u-boot.img \
+   $(BIN_DIR)/uboot-$(BOARD)-$(1)/openwrt-$(BOARD)-$(1)-u-boot.img
+   $(INSTALL_DIR) $(BIN_DIR)/u-boot-kwboot/
+   $(CP) $(PKG_BUILD_DIR)/tools/kwboot \
+   $(BIN_DIR)/u-boot-kwboot/
+endef
+
+define Package/uboot/install/template
+define Package/uboot-kirkwood-$(1)/install
+   $(call Package/uboot/install/default,$(2))
+endef
+endef
+
+$(foreach u,$(UBOOTS), \
+   $(eval $(call Package/uboot/install/template,$(u),$(u))) \
+)
+
+$(foreach u,$(UBOOTS), \
+   $(eval $(call BuildUBootPackage,$(u))) \
+   $(eval $(call BuildPackage,uboot-kirkwood-$(u))) \
+)
diff --git 
a/package/boot/uboot-kirkwood-mibodhi/patches/200-openwrt-config.patch 
b/package/boot/uboot-kirkwood-mibodhi/patches/200-openwrt-config.patch
new file mode 100644
index 000..8abbfe6
--- /dev/null
+++ b/package/boot/uboot-kirkwood-mibodhi/patches/200-openwrt-config.patch
@@ -0,0 +1,109 @@
+--- /dev/null
 b/include/configs/openwrt-kirkwood-common.h
+@@ -0,0 +1,47 @@
++/*
++ * Copyright (C) 2013 Luka Perkov l...@openwrt.org
++ *
++ * SPDX-License-Identifier:   GPL-2.0+
++ */
++
++#ifndef __OPENWRT_KIRKWOOD_COMMON_H
++#define __OPENWRT_KIRKWOOD_COMMON_H
++
++/* Commands */
++#define CONFIG_CMD_BOOTZ
++
++#if defined(CONFIG_CMD_NET)
++#define CONFIG_CMD_DHCP
++#define CONFIG_CMD_PING
++#endif
++
++/* Auto boot */
++#undef CONFIG_BOOTDELAY
++#define CONFIG_BOOTDELAY  3
++
++/* Ethernet */
++#if defined(CONFIG_CMD_NET)
++#define CONFIG_SERVERIP   192.168.1.2
++#define CONFIG_IPADDR 192.168.1.1
++#endif
++
++/* second stage loader */
++#if defined(CONFIG_SECOND_STAGE)
++#undef CONFIG_ENV_IS_IN_NAND
++#undef CONFIG_ENV_SECT_SIZE
++#define CONFIG_ENV_IS_NOWHERE
++#endif
++
++/* Flattened Device Tree */
++#define CONFIG_OF_LIBFDT
++
++/* Flattened uImage Tree */
++#define CONFIG_FIT
++#define CONFIG_FIT_VERBOSE
++
++/* Various */
++#define CONFIG_BZIP2
++#define CONFIG_LZMA
++#define CONFIG_LZO
++
++#endif /* __OPENWRT_KIRKWOOD_COMMON_H */
+--- a/include/configs/pogo_v4.h
 b/include/configs/pogo_v4.h
+@@ -94,19 +94,40 @@
+  * Default environment