Windowed Terminal

Norman Feske norman.feske at ...1...
Wed Oct 29 12:06:03 CET 2014


Hi Ben,

> I created a windowed terminal run script. It uses the cli_monitor server
> (used in terminal_mux.run) in a windowed nit_fb, and it works, except I
> can't switch between terminals like I can in terminul_mux using Ctrl+X.
> How can I add this functionality? I've attached the run script for you
> to look at.

the Ctrl-X feature is provided by the terminal_mux component that you
would need to stick in-between the cli_monitor and the terminal_srv. For
more information about the terminal infrastructure, you may refer to the
following documentation:


http://genode.org/documentation/release-notes/13.05#Terminal_infrastructure

However, when having a window manager in place, wouldn't it be more
natural to let the new application appear in a new window instead? This
can be done by starting another instance of init as a subsystem of
cli_monitor. This instance hosts a nit_fb, a terminal, and the noux
runtime running Vim. I have modified your run script accordingly (see
the attachment) to give you the idea how easy this can be accomplished
by the means for configuration.

Cheers
Norman

-- 
Dr.-Ing. Norman Feske
Genode Labs

http://www.genode-labs.com · http://genode.org

Genode Labs GmbH · Amtsgericht Dresden · HRB 28424 · Sitz Dresden
Geschäftsführer: Dr.-Ing. Norman Feske, Christian Helmuth
-------------- next part --------------
#
# Build
#

set build_components {
	core init
	drivers/timer
	server/wm app/decorator app/floating_window_layouter
	server/nitpicker app/pointer server/report_rom
	drivers/framebuffer drivers/pci drivers/input
	test/nitpicker
	app/backdrop
	app/launchpad
	server/nit_fb
	noux/minimal lib/libc_noux
	server/terminal server/ram_fs
	app/cli_monitor test/bomb test/signal
	test/resource_yield
	server/terminal_log
	noux-pkg/vim
}

#
# Build Noux packages only once
#
foreach pkg {bash coreutils} {
	lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg }

build $build_components

# strip all binaries prior archiving
exec sh -c "find bin/bash/ bin/coreutils/ -type f | (xargs strip || true) 2>/dev/null"

exec tar cfv bin/bash.tar      -h -C bin/bash .
exec tar cfv bin/coreutils.tar -h -C bin/coreutils .

create_boot_directory

#
# Generate config
#

append config {
<config prio_levels="2">
	<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>}

append_if [have_spec sdl] config {
	<start name="fb_sdl">
		<resource name="RAM" quantum="4M"/>
		<provides>
			<service name="Input"/>
			<service name="Framebuffer"/>
		</provides>
	</start>}

append_if [have_spec pci] config {
	<start name="pci_drv">
		<resource name="RAM" quantum="1M"/>
		<provides><service name="PCI"/></provides>
	</start>}

append_if [have_spec framebuffer] config {
	<start name="fb_drv">
		<resource name="RAM" quantum="4M"/>
		<provides><service name="Framebuffer"/></provides>
	</start>}

append_if [have_spec gpio] config {
	<start name="gpio_drv">
		<resource name="RAM" quantum="4M"/>
		<provides><service name="Gpio"/></provides>
		<config/>
	</start>}

append_if [have_spec exynos5] config {
	<start name="platform_drv">
		<resource name="RAM" quantum="1M"/>
		<provides><service name="Regulator"/></provides>
		<config/>
	</start>}

append_if [have_spec platform_rpi] config {
	<start name="platform_drv">
		<resource name="RAM" quantum="1M"/>
		<provides><service name="Platform"/></provides>
		<config/>
	</start>}

append_if [have_spec imx53] config {
	<start name="platform_drv">
		<resource name="RAM" quantum="1M"/>
		<provides><service name="Platform"/></provides>
		<config/>
	</start>
	<start name="input_drv">
		<resource name="RAM" quantum="1M"/>
		<provides><service name="Input"/></provides>
		<config/>
	</start> }

append_if [have_spec ps2] config {
	<start name="ps2_drv">
		<resource name="RAM" quantum="1M"/>
		<provides><service name="Input"/></provides>
	</start>}

append_if [expr ![have_spec ps2] && [have_spec usb]] config {
	<start name="usb_drv">
		<resource name="RAM" quantum="12M"/>
		<provides><service name="Input"/></provides>
		<config ehci="yes" uhci="yes" xhci="no"> <hid/> </config>
	</start> }

append config {
	<start name="timer">
		<resource name="RAM" quantum="1M"/>
		<provides><service name="Timer"/></provides>
	</start>
	<start name="nitpicker">
		<resource name="RAM" quantum="1M"/>
		<provides><service name="Nitpicker"/></provides>
		<config>
			<domain name="pointer"   layer="1" xray="no" origin="pointer" />
			<domain name="decorator" layer="2" xray="opaque" />
			<domain name="default"   layer="2" />

			<policy label="pointer"         domain="pointer"/>
			<policy label=""                domain="default"/>
			<policy label="wm -> decorator" domain="decorator"/>

			<global-key name="KEY_SCROLLLOCK" operation="xray" />
			<global-key name="KEY_SYSRQ"      operation="kill" />
			<global-key name="KEY_PRINT"      operation="kill" />
			<global-key name="KEY_F11"        operation="kill" />
			<global-key name="KEY_F12"        operation="xray" />
		</config>
		<route> }
append_if [have_spec sdl] config {
			<service name="Input"><child name="fb_sdl"/></service> }
append_if [have_spec imx53] config {
			<service name="Input"><child name="input_drv"/></service> }
append_if [have_spec ps2] config {
			<service name="Input"><child name="ps2_drv"/></service> }
append_if [expr ![have_spec ps2] && [have_spec usb]] config {
			<service name="Input"><child name="usb_drv"/></service> }
append config {
			<service name="Framebuffer"><child name="fb_drv"/> </service>
			<any-service><parent/><any-child/></any-service>
		</route>	</start>
	<start name="pointer">
		<resource name="RAM" quantum="1M"/>
		<route>
			<service name="Nitpicker"> <child name="nitpicker"/> </service>
			<any-service> <parent/> <any-child/> </any-service>
		</route>
	</start>
	<start name="wm" priority="-1">
		<resource name="RAM" quantum="32M"/>
		<provides><service name="Nitpicker"/></provides>
		<route>
			<any-service>
				<child name="nitpicker"/> <parent/> <any-child/>
			</any-service>
		</route>
	</start>
	<start name="terminal_fb" priority="-1">
		<binary name="nit_fb"/>
		<resource name="RAM" quantum="2M"/>
		<provides>
			<service name="Framebuffer"/>
			<service name="Input"/>
		</provides>
		<config xpos="0" ypos="0" width="1024" height="380"/>
		<route>
			<any-service> <child name="wm"/> <parent/> <any-child/>
			</any-service>
		</route>
	</start>
	<start name="terminal_srv">
		<binary name="terminal"/>
		<resource name="RAM" quantum="2M"/>
		<provides><service name="Terminal"/></provides>
		<route>
			<service name="Input"><child name="terminal_fb"/></service>
			<service name="Framebuffer"><child name="terminal_fb"/> </service>
			<any-service><parent/><any-child/></any-service>
		</route>
		<config>
			<keyboard layout="en"/>
		</config>
	</start>
	<start name="cli_monitor">
		<resource name="RAM" quantum="100M"/>
		<config>
			<preservation name="RAM" quantum="16M" />
			<subsystem name="noux" help="VIM executed in the noux runtime">
				<resource name="RAM" quantum="20M" />
				<binary name="init"/>
				<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"/>
						<service name="Nitpicker"/>
						<service name="Timer"/>
					</parent-provides>
					<default-route>
						<any-service> <parent/> <any-child/> </any-service>
					</default-route>
					<start name="nit_fb">
						<resource name="RAM" quantum="2M"/>
						<provides>
							<service name="Framebuffer"/>
							<service name="Input"/>
						</provides>
						<config xpos="0" ypos="0" width="640" height="480"/>
					</start>
					<start name="terminal">
						<resource name="RAM" quantum="2M"/>
						<provides><service name="Terminal"/></provides>
						<config>
							<keyboard layout="en"/>
						</config>
					</start>
					<start name="noux">
						<resource name="RAM" quantum="16M"/>
						<config>
							<fstab> <tar name="vim.tar" /> </fstab>
							<start name="/bin/vim">
								<env name="TERM" value="linux" />

								<!-- Deactivate the loading of plugins. Otherwise, vim will
								     attempt to use a sub shell for pattern matching -->
								<arg value="--noplugin" />

								<!-- Do not use swap file. Any attempt to create of would
								     fail because we are on a read-only file system -->
								<arg value="-n" />

								<!-- Use the nocompatible mode, which is much nicer than
								     the plain vi mode -->
								<arg value="-N" />

								<!-- Permanently display status bar -->
								<arg value="--cmd" />
								<arg value="set laststatus=2" />

								<!-- Enable highlighted search results -->
								<arg value="--cmd" />
								<arg value="set hls" />

							</start>
						</config>
					</start>
				</config>
			</subsystem>
			<subsystem name="signal" help="signalling test program">
				<resource name="RAM" quantum="5M" />
				<binary name="test-signal" />
			</subsystem>
			<subsystem name="ram_eater" help="resource-yield test program">
				<resource name="RAM" quantum="25M" />
				<binary name="test-resource_yield" />
				<config child="yes" expand="yes" period_ms="100" />
			</subsystem>
		</config>
		<route>
			<service name="Nitpicker"> <child name="wm"/> </service>
			<any-service>
				<child name="terminal_srv" /> <any-child/> <parent/>
			</any-service>
		</route>
	</start>
</config>}

install_config $config

# copy backdrop PNG images to bin directory
foreach file { genode_logo.png grid.png } {
	file copy -force [genode_dir]/repos/gems/src/app/backdrop/$file bin/ }


#
# Boot modules
#

# generic modules
set boot_modules {
	core init timer wm decorator ld.lib.so noux terminal ram_fs nitpicker nit_fb pointer
	libc.lib.so libm.lib.so libc_noux.lib.so floating_window_layouter report_rom
	terminal_log test-signal cli_monitor test-resource_yield vim.tar
	libc_terminal.lib.so ncurses.lib.so
}

# platform-specific modules
lappend_if [have_spec linux]        boot_modules fb_sdl
lappend_if [have_spec pci]          boot_modules pci_drv
lappend_if [have_spec ps2]          boot_modules ps2_drv
lappend_if [have_spec framebuffer]  boot_modules fb_drv
lappend_if [have_spec usb]          boot_modules usb_drv
lappend_if [have_spec gpio]         boot_modules gpio_drv
lappend_if [have_spec imx53]        boot_modules platform_drv
lappend_if [have_spec exynos5]      boot_modules platform_drv
lappend_if [have_spec platform_rpi] boot_modules platform_drv
lappend_if [have_spec imx53]        boot_modules input_drv

build_boot_image $boot_modules

append qemu_args " -m 256 "

run_genode_until forever


More information about the users mailing list