有一个arm elf文件经过objcopy -O binary 命令处理生成bin文件

进行反汇编:

指令1:

arm_v5t_le-objdump  -b binary -m armv5te -D  u-boot.bin|head

指令2:

arm-linux-objdump  -D -b binary test.bin --architecture=arm  > /tmp/raw.txt

http://linux.chinaunix.net/bbs/thread-1145255-1-1.html

http://chdk.wikia.com/wiki/GPL_Disassembling

Meanwhile I wrote a perl script, which does all the jobs. Also it lookup references and add this to the disassemble output.

Disassembling with GNU/GPL tools

The gnu/gpl tools are not made for analysing alien binary dumps because we usually have the source code if we need to debug. This is not really an replacement for IDA but for me it's was sufficient.

Installing software is not explained in this tutorials.

Prerequisites:

You have a raw binary firmware dump to look at. I'll use here "dump.bin"

In this toybox we have:

arm-elf-objcopy | arm-linux-gnu-objcopy

arm-elf-objdump | arm-linux-gnu-objdump

Here we go:

strings -t x dump.bin > dump.strings

hexdump -C dump.bin > dump.hex

arm-linux-gnu-objdump -m arm -b binary -D dump.bin > dump.dis

However, theres a problem: all files start with an offset of 0x00. Here comes my renumber.pl script:

strings -t x dump.bin | ./renumber.pl 0xff810000 > dump.strings

hexdump -C dump.bin |./renumber.pl 0xff810000 > dump.hex

Before we disassemble the dump, we pack it into elf format. This meat is good for feeding gdb and the IDA demo version ;)

arm-linux-gnu-objcopy --change-addresses=0xff810000 -I binary -O elf32-littlearm -B arm dump.bin dump.elf

arm-linux-gnu-objcopy --set-section-flags .data=code dump.elf

Verify the elf file:

arm-linux-gnu-objdump -x dump.elf

Disassemble:

arm-linux-gnu-objdump -d dump.elf > dump.dis

So finally we have 3 ascii files to stare at:

dump.dis

dump.strings

dump.hex

and

dump.elf for gdb and qemu

Putting all together

Meanwhile I wrote GPL:disassemble.pl perl script, which does all the jobs. Also it lookup references and add this to the disassemble output.

disassemble.pl 0xff810000 dump.bin

e.g. output:

NSTUB(Capture.Create, 0xff938368):

ff938368: e92d4010 stmdbsp!, {r4, lr}

ff93836c: e59f0020 ldrr0, [pc, #32]; ff938394: (ffac13cc)

ff938370: ebfcc3fd blff86936c <_binary_dump_bin_start>

ff938374: eb01cf03 blff9abf88 <_binary_dump_bin_start>

ff938378: e3a00000 movr0, #0; 0x0

ff93837c: e8bd8010 ldmiasp!, {r4, pc}

// this is obviously an entry point, because ^^ is a "return"

ff938380: e24f1020 subr1, pc, #32; ff938368: (e92d4010)

ff938384: e28f000c addr0, pc, #12; ff938398: (74706143) *"Capture.Create"

ff938388: eafcc355 bff8690e4 <_binary_dump_bin_start>

// another

ff93838c: e28f0004 addr0, pc, #4; ff938398: (74706143) *"Capture.Create"

ff938390: eafcc355 bff8690ec <_binary_dump_bin_start>

// this is data, referenced from 0xff93836c followed by some text

ff938394: ffac13cc undefined instruction 0xffac13cc

"Capture.Create":

ff938398: 74706143 ldrvcbtr6, [r0], #-323

ff93839c: 2e657275 mcrcs2, 3, r7, cr5, cr5, {3}

ff9383a0: 61657243 cmnvsr5, r3, asr #4

ff9383a4: 00006574 andeqr6, r0, r4, ror r5

Note: The entire disassembled file is shown as instructions, including strings and numeric constants. Strings are identified where referenced, as shown above, but the corresponding address still has disassembled (nonsense) instructions. If the instructions you are looking at don't make any sense, they are probably data.

using gcc/gas

Another way to create an elf file with symbols from chdk's stub files: forum However, the disassemble script makes a better format but this one is very good for gdb+qemu ;)

Linux怎么处理binray文件,Linux下如何反汇编arm raw binary文件相关推荐

  1. Linux下使用C语言查找一个文件夹下指定扩展名的所有文件

    最近在linux下要干点和c语言相关的任务,其中涉及使用C语言查找一个文件夹下指定扩展名的所有文件,我去开始在网上查找后粘贴后不能用,最后发现是windows下才能使用.最后找到了一篇不错的文章,ht ...

  2. 删除指定文件夹下的小于 4K的所用文件...

    删除指定文件夹下的小于 4K的所用文件... (记一次垃圾邮件的删除..) Const ForReading = 1, ForWriting = 2, ForAppending = 8 Const T ...

  3. PowerShell遍历文件夹下的子文件夹和文件

    PowerShell遍历文件夹下的子文件夹和文件是一件很容易的事儿.Get-ChildItem这个cmdlet就有一个recurse参数是用于遍历文件夹的. PowerShell中,使用Get-Chi ...

  4. 解放文件夹下所有层级的特定格式文件,找出文件夹内所有的txt/FLAC/MP4/MP3等等等等,并复制到另一个文件夹中

    解放文件夹下所有层级的特定格式文件,找出文件夹内所有的txt/FLAC/MP4/MP3等等等等,并复制到另一个文件夹中 引言 代码 得意 天天学习,好好向上 引言 各位朋友们好!最近遇到一些想要方便办 ...

  5. 解决linux使用yum安装新版JDK时,Java文件夹下没有lib、bin等文件,只有jre的问题

    最近在Linux上使用yum安装JDK时,发现/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.292.b10-0.el8_3.x86_64/文件夹下尽然只有jre文件夹,其 ...

  6. linux 复制文件夹下的所有内容到目标文件夹

    在linux 下可以使用cp 命令去复制内容例如 #复制到目录文件夹* 和 . 代表目录下的所有文件 cp ~/temp/* ~/text/ cp ~/temp/. ~/text/ #复制到当前文件夹 ...

  7. linux打包运行python文件_Linux下安装pyinstaller用于将py文件打包生成一个可执行文件...

    安装使用流程 1. 首先给系统装个easy_install, 如果装了的可以跳过这步 到pypi官方网址 https://pypi.python.org/pypi/setuptools 去downlo ...

  8. php读取iso文件,Linux_linux下如何读取使用iso 镜像文件的方法,如果拷贝到本地,可以使用moun - phpStudy...

    linux下如何读取使用iso 镜像文件的方法 如果拷贝到本地,可以使用mount mount fileName mountPoint -o loop,fileName是镜像文件名(*.iso,*.i ...

  9. win10电脑服务器在哪个文件夹下,Win10桌面背景在哪个文件夹?Win10桌面背景所在文件夹介绍...

    最近有Win10用户反映,之前电脑有设了张很好看的桌面背景,但后来不小心给换成了别的,现在想换回来,却不知道要在哪个文件夹找那张桌面背景,用户为此非常困恼.那么,Win10桌面背景在哪个文件夹呢?下面 ...

最新文章

  1. httpd-2.2和httpd-2.4虚拟主机的实现
  2. MySQL事物(详解并发问题和隔离级别)(小白也能懂哦)
  3. 用HTML语言怎样打印出九九乘法表,jsp/javascript打印九九乘法表代码
  4. 国二C语言用编译器做题,C语言编程实例100题——国二国三题库大全(必过).doc
  5. 使用libyuv对YUV数据进行缩放,旋转,镜像,裁剪等操作
  6. 使用ENVI进行监督分类
  7. Android百度浏览器深色模式,深色模式适配指南
  8. 信用卡诈骗罪16个有效辩点
  9. 一文读懂人工智能产业链:基础技术、人工智能技术及人工智能应用
  10. 流程设计建模方法:流程的需求梳理之活动级别梳理
  11. 在Java里面使用Pairs或者二元组
  12. 整理的开学需要准备的物品清单,删了怪可惜,做个备份吧
  13. 游戏建模初学者该怎样学习?
  14. 打印二维、多行的PDF-417条形码控件PDF417 Fonts and Encoder
  15. 上海科技领军企业CIMC中集飞瞳集装箱人工智能AI走向成熟,先进产品领跑全球集装箱AI航运港口人工智能应用,上海人工智能企业公司
  16. 传统向量空间模型的缺陷
  17. 笔试算法《简单密码》
  18. percona-xtrabackup-数据库备份工具学习使用
  19. Date问题:字符串格式时间进行加减
  20. 实验二 :熟悉双绞线水晶头的制作

热门文章

  1. 计算机转正述职报告ppt,转正述职报告ppt
  2. android的json解析方式,Android解析JSON方式
  3. config.class.php,Config.class.php
  4. 毕业设计C语言网吧管理系统,毕业设计网吧管理系统.doc
  5. python动态绘图并保留之前绘图_[转]基于Python实现matplotlib中动态更新图片(交互式绘图)...
  6. flex弹性布局操练2
  7. 移动设备HTML5页面布局
  8. [译文]过犹不及,别再在编程中高射炮打蚊子
  9. 微信小程序echarts层级太高
  10. python selenium 判断元素是否可见