OpenWrt Forum Archive

Topic: Support for Marvell 88F5xx81 based routers

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

maddes; unfortunately so, the Openwrt default rootfs is too small to be accepted on linksys firmware. So this 'padding' with a clean rootfs and then reflashing seemed a good idea for inexperienced users. I've also tried padding only the img file but then stock firmware just doesn't except it.

You can use the openwrt-wrt350nv2-squashfs.img, because the clean rootfs is just that rootfs.

By looking at DirkNL's webupgrade builder, looking at "source_code\src\uboot_wrt350n\board\mv88fxx81\sercomm\upgrade.h" from the LinkSys GPL source and analysing all available binaries, I think that I can create a rock solid solution for the webupgrade image, that should be worthy to be added to the kamikaze trunk. Expect more this weekend.

But I wanted to post how to get the flash image (wrt350n.bin) from an official Linksys release (here 2.0.19):
(This is also available as a shell script)

# remove the first 512 bytes and the last byte (FF) from the official .img file to get the zip file
# for 2.0.17: dd if="WRT350Nv2-ETSI-2.00.17.img" of="wrt350n.zip.tmp" bs=512 skip=1
dd if="WRT350N-EU-ETSI-2.00.19.img" of="wrt350n.zip.tmp" bs=512 skip=1
ZIPSIZE=$(( `stat -c %s "wrt350n.zip.tmp"` - 1 ))
dd if="wrt350n.zip.tmp" of="wrt350n.zip" bs=${ZIPSIZE} count=1 && rm "wrt350n.zip.tmp"

# unpack bin file (unzip from zip package keeps original date & time)
unzip -o "wrt350n.zip"
# - or -
gunzip -c -S .zip "wrt350n.zip" >"wrt350n.bin"

And also how to extract the mtd images from wrt350n.bin:

# extract uImage
ZIMGSIZE=0x`hexdump -v -e '1/1 "%02X"' -s 0x0000000C -n 4 "wrt350n.bin"`
dd if="wrt350n.bin" of="uImage.bin" bs=$(( 64 + ${ZIMGSIZE} )) count=1

# extract rootfs
KERNELMTDSIZE=0x001A0000
ROOTSIZE=0x`hexdump -v -e '1/1 "%02X"' -s $(( ${KERNELMTDSIZE} - 16 )) -n 4 "wrt350n.bin"`
dd if="wrt350n.bin" of="wrt350n.bin.tmp" bs=$(( ${KERNELMTDSIZE} )) skip=1
dd if="wrt350n.bin.tmp" of="rootfs.bin" bs=$(( ${ROOTSIZE} )) count=1

# extract u-boot
BOOTSIZE=0x`hexdump -v -e '1/1 "%02X"' -s 0x007BFFF0 -n 4 "wrt350n.bin"`
dd if="wrt350n.bin" of="wrt350n.bin.tmp" bs=$(( 0x007C0000 )) skip=1
dd if="wrt350n.bin.tmp" of="u-boot.bin" bs=$(( ${BOOTSIZE} )) count=1

# clean up
rm -f "wrt350n.bin.tmp"

Very useful for testing and comparing.

P.S.:
On Debian hexdump is in the package bsdmainutils, which should always be present due to man-db for man pages.
If not available, either install the package or you can also try od from the core-utils package, but you have to get rid of the spaces sad
od -v -A n -t x1 -j 0x0C -N 4 wrt350n.bin

(Last edited by maddes.b on 3 Apr 2010, 17:03)

Does anyone still have the download versions of WRT350Nv2 firmware 2.00.16 or older? (.15 - .10)
Please PM me or contact me via my webpage if you have one firmware download left.

Would be great to be able to analyse the past for the webupgrade too.

Maddes

Webupgrade is done for WRT350N v2.0!

It is rock solid now without a second reboot.
Flash via the upgrade webpage of the stock firmware and after the next reset OpenWrt is running.

The trick is to get a zip file size which is big enough to pass the size check of the stock firmware.
Hence you had to use random data to keep the compression rate low and the file size big.
The random data will be erased when JFFS is formatted on the very first reboot.

Get the latest webupgrade patches and please review them, if you see any logical problems/gaps or missing documentation.
See post #300 how to compile it yourself.

It's great to be able to flash from stock to OpenWrt and back with ease.

(Last edited by maddes.b on 9 Apr 2010, 10:09)

@capibar and other WRT350N v2.1 owners:
#1
In which region is the v2.1 version sold? Where to get the firmware?
So non-v2.1 owners can have a look and maybe help getting webupgrade support done.
On the US homepage of Linksys only v1 firmware is available, on the european pages (UK, Germany) only v2 firmware is available.

#2
If you really want OpenWrt on your v2.1 router, then read the complete thread and see if you can get serial access to the board.
When serial access is established, get all informations possible:
a) In U-Boot:
Restart your router and stop autoboot, then get all information possible (e.g printenv, etc.)
b) Boot log:
Clear the terminal, restart your router, wait until it is completely booted then save the log to a file
c) In Linux:
Hit enter to access the console, then get all information possible (e.g cat /proc/mtd, etc.)
Create images from the mtd partitions and put them on an attached USB stick or drive.
Post these images and burn them to a CD for safety reasons.

If CPU and MTD is similar to WRT350N v2.0 then you may try out the OpenWrt ramdisk build via tftpboot, if you have serial access.
Other you may dare to flash the v2.0 OpenWrt image.
But before you do this get yourself accustomed to tfpboot in U-Boot for flashing and, more important, recovery.

(Last edited by maddes.b on 27 Aug 2009, 12:42)

maddes.b wrote:

Webupgrade is done for WRT350N v2.0!

It is rock solid now without a second reboot.
Flash via the upgrade webpage of the stock firmware and after the next reset OpenWrt is running.

The trick is to get a zip file size which is big enough to pass the size check of the stock firmware.
Hence you had to use random data to keep the compression rate low and the file size big.
The random data will be erased when JFFS is formatted on the very first reboot.

Get the latest webupgrade patches and please review them, if you see any logical problems/gaps or missing documentation.
Do not forget the patches from #5719 (see post ##376).

Hi Maddes,

thanks for all your hard work. When trying to apply the sysupgrade patch after applying the webupgrade patch, I get an error message:

gwk@openwrtbuild:~/kamikaze-webtest$ patch -p0 < ../maddes/orion_sysupgrade_image_makefile.patch
patching file target/linux/orion/image/Makefile
Hunk #1 FAILED at 48.
1 out of 1 hunk FAILED -- saving rejects to file target/linux/orion/image/Makefile.rej

gwk@openwrtbuild:~/kamikaze-webtest$ cat target/linux/orion/image/Makefile.rej
***************
*** 48,54 ****
  endef

  define Image/Build/Linksys
- # placeholder for the WRT350N v2
  endef

  define Image/Build/Freecom
--- 48,58 ----
  endef

  define Image/Build/Linksys
+       ( \
+               dd if=$(KDIR)/$(2)-uImage bs=1024k conv=sync; \
+               dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
+       ) > $(BIN_DIR)/openwrt-$(2)-$(1).img
+ # ToDo: WRT350N v2 webupgrade image
  endef

  define Image/Build/Freecom

When comparing the patch to the original file, it seems that the major changes are threefold:
1. usage of round parnthesis instead of squigly ones ( vs {
2. adjustment of bs argument for both dd operations
3. addition of parenthesis in 3 lines

Is that all I need to adjust?

Upon building, i am running into more errors:

gwk@openwrtbuild:~/kamikaze-webtest$ make V=99
make[1]: Entering directory `/home/gwk/kamikaze-webtest'
make[2]: Entering directory `/home/gwk/kamikaze-webtest'
++ mkdir -p /home/gwk/kamikaze-webtest/staging_dir/target-arm_uClibc-0.9.30.1
++ cd /home/gwk/kamikaze-webtest/staging_dir/target-arm_uClibc-0.9.30.1
++ mkdir -p bin lib include stamp
mkdir -p /home/gwk/kamikaze-webtest/build_dir/target-arm_uClibc-0.9.30.1/stamp
touch /home/gwk/kamikaze-webtest/staging_dir/target-arm_uClibc-0.9.30.1/.prepared
++ mkdir -p /home/gwk/kamikaze-webtest/staging_dir/host
++ cd /home/gwk/kamikaze-webtest/staging_dir/host
++ mkdir -p bin lib include stamp

<---- snip ---->

gcc -O2 -I/home/gwk/kamikaze-webtest/staging_dir/host/include -c src/md5.c -o /home/gwk/kamikaze-webtest/build_dir/host/wrt350nv2-builder-2.0/md5.o
src/md5.c:513: error: redefinition of 'md5_process'
src/md5.c:133: error: previous definition of 'md5_process' was here
src/md5.c:694: error: redefinition of 'md5_init'

<---- snip similar errors for a bit ---->

src/md5.c:362: error: previous definition of 'md5_finish' was here
make[3]: *** [/home/gwk/kamikaze-webtest/build_dir/host/wrt350nv2-builder-2.0/.built] Error 1
make[3]: Leaving directory `/home/gwk/kamikaze-webtest/tools/wrt350nv2-builder'
make[2]: *** [tools/wrt350nv2-builder/compile] Error 2
make[2]: Leaving directory `/home/gwk/kamikaze-webtest'
make[1]: *** [/home/gwk/kamikaze-webtest/staging_dir/target-arm_uClibc-0.9.30.1/stamp/.tools_install_nnn] Error 2
make[1]: Leaving directory `/home/gwk/kamikaze-webtest'
make: *** [world] Error 2
gwk@openwrtbuild:~/kamikaze-webtest$

I would guess that this may be related to the patching issues I had earlier?

Cheers,

Greg

(Last edited by drizzt81 on 24 Aug 2009, 19:11)

Oh, sorry for the inconvenience.
Just leave it out. The webupgrade patches already added everything that is needed to "target/linux/orion/image/Makefile".
The webupgrade patches are newer than the sysupgrade patches.

For the compile error:
What trunk revision are you using?
Did you apply the pathes to a clean checkout or did you had a previous webupgrade installed?
Have you issued a "make distclean" before compiling?

(Last edited by maddes.b on 24 Aug 2009, 20:16)

quick update, I started from stratch in order to see if I could reproduce the complication error and was unable to. Here are my steps this far:

If someone wants to scriptify this, here are all the commands in order up to menuconfig:

patch -p0 < ~/webupgrade.builder.v20.patch
patch -p0 < ~/webupgrade.makefile_tools.r17357.patch
patch -p0 < ~/webupgrade.makefile_wrt350nv2_image.r17357.patch
patch -p0 < ../maddes/orion_sysupgrade_platform_sh.patch
patch -p0 < ../maddes/orion_sysupgrade_mtd.patch

(Last edited by drizzt81 on 24 Aug 2009, 20:43)

maddes.b wrote:

Oh, sorry for the inconvenience.
Just leave it out. The webupgrade patches already added everything that is needed to "target/linux/orion/image/Makefile".
The webupgrade patches are newer than the sysupgrade patches.

For the compile error:
What trunk revision are you using?
Did you apply the pathes to a clean checkout or did you had a previous webupgrade installed?
Have you issued a "make distclean" before compiling?

Starting from stratch has fixed the compile error. Sorry for the inconvenience, apparently the patching messed something up along the way.

I'm glad that a clean checkout (or make distclean) solved it.

You can also take the commands from build_kernel_and_packages.txt.
openwrt release-config is in file orion-config-release, this is exactly the one used for official releases.
All on http://ftp.maddes.net/openwrt/

WARNING!!! The images on the ftp space do not include any web interfaces, pure console only!!! Use at your own risk!!!
This is ALL BETA!!! Newbies should wait for a stable release by the OpenWrt team!!!
Read the complete thread (I mean it) to know the problems and issues.
Inform yourself how to setup OpenWrt before you flash.
Linux experience is mandatory.
And have a fallback router available, or access to your neighbor's wlan, or know how to access the internet with your pc directly.

(Last edited by maddes.b on 3 Apr 2010, 17:06)

maddes.b wrote:

I'm glad that a clean checkout (or make distclean) solved it.

You can also take the commands from build_kernel_and_packages.txt.
openwrt release-config is in file orion-release-config, this is exactly the one used for official releases.
All on ftp://ftp.maddes.net/openwrt/kamikaze/orion/

I guess I could have just downloaded that image instead of going through all the trouble of creating a build environment... oh well, at least I learned something. Time to flash my little bugger.

Update

Flash with image from FTP failed, flash with my image worked, but no webinterface sad

(Last edited by drizzt81 on 24 Aug 2009, 22:35)

Checked with my local copy of "openwrt-wrt350nv2-squashfs-webupgrade.all_ipv6.img" and I could flash it with stock firmware 2.00.17 and 2.00.19.
So I downloaded from FTP, MD5 sum is correct and binary identical to my local copy.

I assume a corrupt download. Did you check the MD5sum?
Otherwise what stock firmware did you had before?

P.S.:
Splitted the downloaded webupgrade img and it is correctly filled up to 0x600000 - 1.

(Last edited by maddes.b on 24 Aug 2009, 23:48)

If you want a webinterface, install either "webif", or "luci-admin-full" plus "luci-admin-mini" and "luci-theme-openwrt"

opkg update  # something often forgotten

opkg install <package>

Of course you need to have an internet connection, check settings with:

uci show network.wan
uci show network.lan
uci show wireless

(Last edited by maddes.b on 3 Apr 2010, 17:09)

I tried going back to stock via sysupgrade earlier, which apparently bricked the router (i/o error during upgrade). So I need to get serial access to it sometime soon - maybe by next week. Is there a cheaper Serial console alternative than your cable. I live in Germany, so anything within the EU would be great.

(Last edited by drizzt81 on 26 Aug 2009, 09:42)

The erase error when using wrt350n.bin is normal, as the flash image is bigger than the mtd partition.
Updated post #376 accordingly.

@drizzt81: I live in Germany too, will mail you.

Just successfully flashed my 2.0 edition WRT350N with your webupgrade build, Maddes, thanks for the work, it really is appreciated.

@drizzt81: Use a cheap Nokia CA-42 or DKU-5 clone cable. Other non-USB-cellular cable may work too.
If you were lucky may own a FTDI cable, mine was a Prolific PL-2303
I din't even solder to the motherboard and work seamlessly.
In the event of need to answer the question: "What is for?" Say: "Nokia 6020" or pick your answer here

Nilfred wrote:

@drizzt81: Use a cheap Nokia CA-42 or DKU-5 clone cable. Other non-USB-cellular cable may work too.
If you were lucky may own a FTDI cable, mine was a Prolific PL-2303
I din't even solder to the motherboard and work seamlessly.
In the event of need to answer the question: "What is for?" Say: "Nokia 6020" or pick your answer here

Thanks Nilfred, Maddes is nice enough to let me borrow his cable for a bit to debrick.

maddes.b wrote:

In which region is the v2.1 version sold?

Aus

maddes.b wrote:

Where to get the firmware?

My v2.1 at least has 2.017 firmware (same as your v2.0 I think)

Internally it looks identical to photos of a v2.0 apart from the v2.1 has a 1/2 sized MiniPCI card

maddes.b wrote:

If CPU and MTD is similar to WRT350N v2.0 then you may dare to flash the v2.0 OpenWrt image.
But before you do this get yourself accustomed to tfpboot in U-Boot for flashing and, more important, recovery.

Same CPU same RAM same ROM

I am just going to give the image of your FTP site a go.  I suspect the only point of failure might be a different wireless card.  If it doesnt work I will hook up a UART to it to try recover.

Wish me luck

Update:

The webupgrade file

openwrt-wrt350nv2-squashfs-webupgrade.all_ipv6.img

works a treat on AUS v2.1 and I can Telnet and SSH in.  No WLAN though.

(Last edited by andrewm1973 on 27 Aug 2009, 11:39)

Hi Andrew,

good to hear that your router is not bricked, and that the webupgrade works with v2.1 too.
So you need a different WLAN driver for the card.
If you can find out which one, then you may install if it is already in the trunk repository.
This also may speed up the inclusion of v2.1 builds into the trunk.

Couldn't find a v2.1 firmware release on the australian or new zealand support pages of Linksys, only a v1.

Did you create an image of the mtd partition from the stock firmware via serial access before flashing to OpenWrt?
If so, this would be great to compare against the 2.0.17 EU release.

It would also be interesting if you could flash back to stock 2.0.17 (as you mentioned) and see if you get WLAN back (or even try the last EU release 2.0.19).
But beware that this may brick your router, serial access needed for recovery.

Maddes

(Last edited by maddes.b on 27 Aug 2009, 19:17)

maddes.b wrote:

Couldn't find a v2.1 firmware release on the australian or new zealand support pages of Linksys, only a v1.

Yes - I believe linksys Aus are particularly useless.  But seeing as it is 2.0.17 anyways I would assume its the same hardware apart from MiniPCI.

maddes.b wrote:

Did you create an image of the mtd partition from the stock firmware via serial access before flashing to OpenWrt?
If so, this would be great to compare against the 2.0.17 EU release.

Me not so bright to know how to do that.  If you can point me at a post number with colour by number instructions I will go buy a new V2.1 this weekend to do it for you.  They are end of life here too but a local shop had 4 of them last week.

maddes.b wrote:

It would also be interesting if you could flash back to stock 2.0.17 (as you mentioned) and see if you get WLAN back (or even try the last EU release 2.0.19).
But beware that this may brick your router, serial access needed for recovery.

I can recover with just UART and dont need JTAG?  I am going to order an FT3232 to make a combined UART/JTAG adaptor to sit in the router.  But thats going to be weeks off yet.

BTW - I could not install Luci from the main repository (openwrt.org).  Failed on the "luci-core postinst" what ever that means.  I did a first-boot and tried again - same problem.  Gave up and installed webif.

So as far as V2.1 AUS goes.

Maddes web-install runs fine to update router.
Wireless does not work (maybe my dumb arse doing something wrong)
USB does not work (Definitly my dumb arse)
Luci does not work (probably something wrong in the package)

For USB support, see #351, you need "kmod-usb2", "kmod-usb-core" and "kmod-nls-base".
To access storage via USB you need "kmod-usb-storage".
Depending on the used filesystem you may need additional kmod packages (kmod-fs-xyz plus corresponding kmod-nls-abc).
Printers need other packages, and so on.

Luci gave me also errors on postinst, but I was still able to access it via browser. Personally I prefer webif (X-Wrt).

(Last edited by maddes.b on 3 Apr 2010, 17:11)

To create an image of the original firmware you just need a serial access, see #5 (serial pin layout), #66 (link to opening the case, plus high res pic of router's inside).
Ground is soldered to the audio jack's ground, Vcc is not soldered, TX and RX go to audio jack's left/right channel (test if no signal, then switch).
I suggest to  get serial access on your current router first, before buying a 2nd one.
If it works, you can get a 2nd one, create images of the original firmware and maybe return it to the dealer (so open it carefully).

With serial access you will see what is going on inside the router before Linux is even started.
The output will be similar to the one from #5.
Note the "Hit ENTER to stop autoboot" message in line 46.
You have 3 seconds to stop the autoboot, this will give you access to the U-Boot system, which offers you to load a ramdisk image without flashing or even flash directly any image.
Please read the complete thread to find out U-Boot commands and more details (reading the complete thread is really recommended).

You can also ignore the message and start the original stock kernel.
When loaded hit enter to get a shell, where you can call all available Linux commands.
Add an USB drive/stick via the web interface of the stock firmware.
Then create images from the mtd partitions to the usb drive/stick via dd.

List of commands for U-Boot and Linux, so you can get all information in one go.
For the log you should set Putty's scrollback to 9999 lines or more under "Window" for the COM connection.

help
printenv
flinfo

Then call "boot" to get to Linux

cat /proc/version
cat /proc/cpuinfo
cat /proc/bus/pci/devices
cat /proc/modules
ls -l /sys/class/net/*/device/driver/module
lspci
ifconfig
dmesg

PM me if some command is missing.

To find out the PCI device check here (section "PCI addressing")
PCI databases are here and here

"cat /proc/bus/pci/devices" for me results in "0138  168c0023 ..." and vendor 168c (or here) is Atheros.

Creating images:

cat /proc/mtd  # to get the numbers (X)
dd if=/dev/mtdblockX of=/path/to/usb/mtdX.img

By the way, after re-reading this thread I recognized that DirkNL has a v2.1 (see post #70).
But this seems to be a different EU version (he's from the netherlands) with the old PCI WLAN card (quote from #73: "I couldn't see any difference between your photos and my WRT").
His v2.1EU logs are in post #78.

(Last edited by maddes.b on 30 Aug 2009, 20:19)

maddes.b wrote:

I suggest to  get serial access on your current router first, before buying a 2nd one.
If it works, you can get a 2nd one, create images of the original firmware and maybe return it to the dealer (so open it carefully).

I am pretty familiar with MAX[3]232s so I I should be right there.  I dont mind spending an extra $140 on a second router.  Hacking things like this is fun.  My next challenge is going to be trying to understnd that thread on modifying U-Boot to up the RAM to 128M

maddes.b wrote:

When loaded hit enter to get a shell, where you can call all available Linux commands.
Add an USB drive/stick via the web interface of the stock firmware.
Then create images from the mtd partitions to the usb drive/stick via dd.

Cool.  Thats probably enough hint about the command.  I will try "Man DD" and "DD ?" and look through this thread for parameters.

maddes.b wrote:

I will create a list of commands for U-Boot and Linux in this post on Sunday

Champion - tnx.

maddes.b wrote:

For USB support, see #351, you need "kmod-usb2".
To access storage via USB you need kmod-usb-storage.
Depending on the used filesystem you may need additional kmod packages (kmod-fs-xyz).
Printers need other packages, and so on.

I have already read the entire 16 page thread (over a several month period) and remembered to do the kmod-usb-* installs.  The USB hub and the thumb drive appear in the X-WRT USB tab.  I just can't find the drive anywhere in where i would normally look for one under /mnt whatever in debian.

maddes.b wrote:

Luci gave me also errors on postinst, but I was still able to access it via browser. Personally I prefer webif (X-Wrt).

OK - So I am not completely dumb big_smile

Hi
I am the owner of WRT350N v2.0 and watching this tread for several months.
IFAIK there is a working OpenWRT code for WRT350N v2.0, so please anyone be so kind to explain to me how can I load it to my router together with X-Wrt?

I have no real knowledge how to get and compile it's code under Linux environment, as well as apply patches to it, so preferably a compiled binary for web upgrade, pls.

Thanks for your help.