2010年11月26日 星期五

dd & skip

看i.MX51文件時,一個蠻有意思的用法,用man的話,資質駑鈍的我實在抓不到他的意思...XD

~$ man dd | grep skip
skip = BLOCKS
skip BLOCS ibs-sized blocks at start of input

文件內有一段是這樣說︰The above u-boot.bin has 1024KB padding at the head of file,for example first executable instruction is at the offset 1KB. If you want to generate a no-padding image, you need do below dd command in host.
$ sudo dd if=./u-boot.bin of=./u-boot-no-padding.bin bs=1024 skip=1
Usually this no-padding uboot image is used in the SD card, for example, program this no-padding uboot image into 1KB offset of SD card so that we do not overwrite the MBR (including partition table) within first 512B on the SD card.

看完man以及文件說明後,就可以推敲出來skip的實際用意。
用上面那個例子簡單來說︰
原本的u-boot填滿前面1KB而不使用,從1K開始的位置開始有實際資料,而後來的u-boot-no-padding,則不填滿那前面的1KB,在寫入SD Card時,則是從offset 1KB開始寫入,前面則是保留給MBR來使用(因為會用到partition table)。

沒有留言:

張貼留言