terminal: use VFS-based font handling

This patch replaces the terminal's formerly built-in fonts with the new
VFS-based font handling.

To avoid the copying of the terminal's font configuration across run
scripts, this patch adds the new terminal/pkg runtime package, which
includes everything needed for instantiating a terminal: the actual
terminal component, the library dependencies (vfs_ttf, which in turn
depends on the libc), a font (bitstream-vera), and a reasonable default
configuration.

Fixes #2758
This commit is contained in:
Norman Feske 2018-04-11 14:14:20 +02:00 committed by Christian Helmuth
parent 0011dd1623
commit 1f1302e185
43 changed files with 702 additions and 785 deletions

View File

@ -0,0 +1 @@
File system for providing the default fonts

View File

@ -0,0 +1,4 @@
_/raw/ttf-bitstream-vera-minimal
_/src/vfs
_/src/vfs_ttf
_/src/libc

View File

@ -0,0 +1 @@
2018-04-13-b 34ed3dca0405409ed930319fb2357ffbcfb130e2

View File

@ -0,0 +1,14 @@
<runtime ram="4M" caps="150" binary="vfs" config="fonts.config">
<provides> <file_system/> </provides>
<content>
<rom label="vfs"/>
<rom label="ld.lib.so"/>
<rom label="libc.lib.so"/>
<rom label="libm.lib.so"/>
<rom label="vfs_ttf.lib.so"/>
<rom label="VeraMono.ttf"/>
</content>
</runtime>

View File

@ -10,3 +10,4 @@ _/pkg/vbox5-nova-sculpt
_/pkg/themed_wm
_/pkg/sticks_blue_backdrop
_/pkg/nano3d
_/pkg/fonts_fs

View File

@ -1,6 +1,7 @@
_/pkg/drivers_managed-pc
_/pkg/wifi
_/pkg/depot_download
_/pkg/terminal
_/src/report_rom
_/src/init
_/src/ram_fs
@ -16,7 +17,6 @@ _/src/top
_/src/trace_subject_reporter
_/src/cpu_load_display
_/src/rom_filter
_/src/terminal
_/src/terminal_log
_/src/file_terminal
_/src/libc

View File

@ -0,0 +1 @@
Graphical terminal with a simple default font configuration

View File

@ -0,0 +1,5 @@
_/raw/ttf-bitstream-vera-minimal
_/raw/terminal
_/src/terminal
_/src/vfs_ttf
_/src/libc

View File

@ -0,0 +1 @@
2018-04-11-b 035355bb942e636193a57c5d6a6934c278194ff6

View File

@ -0,0 +1,16 @@
<runtime ram="4M" caps="100" binary="terminal" config="terminal.config">
<requires> <input/> <framebuffer/> </requires>
<provides> <terminal/> </provides>
<content>
<rom label="terminal.config"/>
<rom label="ld.lib.so"/>
<rom label="libc.lib.so"/>
<rom label="libm.lib.so"/>
<rom label="vfs_ttf.lib.so"/>
<rom label="terminal"/>
<rom label="VeraMono.ttf"/>
</content>
</runtime>

View File

@ -0,0 +1,4 @@
content: terminal.config
terminal.config:
cp $(REP_DIR)/recipes/raw/terminal/$@ $@

View File

@ -0,0 +1 @@
2018-04-11 c9678f3083788e171fcda2d72c67300dcc2b13e4

View File

@ -0,0 +1,10 @@
<config>
<vfs>
<rom name="VeraMono.ttf"/>
<dir name="fonts">
<dir name="monospace">
<ttf name="regular" path="/VeraMono.ttf" size_px="16"/>
</dir>
</dir>
</vfs>
</config>

View File

@ -5,3 +5,8 @@ input_session
nitpicker_gfx
terminal_session
timer_session
vfs
gems
block_session
file_system_session
rtc_session

View File

@ -4,18 +4,23 @@ if { ![have_spec foc] && ![have_spec nova] &&
exit 0
}
set build_components {
core init drivers/timer noux/minimal lib/libc_noux
drivers/input
server/terminal server/ram_fs
server/log_terminal
test/libports/ncurses
server/fs_log
server/cpu_sampler
test/cpu_sampler
}
create_boot_directory
lappend_if [have_spec framebuffer] build_components drivers/framebuffer
import_from_depot genodelabs/src/[base_src] \
genodelabs/pkg/[drivers_interactive_pkg] \
genodelabs/pkg/terminal \
genodelabs/src/init \
genodelabs/src/noux \
genodelabs/src/posix \
genodelabs/src/ram_fs \
genodelabs/src/log_terminal \
genodelabs/src/ncurses \
genodelabs/src/bash-minimal \
genodelabs/src/vim-minimal \
genodelabs/src/coreutils-minimal
set build_components { server/fs_log server/cpu_sampler test/cpu_sampler }
if {[have_spec foc] || [have_spec nova]} {
lappend build_components lib/cpu_sampler_platform-$::env(KERNEL)
@ -23,19 +28,12 @@ if {[have_spec foc] || [have_spec nova]} {
lappend build_components lib/cpu_sampler_platform-generic
}
source ${genode_dir}/repos/base/run/platform_drv.inc
lappend_if [need_usb_hid] build_components drivers/usb
lappend_if [have_spec gpio] build_components drivers/gpio
#
# Build Noux packages only once
#
foreach pkg {bash coreutils vim diffutils} {
foreach pkg {diffutils} {
lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg }
append_platform_drv_build_components
build $build_components
# write default vimrc file
@ -49,12 +47,6 @@ set noswapfile
set viminfo=}
close $vimrc_fd
create_boot_directory
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
append config {
<config verbose="yes">
<parent-provides>
@ -76,50 +68,35 @@ append config {
<provides><service name="Timer"/></provides>
</start>}
append_platform_drv_config
append_if [expr [have_spec framebuffer] && ![get_cmd_switch --autopilot]] config {
<start name="fb_drv">
<resource name="RAM" quantum="4M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></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 [need_usb_hid] config {
<start name="usb_drv" caps="120">
<resource name="RAM" quantum="12M"/>
<provides><service name="Input"/></provides>
<config uhci="yes" ehci="yes" xhci="yes"> <hid/> </config>
</start> }
append_if [get_cmd_switch --autopilot] config {
<start name="terminal">
<binary name="log_terminal"/>
<resource name="RAM" quantum="1M"/>
<provides><service name="Terminal"/></provides>
</start> }
</start>}
append_if [expr ![get_cmd_switch --autopilot]] config {
<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="Input"/> <service name="Framebuffer"/>
</provides>
</start>
<start name="terminal">
<resource name="RAM" quantum="2M"/>
<provides><service name="Terminal"/></provides>
<config>
<keyboard layout="de"/>
<font size="12" />
</config>
</start> }
<route>
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>}
append config {
<start name="ram_fs">
@ -183,10 +160,10 @@ append config {
<resource name="RAM" quantum="16M" />
<config>
<fstab>
<tar name="coreutils.tar" />
<tar name="vim.tar" />
<tar name="coreutils-minimal.tar" />
<tar name="vim-minimal.tar" />
<tar name="diffutils.tar" />
<tar name="bash.tar" />
<tar name="bash-minimal.tar" />
<dir name="dev"> <zero/> <null/> </dir>
@ -205,12 +182,10 @@ append config {
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
</config>
}
</config> }
install_config $config
#
# Boot modules
#
@ -224,29 +199,11 @@ proc binary_name_cpu_sampler_platform_lib_so { } {
}
}
# generic modules
set boot_modules {
core ld.lib.so init timer noux terminal ram_fs log_terminal
libc.lib.so libm.lib.so libc_noux.lib.so ncurses.lib.so posix.lib.so
bash.tar coreutils.tar diffutils.tar vim.tar vimrc
build_boot_image {
diffutils.tar vimrc
fs_log cpu_sampler cpu_sampler_platform.lib.so test-cpu_sampler
}
# platform-specific modules
lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec framebuffer] boot_modules fb_drv
lappend_if [need_usb_hid] boot_modules usb_drv
lappend_if [have_spec gpio] boot_modules [gpio_drv]
append_platform_drv_boot_modules
build_boot_image $boot_modules
if {[have_spec x86_64]} {
# bash.tar is really huge when built for x86_64
} else {
}
if { ![get_cmd_switch --autopilot] } { run_genode_until forever }
# autopilot test

View File

@ -1,20 +1,23 @@
create_boot_directory
import_from_depot genodelabs/src/[base_src] \
genodelabs/pkg/[drivers_interactive_pkg] \
genodelabs/src/report_rom \
genodelabs/src/fs_rom \
genodelabs/src/ram_fs \
genodelabs/src/vfs \
genodelabs/src/nitpicker \
genodelabs/src/init
proc depot_user {} { return nfeske }
import_from_depot [depot_user]/src/[base_src] \
[depot_user]/pkg/[drivers_interactive_pkg] \
[depot_user]/src/report_rom \
[depot_user]/src/fs_rom \
[depot_user]/src/ram_fs \
[depot_user]/src/vfs \
[depot_user]/src/nitpicker \
[depot_user]/src/init \
[depot_user]/src/vfs_ttf \
[depot_user]/src/libc \
[depot_user]/raw/ttf-bitstream-vera-minimal
create_tar_from_depot_binaries [run_dir]/genode/depot.tar \
genodelabs/pkg/sculpt-installation \
genodelabs/pkg/themed_wm \
genodelabs/pkg/sticks_blue_backdrop
proc depot_user {} { return genodelabs }
[depot_user]/pkg/sculpt-installation \
[depot_user]/pkg/themed_wm \
[depot_user]/pkg/sticks_blue_backdrop
proc current_pkg { pkg } { return $pkg/[_current_depot_archive_version pkg $pkg] }
@ -57,7 +60,7 @@ install_config {
<start name="nitpicker">
<resource name="RAM" quantum="4M"/>
<provides><service name="Nitpicker"/></provides>
<config>
<config focus="rom">
<background color="#123456"/>
<domain name="pointer" layer="1" content="client" label="no" origin="pointer" />
<domain name="default" layer="3" content="client" label="no" hover="always" />
@ -177,9 +180,16 @@ install_config {
</start>
-->
<start name="fonts_fs" pkg="} [depot_user]/pkg/[current_pkg fonts_fs] {">
<route>
<service name="ROM" label="config"> <parent label="fonts.config"/> </service>
</route>
</start>
<start name="noux" pkg="} [depot_user]/pkg/[current_pkg noux-system] {">
<route>
<service name="Nitpicker"> <child name="wm"/> </service>
<service name="File_system" label="fonts"> <child name="fonts_fs"/> </service>
<service name="File_system"> <parent/> </service>
</route>
</start>
@ -201,6 +211,7 @@ install_config {
<service name="ROM" label_last="ld.lib.so"> <parent/> </service>
<service name="ROM" label_last="init"> <parent/> </service>
<service name="ROM" label="config"> <child name="report_rom"/> </service>
<service name="ROM" label_last="fonts.config"> <parent/> </service>
<service name="ROM"> <child name="fs_rom"/> </service>
<service name="Timer"> <child name="timer"/> </service>
<service name="Nitpicker" label_last="backdrop">
@ -214,6 +225,15 @@ install_config {
build { app/depot_query app/depot_deploy }
file copy -force [genode_dir]/repos/gems/run/sculpt/fonts.config [run_dir]/genode/
#
# Pin the nitpicker focus to the window manager by providing a static focus ROM
#
set fd [open [run_dir]/genode/focus w]
puts $fd "<focus label=\"dynamic -> wm -> wm -> \"/>"
close $fd
build_boot_image { depot_query depot_deploy }
run_genode_until forever

View File

@ -107,6 +107,7 @@ install_config {
<content>
<rom name="fb_drv.config"/>
<rom name="nitpicker.config"/>
<rom name="fonts.config"/>
<rom name="input_filter.config"/>
<rom name="en_us.chargen"/>
<rom name="de.chargen"/>
@ -383,7 +384,9 @@ install_config {
<service name="LOG"> <child name="log"/> </service>
<service name="ROM" label="config">
<child name="leitzentrale_config"/> </service>
<service name="ROM" label="control_noux -> vimrc">
<service name="ROM" label_last="vimrc">
<child name="config_rom"/> </service>
<service name="ROM" label_last="fonts.config">
<child name="config_rom"/> </service>
<service name="ROM" label="trace_subjects">
<child name="report_rom"/> </service>
@ -559,6 +562,12 @@ append depot_deploy_config {
</route>
</start>
<start name="fonts_fs" pkg="} [depot_user]/pkg/[current_pkg fonts_fs] {">
<route>
<service name="ROM" label="config"> <parent label="fonts.config"/> </service>
</route>
</start>
<start name="wm" pkg="} [depot_user]/pkg/[current_pkg themed_wm] {">
<route>
<service name="Nitpicker"> <parent/> </service>
@ -578,6 +587,8 @@ append depot_deploy_config {
<parent label="config"/> </service>
<service name="File_system" label="report">
<parent label="report"/> </service>
<service name="File_system" label="fonts">
<child name="fonts_fs"/> </service>
<service name="File_system" label="target">
<parent label="rw"/> </service>
<service name="ROM" label="vimrc"> <parent/> </service>

View File

@ -40,7 +40,12 @@
<binary name="terminal"/>
<resource name="RAM" quantum="4M"/>
<provides> <service name="Terminal"/> </provides>
<config> <keyboard layout="none"/> <font size="16" /> </config>
<route>
<service name="ROM" label="config"> <parent label="config -> fonts.config"/> </service>
<service name="Framebuffer"> <child name="nit_fb"/> </service>
<service name="Input"> <child name="nit_fb"/> </service>
<any-service> <parent/> </any-service>
</route>
</start>
<start name="noux" caps="500">

View File

@ -24,7 +24,12 @@
<binary name="terminal"/>
<resource name="RAM" quantum="4M"/>
<provides> <service name="Terminal"/> </provides>
<config> <keyboard layout="none"/> <font size="16" /> </config>
<route>
<service name="ROM" label="config"> <parent label="fonts.config"/> </service>
<service name="Framebuffer"> <child name="nit_fb"/> </service>
<service name="Input"> <child name="nit_fb"/> </service>
<any-service> <parent/> </any-service>
</route>
</start>
<start name="noux" caps="500">

View File

@ -101,6 +101,8 @@
<service name="ROM" label_last="platform_info"> <parent/> </service>
<service name="ROM" label_last="wlan.config">
<parent label="config -> wlan.config"/> </service>
<service name="ROM" label_last="fonts.config">
<parent label="config -> fonts.config"/> </service>
<service name="ROM" label="config"> <child name="report_rom"/> </service>
<service name="ROM" label="clicked"> <parent label="clicked"/> </service>
<service name="ROM"> <child name="depot_rom"/> </service>

View File

@ -51,6 +51,8 @@
<route>
<service name="ROM" label="config">
<parent label="config -> subinit/default_noux.config"/> </service>
<service name="ROM" label="fonts.config">
<parent label="config -> fonts.config"/> </service>
<service name="File_system" label="config">
<parent label="config"/> </service>
<service name="File_system" label="target">

View File

@ -0,0 +1,13 @@
<config>
<vfs>
<rom name="VeraMono.ttf"/>
<dir name="fonts">
<dir name="monospace">
<ttf name="regular" path="/VeraMono.ttf" size_px="16" cache="256K"/>
</dir>
</dir>
</vfs>
<!-- policy when using this file as fonts-fs config -->
<default-policy root="/fonts" />
</config>

View File

@ -49,6 +49,8 @@
<route>
<service name="ROM" label="config">
<parent label="config -> subinit/default_noux.config"/> </service>
<service name="ROM" label="fonts.config">
<parent label="config -> fonts.config"/> </service>
<service name="File_system" label="config">
<parent label="config"/> </service>
<service name="File_system" label="target">

View File

@ -84,8 +84,14 @@
<resource name="RAM" quantum="4M"/>
<provides> <service name="Terminal"/> </provides>
<config>
<keyboard layout="none"/>
<font size="8" />
<vfs>
<rom name="VeraMono.ttf"/>
<dir name="fonts">
<dir name="monospace">
<ttf name="regular" path="/VeraMono.ttf" size_px="10"/>
</dir>
</dir>
</vfs>
</config>
<route>
<any-service> <child name="log_nit_fb"/> <parent/> </any-service>
@ -131,11 +137,8 @@
<binary name="terminal"/>
<resource name="RAM" quantum="8M"/>
<provides> <service name="Terminal"/> </provides>
<config>
<keyboard layout="none"/>
<font size="16" />
</config>
<route>
<service name="ROM" label="config"> <parent label="fonts.config"/> </service>
<any-service> <child name="control_nit_fb"/> <parent/> </any-service>
</route>
</start>

View File

@ -40,7 +40,12 @@
<binary name="terminal"/>
<resource name="RAM" quantum="4M"/>
<provides> <service name="Terminal"/> </provides>
<config> <keyboard layout="none"/> <font size="16" /> </config>
<route>
<service name="ROM" label="config"> <parent label="config -> fonts.config"/> </service>
<service name="Framebuffer"> <child name="nit_fb"/> </service>
<service name="Input"> <child name="nit_fb"/> </service>
<any-service> <parent/> </any-service>
</route>
</start>
<start name="noux" caps="500" version="initial">

View File

@ -1,21 +1,12 @@
set build_components {
core init drivers/timer
server/input_filter server/terminal test/terminal_echo
drivers/framebuffer drivers/input
}
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
exec cp -f [genode_dir]/repos/os/src/server/input_filter/en_us.chargen bin/
exec cp -f [genode_dir]/repos/os/src/server/input_filter/de.chargen bin/
import_from_depot genodelabs/src/[base_src] \
genodelabs/pkg/[drivers_interactive_pkg] \
genodelabs/pkg/terminal \
genodelabs/src/init
append config {
<config verbose="yes">
install_config {
<config>
<parent-provides>
<service name="ROM"/>
<service name="LOG"/>
@ -26,82 +17,36 @@ append config {
<service name="IO_PORT"/>
<service name="IO_MEM"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<default caps="100"/>
}
append_if [have_spec sdl] config {
<start name="fb_sdl">
<resource name="RAM" quantum="4M"/>
<provides>
<service name="Input"/>
<service name="Framebuffer"/>
</provides>
<config width="640" height="480"/>
</start>
<alias name="input_drv" child="fb_sdl"/>}
append_platform_drv_config
append_if [have_spec framebuffer] config {
<start name="fb_drv" caps="200">
<resource name="RAM" quantum="4M"/>
<provides><service name="Framebuffer"/></provides>
<config width="640" height="480"/>
</start>}
append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></provides>
</start>
<alias name="input_drv" child="ps2_drv"/>}
append config {
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
<start name="input_filter">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Input"/> </provides>
<config>
<input label="input"/>
<output>
<chargen>
<input name="input"/>
<mod1>
<key name="KEY_LEFTSHIFT"/> <key name="KEY_RIGHTSHIFT"/>
</mod1>
<mod2>
<key name="KEY_LEFTCTRL"/> <key name="KEY_RIGHTCTRL"/>
</mod2>
<mod3>
<key name="KEY_RIGHTALT"/> <!-- AltGr -->
</mod3>
<repeat delay_ms="500" rate_ms="250"/>
<!-- <include rom="de.chargen"/> -->
<include rom="en_us.chargen"/>
</chargen>
</output>
</config>
<start name="drivers" caps="1000">
<resource name="RAM" quantum="32M" constrain_phys="yes"/>
<binary name="init"/>
<route>
<service name="Input"> <child name="input_drv"/> </service>
<any-service> <parent/> <any-child/> </any-service>
<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="Input"/> <service name="Framebuffer"/>
</provides>
</start>
<start name="terminal">
<resource name="RAM" quantum="2M"/>
<provides><service name="Terminal"/></provides>
<config>
<keyboard layout="none"/>
<!-- supported built-in font sizes are 8, 12, and 16 -->
<font size="12" />
</config>
<route>
<service name="Input"> <child name="input_filter"/> </service>
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
@ -112,26 +57,9 @@ append config {
</config>
}
install_config $config
build { server/terminal test/terminal_echo }
#
# Boot modules
#
# generic modules
set boot_modules {
core ld.lib.so init timer input_filter terminal test-terminal_echo
en_us.chargen de.chargen
}
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec framebuffer] boot_modules fb_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules
build_boot_image { terminal test-terminal_echo }
run_genode_until forever

View File

@ -1,32 +1,14 @@
#
# \brief Showcases terminal_log server
# \author Stefan Kalkowski
# \date 2012-05-21
#
set build_components {
core
init
drivers/framebuffer
drivers/input
drivers/timer
server/nitpicker
server/nit_fb
server/terminal
server/terminal_log
test/nitpicker
app/launchpad
app/pointer
}
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
append config {
import_from_depot genodelabs/src/[base_src] \
genodelabs/pkg/[drivers_interactive_pkg] \
genodelabs/pkg/terminal \
genodelabs/src/nitpicker \
genodelabs/src/nit_fb \
genodelabs/src/demo \
genodelabs/src/init
install_config {
<config>
<parent-provides>
<service name="ROM"/>
@ -45,42 +27,29 @@ append config {
<service name="Platform"> <child name="platform_drv"/> </service>
<any-service><parent/></any-service>
</default-route>
<default caps="100"/>
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Timer"/></provides>
</start>
}
append_if [have_spec sdl] config {
<start name="fb_sdl">
<resource name="RAM" quantum="4M"/>
<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="Input"/>
<service name="Framebuffer"/>
<service name="Input"/> <service name="Framebuffer"/>
</provides>
</start>
<alias name="fb_drv" child="fb_sdl"/>
<alias name="input_drv" child="fb_sdl"/>}
append_platform_drv_config
append_if [have_spec framebuffer] config {
<start name="fb_drv" caps="200">
<resource name="RAM" quantum="4M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></provides>
</start>
<alias name="input_drv" child="ps2_drv"/>}
append config {
<start name="nitpicker">
<resource name="RAM" quantum="1M"/>
<resource name="RAM" quantum="2M"/>
<provides><service name="Nitpicker"/></provides>
<config>
<domain name="pointer" layer="1" content="client" label="no" origin="pointer" />
@ -89,14 +58,16 @@ append config {
<default-policy domain="default"/>
</config>
<route>
<service name="Input"> <child name="input_drv"/> </service>
<service name="Framebuffer"> <child name="fb_drv"/> </service>
<service name="Input"> <child name="drivers"/> </service>
<service name="Framebuffer"> <child name="drivers"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="pointer">
<resource name="RAM" quantum="1M"/>
</start>
<start name="terminal_fb">
<binary name="nit_fb"/>
<resource name="RAM" quantum="4M"/>
@ -106,53 +77,37 @@ append config {
</provides>
<config xpos="0" ypos="0" width="640" height="480" refresh_rate="25"/>
</start>
<start name="terminal">
<resource name="RAM" quantum="3M"/>
<provides><service name="Terminal"/></provides>
<route>
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
<service name="Input"> <child name="terminal_fb"/> </service>
<service name="Framebuffer"> <child name="terminal_fb"/> </service>
<any-service> <parent/> <any-child/></any-service>
</route>
</start>
<start name="terminal_log">
<resource name="RAM" quantum="1M"/>
<provides><service name="LOG"/></provides>
</start>
<start name="launchpad">
<start name="launchpad" caps="2000">
<resource name="RAM" quantum="32M"/>
<route>
<service name="LOG"> <child name="terminal_log"/> </service>
<any-service> <any-child/> <parent/></any-service>
</route>
<config>
<launcher name="testnit" ram_quota="768K" />
<launcher name="testnit" ram_quota="1M" caps="100"/>
</config>
</start>
</config>
}
install_config $config
</config>}
# generic modules
set boot_modules {
core ld.lib.so init
timer
nitpicker
pointer
launchpad
testnit
nit_fb
terminal
terminal_log
}
build { server/terminal_log test/nitpicker }
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec framebuffer] boot_modules fb_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules
build_boot_image { terminal_log testnit }
run_genode_until forever

View File

@ -72,8 +72,18 @@ class Terminal::Framebuffer
void switch_to_new_mode()
{
_ds.construct(_env.rm(), _fb.dataspace());
/*
* The mode information must be obtained before updating the
* dataspace to ensure that the mode is consistent with the
* obtained version of the dataspace.
*
* Otherwise - if the server happens to change the mode just after
* the dataspace update - the mode information may correspond to
* the next pending mode at the server while we are operating on
* the old (possibly too small) dataspace.
*/
_mode = _fb.mode();
_ds.construct(_env.rm(), _fb.dataspace());
}
};

View File

@ -21,7 +21,9 @@
#include <base/attached_rom_dataspace.h>
#include <base/attached_ram_dataspace.h>
#include <input/event.h>
#include <nitpicker_gfx/tff_font.h>
#include <gems/vfs.h>
#include <gems/vfs_font.h>
#include <gems/cached_font.h>
/* terminal includes */
#include <terminal/decoder.h>
@ -46,16 +48,27 @@ struct Terminal::Main : Character_consumer
Attached_rom_dataspace _config { _env, "config" };
/**
* Return font data according to config
*/
static char const *_font_data(Xml_node config);
Heap _heap { _env.ram(), _env.rm() };
Tff_font::Static_glyph_buffer<4096> _glyph_buffer { };
Root_directory _root_dir { _env, _heap, _config.xml().sub_node("vfs") };
Reconstructible<Tff_font> _font { _font_data(_config.xml()), _glyph_buffer };
Cached_font::Limit _font_cache_limit { 0 };
Reconstructible<Font_family> _font_family { *_font };
struct Font
{
Vfs_font _vfs_font;
Cached_font _cached_font;
Font(Allocator &alloc, Directory &root_dir, Cached_font::Limit limit)
:
_vfs_font(alloc, root_dir, "fonts/monospace/regular"),
_cached_font(alloc, _vfs_font, limit)
{ }
Text_painter::Font const &font() const { return _cached_font; }
};
Constructible<Font> _font { };
Color_palette _color_palette { };
@ -67,15 +80,13 @@ struct Terminal::Main : Character_consumer
Input::Connection _input { _env };
Timer::Connection _timer { _env };
Heap _heap { _env.ram(), _env.rm() };
Framebuffer _framebuffer { _env, _config_handler };
typedef Pixel_rgb565 PT;
Constructible<Text_screen_surface<PT>> _text_screen_surface { };
Session::Size _terminal_size { };
Area _terminal_size { };
/*
* Time in milliseconds between a change of the terminal content and the
@ -86,22 +97,21 @@ struct Terminal::Main : Character_consumer
bool _flush_scheduled = false;
void _handle_flush(Duration)
void _handle_flush()
{
_flush_scheduled = false;
// XXX distinguish between normal and alternate display
if (_text_screen_surface.constructed())
_text_screen_surface->redraw();
}
Timer::One_shot_timeout<Main> _flush_timeout {
_timer, *this, &Main::_handle_flush };
Signal_handler<Main> _flush_handler {
_env.ep(), *this, &Main::_handle_flush };
void _schedule_flush()
{
if (!_flush_scheduled) {
_flush_timeout.schedule(Microseconds{1000*_flush_delay});
_timer.trigger_once(1000*_flush_delay);
_flush_scheduled = true;
}
}
@ -131,10 +141,11 @@ struct Terminal::Main : Character_consumer
Main(Env &env) : _env(env)
{
_handle_config();
_timer .sigh(_flush_handler);
_config.sigh(_config_handler);
_input .sigh(_input_handler);
_input.sigh(_input_handler);
_handle_config();
/* announce service at our parent */
_env.parent().announce(_env.ep().manage(_root));
@ -142,48 +153,65 @@ struct Terminal::Main : Character_consumer
};
/* built-in fonts */
extern char const _binary_notix_8_tff_start;
extern char const _binary_terminus_12_tff_start;
extern char const _binary_terminus_16_tff_start;
char const *Terminal::Main::_font_data(Xml_node config)
{
if (config.has_sub_node("font")) {
size_t const size = config.sub_node("font").attribute_value("size", 16U);
switch (size) {
case 8: return &_binary_notix_8_tff_start; break;
case 12: return &_binary_terminus_12_tff_start; break;
case 16: return &_binary_terminus_16_tff_start; break;
default: break;
}
}
return &_binary_terminus_16_tff_start;
}
void Terminal::Main::_handle_config()
{
_config.update();
_font_family.destruct();
_font.destruct();
Xml_node const config = _config.xml();
_font.construct(_font_data(config), _glyph_buffer);
_font_family.construct(*_font);
_font.destruct();
_root_dir.apply_config(config.sub_node("vfs"));
Cached_font::Limit const cache_limit {
config.attribute_value("cache", Number_of_bytes(256*1024)) };
_font.construct(_heap, _root_dir, cache_limit);
/*
* Adapt terminal to framebuffer mode changes
* Adapt terminal to font or framebuffer mode changes
*/
_framebuffer.switch_to_new_mode();
_text_screen_surface.construct(_heap, *_font_family,
_color_palette, _framebuffer);
_terminal_size = _text_screen_surface->size();
_root.notify_resized(_terminal_size);
/*
* Distinguish the case where the framebuffer change affects the character
* grid size from the case where merely the pixel position of the character
* grid within the framebuffer changed.
*
* In the former case, the text-screen surface is reallocated and cleared.
* Clients (like ncurses) are expected to respond to a terminal-size change
* with a redraw. In the latter case, the client would skip the redraw. So
* we need to preserve the content and just reposition the character grid.
*/
try {
Text_screen_surface<PT>::Geometry const new_geometry(_font->font(), _framebuffer);
bool const reconstruct = !_text_screen_surface.constructed() ||
_text_screen_surface->size() != new_geometry.size();
if (reconstruct) {
_text_screen_surface.construct(_heap, _font->font(),
_color_palette, _framebuffer);
_terminal_size = _text_screen_surface->size();
} else {
_text_screen_surface->geometry(new_geometry);
}
}
catch (Text_screen_surface<PT>::Geometry::Invalid)
{
warning("invalid framebuffer size");
/*
* Make sure to never operate on an invalid-sized framebuffer
*
* If the exception is thrown by the construction of 'new_geometry',
* there may still be a stale '_text_screen_surface'.
*/
_text_screen_surface.destruct();
}
_root.notify_resized(Session::Size(_terminal_size.w(), _terminal_size.h()));
_schedule_flush();
}

View File

@ -1,4 +1,3 @@
TARGET = terminal
SRC_CC = main.cc
LIBS = base
SRC_BIN = $(notdir $(wildcard $(PRG_DIR)/*.tff))
LIBS = base vfs

View File

@ -25,7 +25,6 @@
#include <nitpicker_gfx/box_painter.h>
/* local includes */
#include "font_family.h"
#include "color_palette.h"
#include "framebuffer.h"
@ -35,19 +34,70 @@ namespace Terminal { template <typename> class Text_screen_surface; }
template <typename PT>
class Terminal::Text_screen_surface
{
public:
class Invalid_framebuffer_size : Genode::Exception { };
typedef Text_painter::Font Font;
typedef Glyph_painter::Fixpoint_number Fixpoint_number;
struct Geometry
{
Area fb_size;
Fixpoint_number char_width;
unsigned char_height;
unsigned columns;
unsigned lines;
class Invalid : Genode::Exception { };
Geometry(Font const &font, Framebuffer const &framebuffer)
:
fb_size(framebuffer.w(), framebuffer.h()),
char_width(font.string_width(Utf8_ptr("M"))),
char_height(font.height()),
columns((framebuffer.w() << 8)/char_width.value),
lines(framebuffer.h()/char_height)
{
if (columns*lines == 0)
throw Invalid();
}
Rect fb_rect() const { return Rect(Point(0, 0), fb_size); }
Rect used_rect() const { return Rect(start(), used_pixels()); }
Area size() const { return Area(columns, lines); }
/**
* Return pixel area covered by the character grid
*/
Area used_pixels() const
{
return Area((columns*char_width.value)>>8, lines*char_height);
}
/**
* Return excess area in pixels
*/
Area unused_pixels() const
{
return Area(fb_size.w() - used_pixels().w(),
fb_size.h() - used_pixels().h());
}
/**
* Return start position of character grid
*/
Point start() const { return Point(1, 1); }
bool valid() const { return columns*lines > 0; }
};
private:
Font_family const &_font_family;
Font const &_font;
Color_palette const &_palette;
Framebuffer &_framebuffer;
/* take size of space character as character cell size */
unsigned const _char_width { _font_family.cell_width() };
unsigned const _char_height { _font_family.cell_height() };
/* number of characters fitting on the framebuffer */
unsigned const _columns { _framebuffer.w()/_char_width };
unsigned const _lines { _framebuffer.h()/_char_height };
Geometry _geometry { _font, _framebuffer };
Cell_array<Char_cell> _cell_array;
Char_cell_array_character_screen _character_screen { _cell_array };
@ -56,46 +106,62 @@ class Terminal::Text_screen_surface
public:
Text_screen_surface(Allocator &alloc, Font_family const &font_family,
/**
* Constructor
*
* \throw Geometry::Invalid
*/
Text_screen_surface(Allocator &alloc, Font const &font,
Color_palette &palette, Framebuffer &framebuffer)
:
_font_family(font_family),
_font(font),
_palette(palette),
_framebuffer(framebuffer),
_cell_array(_columns, _lines, alloc)
_cell_array(_geometry.columns, _geometry.lines, alloc)
{ }
/**
* Update geometry
*
* Called whenever the framebuffer dimensions slightly change but
* without any effect on the grid size. In contrast, if the grid
* size changes, the entire 'Text_screen_surface' is reconstructed.
*/
void geometry(Geometry const &geometry)
{
_geometry = geometry;
_cell_array.mark_all_lines_as_dirty(); /* trigger refresh */
}
void redraw()
{
Font const &regular_font = _font_family.font(Font_face::REGULAR);
Area const cell_size = regular_font.bounding_box();
unsigned const glyph_height = regular_font.bounding_box().h(),
glyph_step_x = regular_font.bounding_box().w();
unsigned const fb_width = _framebuffer.w(),
fb_height = _framebuffer.h();
int const clip_top = 0, clip_bottom = fb_height,
clip_left = 0, clip_right = fb_width;
PT *fb_base = _framebuffer.pixel<PT>();
Surface<PT> surface(fb_base, Area(_framebuffer.w(), _framebuffer.h()));
Surface<PT> surface(fb_base, _geometry.fb_size);
unsigned const fg_alpha = 255;
unsigned y = 0;
/* clear border */
{
Rect r[4] { };
Rect const all(Point(0, 0), _geometry.fb_size);
_geometry.fb_rect().cut(_geometry.used_rect(), &r[0], &r[1], &r[2], &r[3]);
for (unsigned i = 0; i < 4; i++)
Box_painter::paint(surface, r[i], Color(0, 0, 0));
}
int const clip_top = 0, clip_bottom = _geometry.fb_size.h(),
clip_left = 0, clip_right = _geometry.fb_size.w();
unsigned y = _geometry.start().y();
for (unsigned line = 0; line < _cell_array.num_lines(); line++) {
if (_cell_array.line_dirty(line)) {
unsigned x = 0;
Fixpoint_number x { (int)_geometry.start().x() };
for (unsigned column = 0; column < _cell_array.num_cols(); column++) {
Char_cell cell = _cell_array.get_cell(column, line);
Font const &font = _font_family.font(cell.font_face());
unsigned char ascii = cell.ascii;
if (ascii == 0)
@ -103,7 +169,7 @@ class Terminal::Text_screen_surface
Text_painter::Codepoint const c { ascii };
font.apply_glyph(c, [&] (Glyph_painter::Glyph const &glyph) {
_font.apply_glyph(c, [&] (Glyph_painter::Glyph const &glyph) {
Color_palette::Highlighted const highlighted { cell.highlight() };
Color_palette::Inverse const inverse { cell.inverse() };
@ -123,17 +189,27 @@ class Terminal::Text_screen_surface
PT const pixel(fg_color.r, fg_color.g, fg_color.b);
Box_painter::paint(surface, Rect(Point(x, y), cell_size), bg_color);
Fixpoint_number next_x = x;
next_x.value += _geometry.char_width.value;
Glyph_painter::paint(Glyph_painter::Position((int)x, (int)y),
glyph, fb_base, fb_width,
Box_painter::paint(surface,
Rect(Point(x.decimal(), y),
Point(next_x.decimal() - 1,
y + _geometry.char_height - 1)),
bg_color);
/* horizontally align glyph within cell */
x.value += (_geometry.char_width.value - (int)((glyph.width - 1)<<8)) >> 1;
Glyph_painter::paint(Glyph_painter::Position(x, (int)y),
glyph, fb_base, _geometry.fb_size.w(),
clip_top, clip_bottom, clip_left, clip_right,
pixel, fg_alpha);
x += glyph_step_x;
x = next_x;
});
}
}
y += glyph_height;
y += _geometry.char_height;
}
int first_dirty_line = 10000,
@ -150,9 +226,10 @@ class Terminal::Text_screen_surface
int const num_dirty_lines = last_dirty_line - first_dirty_line + 1;
if (num_dirty_lines > 0)
_framebuffer.refresh(Rect(Point(0, first_dirty_line*_char_height),
Area(fb_width,
num_dirty_lines*_char_height)));
_framebuffer.refresh(Rect(Point(0, first_dirty_line*_geometry.char_height),
Area(_geometry.fb_size.w(),
num_dirty_lines*_geometry.char_height +
_geometry.unused_pixels().h())));
}
void apply_character(Character c)
@ -161,7 +238,10 @@ class Terminal::Text_screen_surface
_decoder.insert(c.c);
}
Session::Size size() const { return Session::Size(_columns, _lines); }
/**
* Return size in colums/rows
*/
Area size() const { return _geometry.size(); }
};
#endif /* _TEXT_SCREEN_SURFACE_H_ */

View File

@ -88,8 +88,7 @@ class Cell_array
_array = new (alloc) Char_cell_line[num_lines];
_line_dirty = new (alloc) bool[num_lines];
for (unsigned i = 0; i < num_lines; i++)
_line_dirty[i] = false;
mark_all_lines_as_dirty();
for (unsigned i = 0; i < num_lines; i++)
_array[i] = new (alloc) CELL[num_cols];
@ -104,6 +103,12 @@ class Cell_array
Genode::destroy(_alloc, _array);
}
void mark_all_lines_as_dirty()
{
for (unsigned i = 0; i < _num_lines; i++)
_line_dirty[i] = true;
}
void set_cell(int column, int line, CELL cell)
{
_array[line][column] = cell;

View File

@ -6,6 +6,7 @@
<file_system label="config" writeable="yes"/>
<file_system label="report" writeable="no"/>
<file_system label="target" writeable="yes"/>
<file_system label="fonts" writeable="no"/>
<rom label="vimrc"/>
</requires>

View File

@ -23,7 +23,13 @@
<start name="terminal">
<resource name="RAM" quantum="4M"/>
<provides> <service name="Terminal"/> </provides>
<config> <keyboard layout="none"/> <font size="16" /> </config>
<config>
<vfs> <dir name="fonts"> <fs/> </dir> </vfs>
</config>
<route>
<service name="File_system"> <parent label="fonts"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="noux" caps="500">

View File

@ -2,10 +2,10 @@ create_boot_directory
import_from_depot genodelabs/src/[base_src] \
genodelabs/pkg/[drivers_interactive_pkg] \
genodelabs/pkg/terminal \
genodelabs/src/init \
genodelabs/src/libc \
genodelabs/src/noux \
genodelabs/src/terminal \
genodelabs/src/posix \
genodelabs/src/ncurses \
genodelabs/src/vim \
@ -64,10 +64,10 @@ install_config {
<start name="terminal">
<resource name="RAM" quantum="2M"/>
<provides><service name="Terminal"/></provides>
<config>
<keyboard layout="none"/>
<font size="12" />
</config>
<route>
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="ram_fs">

View File

@ -3,15 +3,21 @@ if {!([have_spec nova])} {
exit 0
}
create_boot_directory
import_from_depot genodelabs/src/[base_src] \
genodelabs/pkg/[drivers_interactive_pkg] \
genodelabs/pkg/terminal \
genodelabs/src/init \
genodelabs/src/libc \
genodelabs/src/noux \
genodelabs/src/posix \
genodelabs/src/ncurses
source ${genode_dir}/repos/ports/run/noux_gdb.inc
if {[have_spec arm]} {
set tool_prefix "genode-arm-"
}
if {[have_spec x86]} {
set tool_prefix "genode-x86-"
}
if {[have_spec arm]} { set tool_prefix "genode-arm-" }
if {[have_spec x86]} { set tool_prefix "genode-x86-" }
#
# Uncomment the following line when working on the GDB source code. Otherwise,
@ -20,32 +26,16 @@ if {[have_spec x86]} {
#exec rm -rf noux-pkg/[noux_gdb_pkg_name]/ bin/[noux_gdb_pkg_name]/
set build_components {
core init drivers/timer noux lib/libc_noux
drivers/framebuffer drivers/input drivers/usb
server/terminal server/terminal_crosslink
server/terminal_crosslink
app/gdb_monitor
}
lappend build_components "lib/gdbserver_platform-$::env(KERNEL)"
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
lappend_if [have_spec gpio] build_components drivers/gpio
lappend_if [have_spec nova] build_components lib/ld/nova
lappend_if [have_spec foc] build_components lib/ld/foc
lappend build_components noux-pkg/[noux_gdb_pkg_name]
# the application to be debugged with GDB
lappend build_components test/gdb_monitor
set gdb_target_binary_name test-gdb_monitor
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
# GDB loads symbols from 'debug/ld.lib.so'
@ -82,67 +72,47 @@ append config {
<service name="IO_PORT"/>
<service name="IO_MEM"/>
</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>
append_if [have_spec sdl] config {
<start name="fb_sdl">
<resource name="RAM" quantum="4M"/>
<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="Input"/>
<service name="Framebuffer"/>
<service name="Input"/> <service name="Framebuffer"/>
</provides>
</start>}
append_platform_drv_config
append_if [have_spec framebuffer] config {
<start name="fb_drv" caps="200">
<resource name="RAM" quantum="4M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></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 [expr ![have_spec ps2] && [have_spec usb]] config {
<start name="usb_drv">
<resource name="RAM" quantum="12M"/>
<provides><service name="Input"/></provides>
<config uhci="yes" ehci="yes" xhci="yes"> <hid/> </config>
</start>}
append config {
</start>
<start name="terminal_noux">
<binary name="terminal"/>
<resource name="RAM" quantum="2M"/>
<provides><service name="Terminal"/></provides>
<config>
<keyboard layout="de"/>
</config>
<route>
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="terminal_gdb">
<binary name="terminal_crosslink"/>
<resource name="RAM" quantum="1M"/>
<provides> <service name="Terminal"/> </provides>
</start>
<start name="gdb_monitor" caps="200">
<resource name="RAM" quantum="16M"/>
<route>
@ -224,23 +194,15 @@ proc binary_name_gdbserver_platform_lib_so { } {
return "gdbserver_platform-$::env(KERNEL).lib.so"
}
# generic modules
append boot_modules {
core init timer ld.lib.so noux terminal terminal_crosslink
posix.lib.so libc.lib.so libm.lib.so ncurses.lib.so expat.lib.so
libc_noux.lib.so libc_pipe.lib.so libc_terminal.lib.so
set boot_modules {
terminal_crosslink
expat.lib.so
libc_pipe.lib.so libc_terminal.lib.so
gdb_monitor gdbserver_platform.lib.so test-gdb_monitor
test-gdb_monitor.tar test-gdb_monitor-src.tar
} [noux_gdb_pkg_name].tar
}
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec framebuffer] boot_modules fb_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec usb] boot_modules usb_drv
lappend_if [have_spec gpio] boot_modules [gpio_drv]
append_platform_drv_boot_modules
lappend boot_modules [noux_gdb_pkg_name].tar
build_boot_image $boot_modules

View File

@ -1,87 +1,73 @@
set build_components {
core init drivers/timer noux/minimal lib/libc_noux
drivers/framebuffer drivers/input
server/terminal server/ram_fs
test/libports/ncurses
}
set use_usb_input [expr ![have_spec ps2] && ![have_spec sdl] && [have_spec usb]]
create_boot_directory
lappend_if $use_usb_input build_components drivers/usb
import_from_depot genodelabs/src/[base_src] \
genodelabs/pkg/[drivers_interactive_pkg] \
genodelabs/pkg/terminal \
genodelabs/src/init \
genodelabs/src/libc \
genodelabs/src/noux \
genodelabs/src/posix \
genodelabs/src/bash \
genodelabs/src/ncurses \
genodelabs/src/coreutils \
genodelabs/src/ram_fs
#
# Build Noux packages only once
#
set noux_pkgs {bash coreutils make}
set noux_pkgs {make}
set build_components { }
foreach pkg $noux_pkgs {
lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg }
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
install_config {
<config verbose="yes">
<parent-provides>
<service name="ROM"/>
<service name="LOG"/>
<service name="RM"/>
<service name="CPU"/>
<service name="PD"/>
<service name="IRQ"/>
<service name="IO_PORT"/>
<service name="IO_MEM"/>
</parent-provides>
append config {
<config verbose="yes">
<parent-provides>
<service name="ROM"/>
<service name="LOG"/>
<service name="RM"/>
<service name="CPU"/>
<service name="PD"/>
<service name="IRQ"/>
<service name="IO_PORT"/>
<service name="IO_MEM"/>
</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> }
<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>}
<default caps="100"/>
append_if $use_usb_input config {
<start name="usb_drv">
<resource name="RAM" quantum="12M"/>
<provides><service name="Input"/></provides>
<config uhci="yes" ehci="no" xhci="no"> <hid/> </config>
</start> }
append_platform_drv_config
append_if [have_spec framebuffer] config {
<start name="fb_drv" caps="200">
<resource name="RAM" quantum="4M"/>
<provides><service name="Framebuffer"/></provides>
</start>}
append_if [have_spec ps2] config {
<start name="ps2_drv">
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></provides>
</start> }
<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="Input"/> <service name="Framebuffer"/>
</provides>
</start>
append config {
<start name="terminal">
<resource name="RAM" quantum="2M"/>
<provides><service name="Terminal"/></provides>
<config>
<keyboard layout="de"/>
</config>
<route>
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="ram_fs">
<resource name="RAM" quantum="10M"/>
<provides><service name="File_system"/></provides>
@ -113,19 +99,17 @@ echo "$1"
<policy label="noux -> home" root="/home/user" writeable="yes" />
</config>
</start>
<start name="noux" caps="500">
<resource name="RAM" quantum="1G" />
<config>
<fstab> }
foreach pkg $noux_pkgs {
append config " <tar name=\"$pkg.tar\" />" }
append config {
<fstab>
<tar name="coreutils.tar" />
<tar name="bash.tar" />
<tar name="make.tar" />
<dir name="bin"> <symlink name="sh" target="bash"/> </dir>
<dir name="home"> <fs label="home" /> </dir>
<dir name="ram"> <fs label="root" /> </dir>
</fstab>
<start name="/bin/bash">
<env name="TERM" value="screen" />
@ -134,32 +118,8 @@ append config {
</start>
</config>
</start>
</config>
}
install_config $config
#
# Boot modules
#
# generic modules
set boot_modules {
core init timer ld.lib.so noux terminal ram_fs posix.lib.so
libc.lib.so libm.lib.so libc_noux.lib.so ncurses.lib.so }
foreach pkg $noux_pkgs { lappend boot_modules "$pkg.tar" }
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec framebuffer] boot_modules fb_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if $use_usb_input boot_modules usb_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules
</config> }
build_boot_image { make.tar }
run_genode_until forever

View File

@ -6,81 +6,68 @@
#
# The test shows two framebuffer terminals. The upper terminal runs an
# interatctive shell and the lower terminal can be accessed from the shell via
# interactive shell and the lower terminal can be accessed from the shell via
# /dev/terminal.
#
# Example for writing to the lower terminal: echo "test" > /dev/terminal
# Example for reading a line from the lower terminal: head -n 1 /dev/terminal
#
set build_components {
core init drivers/timer noux lib/libc_noux
drivers/framebuffer drivers/input
server/terminal server/ram_fs server/nitpicker app/pointer
server/nit_fb
}
#
# Build Noux packages only once
#
foreach pkg {bash coreutils} {
lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg }
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
append config {
<config verbose="yes">
<parent-provides>
<service name="ROM"/>
<service name="LOG"/>
<service name="RM"/>
<service name="CPU"/>
<service name="PD"/>
<service name="IRQ"/>
<service name="IO_PORT"/>
<service name="IO_MEM"/>
</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> }
import_from_depot genodelabs/src/[base_src] \
genodelabs/pkg/[drivers_interactive_pkg] \
genodelabs/pkg/terminal \
genodelabs/src/init \
genodelabs/src/nitpicker \
genodelabs/src/nit_fb \
genodelabs/src/libc \
genodelabs/src/noux \
genodelabs/src/posix \
genodelabs/src/ncurses \
genodelabs/src/bash \
genodelabs/src/coreutils \
genodelabs/src/ram_fs
append_if [have_spec sdl] config {
<start name="fb_drv">
<binary name="fb_sdl"/>
<resource name="RAM" quantum="4M"/>
install_config {
<config verbose="yes">
<parent-provides>
<service name="ROM"/>
<service name="LOG"/>
<service name="RM"/>
<service name="CPU"/>
<service name="PD"/>
<service name="IRQ"/>
<service name="IO_PORT"/>
<service name="IO_MEM"/>
</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="Input"/>
<service name="Framebuffer"/>
<service name="Input"/> <service name="Framebuffer"/>
</provides>
</start> }
</start>
append_platform_drv_config
append_if [have_spec framebuffer] config {
<start name="fb_drv" caps="200">
<resource name="RAM" quantum="4M"/>
<provides><service name="Framebuffer"/></provides>
</start> }
append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></provides>
</start> }
append config {
<start name="nitpicker">
<resource name="RAM" quantum="1M"/>
<resource name="RAM" quantum="2M"/>
<provides><service name="Nitpicker"/></provides>
<config>
<domain name="pointer" layer="1" content="client" label="no" origin="pointer" />
@ -88,19 +75,17 @@ append config {
<policy label_prefix="pointer" domain="pointer"/>
<default-policy domain="default"/>
</config>
<route> }
append_if [have_spec ps2] config {
<service name="Input"><child name="ps2_drv"/></service> }
append_if [have_spec sdl] config {
<service name="Input"><child name="fb_drv"/> </service>}
append config {
<service name="Framebuffer"><child name="fb_drv"/> </service>
<route>
<service name="Input"> <child name="drivers"/> </service>
<service name="Framebuffer"><child name="drivers"/> </service>
<any-service><parent/><any-child/></any-service>
</route>
</start>
<start name="pointer">
<resource name="RAM" quantum="1M"/>
</start>
<start name="terminal_noux_fb">
<binary name="nit_fb"/>
<resource name="RAM" quantum="2M"/>
@ -110,6 +95,7 @@ append config {
</provides>
<config xpos="0" ypos="0" width="1024" height="380" refresh_rate="25"/>
</start>
<start name="terminal_test_fb">
<binary name="nit_fb"/>
<resource name="RAM" quantum="2M"/>
@ -119,32 +105,31 @@ append config {
</provides>
<config xpos="0" ypos="388" width="1024" height="380" refresh_rate="25"/>
</start>
<start name="terminal_noux">
<binary name="terminal"/>
<resource name="RAM" quantum="2M"/>
<provides><service name="Terminal"/></provides>
<route>
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
<service name="Input"><child name="terminal_noux_fb"/></service>
<service name="Framebuffer"><child name="terminal_noux_fb"/> </service>
<any-service><parent/><any-child/></any-service>
</route>
<config>
<keyboard layout="de"/>
</config>
</start>
<start name="terminal_test">
<binary name="terminal"/>
<resource name="RAM" quantum="2M"/>
<provides><service name="Terminal"/></provides>
<route>
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
<service name="Input"><child name="terminal_test_fb"/></service>
<service name="Framebuffer"><child name="terminal_test_fb"/> </service>
<any-service><parent/><any-child/></any-service>
</route>
<config>
<keyboard layout="de"/>
</config>
</start>
<start name="ram_fs">
<resource name="RAM" quantum="10M"/>
<provides><service name="File_system"/></provides>
@ -153,6 +138,7 @@ append config {
<policy label="noux -> root" root="/" />
</config>
</start>
<start name="noux" caps="300">
<resource name="RAM" quantum="1G" />
<route>
@ -175,32 +161,8 @@ append config {
</start>
</config>
</start>
</config>
}
</config> }
install_config $config
#
# Boot modules
#
# generic modules
set boot_modules {
core init timer ld.lib.so noux terminal ram_fs nitpicker nit_fb pointer
libc.lib.so libm.lib.so libc_noux.lib.so posix.lib.so
bash.tar coreutils.tar
}
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec framebuffer] boot_modules fb_drv
lappend_if [have_spec ps2] boot_modules ps2_drv
append_platform_drv_boot_modules
build_boot_image $boot_modules
# bash.tar is really huge when built for x86_64
build_boot_image { }
run_genode_until forever

View File

@ -7,47 +7,23 @@ if {[have_spec linux]} {
exit 0
}
proc gpio_drv { } { if {[have_spec rpi] && [have_spec hw]} { return hw_gpio_drv }
if {[have_spec rpi] && [have_spec foc]} { return foc_gpio_drv }
return gpio_drv }
#
# On OMAP4 where no PS/2 is available, we rely on USB HID
#
proc use_usb_input { } { return [expr ![have_spec ps2] && [have_spec usb]] }
#
# Uncomment the following line when working on the VIM source code. Otherwise,
# the package may get recompiled, yet it does not get reinstalled into 'bin/'.
#
#exec rm -rf noux-pkg/bash bin/bash
set build_components {
core init drivers/timer noux/minimal lib/libc_noux
drivers/framebuffer drivers/input
server/terminal server/ram_fs server/trace_fs
test/libports/ncurses
lib/trace/policy/rpc_name
}
lappend_if [use_usb_input] build_components drivers/usb
lappend_if [have_spec gpio] build_components drivers/gpio
set noux_pkgs "bash coreutils grep vim"
#
# Build Noux packages only once
#
foreach pkg $noux_pkgs {
lappend_if [expr ![file exists bin/$pkg]] build_components noux-pkg/$pkg }
source ${genode_dir}/repos/base/run/platform_drv.inc
append_platform_drv_build_components
build $build_components
create_boot_directory
import_from_depot genodelabs/src/[base_src] \
genodelabs/pkg/[drivers_interactive_pkg] \
genodelabs/pkg/terminal \
genodelabs/src/init \
genodelabs/src/libc \
genodelabs/src/noux \
genodelabs/src/posix \
genodelabs/src/ncurses \
genodelabs/src/vim \
genodelabs/src/bash \
genodelabs/src/grep \
genodelabs/src/coreutils \
genodelabs/src/ram_fs
# write default vimrc file
set vimrc_fd [open "bin/vimrc" w]
puts $vimrc_fd {
@ -59,7 +35,7 @@ set noswapfile
set viminfo=}
close $vimrc_fd
append config {
install_config {
<config verbose="yes">
<parent-provides>
<service name="ROM"/>
@ -72,69 +48,49 @@ append config {
<service name="IO_MEM"/>
<service name="TRACE"/>
</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>
append_if [have_spec sdl] config {
<start name="fb_sdl">
<resource name="RAM" quantum="4M"/>
<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="Input"/>
<service name="Framebuffer"/>
<service name="Input"/> <service name="Framebuffer"/>
</provides>
</start>}
</start>
append_platform_drv_config
append_if [have_spec framebuffer] config {
<start name="fb_drv" caps="200">
<resource name="RAM" quantum="4M"/>
<provides><service name="Framebuffer"/></provides>
<config width="640" height="480" />
</start>}
append_if [have_spec ps2] config {
<start name="ps2_drv">
<resource name="RAM" quantum="1M"/>
<provides><service name="Input"/></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 [use_usb_input] config {
<start name="usb_drv">
<resource name="RAM" quantum="12M"/>
<provides><service name="Input"/></provides>
<config uhci="yes" ehci="yes" xhci="yes"> <hid/> </config>
</start> }
append config {
<start name="terminal">
<resource name="RAM" quantum="2M"/>
<provides><service name="Terminal"/></provides>
<config>
<keyboard layout="us"/>
<font size="12" />
</config>
<route>
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="trace_fs">
<start name="trace_fs" caps="200">
<resource name="RAM" quantum="128M"/>
<provides><service name="File_system"/></provides>
<config>
<policy label="noux -> trace" root="/" interval="1000" subject_limit="512" trace_quota="64M" parent_levels="0" />
<policy label="noux -> trace" root="/" interval="1000"
subject_limit="512" trace_quota="64M" parent_levels="0" />
</config>
</start>
<start name="ram_fs">
<resource name="RAM" quantum="32M"/>
<provides><service name="File_system"/></provides>
@ -156,28 +112,29 @@ append config {
<policy label="noux -> tmp" root="/tmp" writeable="yes" />
</config>
</start>
<start name="noux" caps="200">
<start name="noux" caps="2000">
<resource name="RAM" quantum="256M" />
<config>
<fstab> }
foreach pkg $noux_pkgs {
append config " <tar name=\"$pkg.tar\" />" }
append config {
<fstab>
<tar name="coreutils.tar" />
<tar name="vim.tar" />
<tar name="bash.tar" />
<tar name="grep.tar" />
<dir name="home"> <fs label="home" /> </dir>
<dir name="ram"> <fs label="root" /> </dir>
<dir name="tmp"> <fs label="tmp" /> </dir>
<dir name="trace"> <fs label="trace" /> </dir>
<dir name="dev">
<null /> <zero />
</dir>
<dir name="dev"> <null /> <zero /> </dir>
<dir name="share"> <dir name="vim"> <rom name="vimrc"/> </dir> </dir>
</fstab>
<start name="/bin/bash">
<env name="TERM" value="screen" />
<env name="HOME" value="/home" />
<arg value="--login" />
<!-- <arg value="-login" /> -->
</start>
</config>
<route>
@ -194,37 +151,9 @@ append config {
</start>
</config>}
install_config $config
#
# Boot modules
#
# generic modules
set boot_modules {
core init timer ld.lib.so noux terminal ram_fs
libc.lib.so libm.lib.so libc_noux.lib.so posix.lib.so
ncurses.lib.so pcre.lib.so zlib.lib.so readline.lib.so
trace_fs
rpc_name
}
foreach pkg $noux_pkgs {
append boot_modules " $pkg.tar " }
# platform-specific modules
lappend_if [have_spec linux] boot_modules fb_sdl
lappend_if [have_spec ps2] boot_modules ps2_drv
lappend_if [have_spec framebuffer] boot_modules fb_drv
lappend_if [use_usb_input ] boot_modules usb_drv
lappend_if [have_spec gpio] boot_modules [gpio_drv]
append_platform_drv_boot_modules
build_boot_image $boot_modules
build { server/trace_fs lib/trace/policy/rpc_name }
build_boot_image { vimrc trace_fs rpc_name }
run_genode_until forever

View File

@ -2,10 +2,10 @@ create_boot_directory
import_from_depot genodelabs/src/[base_src] \
genodelabs/pkg/[drivers_interactive_pkg] \
genodelabs/pkg/terminal \
genodelabs/src/init \
genodelabs/src/libc \
genodelabs/src/noux \
genodelabs/src/terminal \
genodelabs/src/posix \
genodelabs/src/ncurses \
genodelabs/src/vim
@ -50,7 +50,10 @@ install_config {
<start name="terminal">
<resource name="RAM" quantum="2M"/>
<provides><service name="Terminal"/></provides>
<config> <keyboard layout="none"/> </config>
<route>
<service name="ROM" label="config"> <parent label="terminal.config"/> </service>
<any-service> <parent/> <any-child/> </any-service>
</route>
</start>
<start name="noux" caps="1000">