Re: [OpenWrt-Devel] Firstboot problems

2014-02-07 Thread Ben Mulvihill
Hi,

I had a similar problem on the BT Home Hub 2B, which also
has nand flash. The problem as you say seems to be that
mount_root assume that the deadc0de will be at the start
of the block where it would be for nor flash. I expect others
will have a better idea of the right way to solve this (perhaps
avoiding using squashfs on nand completely) but for the moment
I have I got round the problem by patching ubox mount_root.c
as follows.

I have also had to add to modify include/image.mk, adding 16K
(which is the erase block size on the HH2B) to the call to padjffs2.

Ben

--- a/mount_root.c  2014-01-18 10:19:12.319136947 +0100
+++ b/mount_root.c  2014-01-18 10:18:21.149945597 +0100
@@ -381,6 +381,13 @@
return FS_JFFS2;
}

+   if (type == MTD_TYPE_NAND 
+   deadc0de == 0x) {
+
+   LOG(jffs2 is ready\n);
+   return FS_JFFS2;
+   }
+
ERROR(No jffs2 marker was found\n);

return FS_NONE;

On Fri, 2014-02-07 at 03:00 +0100, Marco Antonio Mauro wrote:
 Hi,
 
 the router I'm working on at the moment, the DGN3500 lantiq platform,
 has a strange issue: it won't create or save the configuration. I see
 this in the logs:
 
 [0.00] Linux version 3.10.26 (marcus905@experiment) (gcc
 version 4.6.4 (OpenWrt/Linaro GCC 4.6-2013.05 r39286) ) #39 Thu Feb 6
 19:19:14 CET 2014
 [0.00] SoC: AR9 rev 1.1
 [0.00] bootconsole [early0] enabled
 [0.00] CPU revision is: 0001954c (MIPS 34Kc)
 [0.00] MIPS: machine is DGN3500 - Netgear DGN3500
 [0.00] Determined physical RAM map:
 [0.00]  memory: 0400 @  (usable)
 [0.00] Initrd not found or empty - disabling initrd
 [0.00] Zone ranges:
 [0.00]   Normal   [mem 0x-0x03ff]
 [0.00] Movable zone start for each node
 [0.00] Early memory node ranges
 [0.00]   node   0: [mem 0x-0x03ff]
 [0.00] On node 0 totalpages: 16384
 [0.00] free_area_init_node: node 0, pgdat 8034e9d0,
 node_mem_map 81002a80
 [0.00]   Normal zone: 128 pages used for memmap
 [0.00]   Normal zone: 0 pages reserved
 [0.00]   Normal zone: 16384 pages, LIFO batch:3
 [0.00] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
 [0.00] Primary data cache 16kB, 4-way, VIPT, no aliases,
 linesize 32 bytes
 [0.00] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
 [0.00] pcpu-alloc: [0] 0
 [0.00] Built 1 zonelists in Zone order, mobility grouping on.
 Total pages: 16256
 [0.00] Kernel command line: console=ttyLTQ0,115200 init=/etc/preinit
 ...
 [0.248000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
 [0.256000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME)
 (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
 ...
 [0.304000] spi_gpio spi.4: master is unqueued, this is deprecated
 [0.312000] m25p80 spi32766.0: found mx25l12805d, expected s25fl129p0
 [0.316000] m25p80 spi32766.0: mx25l12805d (16384 Kbytes)
 [0.32] 4 ofpart partitions found on MTD device spi32766.0
 [0.328000] Creating 4 MTD partitions on spi32766.0:
 [0.332000] 0x-0x0001 : uboot
 [0.34] 0x0001-0x0002 : uboot-env
 [0.348000] 0x0002-0x0003 : calibration
 [0.352000] 0x0005-0x00ff : firmware
 [0.36] 0x0017c7c8-0x00ff : rootfs
 [0.364000] mtd: partition rootfs must either start or end on
 erase block boundary or be smaller than an erase block -- forcing
 read-only
 [0.38] mtd: device 4 (rootfs) set to be root filesystem
 [0.384000] mtd: partition rootfs_data created automatically,
 ofs=0x73, len=0x8c
 [0.392000] 0x0073-0x00ff : rootfs_data
 ...
 [  160.68] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
 not found at 0x: 0x7345 instead
 [  160.696000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
 not found at 0x0004: 0x6f4d instead
 [  160.712000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
 not found at 0x000c: 0x5035 instead
 [  160.728000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
 not found at 0x0010: 0x3600 instead
 [  160.744000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
 not found at 0x002c: 0x0041 instead
 [  160.76] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
 not found at 0x0030: 0x3200 instead
 [  160.776000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
 not found at 0x0038: 0x0011 instead
 [  160.792000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
 not found at 0x0040: 0x4572 instead
 [  160.808000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
 not found at 0x0044: 0x4d6d instead
 [  160.824000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
 not found at 0x0048: 0x3845 instead
 [  160.832000] jffs2: Further such events for 

Re: [OpenWrt-Devel] Firstboot problems

2014-02-07 Thread Marco Antonio Mauro
I think I found out the cause. The partition rootfs data gets created
after the squashfs one at 0x73 in my case, but there there's the
sercomm signature and checksum needed for the bootloader there, and
the deadc0de jffs2 magic is instead at 0x74, and that's where the
partition should start actually.

Any suggestion?

-- 
Marcus905
GPG pubkey:
http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x1FC0ECC932FE5FAC
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Firstboot problems

2014-02-07 Thread Marco Antonio Mauro
On Fri, Feb 7, 2014 at 12:38 PM, Marco Antonio Mauro marcu...@gmail.com wrote:
 I think I found out the cause. The partition rootfs data gets created
 after the squashfs one at 0x73 in my case, but there there's the
 sercomm signature and checksum needed for the bootloader there, and
 the deadc0de jffs2 magic is instead at 0x74, and that's where the
 partition should start actually.

 Any suggestion?

I managed to fool the sercomm SBL by putting it slightly before the
eraseblock start. I submitted the patch to the list, it works perfect
now!

Obviously the same checksum, signature and workaround have to be done
for the sysupgrade images too -- I took care of that in the same
patch.

Now only the ath9k wifi needs to be fixed and then we have another
(the absolute second maybe) fully working OpenWRT DSL router!


-- 
Marcus905
GPG pubkey:
http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x1FC0ECC932FE5FAC
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] Firstboot problems

2014-02-07 Thread Ben Mulvihill
On Fri, 2014-02-07 at 23:33 +0100, Marco Antonio Mauro wrote:
 On Fri, Feb 7, 2014 at 12:38 PM, Marco Antonio Mauro marcu...@gmail.com 
 wrote:
  I think I found out the cause. The partition rootfs data gets created
  after the squashfs one at 0x73 in my case, but there there's the
  sercomm signature and checksum needed for the bootloader there, and
  the deadc0de jffs2 magic is instead at 0x74, and that's where the
  partition should start actually.
 
  Any suggestion?
 
 I managed to fool the sercomm SBL by putting it slightly before the
 eraseblock start. I submitted the patch to the list, it works perfect
 now!
 
 Obviously the same checksum, signature and workaround have to be done
 for the sysupgrade images too -- I took care of that in the same
 patch.
 
 Now only the ath9k wifi needs to be fixed and then we have another
 (the absolute second maybe) fully working OpenWRT DSL router!
 
 

My earlier reply was completely off. I misread nand flash for some
reason. Sorry! Glad you fixed it.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] Firstboot problems

2014-02-06 Thread Marco Antonio Mauro
Hi,

the router I'm working on at the moment, the DGN3500 lantiq platform,
has a strange issue: it won't create or save the configuration. I see
this in the logs:

[0.00] Linux version 3.10.26 (marcus905@experiment) (gcc
version 4.6.4 (OpenWrt/Linaro GCC 4.6-2013.05 r39286) ) #39 Thu Feb 6
19:19:14 CET 2014
[0.00] SoC: AR9 rev 1.1
[0.00] bootconsole [early0] enabled
[0.00] CPU revision is: 0001954c (MIPS 34Kc)
[0.00] MIPS: machine is DGN3500 - Netgear DGN3500
[0.00] Determined physical RAM map:
[0.00]  memory: 0400 @  (usable)
[0.00] Initrd not found or empty - disabling initrd
[0.00] Zone ranges:
[0.00]   Normal   [mem 0x-0x03ff]
[0.00] Movable zone start for each node
[0.00] Early memory node ranges
[0.00]   node   0: [mem 0x-0x03ff]
[0.00] On node 0 totalpages: 16384
[0.00] free_area_init_node: node 0, pgdat 8034e9d0,
node_mem_map 81002a80
[0.00]   Normal zone: 128 pages used for memmap
[0.00]   Normal zone: 0 pages reserved
[0.00]   Normal zone: 16384 pages, LIFO batch:3
[0.00] Primary instruction cache 32kB, VIPT, 4-way, linesize 32 bytes.
[0.00] Primary data cache 16kB, 4-way, VIPT, no aliases,
linesize 32 bytes
[0.00] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[0.00] pcpu-alloc: [0] 0
[0.00] Built 1 zonelists in Zone order, mobility grouping on.
Total pages: 16256
[0.00] Kernel command line: console=ttyLTQ0,115200 init=/etc/preinit
...
[0.248000] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[0.256000] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME)
(CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
...
[0.304000] spi_gpio spi.4: master is unqueued, this is deprecated
[0.312000] m25p80 spi32766.0: found mx25l12805d, expected s25fl129p0
[0.316000] m25p80 spi32766.0: mx25l12805d (16384 Kbytes)
[0.32] 4 ofpart partitions found on MTD device spi32766.0
[0.328000] Creating 4 MTD partitions on spi32766.0:
[0.332000] 0x-0x0001 : uboot
[0.34] 0x0001-0x0002 : uboot-env
[0.348000] 0x0002-0x0003 : calibration
[0.352000] 0x0005-0x00ff : firmware
[0.36] 0x0017c7c8-0x00ff : rootfs
[0.364000] mtd: partition rootfs must either start or end on
erase block boundary or be smaller than an erase block -- forcing
read-only
[0.38] mtd: device 4 (rootfs) set to be root filesystem
[0.384000] mtd: partition rootfs_data created automatically,
ofs=0x73, len=0x8c
[0.392000] 0x0073-0x00ff : rootfs_data
...
[  160.68] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
not found at 0x: 0x7345 instead
[  160.696000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
not found at 0x0004: 0x6f4d instead
[  160.712000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
not found at 0x000c: 0x5035 instead
[  160.728000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
not found at 0x0010: 0x3600 instead
[  160.744000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
not found at 0x002c: 0x0041 instead
[  160.76] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
not found at 0x0030: 0x3200 instead
[  160.776000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
not found at 0x0038: 0x0011 instead
[  160.792000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
not found at 0x0040: 0x4572 instead
[  160.808000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
not found at 0x0044: 0x4d6d instead
[  160.824000] jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985
not found at 0x0048: 0x3845 instead
[  160.832000] jffs2: Further such events for this erase block will
not be printed
[  160.948000] jffs2: Empty flash at 0x0050 ends at 0x1000
[  161.072000] jffs2: Empty flash at 0x1004 ends at 0x2000
[  163.168000] jffs2_scan_eraseblock(): End of filesystem marker found
at 0x1
[  163.176000] jffs2: Cowardly refusing to erase blocks on filesystem
with no valid JFFS2 nodes
[  163.18] jffs2: empty_blocks 139, bad_blocks 0, c-nr_blocks 140

What could the problem be? What should I check?

I think that it's creating rootfs_data in the correct place, but then
the jffs2 filesystem starts looking for the end marker (deadc0de if i
recall correctly) in the wrong place and therefore leaving the
partition unformatted and leaving the config in the ramdisk.

Any idea?
-- 
Marcus905
GPG pubkey:
http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x1FC0ECC932FE5FAC
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel