if {![have_include power_on/qemu]} {
	puts "\n Run script is not supported on this platform. \n"
	exit 0
}

create_boot_directory
build { app/umurmur }
import_from_depot [depot_user]/src/[base_src] \
                  [depot_user]/pkg/[drivers_nic_pkg] \
                  [depot_user]/src/init \
                  [depot_user]/src/libc \
                  [depot_user]/src/libcrypto \
                  [depot_user]/src/libssl \
                  [depot_user]/src/posix \
                  [depot_user]/src/vfs_lwip \
                  [depot_user]/src/vfs

install_config {
<config verbose="yes">
	<parent-provides>
		<service name="ROM"/>
		<service name="IRQ"/>
		<service name="IO_MEM"/>
		<service name="IO_PORT"/>
		<service name="PD"/>
		<service name="RM"/>
		<service name="CPU"/>
		<service name="LOG"/>
	</parent-provides>
	<default-route>
		<any-service> <parent/> <any-child/> </any-service>
	</default-route>
	<default caps="100"/>
	<start name="timer">
		<resource name="RAM" quantum="1M"/>
		<provides> <service name="Timer"/> </provides>
	</start>

	<start name="drivers" caps="1000">
		<resource name="RAM" quantum="32M" constrain_phys="yes"/>
		<binary name="init"/>
		<route>
			<service name="ROM" label="config"> <parent label="drivers.config"/> </service>
			<service name="Timer"> <child name="timer"/> </service>
			<any-service> <parent/> </any-service>
		</route>
		<provides> <service name="Nic"/> </provides>
	</start>

	<start name="umurmur" caps="120">
		<resource name="RAM" quantum="4M"/>
		<config>
			<vfs>
				<dir name="dev">
					<log/>
					<inline name="rtc">2018-09-24 00:00</inline>
					<inline name="random">012345678</inline>
				</dir>

				<dir name="socket"> <lwip dhcp="yes"/> </dir>

				<dir name="etc">
					<inline name="umurmur.conf">
max_bandwidth = 48000;
welcometext = "Welcome to uMurmur!";
# certificate = "/etc/umurmur/cert.crt";
# private_key = "/etc/umurmur/key.key";
password = "";
max_users = 10;
channels = ( {
		name = "Root";
		parent = "";
		description = "Root channel. No entry.";
		noenter = true;
	},
	{
		name = "Lobby";
		parent = "Root";
		description = "Lobby channel";
	}
);
default_channel = "Lobby";
					</inline>
					<ram/>
				</dir>
			</vfs>
			<libc stdout="/dev/log" stderr="/dev/log" rtc="/dev/rtc" socket="/socket"/>
		</config>
	</start>
</config>}

build_boot_image { libconfig.lib.so protobuf-c.lib.so umurmur }

# qemu config
append qemu_args " -nographic -net nic,model=e1000 "
append qemu_args " -net user -redir tcp:64738::64738 "

run_genode_until forever

# vi: set ft=tcl :
