quic / gunyah-hypervisor

Gunyah is a Type-1 hypervisor designed for strong security, performance and modularity.
Other
313 stars 58 forks source link

How to Add a test Application/Image into the VM running in gunyah #12

Closed H-H-bin closed 2 years ago

H-H-bin commented 2 years ago

Following the Guide, I can successfully run gunyah and the VM, but I want do some more study about it, so, I want to add A Test App( A image) into the VM, then I can run some test. But I failed. I tried the below two ways:

  1. add the image as the qemu-system-aarch64 with "--drive " option like below:

    qemu-system-aarch64 \
    -machine virt,virtualization=on,gic-version=3,highmem=off \
    -cpu max -m size=2G -smp cpus=8 -nographic \
    -kernel ../gunyah/gunyah-hypervisor/hypvm.elf \
    -device loader,file=/usr/local/src/out/Image,addr=0x41080000 \
    -device loader,file=/usr/local/src/out/virt.dtb,addr=0x44200000 \
    -device loader,file=/usr/local/src/out/initrd.img,addr=0x44400000 \
    **-drive  format=raw,index=0,file=../gunyah/myAPP.squashfs**

    The command runs successfully without error, but after login to VM OS, there nothing can be seen in any folders in the VM OS

  2. Try add my APP into the initram disk image, and got error below: [ 36.559017] Initramfs unpacking failed: read error ....... ..... [ 55.419495] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0) [ 55.435487] CPU: 5 PID: 1 Comm: swapper/0 Not tainted 5.14.0-rc1-00199-g45312bd762d3-dirty [ 55.441980] Hardware name: linux,dummy-virt (DT) [ 55.445334] Call trace: [ 55.448231] dump_backtrace+0x0/0x1d4 [ 55.461203] show_stack+0x1c/0x28 [ 55.467446] dump_stack_lvl+0x68/0x80 [ 55.480107] dump_stack+0x18/0x3c [ 55.481206] panic+0x17c/0x36c [ 55.482637] mount_block_root+0x1d4/0x200 [ 55.484015] mount_root+0x60/0x6c [ 55.488445] prepare_namespace+0x11c/0x198 [ 55.489134] kernel_init_freeable+0x154/0x184 [ 55.489837] kernel_init+0x24/0x19c [ 55.490759] ret_from_fork+0x10/0x18 [ 55.494631] SMP: stopping secondary CPUs [ 55.514051] Kernel Offset: 0x4396b0c80000 from 0xffff800010000000 [ 55.517683] PHYS_OFFSET: 0x40000000 [ 55.524732] CPU features: 0x000002d1,6d300c47 [ 55.533291] Memory Limit: none [ 55.552053] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(1,0) ]---

Any advice would be greatly appreciated.

H-H-bin commented 2 years ago

Hi,

We successfully to map a squashfs roofFS system with correct QEMU options as below: qemu-system-aarch64 \ -machine virt,virtualization=on,gic-version=3,highmem=off \ -cpu max -m size=2G -smp cpus=8 -nographic \ -kernel /usr/local/src/gunyah/gunyah-hypervisor/hypvm.elf \ -device loader,file=/usr/local/src/gunyah/out/Image,addr=0x41080000 \ -device loader,file=/usr/local/src/gunyah/device-tree/virt-rootfs.overlay.dtb,addr=0x44200000 \ -drive format=raw,index=1,id=hd0,if=none,file=rootFS-image.squashfs \ -drive format=raw,index=2,id=hd1,file=/usr/local/src/gunyah/myApp-image.squashfs \ -device virtio-blk-device,drive=hd0