views:

48

answers:

1

How do i unstrip a stripped object file ?

Does eu-unstrip from elfutils can make this for me ?

I need this to convert a zImage kernel to vmlinux without recompiling.

This is apart of my script:

magic="1f 8b 08 00"
full_line=$(od -A d -t x1 zImage | grep "$magic" )
offset_full_line=$( echo $full_line | cut -f1 -d" ")
data_full_line=$( echo $full_line | cut -f1 -d" " --complement )
index=$[ $( awk -v a="$data_full_line" -v b="$magic" 'BEGIN{print index(a,b)}' ) / 3 ]
offset=$[ 10#$offset_full_line + $index ]

dd if=zImage bs=1 skip=$offset 2>/dev/null | zcat > vmlinux

But my result vmlinux has an unknown format because it doesn't contain ELF headers, so how can i recover those headers ?

A: 

Your question makes no sense. If the object file has been stripped, then obviously the information is no longer there. You've got nowhere to extract the stripped data from.

Nathan Fellman