Andes Workshop

It is currently Thu Nov 14, 2019 3:34 am

All times are UTC + 8 hours [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: cut binary files (split) use dd command
PostPosted: Mon Mar 10, 2014 4:47 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
Use dd command to skip 0x20 bytes. (32 bytes)
In other word, we need to delete the first 32 bytes of a binary file.
Input file: demo-int-c-ext.bin
Outupt file: test.bin

In cygwin:
$ dd if=./demo-int-c-ext.bin of=./test.bin bs=1 skip=32
8004+0 records in
8004+0 records out
8004 bytes (8.0 kB) copied, 0.035 s, 229 kB/s

hylai@APC187 /cygdrive/d/Andestech/AndeSight201MCU/mcu_64/workspace/demo-int-
xt/Debug/output
$ ls -al
total 204
drwxrwxrwx+ 1 hylai mkpasswd 0 Mar 10 15:30 .
drwx------+ 1 hylai mkpasswd 4096 Mar 10 15:20 ..
-rwxrwxrwx 1 hylai mkpasswd 8036 Mar 10 15:20 demo-int-c-ext.bin
-rw-rw-rw- 1 hylai mkpasswd 116966 Mar 10 15:20 objdump.txt
-rw-rw-rw- 1 hylai mkpasswd 46241 Mar 10 15:20 readelf.txt
-rw-rw-rw- 1 hylai mkpasswd 19113 Mar 10 15:20 symbol.txt
-rw-r--r-- 1 hylai mkpasswd 8004 Mar 10 15:41 test.bin

Attachment:
cygwin.png
cygwin.png [ 55.82 KiB | Viewed 4188 times ]


Sample:
Attachment:
demo-int-c-ext.bin [7.85 KiB]
Downloaded 293 times

Attachment:
test.bin [7.82 KiB]
Downloaded 290 times


In AndeSight, add "dd if=./output/demo-int-c-ext.bin of=test.bin bs=1 skip=32" to post-build steps.


Attachment:
andesight1.png
andesight1.png [ 38.58 KiB | Viewed 4188 times ]


Attachment:
andesight2.png
andesight2.png [ 11.35 KiB | Viewed 4188 times ]


Top
 Profile Send private message E-mail  
 
 Post subject: Re: cut binary files (split) use dd command
PostPosted: Wed Mar 12, 2014 5:59 pm 
Offline
User avatar

Joined: Fri Mar 04, 2011 9:36 pm
Posts: 500
If we would like to cut 2 KB file (but skip the first 32 bytes)
dd if=./demo-int-c-ext.bin of=./test.bin bs=1 skip=32 count=2048
It means cut 32~(32+2048) bytes, total 2048 bytes.

Attachment:
dd.png
dd.png [ 19.97 KiB | Viewed 4181 times ]


Reference: (Chinese page)
http://blog.csdn.net/do2jiang/article/details/5069536


Top
 Profile Send private message E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group