public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* Extboot Option Rom rewritten in C
@ 2008-04-15  2:56 Nguyen Anh Quynh
  2008-04-15  3:22 ` Anthony Liguori
  0 siblings, 1 reply; 8+ messages in thread
From: Nguyen Anh Quynh @ 2008-04-15  2:56 UTC (permalink / raw)
  To: kvm-devel, Anthony Liguori

[-- Attachment #1: Type: text/plain, Size: 1033 bytes --]

Hi Anthony,

I spot a bug and few dead code in the extboot option rom. Perhaps the
reason they are there is because less people want to look at assembly
code, and it looks indeed scary.

So I decided to rewrite it in C, using .code16gcc directive. Some advantages:
- C code is easier to understand, find bugs, maintain and hack (so we
can add more features in the future)
- The binary image is same: 1.5K. The actual code size is also about
the same size: around 1.2K. (gcc can optimize really well)

See the code in attachment. The new code consists of a very small
assembly file boot.S, which merely interfaces with the C code.
"signrom" is modified to work with the new binary image.

- To compile code, just run "make"
- To save the original /usr/share/qemu/extboot.bin (to
/usr/share/qemu/extboot.bin.org), just run "make save"
- Then "make install" to install the new extboot.bin into /usr/share/qemu/

I succesfully compile and run this option rom with virtio from
2.6.25-rc8 on Ubuntu 7.10.

Any comment?

Many thanks,
Quynh

[-- Attachment #2: extboot-C.tbz2 --]
[-- Type: application/x-bzip-compressed-tar, Size: 6927 bytes --]

[-- Attachment #3: Type: text/plain, Size: 320 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

[-- Attachment #4: Type: text/plain, Size: 158 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Extboot Option Rom rewritten in C
  2008-04-15  2:56 Extboot Option Rom rewritten in C Nguyen Anh Quynh
@ 2008-04-15  3:22 ` Anthony Liguori
  2008-04-15  3:30   ` Nguyen Anh Quynh
  0 siblings, 1 reply; 8+ messages in thread
From: Anthony Liguori @ 2008-04-15  3:22 UTC (permalink / raw)
  To: Nguyen Anh Quynh; +Cc: kvm-devel

Hi Nguyen,

Nguyen Anh Quynh wrote:
> Hi Anthony,
>
> I spot a bug and few dead code in the extboot option rom. Perhaps the
> reason they are there is because less people want to look at assembly
> code, and it looks indeed scary.
>
> So I decided to rewrite it in C, using .code16gcc directive. Some advantages:
> - C code is easier to understand, find bugs, maintain and hack (so we
> can add more features in the future)
> - The binary image is same: 1.5K. The actual code size is also about
> the same size: around 1.2K. (gcc can optimize really well)
>   

I think converting to code16gcc is a good direction to go in.  I 
actually rewrote it myself using code16gcc but I ran into problems with 
segment assumptions and Windows guests.  I tried out your version with a 
Linux guest with good success but it fails with a win2k guest.

Have you tested with a Windows guest?  If we can work through the 
Windows issues, this is definitely the right way to go.

Regards,

Anthony Liguori

> See the code in attachment. The new code consists of a very small
> assembly file boot.S, which merely interfaces with the C code.
> "signrom" is modified to work with the new binary image.
>
> - To compile code, just run "make"
> - To save the original /usr/share/qemu/extboot.bin (to
> /usr/share/qemu/extboot.bin.org), just run "make save"
> - Then "make install" to install the new extboot.bin into /usr/share/qemu/
>
> I succesfully compile and run this option rom with virtio from
> 2.6.25-rc8 on Ubuntu 7.10.
>
> Any comment?
>
> Many thanks,
> Quynh
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Extboot Option Rom rewritten in C
  2008-04-15  3:22 ` Anthony Liguori
@ 2008-04-15  3:30   ` Nguyen Anh Quynh
  2008-04-15  3:34     ` Anthony Liguori
  0 siblings, 1 reply; 8+ messages in thread
From: Nguyen Anh Quynh @ 2008-04-15  3:30 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: kvm-devel

On 4/15/08, Anthony Liguori <aliguori@us.ibm.com> wrote:
> Hi Nguyen,
>
>  Nguyen Anh Quynh wrote:
>
> > Hi Anthony,
> >
> > I spot a bug and few dead code in the extboot option rom. Perhaps the
> > reason they are there is because less people want to look at assembly
> > code, and it looks indeed scary.
> >
> > So I decided to rewrite it in C, using .code16gcc directive. Some
> advantages:
> > - C code is easier to understand, find bugs, maintain and hack (so we
> > can add more features in the future)
> > - The binary image is same: 1.5K. The actual code size is also about
> > the same size: around 1.2K. (gcc can optimize really well)
> >
> >
>
>  I think converting to code16gcc is a good direction to go in.  I actually
> rewrote it myself using code16gcc but I ran into problems with segment
> assumptions and Windows guests.  I tried out your version with a Linux guest
> with good success but it fails with a win2k guest.
>
>  Have you tested with a Windows guest?

Not yet. Last time I tried, the Windows virtio drivers posted a while
ago dont work with my WinXP. I will try again, though.

>  If we can work through the Windows
> issues, this is definitely the right way to go.

So the assembly option rom works with your Win2k?? If so, definitely
we can fix the C code.

Thanks,
Quynh

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Extboot Option Rom rewritten in C
  2008-04-15  3:30   ` Nguyen Anh Quynh
@ 2008-04-15  3:34     ` Anthony Liguori
  2008-04-15  3:51       ` Nguyen Anh Quynh
  2008-04-15 11:41       ` Jun Koi
  0 siblings, 2 replies; 8+ messages in thread
From: Anthony Liguori @ 2008-04-15  3:34 UTC (permalink / raw)
  To: Nguyen Anh Quynh; +Cc: kvm-devel

Nguyen Anh Quynh wrote:
> On 4/15/08, Anthony Liguori <aliguori@us.ibm.com> wrote:
>   
>> Hi Nguyen,
>>
>>  Nguyen Anh Quynh wrote:
>>
>>     
>>> Hi Anthony,
>>>
>>> I spot a bug and few dead code in the extboot option rom. Perhaps the
>>> reason they are there is because less people want to look at assembly
>>> code, and it looks indeed scary.
>>>
>>> So I decided to rewrite it in C, using .code16gcc directive. Some
>>>       
>> advantages:
>>     
>>> - C code is easier to understand, find bugs, maintain and hack (so we
>>> can add more features in the future)
>>> - The binary image is same: 1.5K. The actual code size is also about
>>> the same size: around 1.2K. (gcc can optimize really well)
>>>
>>>
>>>       
>>  I think converting to code16gcc is a good direction to go in.  I actually
>> rewrote it myself using code16gcc but I ran into problems with segment
>> assumptions and Windows guests.  I tried out your version with a Linux guest
>> with good success but it fails with a win2k guest.
>>
>>  Have you tested with a Windows guest?
>>     
>
> Not yet. Last time I tried, the Windows virtio drivers posted a while
> ago dont work with my WinXP. I will try again, though.
>   

I just test with scsi, not virtio.

You should be able to get very far along the Windows boot process with 
extboot.  If you just install the LSI driver in Win2k, you can boot up 
completely.  Someone just posted instructions for doing scsi boot with 
Windows XP assuming you installed the VM from IDE.

>>  If we can work through the Windows
>> issues, this is definitely the right way to go.
>>     
>
> So the assembly option rom works with your Win2k?? If so, definitely
> we can fix the C code.
>   

Yes it does.  I'd greatly prefer a C version so I'm all for it if we can 
get it working.

Regards,

Anthony Liguori

> Thanks,
> Quynh
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Extboot Option Rom rewritten in C
  2008-04-15  3:34     ` Anthony Liguori
@ 2008-04-15  3:51       ` Nguyen Anh Quynh
  2008-04-15  3:54         ` Nguyen Anh Quynh
  2008-04-15 11:41       ` Jun Koi
  1 sibling, 1 reply; 8+ messages in thread
From: Nguyen Anh Quynh @ 2008-04-15  3:51 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: kvm-devel

On 4/15/08, Anthony Liguori <aliguori@us.ibm.com> wrote:
> Nguyen Anh Quynh wrote:
>
> > On 4/15/08, Anthony Liguori <aliguori@us.ibm.com> wrote:
> >
> >
> > > Hi Nguyen,
> > >
> > >  Nguyen Anh Quynh wrote:
> > >
> > >
> > >
> > > > Hi Anthony,
> > > >
> > > > I spot a bug and few dead code in the extboot option rom. Perhaps the
> > > > reason they are there is because less people want to look at assembly
> > > > code, and it looks indeed scary.
> > > >
> > > > So I decided to rewrite it in C, using .code16gcc directive. Some
> > > >
> > > >
> > > advantages:
> > >
> > >
> > > > - C code is easier to understand, find bugs, maintain and hack (so we
> > > > can add more features in the future)
> > > > - The binary image is same: 1.5K. The actual code size is also about
> > > > the same size: around 1.2K. (gcc can optimize really well)
> > > >
> > >  I think converting to code16gcc is a good direction to go in.  I
> actually
> > > rewrote it myself using code16gcc but I ran into problems with segment
> > > assumptions and Windows guests.  I tried out your version with a Linux
> guest
> > > with good success but it fails with a win2k guest.
> > >
> > >  Have you tested with a Windows guest?
> > >
> > >
> >
> > Not yet. Last time I tried, the Windows virtio drivers posted a while
> > ago dont work with my WinXP. I will try again, though.
> >
> >
>
>  I just test with scsi, not virtio.
>
>  You should be able to get very far along the Windows boot process with
> extboot.  If you just install the LSI driver in Win2k, you can boot up
> completely.  Someone just posted instructions for doing scsi boot with
> Windows XP assuming you installed the VM from IDE.
>

I searched around for those scsi boot instructions, but dont see any.
Any pointer?

Thanks,
Q

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Extboot Option Rom rewritten in C
  2008-04-15  3:51       ` Nguyen Anh Quynh
@ 2008-04-15  3:54         ` Nguyen Anh Quynh
  2008-04-15 14:21           ` Anthony Liguori
  0 siblings, 1 reply; 8+ messages in thread
From: Nguyen Anh Quynh @ 2008-04-15  3:54 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: kvm-devel

On 4/15/08, Nguyen Anh Quynh <aquynh@gmail.com> wrote:

>  >  You should be able to get very far along the Windows boot process with
>  > extboot.  If you just install the LSI driver in Win2k, you can boot up
>  > completely.  Someone just posted instructions for doing scsi boot with
>  > Windows XP assuming you installed the VM from IDE.
>  >
>
>
> I searched around for those scsi boot instructions, but dont see any.
>  Any pointer?

Is that the post from Alberto Treviño? Will try it soon.

Thanks,
Q

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Extboot Option Rom rewritten in C
  2008-04-15  3:34     ` Anthony Liguori
  2008-04-15  3:51       ` Nguyen Anh Quynh
@ 2008-04-15 11:41       ` Jun Koi
  1 sibling, 0 replies; 8+ messages in thread
From: Jun Koi @ 2008-04-15 11:41 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: kvm-devel

On Tue, Apr 15, 2008 at 12:34 PM, Anthony Liguori <aliguori@us.ibm.com> wrote:
> Nguyen Anh Quynh wrote:
>  > On 4/15/08, Anthony Liguori <aliguori@us.ibm.com> wrote:
>  >
>  >> Hi Nguyen,
>  >>
>  >>  Nguyen Anh Quynh wrote:
>  >>
>  >>
>  >>> Hi Anthony,
>  >>>
>  >>> I spot a bug and few dead code in the extboot option rom. Perhaps the
>  >>> reason they are there is because less people want to look at assembly
>  >>> code, and it looks indeed scary.
>  >>>
>  >>> So I decided to rewrite it in C, using .code16gcc directive. Some
>  >>>
>  >> advantages:
>  >>
>  >>> - C code is easier to understand, find bugs, maintain and hack (so we
>  >>> can add more features in the future)
>  >>> - The binary image is same: 1.5K. The actual code size is also about
>  >>> the same size: around 1.2K. (gcc can optimize really well)
>  >>>
>  >>>
>  >>>
>  >>  I think converting to code16gcc is a good direction to go in.  I actually
>  >> rewrote it myself using code16gcc but I ran into problems with segment
>  >> assumptions and Windows guests.  I tried out your version with a Linux guest
>  >> with good success but it fails with a win2k guest.
>  >>
>  >>  Have you tested with a Windows guest?
>  >>
>  >
>  > Not yet. Last time I tried, the Windows virtio drivers posted a while
>  > ago dont work with my WinXP. I will try again, though.
>  >
>
>  I just test with scsi, not virtio.
>
>  You should be able to get very far along the Windows boot process with
>  extboot.  If you just install the LSI driver in Win2k, you can boot up
>  completely.  Someone just posted instructions for doing scsi boot with
>  Windows XP assuming you installed the VM from IDE.
>

Anthony, could you post in detail on how to configure LSI with W2k to
boot on scsi? I tried hard here, but it never works for me. I always
get error at bootup step. W2k reports something like it cannot find
Windows kernel :-(

Many thanks,
Jun

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Extboot Option Rom rewritten in C
  2008-04-15  3:54         ` Nguyen Anh Quynh
@ 2008-04-15 14:21           ` Anthony Liguori
  0 siblings, 0 replies; 8+ messages in thread
From: Anthony Liguori @ 2008-04-15 14:21 UTC (permalink / raw)
  To: Nguyen Anh Quynh; +Cc: kvm-devel

Nguyen Anh Quynh wrote:
> On 4/15/08, Nguyen Anh Quynh <aquynh@gmail.com> wrote:
>
>   
>>  >  You should be able to get very far along the Windows boot process with
>>  > extboot.  If you just install the LSI driver in Win2k, you can boot up
>>  > completely.  Someone just posted instructions for doing scsi boot with
>>  > Windows XP assuming you installed the VM from IDE.
>>  >
>>
>>
>> I searched around for those scsi boot instructions, but dont see any.
>>  Any pointer?
>>     
>
> Is that the post from Alberto Treviño? Will try it soon.
>   

Yup.

Regards,

Anthony Liguori

> Thanks,
> Q
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save $100. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> _______________________________________________
> kvm-devel mailing list
> kvm-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/kvm-devel
>   


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-04-15 14:21 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-15  2:56 Extboot Option Rom rewritten in C Nguyen Anh Quynh
2008-04-15  3:22 ` Anthony Liguori
2008-04-15  3:30   ` Nguyen Anh Quynh
2008-04-15  3:34     ` Anthony Liguori
2008-04-15  3:51       ` Nguyen Anh Quynh
2008-04-15  3:54         ` Nguyen Anh Quynh
2008-04-15 14:21           ` Anthony Liguori
2008-04-15 11:41       ` Jun Koi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox