OpenWrt Forum Archive

Topic: generate .trx file for reflashing

The content of this topic has been archived on 30 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Dear friends
    I am a beginner and i am facing some problem in reflashing my bullet2 device .
I have read in some of the readme.txt that we should have .trx file to reflash from the bullet itself.
(http://downloads.openwrt.org/whiterussian/rc5/00-README)
But could you please help me telling how to generate the .trx file.

I am using OpenWrt Backfire 10.03 and i have compiled and made the binary file "openwrt-atheros-ubnt2-squashfs.bin".
I have loaded it using tftp and it is working fine.
But i don't know how to get the .trx file for reflashing.

Since our bullets will be on the roof-tops, i have to remotely reflash it.

Could you please help me in this.

Thanks
Johns

(Last edited by johnsgeorge on 5 Oct 2010, 12:22)

I dont have an exact answer for you but I think you should start reading the difference between trx and bin
https://forum.openwrt.org/viewtopic.php?id=12248 is just one of the threads
in one line short the bin file has a header of 32 bytes while compared to a trx.
you can usually convert a bin to trx by stripping off the header which I just talked about

Dear mohnkhan
  I have tried the command "hexdump -C openwrt-atheros-ubnt2-squashfs.bin  | grep HDR0". But it couldn't find HDR0 in the file. Can you please suggest some alternative.

well that was just an example.

 dd if=firmware.bin of=firmware.trx bs=32 skip=1

is one trick to get the first 32 skipped.
A .trx file is simply a firmware image in "raw" format with no
extraneous vendor-specific wrapper info

for your particular platform you need to check if its supported by kamikaze or backfire (better the latest one).
the above command should work.
for older versions it used to be like this

mtd -r write filename.trx linux

thats what I can recall from the back of my brain.

may be somebody with more knowledge on your platform can help you out if this does not work.

When i tried "mtd -r write openwrt-atheros-ubnt2-squashfs.trx linux", i am getting the following errors

"Could not open mtd device: linux
Can't open device for writing!"

I tried with .bin also. But the error is same. I have generated the .trx file by removing the first 32 bytes using the follwoing command
dd if=openwrt-atheros-ubnt2-squashfs.bin of=openwrt-atheros-ubnt2-squashfs.trx bs=32 skip=1

I had checked in the forum and have seen many people reporting the above problem, but could get an answer.

Also i have tried to refflash the image using the web browser (http://192.168.1.1/cgi-bin/luci/;stok=. … em/upgrade).
Then i am getting the below error.

"The uploaded image file does not contain a supported format. Make sure that you choose the generic image format for your platform."

I tried to upload the .trx file because it was mentioned in some of the forums. Then i tried with the .bin file also. Both didn't work.

How can us ensure that if we discard the first 32 bytes from .bin file , we are getting a .trx file.

So i was not able to use the mtd command or the web interface to reflash my bullet.

It would be a great help if some one can help me to reflash my bullet.
(I am able to flash it using tftp. But since my bullet will be placed at roof top, i have to re-flash it remotely using the wireless interface of the bullet)

(Last edited by johnsgeorge on 5 Oct 2010, 16:12)

The cat /proc/mtd output is

dev:    size   erasesize  name
mtd0: 00030000 00010000 "RedBoot"
mtd1: 000d0000 00010000 "kernel"
mtd2: 002e0000 00010000 "rootfs"
mtd3: 00130000 00010000 "rootfs_data"
mtd4: 0000f000 0000f000 "FIS directory"
mtd5: 00001000 00001000 "RedBoot config"
mtd6: 00010000 00010000 "boardconfig"

If i do  mtd -r write Bullet2-v3.5.1.build4631.bin rootfs i am getting

Unlocking rootfs ...
Writing from Bullet2-v3.5.1.build4631.bin to rootfs ...  [e]Failed to erase block

Could any of you help me to fix this problem of reflashing the bullet as i am stuck in this.
Thanking you in advance.

I got the solution for my problem and i have explained it below

When we make the binaries using the command "make" (or make V=99),
openwrt-atheros-combined.squashfs.img will be created in /bin/atheros/ along with other binaries.

copy this to the /tmp folder in the router, and execute the command
"sysupgrade openwrt-atheros-combined.squashfs.img "

I have attached the logs which i got after executing  the command

root@OpenWrt:/tmp# /sbin/sysupgrade openwrt-atheros-combined.squashfs.img
Saving config files...
Switching to ramdisk...
mount: mounting mini_fo:/jffs on /mnt failed: Function not implemented
Performing system upgrade...
Unlocking kernel ...
Unlocking rootfs ...
Writing from <stdin> to kernel ...     
Writing from <stdin> to rootfs ...     
Appending jffs2 data from /tmp/sysupgrade.tgz to rootfs...
Updating FIS table...
Rebooting ...

Now once the router is up after the reboot, you will be able to connect to it using the ip you have configured or else with 192.168.1.1

You can also upgrade the firmware from the web browser http://192.168.1.100/cgi-bin/luci/;stok … m/upgrade/
Just browse and select the openwrt-atheros-combined.squashfs.img file.
It will upgrade and reboot. If you have changed the ip address then use the new ip after upgrade

Thank you for all your help
Johns

The discussion might have continued from here.