genodelabs / goa

Tool for streamlining the development of Genode applications
GNU Affero General Public License v3.0
19 stars 17 forks source link

Please add vbox example #25

Closed TLC62CsRraK4hdw6 closed 1 year ago

TLC62CsRraK4hdw6 commented 1 year ago

Is Virtualbox supported for testing with goa run? I've mostly just tried to run the example from: https://github.com/genodelabs/genode/tree/master/repos/ports/recipes/pkg/vbox5

I currently use the following pkg/vbox_test/runtime:

<runtime ram="4300M" caps="2500" binary="init">

        <requires>
                <file_system label="vm"/>
                <file_system label="shared"/>
                <vm/>
                <timer/>
                <gui/>
                <nic/>
                <rom label="capslock"/>
                <report label="shape"/>
                <report label="clipboard"/>
                <rom    label="clipboard"/>
                <rm/>
                <rtc/>
                <rom label="usb_devices"/>
                <usb/>
        </requires>

        <config verbose="yes">

                <parent-provides>
                        <service name="ROM"/>
                        <service name="PD"/>
                        <service name="RM"/>
                        <service name="CPU"/>
                        <service name="LOG"/>
                        <service name="VM"/>
                        <service name="Gui"/>
                        <service name="Timer"/>
                        <service name="Rtc"/>
                        <service name="Report"/>
                        <service name="File_system"/>
                        <service name="Usb"/>
                        <service name="Nic"/>
                </parent-provides>

                <default-route> <any-service> <parent/> <any-child/> </any-service> </default-route>

                <default caps="100"/>

    <start name="vfs" caps="400">
        <resource name="RAM" quantum="10M"/>
        <provides><service name="File_system"/></provides>
        <config>
            <vfs>
                <ram/>
                <rom name="machine.vbox"/>
            </vfs>
            <default-policy root="/" writeable="yes"/>
        </config>
        <route>
            <any-service> <parent/> <any-child/> </any-service>
        </route>
    </start>

                <start name="vbox" caps="2000">
                        <binary name="virtualbox5" />
                        <resource name="RAM" quantum="4G"/>
                        <exit propagate="yes"/>
                        <config vbox_file="machine.vbox" xhci="yes" vm_name="linux" capslock="ROM">
                                <vfs>
                                        <dir name="dev">
                                                <log/>
                                                <rtc/>
                                         </dir>
                                        <dir name="shared"> <fs label="shared" writeable="yes"/> </dir>
                                        <fs writeable="yes"/>
                                </vfs>
                                <libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc"/>
                        </config>
                        <route>
                                <service name="Audio_out"> <parent/> </service>
                                <service name="File_system" label="shared"> <parent label="shared"/> </service>
                                <service name="File_system">                <child name="vfs"/> </service>
                                <service name="ROM" label="usb_devices"> <parent label="usb_devices"/> </service>
                                <service name="ROM" label="capslock"> <parent label="capslock"/> </service>
                                <service name="ROM" label="platform_info">
                                        <parent label="platform_info"/> </service>
                                <service name="Nic"> <parent/> </service>
                                <service name="Report" label="shape"> <parent label="shape"/> </service>
                                <service name="ROM"    label="clipboard"> <parent label="clipboard"/> </service>
                                <service name="Report" label="clipboard"> <parent label="clipboard"/> </service>
                                <service name="Gui"> <parent label=""/> </service>
                                <any-service> <parent/> </any-service>
                        </route>
                </start>
        </config>

        <content>
                <rom label="ld.lib.so"/>
                <rom label="init"/>
                <rom label="virtualbox5"/>
                <rom label="libc.lib.so"/>
                <rom label="libm.lib.so"/>
                <rom label="libiconv.lib.so"/>
                <rom label="libyuv.lib.so"/>
                <rom label="qemu-usb.lib.so"/>
                <rom label="stdcxx.lib.so"/>
                <rom label="vfs.lib.so"/>
                <rom label="jpeg.lib.so"/>
                <rom label="platform_info"/>
                <rom label="machine.vbox"/>
                <rom label="vfs"/>
        </content>

</runtime>

The following pkg/vbox_test/archives:

TLC62CsRraK4hdw6/src/vbox5
TLC62CsRraK4hdw6/src/libc
TLC62CsRraK4hdw6/src/init
TLC62CsRraK4hdw6/src/posix
TLC62CsRraK4hdw6/src/zlib
TLC62CsRraK4hdw6/src/libiconv
TLC62CsRraK4hdw6/src/libyuv
TLC62CsRraK4hdw6/src/stdcxx
TLC62CsRraK4hdw6/src/vfs
TLC62CsRraK4hdw6/src/jpeg

The following raw/platform_info (since I read it's not provided on Linux? taken from https://github.com/genodelabs/genode/blob/master/repos/os/run/vmm_x86.run#L75 :

                        <platform_info>
                                <kernel name="nova"/>
                                <acpi revision="2" rsdt="0x2ffe20c5"/>
                                <affinity-space width="2" height="2"/>
                                <boot/>
                                <hardware>
                                        <features svm="true" vmx="true"/>
                                        <tsc invariant="false" freq_khz="2555589"/>
                                        <cpus>
                                                <cpu id="0" package="0" core="0" thread="0" family="0x10" model="0x2" stepping="0x3" platform="0x0" patch="0x0"/>
                                        </cpus>
                                </hardware>
                        </platform_info>

And a machine.vbox from https://github.com/genodelabs/genode/blob/master/repos/gems/recipes/raw/download_coreplus/machine.vbox

The following is output by goa run:

Genode sculpt-22.04 <local changes>
17592186044415 MiB RAM and 18997 caps assigned to init
[init -> nic_drv] MAC address 02:00:00:00:00:01
[init -> nic_drv] using tap device "tap0"
[init -> nic_drv] Error: could not configure /dev/net/tun: no virtual network emulation
terminate called after throwing an instance of 'Genode::Exception'
[init -> vbox_test] parent provides
[init -> vbox_test]   service "ROM"
[init -> vbox_test]   service "PD"
[init -> vbox_test]   service "RM"
[init -> vbox_test]   service "CPU"
[init -> vbox_test]   service "LOG"
[init -> vbox_test]   service "VM"
[init -> vbox_test]   service "Gui"
[init -> vbox_test]   service "Timer"
[init -> vbox_test]   service "Rtc"
[init -> vbox_test]   service "Report"
[init -> vbox_test]   service "File_system"
[init -> vbox_test]   service "Usb"
[init -> vbox_test]   service "Nic"
[init -> vbox_test] child "vfs"
[init -> vbox_test]   RAM quota:  9992K
[init -> vbox_test]   cap quota:  366
[init -> vbox_test]   ELF binary: vfs
[init -> vbox_test]   priority:   0
[init -> vbox_test]   provides service File_system
[init -> vbox_test] child "vbox"
[init -> vbox_test]   RAM quota:  4194056K
[init -> vbox_test]   cap quota:  1966
[init -> vbox_test]   ELF binary: virtualbox5
[init -> vbox_test]   priority:   0
[init -> vbox_test] child "vfs" announces service "File_system"
error: XDG_RUNTIME_DIR is invalid or not set in the environment.
Authorization required, but no authorization protocol specified
[init -> drivers -> fb_sdl] Error: fb_sdl works on X11 only. Your SDL backend is offscreen.
terminate called after throwing an instance of 'Sdl_videodriver_not_supported'
[init -> vbox_test -> vbox] Log created: 2023-01-21T15:24:00.002000000Z
[init -> vbox_test -> vbox] main     Executable: /virtualbox
[init -> vbox_test -> vbox] Error: SystemPropertiesWrap : Cannot determine default Guest Additions ISO location. Most likely they are not available
[init -> vbox_test] child "vbox" requests resources: cap_quota=4

And then it's just stuck there.

Please either document that virtualization is not possible or provide an example in this repository. Thanks for the great work!

nfeske commented 1 year ago

Duplicate of #26.