Re: [kvm-devel] [RFC] linuxboot Option ROM for Linux kernel booting

2008-04-20 Thread Nguyen Anh Quynh
Forget to say that this patch is against kvm-66.

Thanks,
Q

On Mon, Apr 21, 2008 at 12:32 PM, Nguyen Anh Quynh <[EMAIL PROTECTED]> wrote:
> Hi,
>
>  This should be submitted to upstream (but not to kvm-devel list), but
>  this is only the test code that I want to quickly send out for
>  comments. In case it looks OK, I will send it to upstream later.
>
>  Inspired by extboot and conversations with Anthony and HPA, this
>  linuxboot option ROM is a simple option ROM that intercepts int19 in
>  order to execute linux setup code. This approach eliminates the need
>  to manipulate the boot sector for this purpose.
>
>  To test it, just load linux kernel with your KVM/QEMU image using
>  -kernel option in normal way.
>
>  I succesfully compiled and tested it with kvm-66 on Ubuntu 7.10, guest
>  Ubuntu 8.04.
>
>  Thanks,
>  Quynh
>
>
>  # diffstat linuxboot1.diff
>   Makefile |   13 -
>   linuxboot/Makefile   |   40 +++
>   linuxboot/boot.S |   54 +
>   linuxboot/farvar.h   |  130 
> +++
>   linuxboot/rom.c  |  104 
>   linuxboot/signrom|binary
>   linuxboot/signrom.c  |  128 
> ++
>   linuxboot/util.h |   69 +++
>   qemu/Makefile|3 -
>   qemu/Makefile.target |2
>   qemu/hw/linuxboot.c  |   39 +++
>   qemu/hw/pc.c |   22 +++-
>   qemu/hw/pc.h |5 +
>   13 files changed, 600 insertions(+), 9 deletions(-)
>

-
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


Re: [kvm-devel] [RFC] linuxboot Option ROM for Linux kernel booting

2008-04-20 Thread Nguyen Anh Quynh
Hmm, the last patch includes a binary. So please take this patch instead.

Thanks,
Q

# diffstat linuxboot1.diff
 Makefile |   13 -
 linuxboot/Makefile   |   40 +++
 linuxboot/boot.S |   54 +
 linuxboot/farvar.h   |  130 +++
 linuxboot/rom.c  |  104 
 linuxboot/signrom.c  |  128 ++
 linuxboot/util.h |   69 +++
 qemu/Makefile|3 -
 qemu/Makefile.target |2
 qemu/hw/linuxboot.c  |   39 +++
 qemu/hw/pc.c |   22 +++-
 qemu/hw/pc.h |5 +
 12 files changed, 600 insertions(+), 9 deletions(-)





On Mon, Apr 21, 2008 at 12:33 PM, Nguyen Anh Quynh <[EMAIL PROTECTED]> wrote:
> Forget to say that this patch is against kvm-66.
>
>  Thanks,
>  Q
>
>
>
>  On Mon, Apr 21, 2008 at 12:32 PM, Nguyen Anh Quynh <[EMAIL PROTECTED]> wrote:
>  > Hi,
>  >
>  >  This should be submitted to upstream (but not to kvm-devel list), but
>  >  this is only the test code that I want to quickly send out for
>  >  comments. In case it looks OK, I will send it to upstream later.
>  >
>  >  Inspired by extboot and conversations with Anthony and HPA, this
>  >  linuxboot option ROM is a simple option ROM that intercepts int19 in
>  >  order to execute linux setup code. This approach eliminates the need
>  >  to manipulate the boot sector for this purpose.
>  >
>  >  To test it, just load linux kernel with your KVM/QEMU image using
>  >  -kernel option in normal way.
>  >
>  >  I succesfully compiled and tested it with kvm-66 on Ubuntu 7.10, guest
>  >  Ubuntu 8.04.
>  >
>  >  Thanks,
>  >  Quynh
>  >
>  >
>  >  # diffstat linuxboot1.diff
>  >   Makefile |   13 -
>  >   linuxboot/Makefile   |   40 +++
>  >   linuxboot/boot.S |   54 +
>  >   linuxboot/farvar.h   |  130 
> +++
>  >   linuxboot/rom.c  |  104 
>  >   linuxboot/signrom|binary
>  >   linuxboot/signrom.c  |  128 
> ++
>  >   linuxboot/util.h |   69 +++
>  >   qemu/Makefile|3 -
>  >   qemu/Makefile.target |2
>  >   qemu/hw/linuxboot.c  |   39 +++
>  >   qemu/hw/pc.c |   22 +++-
>  >   qemu/hw/pc.h |5 +
>  >   13 files changed, 600 insertions(+), 9 deletions(-)
>  >
>
commit f4f1178898c8a4bbbc0a432354dbcc56353099c3
Author: Nguyen Anh Quynh <[EMAIL PROTECTED]>
Date:   Mon Apr 21 12:27:47 2008 +0900

Linuxboot Option ROM support.

Signed-off-by: Nguyen Anh Quynh <[EMAIL PROTECTED]>

diff --git a/Makefile b/Makefile
index 76c149a..fdd9388 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ DESTDIR=
 
 rpmrelease = devel
 
-.PHONY: kernel user libkvm qemu bios vgabios extboot clean libfdt
+.PHONY: kernel user libkvm qemu bios vgabios extboot linuxboot clean libfdt
 
 all: libkvm qemu
 ifneq '$(filter $(ARCH), x86_64 i386 ia64)' ''
@@ -19,7 +19,7 @@ qemu kernel user libkvm:
 
 qemu: libkvm
 ifneq '$(filter $(ARCH), i386 x86_64)' ''
-qemu: extboot
+qemu: extboot linuxboot
 endif
 ifneq '$(filter $(ARCH), powerpc)' ''
 qemu: libfdt
@@ -41,6 +41,14 @@ extboot:
|| ! cmp -s qemu/pc-bios/extboot.bin extboot/extboot.bin; then \
 		cp extboot/extboot.bin qemu/pc-bios/extboot.bin; \
 	fi
+
+linuxboot:
+	$(MAKE) -C $@
+	if ! [ -f qemu/pc-bios/linuxboot.bin ] \
+   || ! cmp -s qemu/pc-bios/linuxboot.bin linuxboot/linuxboot.bin; then \
+		cp linuxboot/linuxboot.bin qemu/pc-bios/linuxboot.bin; \
+	fi
+
 libfdt:
 	$(MAKE) -C $@
 
@@ -88,6 +96,7 @@ srpm:
 	tar czf $(RPMTOPDIR)/SOURCES/kernel.tar.gz kernel
 	tar czf $(RPMTOPDIR)/SOURCES/scripts.tar.gz scripts
 	tar czf $(RPMTOPDIR)/SOURCES/extboot.tar.gz extboot
+	tar czf $(RPMTOPDIR)/SOURCES/linuxboot.tar.gz linuxboot
 	cp Makefile configure kvm_stat $(RPMTOPDIR)/SOURCES
 	rpmbuild  --define="_topdir $(RPMTOPDIR)" -bs $(tmpspec)
 	$(RM) $(tmpspec)
diff --git a/linuxboot/Makefile b/linuxboot/Makefile
new file mode 100644
index 000..3bc88a6
--- /dev/null
+++ b/linuxboot/Makefile
@@ -0,0 +1,40 @@
+# Makefile for linuxboot Option ROM
+# Nguyen Anh Quynh <[EMAIL PROTECTED]>
+
+CC = gcc
+CCFLAGS = -g -Wall -Werror -nostdlib -fno-builtin -fomit-frame-pointer -Os
+
+cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
+  /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
+CCFLAGS += $(call cc-option,$(CC),-nopie,)
+CCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
+CCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
+
+INSTALLDIR = /usr/share/qemu
+
+.PHONY: all
+all: clean linuxboot.bin
+
+.PHONY: install
+install: linuxboot.bin
+	cp linuxboot.bin $(INSTALLDIR)
+
+.PHONY: clean
+clean:
+	$(RM) *.o *.img *.bin signrom *~
+
+linuxboo

Re: [kvm-devel] [RFC] linuxboot Option ROM for Linux kernel booting

2008-04-22 Thread Nguyen Anh Quynh
Hi,

I am thinking about comibing this ROM with the extboot. Both two ROM
are about "booting", so I think that is reasonable. So we will have
only 1 ROM that supports both external boot and Linux boot.

Is that desirable or not?

Thanks,
Quynh

On 4/21/08, Nguyen Anh Quynh <[EMAIL PROTECTED]> wrote:
> Hmm, the last patch includes a binary. So please take this patch instead.
>
>  Thanks,
>
> Q
>
>  # diffstat linuxboot1.diff
>   Makefile |   13 -
>   linuxboot/Makefile   |   40 +++
>   linuxboot/boot.S |   54 +
>   linuxboot/farvar.h   |  130 
> +++
>   linuxboot/rom.c  |  104 
>
>  linuxboot/signrom.c  |  128 
> ++
>   linuxboot/util.h |   69 +++
>   qemu/Makefile|3 -
>   qemu/Makefile.target |2
>   qemu/hw/linuxboot.c  |   39 +++
>   qemu/hw/pc.c |   22 +++-
>   qemu/hw/pc.h |5 +
>
>  12 files changed, 600 insertions(+), 9 deletions(-)
>
>
>
>
>
>
>  On Mon, Apr 21, 2008 at 12:33 PM, Nguyen Anh Quynh <[EMAIL PROTECTED]> wrote:
>  > Forget to say that this patch is against kvm-66.
>  >
>  >  Thanks,
>  >  Q
>  >
>  >
>  >
>  >  On Mon, Apr 21, 2008 at 12:32 PM, Nguyen Anh Quynh <[EMAIL PROTECTED]> 
> wrote:
>  >  > Hi,
>  >  >
>  >  >  This should be submitted to upstream (but not to kvm-devel list), but
>  >  >  this is only the test code that I want to quickly send out for
>  >  >  comments. In case it looks OK, I will send it to upstream later.
>  >  >
>  >  >  Inspired by extboot and conversations with Anthony and HPA, this
>  >  >  linuxboot option ROM is a simple option ROM that intercepts int19 in
>  >  >  order to execute linux setup code. This approach eliminates the need
>  >  >  to manipulate the boot sector for this purpose.
>  >  >
>  >  >  To test it, just load linux kernel with your KVM/QEMU image using
>  >  >  -kernel option in normal way.
>  >  >
>  >  >  I succesfully compiled and tested it with kvm-66 on Ubuntu 7.10, guest
>  >  >  Ubuntu 8.04.
>  >  >
>  >  >  Thanks,
>  >  >  Quynh
>  >  >
>  >  >
>  >  >  # diffstat linuxboot1.diff
>  >  >   Makefile |   13 -
>  >  >   linuxboot/Makefile   |   40 +++
>  >  >   linuxboot/boot.S |   54 +
>  >  >   linuxboot/farvar.h   |  130 
> +++
>  >  >   linuxboot/rom.c  |  104 
>  >  >   linuxboot/signrom|binary
>  >  >   linuxboot/signrom.c  |  128 
> ++
>  >  >   linuxboot/util.h |   69 +++
>  >  >   qemu/Makefile|3 -
>  >  >   qemu/Makefile.target |2
>  >  >   qemu/hw/linuxboot.c  |   39 +++
>  >  >   qemu/hw/pc.c |   22 +++-
>  >  >   qemu/hw/pc.h |5 +
>  >  >   13 files changed, 600 insertions(+), 9 deletions(-)
>  >  >
>  >
>
>

-
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


Re: [kvm-devel] [RFC] linuxboot Option ROM for Linux kernel booting

2008-04-22 Thread Anthony Liguori
Nguyen Anh Quynh wrote:
> Hi,
>
> I am thinking about comibing this ROM with the extboot. Both two ROM
> are about "booting", so I think that is reasonable. So we will have
> only 1 ROM that supports both external boot and Linux boot.
>
> Is that desirable or not?
>   

I think so.

Regards,

Anthony Liguori


-
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


Re: [kvm-devel] [RFC] linuxboot Option ROM for Linux kernel booting

2008-04-22 Thread Anthony Liguori
Nguyen Anh Quynh wrote:
> Hi,
>
> This should be submitted to upstream (but not to kvm-devel list), but
> this is only the test code that I want to quickly send out for
> comments. In case it looks OK, I will send it to upstream later.
>
> Inspired by extboot and conversations with Anthony and HPA, this
> linuxboot option ROM is a simple option ROM that intercepts int19 in
> order to execute linux setup code. This approach eliminates the need
> to manipulate the boot sector for this purpose.
>
> To test it, just load linux kernel with your KVM/QEMU image using
> -kernel option in normal way.
>
> I succesfully compiled and tested it with kvm-66 on Ubuntu 7.10, guest
> Ubuntu 8.04.
>   

For the next rounds, could you actually rebase against upstream QEMU and 
submit to qemu-devel?  One of Paul Brook's objections to extboot had 
historically been that it wasn't not easily sharable with other 
architectures.  With a C version, it seems more reasonable now to do that.

Make sure you remove all the old linux boot code too within QEMU along 
with the -hda checks.

Regards,

Anthony Liguori

> Thanks,
> Quynh
>
>
> # diffstat linuxboot1.diff
>  Makefile |   13 -
>  linuxboot/Makefile   |   40 +++
>  linuxboot/boot.S |   54 +
>  linuxboot/farvar.h   |  130 
> +++
>  linuxboot/rom.c  |  104 
>  linuxboot/signrom|binary
>  linuxboot/signrom.c  |  128 
> ++
>  linuxboot/util.h |   69 +++
>  qemu/Makefile|3 -
>  qemu/Makefile.target |2
>  qemu/hw/linuxboot.c  |   39 +++
>  qemu/hw/pc.c |   22 +++-
>  qemu/hw/pc.h |5 +
>  13 files changed, 600 insertions(+), 9 deletions(-)
>   


-
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


Re: [kvm-devel] [RFC] linuxboot Option ROM for Linux kernel booting

2008-04-22 Thread H. Peter Anvin
Nguyen Anh Quynh wrote:
> Hi,
> 
> I am thinking about comibing this ROM with the extboot. Both two ROM
> are about "booting", so I think that is reasonable. So we will have
> only 1 ROM that supports both external boot and Linux boot.
> 
> Is that desirable or not?
> 

Does it make the code simpler and easier to understand?  If not, then I 
would say no.

-hpa

-
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


Re: [kvm-devel] [RFC] linuxboot Option ROM for Linux kernel booting

2008-04-23 Thread Nguyen Anh Quynh
On 4/22/08, Anthony Liguori <[EMAIL PROTECTED]> wrote:
> Nguyen Anh Quynh wrote:
>
> > Hi,
> >
> > This should be submitted to upstream (but not to kvm-devel list), but
> > this is only the test code that I want to quickly send out for
> > comments. In case it looks OK, I will send it to upstream later.
> >
> > Inspired by extboot and conversations with Anthony and HPA, this
> > linuxboot option ROM is a simple option ROM that intercepts int19 in
> > order to execute linux setup code. This approach eliminates the need
> > to manipulate the boot sector for this purpose.
> >
> > To test it, just load linux kernel with your KVM/QEMU image using
> > -kernel option in normal way.
> >
> > I succesfully compiled and tested it with kvm-66 on Ubuntu 7.10, guest
> > Ubuntu 8.04.
> >
> >
>
>  For the next rounds, could you actually rebase against upstream QEMU and
> submit to qemu-devel?  One of Paul Brook's objections to extboot had
> historically been that it wasn't not easily sharable with other
> architectures.  With a C version, it seems more reasonable now to do that.

OK.

>
>  Make sure you remove all the old linux boot code too within QEMU along with
> the -hda checks.

Sure.

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


Re: [kvm-devel] [RFC] linuxboot Option ROM for Linux kernel booting

2008-04-23 Thread Nguyen Anh Quynh
On 4/23/08, H. Peter Anvin <[EMAIL PROTECTED]> wrote:
> Nguyen Anh Quynh wrote:
>
> > Hi,
> >
> > I am thinking about comibing this ROM with the extboot. Both two ROM
> > are about "booting", so I think that is reasonable. So we will have
> > only 1 ROM that supports both external boot and Linux boot.
> >
> > Is that desirable or not?
> >
> >
>
>  Does it make the code simpler and easier to understand?  If not, then I 
> would say no.


Actually no. I must say that it looks ugly to me.

The fact is that linuxboot ROM and extboot ROM are about different
things, and they only share a bit in that they both intercept int 19.

I very much like the the Unix principal, that is "Does one thing, and
does it well", so I prefer to have 2 independent ROM: one to boot
Linux, and one to do external boot. I see no problem that we have more
than one ROM, and these two can be independently loaded into the
memory.

So I think I agree with Peter here.

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