diff mbox

[PULL,2/4] bios: Add fast variant of SeaBIOS for use with -kernel on x86.

Message ID 1467624822-25974-3-git-send-email-kraxel@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Gerd Hoffmann July 4, 2016, 9:33 a.m. UTC
From: "Richard W.M. Jones" <rjones@redhat.com>

This commit adds a fast variant of SeaBIOS called 'bios-fast.bin'.

It's designed to be the fastest (also the smallest, but that's not the
main aim) SeaBIOS that is just enough to boot a Linux kernel using the
-kernel option on i686 and x86_64.

This commit does not modify the -kernel option to use this.  You have
to specify it by doing something like this:

  -kernel vmlinuz -bios bios-fast.bin

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 Makefile                 |  3 ++-
 roms/Makefile            |  4 +++-
 roms/config.seabios-fast | 27 +++++++++++++++++++++++++++
 3 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100644 roms/config.seabios-fast

Comments

Richard W.M. Jones July 4, 2016, 10:08 a.m. UTC | #1
On Mon, Jul 04, 2016 at 11:33:40AM +0200, Gerd Hoffmann wrote:
> From: "Richard W.M. Jones" <rjones@redhat.com>
> 
> This commit adds a fast variant of SeaBIOS called 'bios-fast.bin'.
> 
> It's designed to be the fastest (also the smallest, but that's not the
> main aim) SeaBIOS that is just enough to boot a Linux kernel using the
> -kernel option on i686 and x86_64.
> 
> This commit does not modify the -kernel option to use this.  You have
> to specify it by doing something like this:
> 
>   -kernel vmlinuz -bios bios-fast.bin
> 
> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
> Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Hi Gerd, I'd like to "self-" NACK this patch - ie. I withdraw it.

It needs more work to benchmark any time savings, and I think also to
explore other ways to fix the problem.

Thanks,

Rich.
Gerd Hoffmann July 4, 2016, 11:44 a.m. UTC | #2
On Mo, 2016-07-04 at 11:08 +0100, Richard W.M. Jones wrote:
> Hi Gerd, I'd like to "self-" NACK this patch - ie. I withdraw it.

Ok.  Dropped patch, dropped binary, PULL v2 sent.

cheers,
  Gerd
Laurent Vivier July 4, 2016, 6:38 p.m. UTC | #3
Hi,

On 04/07/2016 11:33, Gerd Hoffmann wrote:
> From: "Richard W.M. Jones" <rjones@redhat.com>
> 
> This commit adds a fast variant of SeaBIOS called 'bios-fast.bin'.
> 
> It's designed to be the fastest (also the smallest, but that's not the
> main aim) SeaBIOS that is just enough to boot a Linux kernel using the
> -kernel option on i686 and x86_64.
> 
> This commit does not modify the -kernel option to use this.  You have
> to specify it by doing something like this:
> 
>   -kernel vmlinuz -bios bios-fast.bin

I like the idea: I'm wondering if we should do the same thing for ppc64?

In fact, it is already done, if you have kvm-unit-tests, you can do:

qemu-system-ppc64 ... -kernel vmlinuz \
                      -initrd initramfs.img \
                      -append .... \
                      -bios .../kvm-unit-tests/powerpc/boot_rom.bin

and boot_rom.bin is (thanks to the power of device-tree):

    #define SPAPR_KERNEL_LOAD_ADDR 0x400000
    .text
    .globl start
    start:
            b       SPAPR_KERNEL_LOAD_ADDR - 0x100

It can't be faster...

The question is: should we add this binary to qemu?

And it can open new doors: booting with petitboot instead of SLOF.

Laurent
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 9d12dc6..7bfb8b4 100644
--- a/Makefile
+++ b/Makefile
@@ -408,7 +408,8 @@  common  de-ch  es     fo  fr-ca  hu     ja  mk  nl-be      pt  sl     tr \
 bepo    cz
 
 ifdef INSTALL_BLOBS
-BLOBS=bios.bin bios-256k.bin sgabios.bin vgabios.bin vgabios-cirrus.bin \
+BLOBS=bios.bin bios-256k.bin bios-fast.bin \
+sgabios.bin vgabios.bin vgabios-cirrus.bin \
 vgabios-stdvga.bin vgabios-vmware.bin vgabios-qxl.bin vgabios-virtio.bin \
 acpi-dsdt.aml \
 ppc_rom.bin openbios-sparc32 openbios-sparc64 openbios-ppc QEMU,tcx.bin QEMU,cgthree.bin \
diff --git a/roms/Makefile b/roms/Makefile
index 7bd1252..26b0586 100644
--- a/roms/Makefile
+++ b/roms/Makefile
@@ -61,9 +61,11 @@  default:
 	@echo "  slof           -- update slof.bin"
 	@echo "  u-boot.e500    -- update u-boot.e500"
 
-bios: build-seabios-config-seabios-128k build-seabios-config-seabios-256k
+bios: build-seabios-config-seabios-128k build-seabios-config-seabios-256k \
+      build-seabios-config-seabios-fast
 	cp seabios/builds/seabios-128k/bios.bin ../pc-bios/bios.bin
 	cp seabios/builds/seabios-256k/bios.bin ../pc-bios/bios-256k.bin
+	cp seabios/builds/seabios-fast/bios.bin ../pc-bios/bios-fast.bin
 
 seavgabios: $(patsubst %,seavgabios-%,$(vgabios_variants))
 
diff --git a/roms/config.seabios-fast b/roms/config.seabios-fast
new file mode 100644
index 0000000..045693e
--- /dev/null
+++ b/roms/config.seabios-fast
@@ -0,0 +1,27 @@ 
+# The fastest SeaBIOS that can boot Linux using -kernel.
+# NB: Since we are using -kernel, we don't need SeaBIOS itself
+# to do any boot drive detection, boot ordering, etc.
+
+# general stuff
+CONFIG_QEMU=y
+CONFIG_ROM_SIZE=0
+CONFIG_WRITABLE_UPPERMEMORY=y
+CONFIG_RELOCATE_INIT=n
+
+# no input, no boot menu
+CONFIG_MOUSE=n
+CONFIG_KEYBOARD=n
+CONFIG_BOOTMENU=n
+CONFIG_BOOTSPLASH=n
+CONFIG_BOOTORDER=n
+
+# hardware support we don't need
+CONFIG_LPT=n
+CONFIG_SERIAL=n
+CONFIG_USB=n
+CONFIG_DRIVES=n
+CONFIG_TCGBIOS=n
+CONFIG_VGAHOOKS=n
+
+# no logging
+CONFIG_DEBUG_LEVEL=0