OpenWrt Forum Archive

Topic: P-2812HNU-FX: getting OpenWrt installed

The content of this topic has been archived between 6 Jun 2015 and 5 May 2018. Unfortunately there are posts – most likely complete pages – missing.

Should that really be C#? I can provide it in C.

nop, any C:

thank u.

but i need to do this:

Move bytes in file like this

0x1234 in 0x3412

00 80 5D 00  ---->>> 5D 00 00 80

(Last edited by cornelus2009 on 25 Jun 2015, 06:45)

but i need to do this:

Move bytes in file like this

0x1234 in 0x3412

00 80 5D 00  ---->>> 5D 00 00 80

The first one is a byte wrap, the second one is a word wrap. As your initial spec was a word wrap, I implemented that:

#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>

int openfile( char *name, int mode, int def )
{
        if( !strcmp( name, "-" ) )
            return def;
        def = open( name, mode );
        if( -1 == def )
        {
                int err = errno;
                printf( "cannot open %s; error %d\n", name, err );
                exit( err );
        }
        return def;
}


int main( int argc, char **argv )
{
        int in = 0, out = 1;
        short buf[ 2 ];
        if( 3 == argc )
        {
                in = openfile( argv[ 1 ], O_RDONLY, 0 );
                out = openfile( argv[ 2 ], O_WRONLY, 1 );
        }
        else if( 1 != argc )
        {
                printf( "Use %s [ in out ]\n", argv[ 0 ] );
                return 0;
        }
        
        while( 4 == read( in, buf, 4 ) )
        {
                short t=buf[ 0 ];
                buf[ 0 ] = buf[ 1 ];
                buf[ 1 ] = t;
                write( out, buf, 4 );
        }
        
        return 0;
}

Not the most efficient program I ever wrote, but without knowledge how it will be used it cannot be optimized. It can be used two ways, simply piping:

~$ echo 1234 | exchangebytes
3412

or using files

exchangebytes inputfile outputfile

If you use a '-' as filename it will be stdin (or -out).
Input is read in chunks of 4 bytes. An incomplete chunk at the end is ignored.

thank u.
program do desired order of bytes, but seems is not a valid lzma.

Hello,

I want to say thank you to everyone that has contributed and I was wondering if somebody could help me restore my bricked Zyxel P-2812HNU-F3-telenor so I can get it working again. The firmware I would like to have flashed is this one: 311BLN18D0.bin http://www.solidfiles.com/d/8897ddf307/ or anything like OpenWRT will be a bonus but the router is branded (Telenor) so as long as I get it working I'm pretty much happy. They do not use ADSL it has a switch to set it to WAN and that's what Telenor is using on my set-up here.

I have opened the router and connected to the pins next to the NAND but there is no reply: http://i.imgur.com/g99cQYG.png I might have plugged wrong ones but it seems like when I power it over the power connection it boots. Picture: http://i.imgur.com/J7Km4zh.jpg
I've been trying to press "z" during the bootup but since it's self-testing all the time that might not work like it should have. I have been reading up on replacing the U-boot but I'm not sure how to short (sorry I'm a complete newbie) is it something in the range of holding a resistor against the bootsels? (I probably have to call my friend over to do this part)

The router is blinking and that means that it is self-testing and after about 15-20 secounds all lights flash and it reboots in a loop of self-test that means it's bricked. I believe it might be best for me to just give up on this router and order a new ASUS or TP-LINK but that would cost quite a bit of money to do.

Currently using Windows 8.1 but can also run Windows 7 or Debian 8 from Raspberry PI.

feitingen wrote:

If you want a F3, let me know smile

Alternatively, i have a P8702N I'm not using, someone posted bootlog and stuff here:
http://www.dd-wrt.com/phpBB2/viewtopic.php?p=922659

ZyXEL P8702N is probably the only Telenor one that does 5Ghz so it's better for heavily populated areas.

(Last edited by courfazor on 25 Jun 2015, 23:45)

You'll first have to fix your serial connection. Without serial you can't do nothing. Did you use a 3.3V TTL level uart? Connected only GND RX and TX?
Baudrate 115200 N 8 1.

Yeah I have only those connected now GND, RX, TX. It needs to be in UART mode before it will get replies in terminal, obviously, is what I assume at least. If not then I guess maybe there is something wrong in the serial connection? I have it set on 115200Baud, 8 bit data, no parity, 1 bit stop and no flow control. 0 msec/char and 0 msec/line since no uploading of ASCII.

I have minimal soldering experience so I was wondering what to do. I found R24 and R15 right next to the Samsung NAND on my F3 which according to wiki needs shortening to be in UART mode (only these two needed? I see somebody mentioned R20 and I assume the other one is for the F1). Now to shorten the pins it looks like a small tin blob on specifically these in particular and maybe the tin layer is a protection. I can get one of my friends to do this its very small and I have only worked with normal ones.

If I understand correctly you can short them with a screwdriver after removing the tin protection blobs by connecting the two pins with two screwdrivers both at once and then turning on the power? (seems like I need three hands here)

But it would be simpler if I could just make a connection between the two blobs on R24 and R15 with two more solder blobs, boot and then remove it as I assume it can't stay shorted since that would cause PCB issues or do I remove each of the four solder tin with solder wix and use the screwdriver (are there even pins under the blobs? If so they must be very small). I assume other people did this before so I don't want to mess up since I have next to no experience especially when it's this small, and I assume after this process is done once it does not need to be repeated.

(Last edited by courfazor on 26 Jun 2015, 00:02)

It needs to be in UART mode before it will get replies in terminal, obviously, is what I assume at least.

Wrong. UART mode is only to be able to boot from UART. Without UART mode you should still see the u-boot and kernel bootlog. And you should get a shell or login prompt when the box is fully booted.

About the shorting, I think it's a bad idea to solder anything. You'll have to desolder it after flashing the u-boot, and as you saw it's really small. I used a small screwdriver to short my blobs. But that was on an F1, which only needs a single shortage.
As soon as you see the 'UART' message on the terminal you can unshort the pins. So the procedure is, short the blobs, powerup the box, and wait until you see either 'UART' or the normal bootlog. In case of UART you can unshort, and upload the special bootloader. In case of normal bootlog unpower the box, and try again.
I think in case of the F3 you'll need 3 hands and 2 small screwdrivers. (Or 2 hands an a foot switch)

Yesterday I started getting a little small line with ASCII characters just about two three of them then I thought hmm, strange, and switched around the Rx and Tx cables and sure enough that was the error. Not sure if it was the device or this particular cable that was the cause. Sorry for making this basic mistake it seems the serial is okay after all.

Tried to change UART mode but it ended up in CFG5 instead of 4, maybe I was doing somthing wrong? like only one got shorted? Used two jewelers screwdrivers with Phillips head on one hand and the power on button with the other.
I managed to flash the ISP firmware 311BLN18D0.bin using ATUR and TFTP and got to the login screen but I don't know how to login as no idea about the credentials on this on and got

enable:wds0     wds1    wds2    wds3
       0        0       0       0
WdsEncrypType:;;;<------>;;;
WdsList:;;;<------>;;;
sh: wlan_wds_down.sh: Permission denied

trying to enable Wi-Fi + having issues accesing the web panel the router blinks but nothing on the browser. I think there were quite a few errors with rules on iptables and permssion denied during bootup so something must be wrong and it could have something to do with the router being bricked before (or just that this flash wiped everything) but thankfully it at least boots now. Here are some of the errors and as you can see it looks like some Telenor related does not exist:

cat: can't open '/var/tmp/hosts': No such file or directory
Starting celld daemon......
setwan 0x10 Success
Enter user spaceclearallmacs Success
ifconfig: SIOCGIFFLAGS: No such device
bridge br1 doesn't exist; can't delete it
cp: cannot stat '/tmp/ccc_account_*****//etc/passwd': No such file or directory
deluser: can't find TelenorRemoteAdmin in /etc/passwd
deluser: /etc/gshadow: No such file or directory
deluser: can't find supervisor in /etc/passwd
deluser: can't find supervisor in /etc/shadow
deluser: can't find supervisor in /etc/group
deluser: /etc/gshadow: No such file or directory

dnsmasq: cannot read /etc/SIK.conf: No such file or directory
cat: can't open '/tmp/schedule/*.sche': No such file or directory
killall: updatedd: no process killed

I do not think I could be able to run OpenWRT as it is branded to Telenor so there might not be much point of me trying to replace the bootloader by having it go into UART mode. If it is possible, like it might very well be, maybe I should try switching to OpenWRT if the ISP firmware won't work. But nonetheless can anyone help me with the branded firmware, maybe I need to set some additional settings or uploading just this file wasn't enough since it was broken and lacked something from before such as these files it can't find. The firmware could be broken apperantly it was released June 18 2015 which is recently.

EDIT: I got sent access to all of these firmwares BLN 10, 11, 12, 15, 16, 18, 17 from support but not sure if flashing any would make a difference.

(Last edited by courfazor on 26 Jun 2015, 12:05)

Yup, everything is now fixed. The credentials for user admin is written below the router as the SSID password.
If you want to know what was the problem you had to access the router on 10.0.0.138, just wipe the temporary settings used to upload as the DHCP is running and they use 10.0.0.* and you will reach a setup screen.
Don't do that, their software doesn't even run on Windows 8.1 it seems - so simply hit abort and it will redirect you to http://10.0.0.138/SIK_off.cgi (which you can do manually). After that I plugged in the WAN and set it to WAN by the switch on the back (reboot if you haven't). Flash again from GUI in case you want to feel safe that it happened correctly which I did. After I ran this to verify my connection setting it to fibre: http://hjelpen.telenor.net/telenorhjelp … nSetup.exe the wi-fi started working and now the router runs like it should.

Of course OpenWRT would have been fun too, but I do have my other $40 ASUS router running DD-WRT and a Raspberry Pi to do the things I need so this is going to hold. I don't know how safe this firmware is but I'm going to trust the ISP that their firmware released this very month is safe enough.

(Last edited by courfazor on 26 Jun 2015, 21:57)

Glad you sorted it.

I do not think I could be able to run OpenWRT as it is branded to Telenor

Installing OpenWRT involves overwriting *all* of the firmware, including the bootloader. And it doesn't use the firmware capabilities as it starts with the low-level UART boot mode of the CPU. So unless rebranding involves a hardware change, it should just work.

Mijzelf wrote:

So unless rebranding involves a hardware change, it should just work.

Yeah, I think the reason I didn't get the right mode might have been due to having one hand and maybe only one got shorted. Since the instructions here and the ones on the wiki is a bit hard to follow, but also that scapi no longer has a device and I have no idea about his version or just get one from the trunk directly.

I put the router together for the time being to test it out. It is performing well but it seems to sometimes get a little stuck loading webpages but that might be the DNS servers from the ISP that does not have the entry cached which I can just switch out. Did you test it out and see any performance differences over using OpenWRT VS the original firmware? And are the USB ports working after switching it out?

(Last edited by courfazor on 27 Jun 2015, 16:59)

Trunk has all my patches (except new DSL driver, VDSL firmware and Wireless EEPROM), my "Unit" is still working smile without Ethernet and DSL part only wifi so it is bit useless to me, nerveless if I find any Bug I will try to fix it, but my testing enq is quite limited smile

(Last edited by scapi on 30 Jun 2015, 18:32)

courfazor: I got it working on a telenor router

You have to short both, I soldered them, and that was a really bad idea, i spent a lot of time getting it off.

I'm getting good speeds on the DSL with no problems so far, i haven't tested the wifi since i have another device for that.
I noticed when downloading at full speed, upload speed suffers, so I used wondershaper with some modifications to get good latency on DNS and stuff, works much better than it ever did before.

USB seems to work, but i never tested anything on the port, just verified that it shows up somewhere in /sys

feitingen wrote:

courfazor: I got it working on a telenor router

You have to short both, I soldered them, and that was a really bad idea, i spent a lot of time getting it off.

I'm getting good speeds on the DSL with no problems so far, i haven't tested the wifi since i have another device for that.
I noticed when downloading at full speed, upload speed suffers, so I used wondershaper with some modifications to get good latency on DNS and stuff, works much better than it ever did before.

USB seems to work, but i never tested anything on the port, just verified that it shows up somewhere in /sys

I can see why that can be a pain to get off when you don't need to have it on anymore tongue I know that Telenor is going to make Download speed suffer if you Upload and the same the other way. I myself was unable to browse internet when uploading a YouTube video some years back on the 16/0.6Mbps ADSL on their previous Thomson modem which was very funny.

Anyway, I tested Wi-Fi and it has been behaving okay. But I have only been streaming HD videos and done normal surfing.
Today, however, I was doing some hardcore gaming just for the old days and been playing for many many hours on Terraria 1.3 + TeamSpeak and it suddenly just disconnected in the middle of a heavy boss fight. The router had signal and everything and displayed green the Wi-Fi was up it just wouldn't give me internet access nor would it let me reconnect even if the name was being broadcasted. After that I quickly connected a 25m cable to get internet directly from the 7 LAN port switch my provider gave me and after some more hours I tried connecting again and the Wi-Fi was working perfectly.

For gaming the Wi-Fi on this device is potentially dangerous. Do you believe that Wi-Fi can get better if I switch over to OpenWRT? It might be due to the poor Wi-Fi performance you choose to use another router for that, and maybe I should just let this one retire now since wi-fi is the only fuction I really want it to do. I have the ASUS router which currently serves as a 6to4 tunnel and therefore I didn't want it to be the main AP but I guess I can enable the firewall on router level and have it give out unique IPv6 addresses to each device over DHCP. It has less RAM and CPU but the Wi-Fi performance is superb (also has dnsmasq) and it never did anything similar to what the ZyXel did when I got disconnected earlier today. It might be related to something else, the speedtest seems to be able to cope with my max connection over wireless which isn't that high since I'm not living in any big city: http://www.speedtest.net/result/4490931364.png

Maybe I can use it to run umurmur only smile

(Last edited by courfazor on 8 Jul 2015, 23:57)

The instruction about making Openwrt running on P-2812 F3 says that R15 and R24 should be shortened. Should they be shortened the way it is pictured below or some other way?

PunBB bbcode test

Will the initializing process stop itself after "CFG 04 UART" appears or it should be stopped somehow?

The picture is correct (and helpful if you add it to the wiki)

The initializing process will stop and you'll see "CFG 04 UART" in the console. If you see a different number (CFG xx) one of them aren't shortened properly.

Tip: Don't solder them unless you're good at desoldering, it was a major struggle for me, but I'm not good at it.
You only need to keep them shortened during boot until you see "CFG 04 UART", but you can keep them shortened until you've written the new bootloader to flash if it's more convenient for you.

thanks for replying! I finally managed to install openwrt on this box. a few remarks from my experience, maybe they will be helpful for others:

1) when doing this on windows make sure that COM port parameters in manager device match those in tera term. in my case there was 9600 in manager and 115200 in tera term which (probably) was responsible for low speed during *.asc file transfer (64b/s)

2) generally I was following wiki: http://wiki.openwrt.org/toh/zyxel/p2812hnu-f3 but at some point I encountered an issue with this command:

root@OpenWrt:/# ubidetach -p /dev/mtd4
ubidetach: error!: cannot detach "/dev/mtd4"
           error 19 (No such device)

Verified against this file https://www.dropbox.com/sh/9aup68dv6oq5 … t.txt?dl=0 and found difference: /dev/mtd4 on wiki and /dev/mtd5 inside a file. I'm not sure if this is a typo at wiki.

after a change it all went well:

root@OpenWrt:/# ubidetach -p /dev/mtd5
[ 1191.436000] UBI: detaching mtd5 from ubi0
[ 1191.440000] UBI: mtd5 is detached from ubi0
root@OpenWrt:/# ubiformat /dev/mtd5 -f /tmp/openwrt-lantiq-xrx200-P2812HNUF3-squashfs-ubinized.bin
ubiformat: mtd5 (nand), size 132120576 bytes (126.0 MiB), 1008 eraseblocks of 131072 bytes (128.0 KiB), min. I/O size 2048 bytes
libscan: scanning eraseblock 1007 -- 100 % complete
ubiformat: 1004 eraseblocks have valid erase counter, mean value is 1
ubiformat: 4 bad eraseblocks found, numbers: 64, 296, 482, 727
ubiformat: flashing eraseblock 28 -- 100 % complete
ubiformat: formatting eraseblock 1007 -- 100 % complete

the rest was as wiki described.

thank you!
geos

I've changed the wiki so it's correct, I also had to use /dev/mtd5, and i used the 'mount' command to check which partition was the correct one.

Please don't change something that is right.

                fpi@10000000 {
                localbus@0 {
                            nor-boot@0 {
                                    compatible = "lantiq,nor";
                                    bank-width = <2>;
                                    reg = <0 0x0 0x800000>;
                                    #address-cells = <1>;
                                    #size-cells = <1>;
    
                                    partition@0 {
                                            label = "uboot";               <--mtd0
                                            reg = <0x0 0x50000>;
                                            read-only;
                                    };
                                    partition@50000 {
                                            label = "uboot-env";         <--mtd1
                                            reg = <0x50000 0x10000>;
                                    };
                                    partition@60000 {
                                            label = "unused";              <--mtd2
                                            reg = <0x60000 0x7a0000>;
                                    };
                            };
    
                            nand-parts@0 {
                                    compatible = "gen_nand", "lantiq,nand-xway";
                                    lantiq,cs = <1>;
                                    bank-width = <2>;
                                    reg = <1 0x0 0x2000000>;
                                    #address-cells = <1>;
                                    #size-cells = <1>;
    
                                    partition@0 {
                                            label = "kernel";               <--mtd3
                                            reg = <0x0 0x200000>;
                                    };
                                    partition@200000 {
                                            label = "ubi";                   <--mtd4
                                            reg = <0x200000 0x7e00000>;
                                    };
                            };
                    };
            }

Dropbox have old images, pre-official trunk, there were two unused partitions on F3 so mtd5, since trunk mtd4 is correct one.

Also in trunk or github bootlog:

[    1.376000] 8021q: 802.1Q VLAN Support v1.8
[    1.384000] UBI: auto-attach mtd4
[    1.384000] UBI: attaching mtd4 to ubi0
[    1.576000] UBI: scanning is finished
[    1.588000] UBI: attached mtd4 (name "ubi", size 126 MiB) to ubi0

(Last edited by scapi on 22 Jul 2015, 22:34)

when I use newest files for F1 the router falls into loop like this:

P-2812HNU-Fx # nand erase.chip

NAND erase.chip: device 0 whole chip
Erasing at 0x1700000 --  17% complete.
Erasing at 0x2e00000 --  36% complete.
Erasing at 0x4500000 --  54% complete.
Erasing at 0x5d60000 --  72% complete.
Erasing at 0x7460000 --  91% complete.
Erasing at 0x7fe0000 -- 100% complete.
OK
P-2812HNU-Fx # 
P-2812HNU-Fx # tftp 0x80700000 /tftpboot/dl.eko.one.pl/chaos_calmer/lantiq/uboot-lantiq-p2812hnufx_nandspl/openwrt-lantiq-p2812hnufx_nandspl-u-boot.img
ltq_phy: addr 0, link 0, speed 10, duplex 0
ltq_phy: addr 1, link 1, speed 1000, duplex 1
ltq_phy: addr 17, link 0, speed 100, duplex 0
ltq_phy: addr 19, link 0, speed 100, duplex 0
ltq_phy: addr 5, link 0, speed 10, duplex 0
Using ltq-eth device
TFTP from server 192.168.1.2; our IP address is 192.168.1.1
Filename '/tftpboot/dl.eko.one.pl/chaos_calmer/lantiq/uboot-lantiq-p2812hnufx_nandspl/openwrt-lantiq-p2812hnufx_nandspl-u-boot.img'.
Load address: 0x80700000
Loading: ###########
     2.5 MiB/s
done
Bytes transferred = 158227 (26a13 hex)
P-2812HNU-Fx # nand write 0x80700000 0x0 0x26a13

NAND write: device 0 offset 0x0, size 0x26a13
 158227 bytes written: OK
P-2812HNU-Fx # 
P-2812HNU-Fx # 
ROM VER: 1.1.4
CFG 06
NAND
NAND Read OK

U-Boot SPL 2013.10-openwrt4 (Jul 21 2015 - 18:11:11)
SPL: initializing NAND flash

ROM VER: 1.1.4
CFG 06
NAND
NAND Read OK

U-Boot SPL 2013.10-openwrt4 (Jul 21 2015 - 18:11:11)
SPL: initializing NAND flash

ROM VER: 1.1.4
CFG 06
NAND
NAND Read OK

U-Boot SPL 2013.10-openwrt4 (Jul 21 2015 - 18:11:11)
SPL: initializing NAND flash

ROM VER: 1.1.4
CFG 06
NAND
NAND Read OK

U-Boot SPL 2013.10-openwrt4 (Jul 21 2015 - 18:11:11)
SPL: initializing NAND flash

ROM VER: 1.1.4
CFG 06
NAND
NAND Read OK

when I use old files from dropbox everything is OK. I was told this is somehow known issue:

"The openwrt-lantiq-p2812hnufx_nandspl-u-boot.img indeed does not boot correctly. Is anyone working on fixing it? (Apparently conversion to TPL is needed) For F1 board it looks to me that it is just a matter of updating u-boot version in openwrt repository and adding a few patches on top of that."

and I'm wondering if this can attract attention of developers to fix it. I can use my F1 to test and verify when needed.

TPL images were temporary fix, there are some issues with these kind of images, they will be updated as soon as Daniel finds some time, unfortunately I cannot touch my U-Boot and test anything as LAN section on my unit is fried.

thanks scapi!

does anyone experience any issues with DHCP on those routers? I noticed DGDodo post on page 4 of this thread where he presents "Sending discover..." message for WAN port and says that it is dead. Has it been solved? I experience an issue with DHCP on F1, the router is having problems getting IP assigned. I described the issue in this thread, maybe someone could take a look and advise.

thank you
geos

(Last edited by geos on 4 Aug 2015, 18:38)