This is an old revision of the document!


Table of Contents

bgrep

file=vmlinuz-3.1.0-1-orion5x
strings $file | grep -i lzma
#| LZMA data is corrupt
xxd /local/rootfs-debian-arm-lenny/usr/lib/locales-all/supported.tar.lzma | head
#| 0000000: 5d00 0080 00ff ffff ffff ffff ff00 170b  ]...............
# header="1f8b0800" # gzip
# header="425a6839" # bzip2
header="fd377a585a00" # xz
header="5d0000" # lzma
 
bgrep "$header"  $file 
# offset=`grep -P -a -b -m 1 --only-matching $'\x5d\x00\x00' $file | cut -f 1 -d :` 
offset=$(bgrep "$header"  $file | tail -n 1 | cut -d' ' -f 2) #TODO: LooP
offset=$(printf "%d" 0x$offset) # 

dd if=$file bs=1 skip=$offset | lzcat > tmp-$offset.out
# lzcat: Decoder error  
size=$(wc -c "$file" | cut -f 1 -d' ') # 1471040
for i in $(seq 1 $size) ; do dd if=$file bs=1 skip=$i | lzcat > tmp/$i.tmp && mv tmp/$i.tmp tmp/$i.out; done
dd if=vmlinuz-3.1.0-1-orion5x skip=7193 bs=1 | xxd | head -n 1
0000000: 5d00 0000 02ff ffff ffff ffff ff00 69bc  ].............i.
strings tmp.out # vmlinux md5=cbd611f32d572c5aec31b22809a2ed35
#| %s version %s (Debian 3.1.1-1) (ben@decadent.org.uk) (gcc version 4.6.2 (Debian 4.6.2-4) ) %s
#| Linux version 3.1.0-1-orion5x (Debian 3.1.1-1) (ben@decadent.org.uk) (gcc version 4.6.2 (Debian 4.6.2-4) ) #1 Tue Nov 15 06:07:47 UTC 2011
file=uImage.buffalo # vmlinux md5=cbd611f32d572c5aec31b22809a2ed35
#| %s version %s (Debian 3.1.1-1) (ben@decadent.org.uk) (gcc version 4.6.2 (Debian 4.6.2-4) ) %s
#| Linux version 3.1.0-1-orion5x (Debian 3.1.1-1) (ben@decadent.org.uk) (gcc version 4.6.2 (Debian 4.6.2-4) ) #1 Tue Nov 15 06:07:47 UTC 2011
#file=vmlinuz-3.1.0-1-orion5x-skip_7193.out # ToDo
#header=454c46
#offset=$(bgrep "$header"  $file | head -n 1 | cut -d' ' -f 2) #TODO: LooP
#offset=$(printf "%d" 0x$offset) # 
#dd if=$file  skip=$offset bs=1 | nm --demangle /dev/stdin
echo "==> searching for gzip header in $zImage"
skip=`grep -P -a -b -m 1 --only-matching $'\x1F\x8B\x08' $zImage | cut -f 1 -d :`

MISC

MORE

cli.1533396095.txt.gz · Last modified: 2018/08/04 17:21 by rzr
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki