Modify

Opened 7 years ago

Closed 7 years ago

Last modified 4 years ago

#9252 closed defect (fixed)

Issues with D-Link 300/600 rev B from trunk

Reported by: boink Owned by: juhosg
Priority: normal Milestone: Barrier Breaker 14.07
Component: other Version: Trunk
Keywords: Cc:

Description

Hi, I've build a firmware using latest trunk for DIR-600 rev B. Everything seems to work ok after flashing but after the first reboot the router becames inaccessible via webif or ssh. Looks like settings aren't saved properly to nvram or they get corrupted somehow.The image is 3.2 Mb large so it should be ok. Can't attach any log files as long as the router becames unavailable after reboot.

Attachments (9)

kernel.log (7.6 KB) - added by boink 7 years ago.
kernel.log
packages.txt (9.4 KB) - added by boink 7 years ago.
packages
dir-300-revb-mtd.patch (692 bytes) - added by Layne Edwards <ledwards@…> 7 years ago.
test patch to change mtd partitions to match the kernel cmd line
dmesg.txt (6.2 KB) - added by boink 7 years ago.
dmesg
df.txt (469 bytes) - added by bionk 7 years ago.
df
dir300-dmesg.txt (6.1 KB) - added by boink 7 years ago.
dmesg from dir-300
df-dir300.txt (402 bytes) - added by boink 7 years ago.
df from dir-300
dir300-cpuifo.txt (630 bytes) - added by boink 7 years ago.
dir-300 cpu info
dir-600-no-jffs-errors.txt (6.2 KB) - added by boink 7 years ago.
dir-600 rev B with 111-mtd-cfi_cmdset_0002-force-word-write.patch

Download all attachments as: .zip

Change History (49)

comment:1 Changed 7 years ago by anonymous

Nobody is working on the ramips port ? As I see it doesn't seems to get very much updated in trunk.

Changed 7 years ago by boink

kernel.log

comment:2 Changed 7 years ago by boink

Here's the kernel log.

comment:3 Changed 7 years ago by Layne Edwards <ledwards@…>

This is not normal:

Data CRC 615041f0 != calculated CRC 5ace6da0 for node at 0006007c
Node CRC ffffffff != calculated CRC 9e903ddf for node at 00060e10
Node CRC ffffffff != calculated CRC 7dc8140f for node at 00060e98
Node CRC ffffffff != calculated CRC 46a2d6d9 for node at 00061014
Write of 307 bytes at 0x000612a0 failed. returned -5, retlen 306
Write of 307 bytes at 0x000613d4 failed. returned -5, retlen 306
Write of 43 bytes at 0x00061f70 failed. returned -5, retlen 40
Write of 43 bytes at 0x00061f9c failed. returned -5, retlen 40
Write of 49 bytes at 0x0006200c failed. returned -5, retlen 48
Write of 49 bytes at 0x00062040 failed. returned -5, retlen 48
Write of 55 bytes at 0x000620b8 failed. returned -5, retlen 54
Write of 55 bytes at 0x000620f0 failed. returned -5, retlen 54

It sounds like your JFFS is not getting built properly. My guess is your image is too large (not enough room to build the JFFS)... an easy test is to build a smaller image (try cutting out LuCI or something) and see if that works.

comment:4 Changed 7 years ago by boink

How image is too big if it's 3.2? I'running DD-WRT with 3.6 MB image and it works.
And there aren't any extra packages to trim, just basic functions. Perhaps the space allocation in the make file isn't optimal or the mtd partitioning is wrong.
Kernel command line: board=DIR-300-revB mtdparts=physmap-flash.0:192k(u-boot)ro,64k(u-boot-env)ro,64k(factory)ro,832k(kernel),2944k(rootfs),3776k@0x50000(firmware).
And beside this nothing is saved to nvram as long as after reboot everything gets corrupted.

comment:5 Changed 7 years ago by Layne Edwards <ledwards@…>

First of all, OpenWrt does not use NVRAM like DD-WRT does. OpenWrt uses a JFFS2 writeable file system to save the configuration data and additional packages. There must be enough free space in flash to create the JFFS2 partition. AFAIK, standard images from DD-WRT do not use a JFFS2 partition... so a 3.6MB image will work fine on a 4MB flash (but you can't add any more packages because you don't have a writeable file system). OpenWrt needs room to create the JFFS2 file system.

Like I said before, I would first try to trim down your squashfs fs (read-only) by removing some packages from your build.

Changed 7 years ago by boink

packages

comment:6 Changed 7 years ago by boink

What packages can be removed to make it work ?

comment:7 Changed 7 years ago by boink

There seems to be enough space on the device.

root@OpenWrt:/# mount
rootfs on / type rootfs (rw)
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,noatime)
sysfs on /sys type sysfs (rw,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime,size=15136k)
tmpfs on /dev type tmpfs (rw,noatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,noatime,mode=600)
root on /tmp/root type tmpfs (rw,noatime,mode=755)
/dev/mtdblock5 on /overlay type jffs2 (rw,noatime)
overlayfs:/overlay on / type overlayfs (rw,noatime)

root@OpenWrt:/# df -h
Filesystem Size Used Available Use% Mounted on
/dev/root 2.1M 2.1M 0 100% /rom
tmpfs 14.8M 180.0K 14.6M 1% /tmp
tmpfs 512.0K 0 512.0K 0% /dev
root 14.8M 68.0K 14.7M 0% /tmp/root
/dev/mtdblock5 832.0K 212.0K 620.0K 25% /overlay
overlayfs:/overlay 832.0K 212.0K 620.0K 25% /

Despite all that, still getting errors with jffs.

comment:8 Changed 7 years ago by Layne Edwards <ledwards@…>

Are you using the dir-300 image from trunk, or the dir-600 patch?

comment:9 Changed 7 years ago by boink

I've applied the DIR-600 patch but even with DIR-300 image it's the same result.I've trimmed the image even more now it has 2.9 megs and still getting errors.

comment:10 Changed 7 years ago by Layne Edwards <ledwards@…>

Try this patch:

Index: target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir300-revb.c
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir300-revb.c
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir300-revb.c
@@ -51,15 +51,15 @@ 
 	}, {
 		.name	= "kernel",
 		.offset	= 0x050000,
-		.size	= 0x0f0000,
+		.size	= 0x0d0000,
 	}, {
 		.name	= "rootfs",
-		.offset	= 0x140000,
-		.size	= 0x2B0000,
+		.offset	= 0x120000,
+		.size	= 0x2e0000,
 	}, {
 		.name	= "openwrt",
 		.offset	= 0x050000,
-		.size	= 0x3a0000,
+		.size	= 0x3b0000,
 	}
 };
 #endif /* CONFIG_MTD_PARTITIONS */

You'll need to clean and rebuild your target after patching:

make target/clean V=99
make target/install V=99

This patch is for the DIR-300 target. It should also work with the DIR-600 patch, but you'll have to edit the file names accordingly.

I have not tested this. I don't have a DIR-600 and I hand-wrote this patch. Use at your own risk.

comment:11 Changed 7 years ago by Layne Edwards <ledwards@…>

Use this patch instead. It is properly formatted.

Index: target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c	(revision 26751)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-300-revb.c	(working copy)
@@ -51,15 +51,15 @@
 	}, {
 		.name	= "kernel",
 		.offset	= 0x050000,
-		.size	= 0x0f0000,
+		.size	= 0x0d0000,
 	}, {
 		.name	= "rootfs",
-		.offset	= 0x140000,
-		.size	= 0x2B0000,
+		.offset	= 0x120000,
+		.size	= 0x2e0000,
 	}, {
 		.name	= "openwrt",
 		.offset	= 0x050000,
-		.size	= 0x3a0000,
+		.size	= 0x3b0000,
 	}
 };
 #endif /* CONFIG_MTD_PARTITIONS */

Changed 7 years ago by Layne Edwards <ledwards@…>

test patch to change mtd partitions to match the kernel cmd line

comment:12 Changed 7 years ago by boink

Seems to throw less jffs errors with the new patch applied to dir-600 patch. But after reboot the router becames unavailable.

Changed 7 years ago by boink

dmesg

Changed 7 years ago by bionk

df

comment:13 Changed 7 years ago by boink

Trying to alter some settings via Luci it seems like the rootfs_data partition is locked and that's causing all the settings not to be written on the jffs partition, rendering the router unavailable after reboot.

comment:14 Changed 7 years ago by info@…

Hi, i´m new on linux and all this stuff, but after 2 weeks, i´m install fedora 14, donload from svn the trunk version and build 2 images for my DIR-600 B.
I build too an usb-serial to see what happen on the serial port.
like Boink say: if i flash , all works fine ! but if i try to change anything a lot of
jffs2 CRC´s errors are displayed, and i think that the network config file and others file are not read or corrupted.
i see this thing too: with openwrt the chip is very hot, but with dd-wrt i can put my finger on it without injurie.
Question: the jffs2 is estable ? i build 2 images:
1_all default from trunk
2_add luci interface
both show the same behavior.
Other issue that i see trough the serial port:
if i flash many times the router with the same image some time when jffs2 finish your job present differents results: no erro, CRC error or many CRC erros

i wait for your help and i´ll test what you say !

Thanks

comment:15 Changed 7 years ago by Layne Edwards <ledwards@…>

I suspect that the DIR-600 rev B is very similar to the DIR-300 rev B, but has minor hardware differences... possibly different GPIOs, etc. This is just speculation, as I don't have either one. You are using an image for the DIR-300 on the DIR-600 (the DIR-600 patch was just copied from the DIR-300 target, by request), so there may be incompatibilities.

comment:16 Changed 7 years ago by anonymous

Lane, any idea that you think, please send it and i´ll test it !
Or any attach that you need from my dir-600 after first flash and second....etc.

Thanks

comment:17 Changed 7 years ago by boink

I will try today to flash a real DIR-300 rev.B with the image to see how it behaves.

comment:18 Changed 7 years ago by boink

Flashed a real DIR-300 rev B with latest trunk and the latest DIR-300 patch for mtd's. Works like a breeze even after 3-4 reboots. No jffs errors at all.So it seems something is not right in the DIR-600 rev B configs.

Changed 7 years ago by boink

dmesg from dir-300

Changed 7 years ago by boink

df from dir-300

Changed 7 years ago by boink

dir-300 cpu info

comment:19 Changed 7 years ago by boink

Flash detection on DIR-600 is :
env[0]: memsize=32
env[1]: initrd_start=0x00000000
env[2]: initrd_size=0x0
env[3]: flash_start=0xBF000000
env[4]: flash_size=0x800000
env[0]: memsize=32
env[1]: initrd_start=0x00000000
env[2]: initrd_size=0x0
env[3]: flash_start=0xBF000000
env[4]: flash_size=0x800000

On DIR-300 is:
env[0]: memsize=32
env[1]: initrd_start=0x00000000
env[2]: initrd_size=0x0
env[3]: flash_start=0xBF000000
env[4]: flash_size=0x400000
env[0]: memsize=32
env[1]: initrd_start=0x00000000
env[2]: initrd_size=0x0
env[3]: flash_start=0xBF000000
env[4]: flash_size=0x400000

Perhaps that's causing some issues with jffs.

comment:20 follow-up: Changed 7 years ago by florian

Out of curiosity, is not it possible to use the kernel supplied command-line partitioning instead of having to recreate one from platform code?

comment:21 Changed 7 years ago by boink

The generated image for DIR-600 revB is using the kernel supplied command-line as outputted by dmesg. I don't understand why it detects the DIR-600 revB flash as 8 MB when it's a 4 MB one.

comment:22 in reply to: ↑ 20 Changed 7 years ago by Layne Edwards <ledwards@…>

Replying to florian:

Out of curiosity, is not it possible to use the kernel supplied command-line partitioning instead of having to recreate one from platform code?

Yes, the Makefile specifies the partitions in the command-line as follows:

mtdlayout_4M=mtdparts=physmap-flash.0:192k(u-boot)ro,64k(u-boot-env)ro,64k(factory)ro,832k(kernel),2944k(rootfs),3776k@0x50000(firmware)
74	define Image/Build/Template/GENERIC_4M
75	        $(call BuildFirmware/Generic,$(1),$(2),board=$(3),mtdlayout_4M,851968,3014656)
76	endef

This should be setting the correct mtd partitions.

There are definitely some flash and/or jffs2 issues with the ramips target. I have seen other issues as well (see #9143)... such as a kernel oops when the jffs2 fs is accessed during firstboot (while the jffs2 is being created). This can be duplicated by accessing LuCI during firstboot. The Samba service also throws a kernel oops when installed, as it tries to access the jffs2 partition before it's ready. The fix for the Samba oops is don't start it by default (enable it after firstboot). I haven't had much time to troubleshoot further yet... for now I'm just working around the problems.

comment:23 Changed 7 years ago by boink

I've applied the following patch from ar71xx target https://dev.openwrt.org/browser/trunk/target/linux/ar71xx/patches-2.6.37/108-mtd_fix_cfi_cmdset_0002_status_check.patch instead of the existing one for ramips. The router boots but the power led is now orange and the load is high. Dmesg doesn't throws any jffs errors with the patch applied. Here's snapshot from top command:

Mem: 14480K used, 15772K free, 0K shrd, 1604K buff, 4656K cached
CPU: 0% usr 99% sys 0% nic 0% idle 0% io 0% irq 0% sirq
Load average: 1.00 0.92 0.53 2/41 1205

PID PPID USER STAT VSZ %MEM %CPU COMMAND

1180 1162 root R 1456 5% 99% cp -a /tmp/root/etc /rom/overlay
1205 1181 root R 1432 5% 1% top
1138 1 root S 1476 5% 0% /bin/sh /etc/rc.common /etc/rc.d/S50d

287 286 root S 1464 5% 0% /bin/sh /etc/init.d/rcS S boot

1159 287 root S 1464 5% 0% /bin/sh /etc/rc.common /etc/rc.d/S95d
1132 1 root S 1460 5% 0% /usr/sbin/uhttpd -f -h /www -r OpenWr

286 1 root S 1460 5% 0% /bin/sh /etc/init.d/rcS S boot

1162 1159 root S 1452 5% 0% /bin/sh /sbin/firstboot switch2jffs
1181 1126 root S 1440 5% 0% /bin/ash --login

324 1 root S 1440 5% 0% syslogd -C16

1 0 root S 1436 5% 0% init

290 1 root S 1436 5% 0% init
291 1 root S 1436 5% 0% init
494 1 root S 1432 5% 0% udhcpc -t 0 -i eth0.2 -b -p /var/run/

1126 1 root S 1428 5% 0% telnetd -l /bin/login.sh

288 286 root S 1428 5% 0% logger -s -p 6 -t sysinit
326 1 root S 1420 5% 0% klogd

1161 1 root S 1420 5% 0% lock /tmp/.switch2jffs
1177 1138 root S 1420 5% 0% lock /tmp/.switch2jffs
157 1 nobody S 908 3% 0% /usr/sbin/dnsmasq -K -D -y -Z -b -E -

comment:24 Changed 7 years ago by akker

DIR 600 rev B is using a different flash chip that the DIR-300. Is this declared somewhere ?
DIR-600 physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x000001 Chip ID 0x001a00
DIR-300 physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank. Manufacturer ID 0x0000c2 Chip ID 0x0022a8

Also the wireless doesn't work on the DIR-300, but with DIR-600 works.

comment:25 Changed 7 years ago by info@…

Hi Boink, i try to follow your test but my dir 600 rev b reports jffs2 crc error.
Can you send a link to your .bin to test it ? and the config file of the menuconfig
to rebuild from your tested point ?
i´m using the trunk r26885.

Thanks.

Other: exist any way to set wireless ON before make ? Which file have the init wireless config ?

Thanks again.

comment:26 Changed 7 years ago by boink

I can provide you with the image for DIR-600, but I don't think it would make any difference as it also throws errors with jffs as well. But if you want to try it here it is: ftp://guest:public@akkerzone.dyndns.org/incoming

comment:27 Changed 7 years ago by info@…

Hi, may be my bad english its no endoff, i ask you your .bin version that use the patch of the ar71xx. If i do not missunderstand this .bin do not show any jffs2 error or i wrong ?
If you can email me, i´ll appreciated. The ftp link do not work.

Regards.

comment:28 Changed 7 years ago by boink

The ar71xx patch is not the right way to do it, as the router doesn't behave properly, so i've reverted the patch. The best way is to wait for devs to do some investigation on the code to see what's causing the jffs issues with DIR-600. Until then I'm running on DIR-300 as is works pretty good.

comment:29 Changed 7 years ago by boink

I've managed to make it work on my DIR-600 rev B. No more jffs errors with the following patch applied from ar71xx target: https://dev.openwrt.org/browser/trunk/target/linux/ar71xx/patches-2.6.37/111-mtd-cfi_cmdset_0002-force-word-write.patch
I did a few reboots and now the router resumes properly.

Changed 7 years ago by boink

dir-600 rev B with 111-mtd-cfi_cmdset_0002-force-word-write.patch

comment:30 Changed 7 years ago by info@…

Hi, i copy the patch file from ar71xx patch´s folder to the ramips´folder, make the proyect but after the firts reboot the same jffs2 CRC errors are show again.

Please, can you enumerate all the steps to buid your image from the original trunk ?

Regards.

If you can send me the .bin to test on my plattform will be appreciated.

comment:31 follow-up: Changed 7 years ago by boink

Have you done make target/clean before rebuild ? I've posted the image on ftp://guest:public@akkerzone.dyndns.org/incoming. Let me know if it's not working so I can send it other way.

comment:32 Changed 7 years ago by info@…

Hi, i download your image, flashed my dir-600 and all fine, like you say no jffs2 crc errors ! I activate wireless using VI from the console, all fine !

Install the patch that you suggest, clean, rebuild and all work fine !
I´m not using the patch for dir-600, i´m using the v2image over the dir-300 generated image.

Thanks a lot !

comment:33 in reply to: ↑ 31 Changed 7 years ago by anonymous

Replying to boink:

Are you able to generate a flashable and working image for dir-300 b1 (with working lan/wireless)?

I am too nooby for this...

would be veeeeery nice.... sittin here for some days now.. and can#t get it work.

Thank you
Chris

comment:34 Changed 7 years ago by anonymous

Last time I've flashed a DIR-300 rev B with openwrt the wireless wasn't working. It shows phy0 -> rt2800_init_eeprom: Error - Invalid RF chipset detected.
phy0 -> rt2x00lib_probe_dev: Error - Failed to allocate device. I can build a firmware for DIR-300 rev B, but I don't have a device to test if the wireless works.

comment:35 Changed 7 years ago by boink

Perhaps this discussion should be taken to the forum as this is not the right place for such ones. From my part the devs can closed this ticket as its original issue seem to be fixed.

comment:36 Changed 7 years ago by gkashperko

It could be related to the issue with ASUS N16 entering emergency repair after first boot. See here and below.

cfi_cmdset_0002-add-buffer-write-cmd-timeout.patch resolved the bug.

comment:37 Changed 7 years ago by boink

I've tested the above patch on DIR-600 rev. B and it doesn't work. The kernel log shows jffs errors. Still the best solution on this machine is the patch from the a71xx target https://dev.openwrt.org/browser/trunk/target/linux/ar71xx/patches-2.6.37/111-mtd-cfi_cmdset_0002-force-word-write.patch

comment:38 Changed 7 years ago by juhosg

  • Owner changed from developers to juhosg
  • Status changed from new to accepted

comment:39 Changed 7 years ago by juhosg

  • Resolution set to fixed
  • Status changed from accepted to closed

Fixed in r27385. Thanks!

comment:40 Changed 4 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.