
if {![have_spec x86_32]} {
	puts "\nOSS currently only supported on x86_32\n"
	exit 0
}

#
# Build
#

set build_components {
	core init
	drivers/timer
	drivers/audio_out
	drivers/pci
	drivers/acpi
	test/audio_out
}

lappend_if [have_spec pci]  build_components drivers/pci/device_pd

build $build_components

create_boot_directory

#
# Config
#

append config {
<config>
	<parent-provides>
		<service name="ROM"/>
		<service name="RAM"/>
		<service name="IRQ"/>
		<service name="IO_MEM"/>
		<service name="IO_PORT"/>
		<service name="CAP"/>
		<service name="PD"/>
		<service name="RM"/>
		<service name="CPU"/>
		<service name="LOG"/>
		<service name="SIGNAL" />
	</parent-provides>
	<default-route>
		<any-service> <parent/> <any-child/> </any-service>
	</default-route>
	<start name="acpi">
		<resource name="RAM" quantum="4M"/>
		<binary name="acpi_drv"/>
		<provides>
			<service name="PCI"/>
			<service name="IRQ" />
		</provides>
		<route>
			<service name="PCI"> <any-child /> </service>
			<any-service> <parent/> <any-child /> </any-service>
		</route>
	</start>
	<start name="timer">
		<resource name="RAM" quantum="1M"/>
		<provides><service name="Timer"/></provides>
	</start>
	<start name="audio_out_drv">
		<resource name="RAM" quantum="6M"/>
		<route>
			<service name="IRQ"><child name="acpi" /></service>
			<any-service> <parent /> <any-child /></any-service>
		</route>
		<provides>
			<service name="Audio_out"/>
		</provides>
	</start>
	<start name="audio0">
		<binary name="test-audio_out"/>
		<resource name="RAM" quantum="8M"/>
		<config>
			<filename>sample.raw</filename>
		</config>
		<route>
			<service name="Audio_out"> <child name="audio_out_drv"/> </service>
			<any-service> <parent/> <any-child/> </any-service>
		</route>
	</start>
</config>}

install_config $config

#
# Boot modules
#

set boot_modules {
	core init timer pci_drv audio_out_drv acpi_drv sample.raw test-audio_out }

lappend_if [have_spec nova] boot_modules pci_device_pd

build_boot_image $boot_modules

append qemu_args " -m 256 -soundhw ac97 -nographic"

run_genode_until forever

