2012-08-22 08:14:40 +00:00
|
|
|
#
|
|
|
|
# \brief Example for hosting the genode.org website on Genode
|
|
|
|
# \author Norman Feske
|
|
|
|
# \date 2012-08-16
|
|
|
|
#
|
2014-04-14 09:57:22 +00:00
|
|
|
# This run script uses the lighttpd web server to host the genode.org website.
|
|
|
|
# When executed the first time, the genode.org website is downloaded to
|
|
|
|
# 'bin/genode_org/website'. When the web server is up, you may point your web
|
|
|
|
# browser to http://localhost:5555
|
2012-08-22 08:14:40 +00:00
|
|
|
#
|
|
|
|
|
2015-02-24 13:53:15 +00:00
|
|
|
if {[have_spec hw_odroid_xu]} {
|
|
|
|
puts "Run script does not support this platform."
|
|
|
|
exit 0
|
|
|
|
}
|
|
|
|
|
2012-08-22 08:14:40 +00:00
|
|
|
set build_components {
|
|
|
|
core init
|
|
|
|
drivers/timer
|
|
|
|
app/lighttpd
|
|
|
|
}
|
|
|
|
|
2015-09-03 12:55:05 +00:00
|
|
|
set use_usb_driver [expr [have_spec omap4] || [have_spec arndale] || [have_spec rpi]]
|
2013-06-28 12:22:45 +00:00
|
|
|
set use_nic_driver [expr !$use_usb_driver]
|
2015-01-14 11:19:34 +00:00
|
|
|
|
2013-06-28 12:22:45 +00:00
|
|
|
if {$use_usb_driver} { set network_driver "usb_drv" }
|
|
|
|
if {$use_nic_driver} { set network_driver "nic_drv" }
|
|
|
|
|
|
|
|
lappend_if $use_usb_driver build_components drivers/usb
|
|
|
|
lappend_if $use_nic_driver build_components drivers/nic
|
2013-11-13 13:10:49 +00:00
|
|
|
lappend_if [have_spec gpio] build_components drivers/gpio
|
2012-09-05 10:04:00 +00:00
|
|
|
|
2015-06-08 07:05:32 +00:00
|
|
|
source ${genode_dir}/repos/base/run/platform_drv.inc
|
|
|
|
append_platform_drv_build_components
|
|
|
|
|
2012-08-22 08:14:40 +00:00
|
|
|
build $build_components
|
|
|
|
|
|
|
|
create_boot_directory
|
|
|
|
|
|
|
|
append config {
|
|
|
|
<config>
|
|
|
|
<parent-provides>
|
|
|
|
<service name="ROM"/>
|
|
|
|
<service name="LOG"/>
|
|
|
|
<service name="CAP"/>
|
|
|
|
<service name="RAM"/>
|
|
|
|
<service name="RM"/>
|
|
|
|
<service name="CPU"/>
|
|
|
|
<service name="PD"/>
|
|
|
|
<service name="IRQ"/>
|
|
|
|
<service name="IO_PORT"/>
|
|
|
|
<service name="IO_MEM"/>
|
|
|
|
<service name="SIGNAL"/>
|
|
|
|
</parent-provides>
|
|
|
|
<default-route>
|
|
|
|
<any-service> <parent/> <any-child/> </any-service>
|
|
|
|
</default-route>
|
|
|
|
<start name="timer">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides><service name="Timer"/></provides>
|
|
|
|
</start>}
|
|
|
|
|
2013-11-13 13:10:49 +00:00
|
|
|
append_if [have_spec gpio] config {
|
|
|
|
<start name="gpio_drv">
|
|
|
|
<resource name="RAM" quantum="4M"/>
|
|
|
|
<provides><service name="Gpio"/></provides>
|
|
|
|
<config/>
|
|
|
|
</start>}
|
|
|
|
|
2013-06-28 12:22:45 +00:00
|
|
|
append_if $use_usb_driver config {
|
2012-09-26 12:01:39 +00:00
|
|
|
<start name="usb_drv">
|
2012-09-17 14:01:07 +00:00
|
|
|
<resource name="RAM" quantum="12M"/>
|
2012-08-23 09:26:19 +00:00
|
|
|
<provides>
|
|
|
|
<service name="Nic"/>
|
|
|
|
</provides>
|
2013-05-22 09:38:16 +00:00
|
|
|
<config ehci="yes">
|
2014-04-22 09:50:56 +00:00
|
|
|
<nic mac="02:00:00:00:01:01" />
|
2012-08-23 09:26:19 +00:00
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
|
2013-06-28 12:22:45 +00:00
|
|
|
append_if $use_nic_driver config {
|
2012-08-22 08:14:40 +00:00
|
|
|
<start name="nic_drv">
|
|
|
|
<resource name="RAM" quantum="4M"/>
|
|
|
|
<provides><service name="Nic"/></provides>
|
2012-08-23 09:26:19 +00:00
|
|
|
</start>}
|
|
|
|
|
2015-06-08 07:05:32 +00:00
|
|
|
append_platform_drv_config
|
2013-06-28 12:22:45 +00:00
|
|
|
|
2012-08-23 09:26:19 +00:00
|
|
|
append config {
|
2012-08-22 08:14:40 +00:00
|
|
|
<start name="lighttpd">
|
|
|
|
<resource name="RAM" quantum="1G" />
|
|
|
|
<config>
|
|
|
|
<arg value="lighttpd" />
|
|
|
|
<arg value="-f" />
|
|
|
|
<arg value="/etc/lighttpd/lighttpd.conf" />
|
|
|
|
<arg value="-D" />
|
2014-04-14 09:57:22 +00:00
|
|
|
<libc stdin="/dev/null" stdout="/dev/log" stderr="/dev/log">
|
|
|
|
<vfs>
|
|
|
|
<dir name="dev">
|
|
|
|
<log/>
|
|
|
|
<null/>
|
|
|
|
</dir>
|
|
|
|
<tar name="genode_org.tar"/>
|
|
|
|
</vfs>
|
|
|
|
</libc>
|
2012-08-22 08:14:40 +00:00
|
|
|
</config>
|
|
|
|
</start>}
|
|
|
|
|
|
|
|
append config {
|
|
|
|
</config>}
|
|
|
|
|
|
|
|
install_config $config
|
|
|
|
|
|
|
|
#
|
|
|
|
# Create TAR archive containting the web-server configuration and the
|
|
|
|
# website content.
|
|
|
|
#
|
|
|
|
|
|
|
|
# lighttpd configuration
|
|
|
|
exec mkdir -p bin/genode_org/etc/lighttpd
|
|
|
|
set fd [open "bin/genode_org/etc/lighttpd/lighttpd.conf" w]
|
|
|
|
puts $fd {
|
|
|
|
server.port = 80
|
|
|
|
server.document-root = "/website"
|
|
|
|
server.event-handler = "select"
|
|
|
|
server.network-backend = "write"
|
|
|
|
server.max-keep-alive-requests = 0
|
|
|
|
index-file.names = ( "index", "index.html", "index.htm" )
|
|
|
|
mimetype.assign = (
|
|
|
|
".png" => "image/png",
|
|
|
|
".jpg" => "image/jpeg",
|
|
|
|
".jpeg" => "image/jpeg",
|
|
|
|
".gif" => "image/gif",
|
|
|
|
".css" => "text/css",
|
|
|
|
".html" => "text/html",
|
|
|
|
".htm" => "text/html",
|
|
|
|
"" => "text/html",
|
|
|
|
) }
|
|
|
|
close $fd
|
|
|
|
|
|
|
|
# mirror of genode.org website
|
|
|
|
if {![file exists bin/genode_org/website/index]} {
|
|
|
|
puts "mirroring genode.org website to bin/genode_org/website..."
|
|
|
|
exec mkdir -p bin/genode_org/website
|
|
|
|
|
|
|
|
# ignore wget errors
|
|
|
|
catch {
|
|
|
|
exec wget -nH -Lrc -P bin/genode_org/website http://genode.org
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
exec tar cfv bin/genode_org.tar -h -C bin/genode_org .
|
|
|
|
|
|
|
|
#
|
|
|
|
# Boot modules
|
|
|
|
#
|
|
|
|
|
|
|
|
# generic modules
|
|
|
|
set boot_modules {
|
2014-04-14 09:57:22 +00:00
|
|
|
core init timer ld.lib.so
|
|
|
|
libc.lib.so libm.lib.so
|
2012-08-23 09:26:19 +00:00
|
|
|
lwip.lib.so zlib.lib.so
|
2012-08-22 08:14:40 +00:00
|
|
|
lighttpd genode_org.tar
|
|
|
|
}
|
|
|
|
|
|
|
|
# platform-specific modules
|
2013-06-28 12:22:45 +00:00
|
|
|
lappend_if $use_usb_driver boot_modules usb_drv
|
|
|
|
lappend_if $use_nic_driver boot_modules nic_drv
|
2013-11-13 13:10:49 +00:00
|
|
|
lappend_if [have_spec gpio] boot_modules gpio_drv
|
2012-08-22 08:14:40 +00:00
|
|
|
|
2015-06-08 07:05:32 +00:00
|
|
|
append_platform_drv_boot_modules
|
|
|
|
|
2012-08-22 08:14:40 +00:00
|
|
|
build_boot_image $boot_modules
|
|
|
|
|
|
|
|
append_if [have_spec x86] qemu_args " -net nic,model=e1000 "
|
|
|
|
append_if [have_spec lan9118] qemu_args " -net nic,model=lan9118 "
|
|
|
|
|
|
|
|
append qemu_args " -net user -redir tcp:5555::80 "
|
|
|
|
append qemu_args " -nographic -serial mon:stdio "
|
|
|
|
|
|
|
|
run_genode_until forever
|