cloudius-systems / capstan

Capstan, a tool for packaging and running your application on OSv. http://osv.io/capstan
Other
367 stars 82 forks source link

Use for qboot? #145

Open davedoesdev opened 9 years ago

davedoesdev commented 9 years ago

I was wondering if there's any value in qboot for Capstan?

https://lwn.net/Articles/645455/

BIOS?

penberg commented 9 years ago

If it makes QEMU boot faster, it also makes OSv boot faster under Capstan.

davedoesdev commented 9 years ago

I'll give it a go once I get it compiling

davedoesdev commented 9 years ago

qboot does boot linux with separate -kernel or cbfs in pflash. It would need the OSV 'kernel' pulling out of the image or put into a cbfs image.

penberg commented 9 years ago

@davedoesdev How much does it improve boot times?

Do you know how to build cbfs images? We probably could add a "qemu-cbs" image target in osv.git and upload those in the Capstan repository as part of the release process.

davedoesdev commented 9 years ago

I did some rough measurements by adding -nographic -S to the command line, pressing 'Ctrl-A c' to get to the monitor, then 'Ctrl-A t' to turn on timestamps then typing 'c' and finally Enter.

For standard BIOS until first kernel message this gave 0.989, 0.932, 0.988 (average: 0.969) For qboot BIOS (fw_cfg): 0.895, 0.887, 0.835 (average: 0.872) cbfs timings: 0.688 0.597 0.643 (average: 0.642)

This was unmodified Ubuntu 14.10 qemu.

I built the cbfs image per the qboot README:

dd if=/dev/zero of=boot.bin bs=4096 count=1
../coreboot-HEAD-44cbe10/util/cbfstool/cbfstool cbfs.rom create -s 8128k -B boot.bin -m x86 -o 0x1000
../coreboot-HEAD-44cbe10/util/cbfstool/cbfstool cbfs.rom add -f ~/Downloads/aboriginal-1.4.1/build/system-image-x86_64/linux -n vmlinuz -t raw
echo 'console=ttyS0' > cmdline
../coreboot-HEAD-44cbe10/util/cbfstool/cbfstool cbfs.rom add -f cmdline -n cmdline -t raw

and then ran with:

qemu-system-x86_64 -nographic -drive if=pflash,file=bios.bin,readonly=on -drive if=pflash,file=cbfs.rom,readonly=on -no-reboot -S
davedoesdev commented 9 years ago

Or you can do as @bonzini suggests:

I compiled qboot with -DBENCHMARK_HACK and added "-device isa-debug-exit,iobase=0xf4" to the QEMU command line. Then you can just us "time" from the shell.

bonzini commented 9 years ago

Is OSv compiled as multiboot or does it a vmlinuz-style header? cbfs is only supported for vmlinuz, at least for now.