OpenWrt Forum Archive

Topic: Examining .rmt firmware files (openrg)

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

Hello,

im trying to replace some rmt contents but How is the dd "skip" value for dd calculated or extracted ? ... I have another openrg device  with other firmware but cant figure out how to get the "skip" value or file map contents   ... is there any utility out there for examining rmt files? is this value something which is fixed or specific to the platform? calculated from ramsize? extracted from the image?

examle from wrv54g  : dd if=wrv54g_2.03_fw.rmt of=ext2.img.gz bs=1c skip=788041c

http://www.seattlewireless.net/index.cgi/LinksysWrv54g

2.1. Examining the filesystem
Extract the compressed {ext2} filesystem from firmware 2.03 like this:

# dd if=wrv54g_2.03_fw.rmt of=ext2.img.gz bs=1c skip=788041c
# gunzip ext2.img.gzExtract the compressed {ext2, cramfs} filesystems from firmware 2.37 like this:

# dd if=wrv54g_v2.37_US.rmt of=layer1.img.gz bs=1c skip=12258c
# gunzip layer1.img.gz
> gunzip: layer1.img.gz: decompression OK, trailing garbage ignored

# dd if=layer1.img of=ext2.img.gz bs=1c skip=1740800c
# dd if=layer1.img of=cramfs.img bs=1c skip=1761280c

# gunzip ext2.img.gz
> gunzip: ext2.img.gz: decompression OK, trailing garbage ignoredMount:

# mount -t ext2 -o loop ext2.img /mnt/ext2

# mount -t cramfs -o loop cramfs.img /mnt/cramfs

I've tried to decode (decompress) *.rtm from Pirelli, but no results, starting from offset with E=..( and till the end of file image is not mountable, maybe lzma is used in that firmware (not gzip from zlib). Tool uncramfs sees files and lists them, but after decompression - zeros in files. Somebody got solved this problem? Maye someone has got all the openRG SDK?

open the image with a hex editor, i use okteta.
Hex 1F 8B 08 is start of gzip files, so do a search for this start in file. just google for other hex file starts.
in okteta u can see offset in lower left corner, e.g. 2FE2 for wrv54g firmware. convert hex value to decimal and append c. c man dd and look for BLOCKS to understand the c.

here are the commands for WRV54G_v2.39.2e_fw.rmt:
$ dd if=wrv54g_v2.39.2e_fw.rmt of=layer1.img.gz bs=1c skip=12258c
$ gunzip layer1.img.gz
$ dd if=layer1.img of=ext2.img.gz bs=1c skip=1740800c
$ dd if=layer1.img of=cramfs.img bs=1c skip=1765376c
$ gunzip ext2.img.gz
$ mount -t ext2 -o loop ext2.img ext2
$ mount -t cramfs -o loop cramfs.img ext2/mnt/cramfs

(Last edited by ixproz on 14 May 2010, 14:21)

The discussion might have continued from here.