On Tue, Feb 01, 2022 at 07:31:39AM +0100, Stefano Brivio wrote: > Hi, > > On Tue, 25 Jan 2022 10:20:11 +0100 > Gerd Hoffmann <kra...@redhat.com> wrote: > > > Hi, > > > > > IMHO the ideal scenario would be for us to have a kernel, initrd > > > containing just busybox tools for the key arch targets we care > > > about. Those could be used with direct kernel boot or stuffed > > > into a disk iamge. Either way, they would boot in ~1 second, > > > even with TCG, and would be able to execute simple shell scripts > > > to test a decent amount of QEMU functionality. > > > > I have some test images based on buildroot which are essentially that. > > https://gitlab.com/kraxel/br-kraxel/ > > > > Still a significant download, but much smaller than a full fedora or > > ubuntu cloud image and it boots much faster too. Not down to only one > > second though. > > I'm not sure you can recycle something from it, but my (ugly) approach > to make this fast (for a different purpose -- I'm using qemu to run > tests in guests, not testing qemu) is to build an initramfs by copying > the host binaries I need (a shell, ip, jq) and recursively sourcing > libraries using ldd (I guess I mentioned it's ugly). > > No downloads, systemd, dracut, etc., guest boots in half a second > (x86_64 on x86_64, KVM -- no idea with TCG). Host kernel with a few > modules packed and loaded by a custom init script.
That is such a good idea, that it is exactly what I do too :-) https://gitlab.com/berrange/tiny-vm-tools/-/blob/master/make-tiny-image.py it works incredibly well for the simple case of host-arch==guest-arch. It could be made to work for foreign arch easily enough - just need to have a foreign chroot lieing around somewhere you can point it to. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|