Thanks a lot for the information.<br>physrd is also a very nice and useful utility, it works on my board..<br><br><div class="gmail_quote">2011/10/21 Peter Stuge <span dir="ltr"><<a href="mailto:peter@stuge.se">peter@stuge.se</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">Alp Eren Köse wrote:<br>
> > > But unfortunately I needed a windoz machine to extract the CMC binary,<br>
> > > you can use the CBROM utility like this:<br>
> > > C:\> CBROM32_195.EXE vendor_bios.bin /TOPHOLE:FFFD0000 extract<br>
> > I'd say you can do the same with dd(1), no?<br>
> ><br>
> Oh yes of course, that's very likely probably :) that should be something<br>
> like this maybe:<br>
> dd skip=(blocks until FFFD0000) if=vendor_bios.bin of=cmc.bin<br>
> is that right? I'm not good at those block calculations:)<br>
<br>
</div>The theory is in the right direction but the details are wrong, and<br>
the command can't work at all.<br>
<br>
() creates a subshell in most if not all shells; not what you want.<br>
<br>
To give dd the correct parameters you need to know where cmc.bin<br>
starts. FFFD0000 is not the answer; it is the correct physical<br>
address when the factory BIOS image is in a flash chip that the CPU<br>
can address, but it is obviously not the correct offset in the file.<br>
<br>
You know that the factory BIOS image is mapped to top of 4GB physical<br>
address, so you need to use subtraction to find the correct offset:<br>
<br>
offset = 0xfffd0000 - (0x100000000 - size of factory BIOS image)<br>
<br>
Then you need to express the offset in a way that dd understands. As<br>
you know from the dd man page, dd uses blocks, and you can set any<br>
block size you want. Since a factory BIOS image size will always be a<br>
multiple of 64KB, and this is how much you want to copy, and since<br>
all other terms in the above equation are 64KB aligned, and since it<br>
is such a nice round number in binary and hexadecimal, 64KB seems<br>
like a good block size. Translate the offset into number of blocks:<br>
<br>
offset_in_blocks = offset / 65536<br>
<br>
And run dd:<br>
<br>
dd if=factor_bios.bin of=cmc.bin bs=64k skip=offset_in_blocks count=1<br>
<br>
<br>
Another method is to use <a href="http://stuge.se/physrd.c" target="_blank">http://stuge.se/physrd.c</a> to try to read from<br>
the flash chip directly, then you do not need to do maths, but on the<br>
other hand you must compile a special program and if you are unlucky<br>
the address region is not accessible by the CPU without special magic<br>
that flashom knows. You would run:<br>
<br>
./physrd 0xfffd0000 64k cmc.bin<br>
<br>
<br>
I think the calculation is faster and simpler.<br>
<font color="#888888"><br>
<br>
//Peter<br>
</font><div><div></div><div class="h5"><br>
--<br>
coreboot mailing list: <a href="mailto:coreboot@coreboot.org">coreboot@coreboot.org</a><br>
<a href="http://www.coreboot.org/mailman/listinfo/coreboot" target="_blank">http://www.coreboot.org/mailman/listinfo/coreboot</a></div></div></blockquote></div><br>