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. If you're interested, you can see it in operation at 3:11:17 (ah, the sarcasm) of: https://passt.top/passt/about/#continuous-integration (click on the "udp/pasta" anchor below, it's a few seconds in), or in slow motion at 0:51 of https://passt.top/passt/about/#passt_2. It's basically: git clone https://mbuto.lameexcu.se/mbuto/ && cd mbuto ./mbuto -c lz4 -p passt -f img # Profiles define sets of binaries ${qemu} -kernel /boot/vmlinuz-$(uname -r) -initrd img -- Stefano