Skip to content
master
Go to file
Code

Latest commit

The switch to meson in commit fd2aada ("Add meson build") had two
major behavior changes for the ELF binary build step:

* ELF binary is no longer build as x86_64 on x86_64
* ELF binary is build as position independent executable on systems with a
  "--enable-default-pie" gcc

The latter will create a slightly larger than 64KB bios.bin which causes an
error when Qemu tries to load it:

  qemu: could not load PC BIOS 'qboot/build/bios.bin'

This behavior change was introduced because the elf linker step was changed
from using ld directly to using cc. Basically something like following
Makefile change:

   bios.bin.elf: $(obj-y) flat.lds
  -        $(LD) -T flat.lds -o bios.bin.elf $(obj-y)
  +        $(CC) -o bios.bin.elf $(obj-y) -Wl,--no-undefined -Wl,--as-needed -nostdlib -m32 -Wl,--build-id=none -Wl,-Tflat.lds

GCC will then take care of calling ld with the appropriate arguments. And
one of these arguments for the "--enable-default-pie" gcc is "-pie":

  $(LD) --build-id --eh-frame-hdr -m elf_i386 --hash-style=gnu -dynamic-linker /lib/ld-linux.so.2 -pie -o bios.bin.elf $(obj-y) --no-undefined --as-needed --build-id=none -Tflat.lds

This default behavior of gcc must be suppressed by adding -no-pie to the
arguments when linking the object files.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
a5300c4

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README

A simple x86 firmware that can boot Linux.

Most of QEMU's startup time is spent:

* in the dynamic linker.  This can be reduced by 150 ms simply by
  compiling a stripped down QEMU:

    ./configure --disable-libssh2 --disable-tcmalloc --disable-glusterfs \
        --disable-seccomp --disable-{bzip2,snappy,lzo} --disable-usb-redir \
        --disable-libusb --disable-smartcard-nss --disable-libnfs  \
        --disable-libiscsi --disable-rbd  --disable-spice --disable-attr \
        --disable-cap-ng --disable-linux-aio --disable-brlapi \
        --disable-vnc-{jpeg,tls,sasl,png,ws} --disable-rdma --disable-bluez \
        --disable-fdt --disable-curl --disable-curses --disable-sdl \
        --disable-gtk  --disable-tpm --disable-vte --disable-vnc  \
        --disable-xen --disable-opengl --target-list=x86_64-softmmu

* in the BIOS.  qboot saves another 150 ms.

* until QEMU 2.7+, in fw_cfg.  qboot uses the DMA interface which is pretty
  much instantaneous.

Compile qboot
=============

Clone the source:

    $ git clone https://github.com/bonzini/qboot.git

Compile the qboot firmware (you may need to install the relevant build
time dependancies):

    $ meson build && ninja -C build

The result will be a 64K file named bios.bin under the build/ directory.

Usage
=====

    $ qemu-kvm -bios bios.bin \
      -kernel /boot/vmlinuz-4.0.3-300.fc22.x86_64 \
      -serial mon:stdio -append 'console=ttyS0,115200,8n1'

TODO
====

* Add the possibility to configure out PIC and PCI bridge initialization

About

Minimal x86 firmware for booting Linux kernels

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.