Re: [LEDE-DEV] [OpenWrt-Devel] 18.03/4

2018-03-09 Thread Philip Prindeville


> On Mar 4, 2018, at 6:26 PM, Alif M. Ahmad  wrote:
> 
> On Fri, Feb 16, 2018 at 01:46:31PM +0100, John Crispin wrote:
>> Hi,
>> 
>> whats on the critical todo list for the upcoming release ? i still have 
>> a few minor things that I'll be adding shortly, apart from that I am 
>> currently not aware of any huge problems. the release will be a mix 
>> between 4.9 and 4.14 afaik !?
>> 
>> John
> 
> I would like to have uefi-gpt image for x86_64. For this feature, uefi
> related changes on Jow's staging repository should be merged.
> 
> I have fixed kernel panic issue when booting gpt image on bios based
> systems with my previous patch series.


There’s also the packaging issue of combining the target and host packaging of 
sgdisk.

Jo: did you have any time to look at that?

-Philip


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 3/3] lantiq: add support for AVM FRITZ!Box 7412

2018-03-09 Thread John Crispin



On 09/03/18 20:55, John Crispin wrote:



On 09/03/18 20:17, Valentin Spreckels wrote:

Specification:
- SoC: Lantiq VRX 220
- CPU Cores: 2x MIPS 34Kc at 500 MHz
- RAM: 128 MiB 250 MHz
- Storage: 128 MiB NAND flash
- Ethernet: built-in Fast Ethernet switch, only port 2 is used
- Wireless: Atheros AR9287-BL1A b/g/n with 2 pcb antennas
- Modem: built-in A/VDSL2 modem
- DECT: Dialog SC14441
- LEDs: 1 two-color, 4 one-color
- Buttons: 2
- FXS: 1 port via TAE or RJ12 connector

Working:
- ethernet
- wifi
- leds
- buttons
- dsl

Not working:
- Second cpu core
- FXS
- DECT

Installation:

1. Use the eva_ramboot.py script to load an initramfs image on the
device. Run it a few seconds after turning the device on.
$ scripts/flashing eva_ramboot 192.168.178.1 
bin/targets/lantiq/xrx200/openwrt-lantiq-xrx200-avm_fritz7412-initramfs-kernel.bin


If it fails to find the device try the ip address 169.254.120.1.
(Firmware updates or the recovery tool apparently change it.)

2. The device will load it in ram and boot it. You can reach it under
the openwrt default ip address 192.168.1.1.

3. Check if the key linux_fs_start is not set to 1 in tffs:
$ fritz_tffs_nand -d /dev/mtd1 -n linux_fs_start
If it is set to 1, the bootloader will select the wrong set of
partitions. Restart the box and install an FritzOS upgrade or do a
recovery. Afterwards start again at step 1.

4. Run sysupgrade to persistently install OpenWRT.

Signed-off-by: Valentin Spreckels 


---
  .../linux/lantiq/base-files/etc/board.d/02_network |   8 +
  .../etc/hotplug.d/firmware/12-ath9k-eeprom |   3 +
  .../lantiq/base-files/lib/upgrade/platform.sh  |   2 +-
  .../files-4.14/arch/mips/boot/dts/FRITZ7412.dts    | 241 

  .../files-4.9/arch/mips/boot/dts/FRITZ7412.dts | 242 
+

  .../lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi   |   2 +-
  target/linux/lantiq/image/Makefile |  13 ++
  7 files changed, 509 insertions(+), 2 deletions(-)
  create mode 100644 
target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts
  create mode 100644 
target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7412.dts


diff --git a/target/linux/lantiq/base-files/etc/board.d/02_network 
b/target/linux/lantiq/base-files/etc/board.d/02_network

index ca974b071e..defdc1a94d 100755
--- a/target/linux/lantiq/base-files/etc/board.d/02_network
+++ b/target/linux/lantiq/base-files/etc/board.d/02_network
@@ -154,6 +154,14 @@ avm,fritz7360sl)
  "0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
  ;;
  +avm,fritz7412)
+    tffsdev=$(find_mtd_chardev "nand-tffs")
+    annex="b"
+    lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca)
+    wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl)

dont use absolute paths please ...

+    ucidef_set_interface_lan 'eth0'
+    ;;
+
  siemens,gigaset-sx76x)
  annex="b"
  ucidef_add_switch "switch0" \
diff --git 
a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom 
b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom

index 498a509012..68181c7b87 100644
--- 
a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
+++ 
b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom

@@ -141,6 +141,9 @@ case "$FIRMWARE" in
  avm,fritz3370|avm,fritz7320|avm,fritz7360sl)
  ath9k_eeprom_extract "urlader" 2437 0
  ;;
+    avm,fritz7412)
+    /usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 
-l 4096 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader")

absolute path ...

+    ;;
  tplink,tdw8970|tplink,tdw8980)
  ath9k_eeprom_extract "boardconfig" 135168 0
  ;;
diff --git a/target/linux/lantiq/base-files/lib/upgrade/platform.sh 
b/target/linux/lantiq/base-files/lib/upgrade/platform.sh

index 2e58cb799a..7a43e7e12e 100755
--- a/target/linux/lantiq/base-files/lib/upgrade/platform.sh
+++ b/target/linux/lantiq/base-files/lib/upgrade/platform.sh
@@ -9,7 +9,7 @@ platform_do_upgrade() {
  local board=$(board_name)
    case "$board" in
- 
bt,homehub-v2b|bt,homehub-v3a|bt,homehub-v5a|zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3)
+ 
avm,fritz7412|bt,homehub-v2b|bt,homehub-v3a|bt,homehub-v5a|zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3)

please turn this into |\
multi|\
line)


  nand_do_upgrade $1
  ;;
  *)
diff --git 
a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts 
b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts

new file mode 100644
index 00..5bcd140520
--- /dev/null
+++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts


i'll leave the dts review to mkresin, there is a newline spacing issue 
for sure. :-)


all in all, thanks, nice patch series

    John

@@ -0,0 +1,241 @@
+/dts-v1/;
+
+#include "vr9.dtsi"
+
+#include 
+#include 
+
+/ {
+    compatible = "avm,fritz7412", "lantiq,xway", "lantiq,vr9

Re: [LEDE-DEV] [PATCH] imx6: disable dma on uart

2018-03-09 Thread Bas Mevissen
On 02/22/2018 12:20 PM, Koen Vandeputte wrote:
> When this target got updated to 4.14, this patch got removed to
> re-evaluate if it was still needed.
> 
> Extensive testing now shows this issue is still present.
> Let's re-add the patch to fix it for now.
> 
> As the uart bus is very low bandwidth .. performance impact is negligible.
> 
> Boot log:
> 
> [   22.513051] imx-uart 202.serial: DMA transaction error.
> [   22.522721] imx-uart 202.serial: DMA transaction error.
> 

An alternative solution is to add the following to the uart's device
tree definition:

dma-names = "", "";

e.g.

&uart1 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_uart1>;
dma-names = "", "";
status = "okay";
};

Regards,

Bas.




___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 2/3] scripts: add EVA ramboot script

2018-03-09 Thread John Crispin



On 09/03/18 20:17, Valentin Spreckels wrote:

The bootloader on the FRITZ!Box 7412 crashes when flashing images. Thus
the AVM recovery tool uses another approach: It uses the bootloader to
load a small linux system into the ram and boot it from there. This
system will then flash the image.

This script mimics the behavior: It loads an openwrt initramfs image.
After this a sysupgrade can be done to persistently install openwrt.

Signed-off-by: Valentin Spreckels 



I have been using an ugly shell script to do the same for a few years so ...

Acked-by: John Crispin 


---
  scripts/flashing/eva_ramboot.py | 37 +
  1 file changed, 37 insertions(+)
  create mode 100755 scripts/flashing/eva_ramboot.py

diff --git a/scripts/flashing/eva_ramboot.py b/scripts/flashing/eva_ramboot.py
new file mode 100755
index 00..b825d2768b
--- /dev/null
+++ b/scripts/flashing/eva_ramboot.py
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+from ftplib import FTP
+from sys import argv
+from os import stat
+
+assert len(argv) == 3
+ip = argv[1]
+image = argv[2]
+
+size = stat(image).st_size
+# arbitrary size limit, to prevent the address calculations from overflows etc.
+assert size < 0x200
+
+# We need to align the address. A page boundary seems to be sufficient on 
7362sl
+# and 7412
+addr = ((0x800 - size) & ~0xfff)
+haddr = 0x8000 + addr
+img = open(image, "rb")
+
+ftp = FTP(ip, 'adam2', 'adam2')
+
+def adam(cmd):
+   print("> %s"%(cmd))
+   resp = ftp.sendcmd(cmd)
+   print("< %s"%(resp))
+   assert resp[0:3] == "200"
+
+ftp.set_pasv(True)
+# The following parameters allow booting the avm recovery system with this
+# script.
+adam('SETENV memsize 0x%08x'%(addr))
+adam('SETENV kernel_args_tmp mtdram1=0x%08x,0x8800'%(haddr))
+adam('MEDIA SDRAM')
+ftp.storbinary('STOR 0x%08x 0x8800'%(haddr), img)
+img.close()
+ftp.close()



___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] [PATCH 1/3] fritz-tools: add fritz_tffs_nand_read tool

2018-03-09 Thread John Crispin

Hi Valentin,

nitpicks inline ...


On 09/03/18 20:17, Valentin Spreckels wrote:

This tool reads informations from AVM TFFS 3.0 filesystems on nand
flash. AVM uses this on newer FRITZ!Boxes (e.g. 7412) without SPI or nor
flash.

Signed-off-by: Valentin Spreckels 

---
  package/utils/fritz-tools/Makefile |  15 +
  package/utils/fritz-tools/src/CMakeLists.txt   |   3 +-
  .../utils/fritz-tools/src/fritz_tffs_nand_read.c   | 558 +
  3 files changed, 575 insertions(+), 1 deletion(-)
  create mode 100644 package/utils/fritz-tools/src/fritz_tffs_nand_read.c

diff --git a/package/utils/fritz-tools/Makefile 
b/package/utils/fritz-tools/Makefile
index 7c547e6f97..a4d69bdf71 100644
--- a/package/utils/fritz-tools/Makefile
+++ b/package/utils/fritz-tools/Makefile
@@ -21,6 +21,15 @@ define Package/fritz-tffs/description
   Utility to partially read the TFFS filesystems.
  endef
  
+define Package/fritz-tffs-nand

+  $(call Package/fritz-tools/Default)
+  TITLE:=Utility to partially read the TFFS filesystems on NAND flash
+endef
+
+define Package/fritz-tffs-nand/description
+ Utility to partially read the TFFS filesystems on NAND flash.
+endef
+
  define Package/fritz-caldata
$(call Package/fritz-tools/Default)
DEPENDS:=+zlib
@@ -36,10 +45,16 @@ define Package/fritz-tffs/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fritz_tffs_read $(1)/usr/bin/fritz_tffs
  endef
  
+define Package/fritz-tffs-nand/install

+   $(INSTALL_DIR) $(1)/usr/bin
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/fritz_tffs_nand_read 
$(1)/usr/bin/fritz_tffs_nand
+endef
+
  define Package/fritz-caldata/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fritz_cal_extract $(1)/usr/bin/
  endef
  
  $(eval $(call BuildPackage,fritz-tffs))

+$(eval $(call BuildPackage,fritz-tffs-nand))
  $(eval $(call BuildPackage,fritz-caldata))
diff --git a/package/utils/fritz-tools/src/CMakeLists.txt 
b/package/utils/fritz-tools/src/CMakeLists.txt
index 021dc7733a..85b815712e 100644
--- a/package/utils/fritz-tools/src/CMakeLists.txt
+++ b/package/utils/fritz-tools/src/CMakeLists.txt
@@ -9,7 +9,8 @@ FIND_PATH(zlib_include_dir zlib.h)
  INCLUDE_DIRECTORIES(${zlib_include_dir})
  
  ADD_EXECUTABLE(fritz_tffs_read fritz_tffs_read.c)

+ADD_EXECUTABLE(fritz_tffs_nand_read fritz_tffs_nand_read.c)
  ADD_EXECUTABLE(fritz_cal_extract fritz_cal_extract.c)
  TARGET_LINK_LIBRARIES(fritz_cal_extract z)
  
-INSTALL(TARGETS fritz_tffs_read fritz_cal_extract RUNTIME DESTINATION bin)

+INSTALL(TARGETS fritz_tffs_read fritz_tffs_nand_read fritz_cal_extract RUNTIME 
DESTINATION bin)
diff --git a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c 
b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c
new file mode 100644
index 00..6f30c2bbdb
--- /dev/null
+++ b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c
@@ -0,0 +1,558 @@
+/*
+ * A tool for reading the TFFS partitions (a name-value storage usually
+ * found in AVM Fritz!Box based devices) on nand flash.
+ *
+ * Copyright (c) 2018 Valentin Spreckels 

+ *
+ * Based on the fritz_tffs_read tool:
+ * Copyright (c) 2015-2016 Martin Blumenstingl 

+ * and on the TFFS 2.0 kernel driver from AVM:
+ * Copyright (c) 2004-2007 AVM GmbH 
+ * and the TFFS 3.0 kernel driver from AVM:
+ * Copyright (C) 2004-2014 AVM GmbH 
+ * and the OpenWrt TFFS kernel driver:
+ * Copyright (c) 2013 John Crispin 
+ *
my owrt mail addr has been invalid since the reboot. please use 
j...@phrozen.org



+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DEFAULT_TFFS_SIZE  (256 * 1024)
+
+#define TFFS_ID_END0x
+#define TFFS_ID_TABLE_NAME 0x01ff
+
+#define TFFS_BLOCK_HEADER_MAGIC0x41564d5f54464653ULL
+#define TFFS_VERSION   0x0003
+#define TFFS_ENTRY_HEADER_SIZE 0x18
+#define TFFS_MAXIMUM_SEGMENT_SIZE  (0x800 - TFFS_ENTRY_HEADER_SIZE)
+
+#define TFFS_SECTOR_SIZE 0x0800
+#define TFFS_SECTOR_OOB_SIZE 0x0040
+#define TFFS_SECTORS_PER_PAGE 2
+
+#define TFFS_SEGMENT_CLEARED 0x
+
+static char *progname;
+static char *mtddev;
+static ch

Re: [LEDE-DEV] 18.03/4 -> GCC 5 or 7

2018-03-09 Thread Matthias Schiffer
On 03/09/2018 01:56 PM, Matthias Schiffer wrote:
> On 03/07/2018 06:49 PM, Lucian Cristian wrote:
>> testing r6395-6c194078db on a ramips Ralink RT5350 with 4.14 and GCC 7.3
>> gives this error in luci
>>
>> daemon.err uhttpd[873]: /usr/bin/lua: /usr/lib/lua/luci/debug.lua:6:
>> attempt to call a number value
>> daemon.err uhttpd[873]: stack traceback:
>> daemon.err uhttpd[873]:    /usr/lib/lua/luci/debug.lua:6: in main chunk
>> daemon.err uhttpd[873]:    [C]: in function 'require'
>> daemon.err uhttpd[873]:    /usr/lib/lua/luci/util.lua:8: in main chunk
>> daemon.err uhttpd[873]:    [C]: in function 'require'
>> daemon.err uhttpd[873]:    /usr/lib/lua/luci/config.lua:4: in main chunk
>> daemon.err uhttpd[873]:    [C]: in function 'require'
>> daemon.err uhttpd[873]: /usr/lib/lua/luci/cacheloader.lua:5: in main chunk
>> daemon.err uhttpd[873]:    [C]: in function 'require'
>> daemon.err uhttpd[873]:    /www/cgi-bin/luci:2: in main chunk
>> daemon.err uhttpd[873]:    [C]: ?
> 
> 
> I was able to reproduce this on ar71xx. Minimal testcase:
> 
>> s = 'foo'
>> print(s:sub(2))
> 
> fails, while
> 
>> print(s.sub(s, 2))
> 
> works correctly, even though the former is only syntactic sugar for the
> latter. FWIW, type(s) correctly states that s is a string. Looking into it 
> now.
> 
> Matthias

Bug reported at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84790

Matthias



signature.asc
Description: OpenPGP digital signature
___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH 1/3] fritz-tools: add fritz_tffs_nand_read tool

2018-03-09 Thread Valentin Spreckels
This tool reads informations from AVM TFFS 3.0 filesystems on nand
flash. AVM uses this on newer FRITZ!Boxes (e.g. 7412) without SPI or nor
flash.

Signed-off-by: Valentin Spreckels 

---
 package/utils/fritz-tools/Makefile |  15 +
 package/utils/fritz-tools/src/CMakeLists.txt   |   3 +-
 .../utils/fritz-tools/src/fritz_tffs_nand_read.c   | 558 +
 3 files changed, 575 insertions(+), 1 deletion(-)
 create mode 100644 package/utils/fritz-tools/src/fritz_tffs_nand_read.c

diff --git a/package/utils/fritz-tools/Makefile 
b/package/utils/fritz-tools/Makefile
index 7c547e6f97..a4d69bdf71 100644
--- a/package/utils/fritz-tools/Makefile
+++ b/package/utils/fritz-tools/Makefile
@@ -21,6 +21,15 @@ define Package/fritz-tffs/description
  Utility to partially read the TFFS filesystems.
 endef
 
+define Package/fritz-tffs-nand
+  $(call Package/fritz-tools/Default)
+  TITLE:=Utility to partially read the TFFS filesystems on NAND flash
+endef
+
+define Package/fritz-tffs-nand/description
+ Utility to partially read the TFFS filesystems on NAND flash.
+endef
+
 define Package/fritz-caldata
   $(call Package/fritz-tools/Default)
   DEPENDS:=+zlib
@@ -36,10 +45,16 @@ define Package/fritz-tffs/install
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fritz_tffs_read $(1)/usr/bin/fritz_tffs
 endef
 
+define Package/fritz-tffs-nand/install
+   $(INSTALL_DIR) $(1)/usr/bin
+   $(INSTALL_BIN) $(PKG_BUILD_DIR)/fritz_tffs_nand_read 
$(1)/usr/bin/fritz_tffs_nand
+endef
+
 define Package/fritz-caldata/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/fritz_cal_extract $(1)/usr/bin/
 endef
 
 $(eval $(call BuildPackage,fritz-tffs))
+$(eval $(call BuildPackage,fritz-tffs-nand))
 $(eval $(call BuildPackage,fritz-caldata))
diff --git a/package/utils/fritz-tools/src/CMakeLists.txt 
b/package/utils/fritz-tools/src/CMakeLists.txt
index 021dc7733a..85b815712e 100644
--- a/package/utils/fritz-tools/src/CMakeLists.txt
+++ b/package/utils/fritz-tools/src/CMakeLists.txt
@@ -9,7 +9,8 @@ FIND_PATH(zlib_include_dir zlib.h)
 INCLUDE_DIRECTORIES(${zlib_include_dir})
 
 ADD_EXECUTABLE(fritz_tffs_read fritz_tffs_read.c)
+ADD_EXECUTABLE(fritz_tffs_nand_read fritz_tffs_nand_read.c)
 ADD_EXECUTABLE(fritz_cal_extract fritz_cal_extract.c)
 TARGET_LINK_LIBRARIES(fritz_cal_extract z)
 
-INSTALL(TARGETS fritz_tffs_read fritz_cal_extract RUNTIME DESTINATION bin)
+INSTALL(TARGETS fritz_tffs_read fritz_tffs_nand_read fritz_cal_extract RUNTIME 
DESTINATION bin)
diff --git a/package/utils/fritz-tools/src/fritz_tffs_nand_read.c 
b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c
new file mode 100644
index 00..6f30c2bbdb
--- /dev/null
+++ b/package/utils/fritz-tools/src/fritz_tffs_nand_read.c
@@ -0,0 +1,558 @@
+/*
+ * A tool for reading the TFFS partitions (a name-value storage usually
+ * found in AVM Fritz!Box based devices) on nand flash.
+ *
+ * Copyright (c) 2018 Valentin Spreckels 

+ *
+ * Based on the fritz_tffs_read tool:
+ * Copyright (c) 2015-2016 Martin Blumenstingl 

+ * and on the TFFS 2.0 kernel driver from AVM:
+ * Copyright (c) 2004-2007 AVM GmbH 
+ * and the TFFS 3.0 kernel driver from AVM:
+ * Copyright (C) 2004-2014 AVM GmbH 
+ * and the OpenWrt TFFS kernel driver:
+ * Copyright (c) 2013 John Crispin 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DEFAULT_TFFS_SIZE  (256 * 1024)
+
+#define TFFS_ID_END0x
+#define TFFS_ID_TABLE_NAME 0x01ff
+
+#define TFFS_BLOCK_HEADER_MAGIC0x41564d5f54464653ULL
+#define TFFS_VERSION   0x0003
+#define TFFS_ENTRY_HEADER_SIZE 0x18
+#define TFFS_MAXIMUM_SEGMENT_SIZE  (0x800 - TFFS_ENTRY_HEADER_SIZE)
+
+#define TFFS_SECTOR_SIZE 0x0800
+#define TFFS_SECTOR_OOB_SIZE 0x0040
+#define TFFS_SECTORS_PER_PAGE 2
+
+#define TFFS_SEGMENT_CLEARED 0x
+
+static char *progname;
+static char *mtddev;
+static char *name_filter = NULL;
+static bool show_all = false;
+static bool print_all_key_names = false;
+static bool swap_bytes = false;
+static uint8_t readbuf[TFFS_SECTOR_SIZE];
+static uint8_t oobbuf[T

[LEDE-DEV] [PATCH 3/3] lantiq: add support for AVM FRITZ!Box 7412

2018-03-09 Thread Valentin Spreckels
Specification:
- SoC: Lantiq VRX 220
- CPU Cores: 2x MIPS 34Kc at 500 MHz
- RAM: 128 MiB 250 MHz
- Storage: 128 MiB NAND flash
- Ethernet: built-in Fast Ethernet switch, only port 2 is used
- Wireless: Atheros AR9287-BL1A b/g/n with 2 pcb antennas
- Modem: built-in A/VDSL2 modem
- DECT: Dialog SC14441
- LEDs: 1 two-color, 4 one-color
- Buttons: 2
- FXS: 1 port via TAE or RJ12 connector

Working:
- ethernet
- wifi
- leds
- buttons
- dsl

Not working:
- Second cpu core
- FXS
- DECT

Installation:

1. Use the eva_ramboot.py script to load an initramfs image on the
device. Run it a few seconds after turning the device on.
$ scripts/flashing eva_ramboot 192.168.178.1 
bin/targets/lantiq/xrx200/openwrt-lantiq-xrx200-avm_fritz7412-initramfs-kernel.bin

If it fails to find the device try the ip address 169.254.120.1.
(Firmware updates or the recovery tool apparently change it.)

2. The device will load it in ram and boot it. You can reach it under
the openwrt default ip address 192.168.1.1.

3. Check if the key linux_fs_start is not set to 1 in tffs:
$ fritz_tffs_nand -d /dev/mtd1 -n linux_fs_start
If it is set to 1, the bootloader will select the wrong set of
partitions. Restart the box and install an FritzOS upgrade or do a
recovery. Afterwards start again at step 1.

4. Run sysupgrade to persistently install OpenWRT.

Signed-off-by: Valentin Spreckels 

---
 .../linux/lantiq/base-files/etc/board.d/02_network |   8 +
 .../etc/hotplug.d/firmware/12-ath9k-eeprom |   3 +
 .../lantiq/base-files/lib/upgrade/platform.sh  |   2 +-
 .../files-4.14/arch/mips/boot/dts/FRITZ7412.dts| 241 
 .../files-4.9/arch/mips/boot/dts/FRITZ7412.dts | 242 +
 .../lantiq/files-4.9/arch/mips/boot/dts/vr9.dtsi   |   2 +-
 target/linux/lantiq/image/Makefile |  13 ++
 7 files changed, 509 insertions(+), 2 deletions(-)
 create mode 100644 
target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts
 create mode 100644 
target/linux/lantiq/files-4.9/arch/mips/boot/dts/FRITZ7412.dts

diff --git a/target/linux/lantiq/base-files/etc/board.d/02_network 
b/target/linux/lantiq/base-files/etc/board.d/02_network
index ca974b071e..defdc1a94d 100755
--- a/target/linux/lantiq/base-files/etc/board.d/02_network
+++ b/target/linux/lantiq/base-files/etc/board.d/02_network
@@ -154,6 +154,14 @@ avm,fritz7360sl)
"0:lan:3" "1:lan:4" "2:lan:2" "4:lan:1" "6t@eth0"
;;
 
+avm,fritz7412)
+   tffsdev=$(find_mtd_chardev "nand-tffs")
+   annex="b"
+   lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca)
+   wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl)
+   ucidef_set_interface_lan 'eth0'
+   ;;
+
 siemens,gigaset-sx76x)
annex="b"
ucidef_add_switch "switch0" \
diff --git 
a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom 
b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
index 498a509012..68181c7b87 100644
--- a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
+++ b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom
@@ -141,6 +141,9 @@ case "$FIRMWARE" in
avm,fritz3370|avm,fritz7320|avm,fritz7360sl)
ath9k_eeprom_extract "urlader" 2437 0
;;
+   avm,fritz7412)
+   /usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 
0x207 -l 4096 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader")
+   ;;
tplink,tdw8970|tplink,tdw8980)
ath9k_eeprom_extract "boardconfig" 135168 0
;;
diff --git a/target/linux/lantiq/base-files/lib/upgrade/platform.sh 
b/target/linux/lantiq/base-files/lib/upgrade/platform.sh
index 2e58cb799a..7a43e7e12e 100755
--- a/target/linux/lantiq/base-files/lib/upgrade/platform.sh
+++ b/target/linux/lantiq/base-files/lib/upgrade/platform.sh
@@ -9,7 +9,7 @@ platform_do_upgrade() {
local board=$(board_name)
 
case "$board" in
-   
bt,homehub-v2b|bt,homehub-v3a|bt,homehub-v5a|zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3)
+   
avm,fritz7412|bt,homehub-v2b|bt,homehub-v3a|bt,homehub-v5a|zyxel,p-2812hnu-f1|zyxel,p-2812hnu-f3)
nand_do_upgrade $1
;;
*)
diff --git a/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts 
b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts
new file mode 100644
index 00..5bcd140520
--- /dev/null
+++ b/target/linux/lantiq/files-4.14/arch/mips/boot/dts/FRITZ7412.dts
@@ -0,0 +1,241 @@
+/dts-v1/;
+
+#include "vr9.dtsi"
+
+#include 
+#include 
+
+/ {
+   compatible = "avm,fritz7412", "lantiq,xway", "lantiq,vr9";
+   model = "1&1 DSL-Modem / 1&1 WLAN-Router";
+
+   chosen {
+   bootargs = "console=ttyLTQ0,115200 mem=126M 
vpe1_load_addr=0x87e0 vpe1_mem=2M ma

[LEDE-DEV] [PATCH 2/3] scripts: add EVA ramboot script

2018-03-09 Thread Valentin Spreckels
The bootloader on the FRITZ!Box 7412 crashes when flashing images. Thus
the AVM recovery tool uses another approach: It uses the bootloader to
load a small linux system into the ram and boot it from there. This
system will then flash the image.

This script mimics the behavior: It loads an openwrt initramfs image.
After this a sysupgrade can be done to persistently install openwrt.

Signed-off-by: Valentin Spreckels 

---
 scripts/flashing/eva_ramboot.py | 37 +
 1 file changed, 37 insertions(+)
 create mode 100755 scripts/flashing/eva_ramboot.py

diff --git a/scripts/flashing/eva_ramboot.py b/scripts/flashing/eva_ramboot.py
new file mode 100755
index 00..b825d2768b
--- /dev/null
+++ b/scripts/flashing/eva_ramboot.py
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+
+from ftplib import FTP
+from sys import argv
+from os import stat
+
+assert len(argv) == 3
+ip = argv[1]
+image = argv[2]
+
+size = stat(image).st_size
+# arbitrary size limit, to prevent the address calculations from overflows etc.
+assert size < 0x200
+
+# We need to align the address. A page boundary seems to be sufficient on 
7362sl
+# and 7412
+addr = ((0x800 - size) & ~0xfff)
+haddr = 0x8000 + addr
+img = open(image, "rb")
+
+ftp = FTP(ip, 'adam2', 'adam2')
+
+def adam(cmd):
+   print("> %s"%(cmd))
+   resp = ftp.sendcmd(cmd)
+   print("< %s"%(resp))
+   assert resp[0:3] == "200"
+
+ftp.set_pasv(True)
+# The following parameters allow booting the avm recovery system with this
+# script.
+adam('SETENV memsize 0x%08x'%(addr))
+adam('SETENV kernel_args_tmp mtdram1=0x%08x,0x8800'%(haddr))
+adam('MEDIA SDRAM')
+ftp.storbinary('STOR 0x%08x 0x8800'%(haddr), img)
+img.close()
+ftp.close()
-- 
2.13.6


___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev


[LEDE-DEV] [PATCH] prereq-mk: Change wget dependency to curl one.

2018-03-09 Thread Rosen Penev
curl is more common than GNU wget is. For example, Cygwin, Arch Linux, and my 
android phone all come with curl by default whereas wget is missing.

Also, scripts/download.pl attempts to use curl before falling back to wget.

This has been tested on a brand new install of Arch Linux.

Signed-off-by: Rosen Penev 
---
 include/prereq-build.mk | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/prereq-build.mk b/include/prereq-build.mk
index 6a423d2c7d..609c4dc88e 100644
--- a/include/prereq-build.mk
+++ b/include/prereq-build.mk
@@ -136,8 +136,8 @@ $(eval $(call SetupHostCommand,unzip,Please install 
'unzip', \
 $(eval $(call SetupHostCommand,bzip2,Please install 'bzip2', \
bzip2 --version http://lists.infradead.org/mailman/listinfo/lede-dev


Re: [LEDE-DEV] 18.03/4 -> GCC 5 or 7

2018-03-09 Thread Matthias Schiffer
On 03/07/2018 06:49 PM, Lucian Cristian wrote:
> testing r6395-6c194078db on a ramips Ralink RT5350 with 4.14 and GCC 7.3
> gives this error in luci
> 
> daemon.err uhttpd[873]: /usr/bin/lua: /usr/lib/lua/luci/debug.lua:6:
> attempt to call a number value
> daemon.err uhttpd[873]: stack traceback:
> daemon.err uhttpd[873]:    /usr/lib/lua/luci/debug.lua:6: in main chunk
> daemon.err uhttpd[873]:    [C]: in function 'require'
> daemon.err uhttpd[873]:    /usr/lib/lua/luci/util.lua:8: in main chunk
> daemon.err uhttpd[873]:    [C]: in function 'require'
> daemon.err uhttpd[873]:    /usr/lib/lua/luci/config.lua:4: in main chunk
> daemon.err uhttpd[873]:    [C]: in function 'require'
> daemon.err uhttpd[873]: /usr/lib/lua/luci/cacheloader.lua:5: in main chunk
> daemon.err uhttpd[873]:    [C]: in function 'require'
> daemon.err uhttpd[873]:    /www/cgi-bin/luci:2: in main chunk
> daemon.err uhttpd[873]:    [C]: ?


I was able to reproduce this on ar71xx. Minimal testcase:

> s = 'foo'
> print(s:sub(2))

fails, while

> print(s.sub(s, 2))

works correctly, even though the former is only syntactic sugar for the
latter. FWIW, type(s) correctly states that s is a string. Looking into it now.

Matthias



signature.asc
Description: OpenPGP digital signature
___
Lede-dev mailing list
Lede-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/lede-dev