genode/tool/run/boot_dir/okl4

210 lines
5.1 KiB
Plaintext
Raw Normal View History

proc binary_name_ld_lib_so { } { return "ld-okl4.lib.so" }
Disambiguate kernel-specific file names This patch removes possible ambiguities with respect to the naming of kernel-dependent binaries and libraries. It also removes the use of kernel-specific global side effects from the build system. The reach of kernel-specific peculiarities has thereby become limited to the actual users of the respective 'syscall-<kernel>' libraries. Kernel-specific build artifacts are no longer generated at magic places within the build directory (like okl4's includes, or the L4 build directories of L4/Fiasco and Fiasco.OC, or the build directories of various kernels). Instead, such artifacts have been largely moved to the libcache. E.g., the former '<build-dir>/l4/' build directory for the L4 build system resides at '<build-dir>/var/libcache/syscall-foc/build/'. This way, the location is unique to the kernel. Note that various tools are still generated somewhat arbitrarily under '<build-dir>/tool/' as there is no proper formalism for building host tools yet. As the result of this work, it has become possible to use a joint Genode build directory that is usable with all kernels of a given hardware platform. E.g., on x86_32, one can now seamlessly switch between linux, nova, sel4, okl4, fiasco, foc, and pistachio without rebuilding any components except for core, the kernel, the dynamic linker, and the timer driver. At the current stage, such a build directory must still be created manually. A change of the 'create_builddir' tool will follow to make this feature easily available. This patch also simplifies various 'run/boot_dir' plugins by removing the option for an externally hosted kernel. This option remained unused for many years now. Issue #2190
2016-12-10 00:30:38 +00:00
proc binary_name_core_o { } { return "okl4/core.o" }
proc binary_name_timer { } { return "pit_timer_drv" }
2011-12-22 15:19:25 +00:00
##
# Get the base-okl4 repository
#
proc base_okl4_dir {} { return [repository_contains mk/spec-okl4.mk] }
2015-01-08 21:08:48 +00:00
2011-12-22 15:19:25 +00:00
##
# Read the location of the OKL4 directory from 'etc/okl4.conf'
#
proc okl4_dir { } {
global _okl4_dir
if {![info exists _okl4_dir]} {
if {[file exists etc/okl4.conf]} {
set _okl4_dir [exec sed -n "/^OKL4_DIR/s/^.*=\\s*//p" etc/okl4.conf]
if {[file exists $_okl4_dir]} { return $_okl4_dir }
}
set _okl4_dir [base_okl4_dir]/contrib/okl4
}
return $_okl4_dir
}
2015-01-08 21:08:48 +00:00
2011-12-22 15:19:25 +00:00
##
# Return whether okl4 kernel is provided from the outside
#
proc okl4_external { } {
if {"[okl4_dir]" == "[base_okl4_dir]/contrib/okl4"} { return 0 }
return 1
}
set weaver_xml_template {
<machine>
<word_size size="0x20" />
<virtual_memory name="virtual">
<region base="0x120000" size="0x3fe00000" />
</virtual_memory>
<physical_memory name="system_dram">
<region base="0x0" size="0xa000" type="dedicated" />
</physical_memory>
<physical_memory name="bios">
<region base="0xf0000" size="0x10000" type="dedicated" />
</physical_memory>
<physical_memory name="rom_expansion">
<region base="0x100000" size="0x1800000" type="dedicated" />
</physical_memory>
<physical_memory name="physical">
<region base="0x2000000" size="0x30000000" type="conventional" />
2011-12-22 15:19:25 +00:00
</physical_memory>
<phys_device name="timer_dev">
<interrupt name="int_timer0" number="0" />
</phys_device>
<phys_device name="serial_dev">
<interrupt name="int_serial0" number="4" />
</phys_device>
<phys_device name="rtc_dev">
</phys_device>
<page_size size="0x1000" />
<page_size size="0x400000" />
</machine>
<physical_pool name="system_dram" direct="true">
<memory src="system_dram" />
</physical_pool>
<virtual_pool name="virtual">
<memory src="virtual" />
</virtual_pool>
<physical_pool name="bios" direct="true">
<memory src="bios" />
</physical_pool>
<physical_pool name="rom_expansion" direct="true">
<memory src="rom_expansion" />
</physical_pool>
<physical_pool name="physical" direct="true">
<memory src="physical" />
</physical_pool>
<kernel file="okl4_kernel" xip="false" >
<dynamic max_threads="0x400" />
<config>
<option key="root_caps" value="4096"/>
</config>
</kernel>
<rootprogram file="core" virtpool="virtual" physpool="physical" direct="true" />
2011-12-22 15:19:25 +00:00
}
2015-01-08 21:08:48 +00:00
proc run_boot_string { } {
return "\n\r\033\\\[1m\033\\\[33mOKL4 -"
}
proc core_link_address { } { return "0x03000000" }
2015-01-08 21:08:48 +00:00
##
# Populate directory with binaries on OKL4
#
proc run_boot_dir {binaries} {
2011-12-22 15:19:25 +00:00
global weaver_xml_template
2011-12-22 15:19:25 +00:00
#
# Build kernel if needed
#
# Once the kernel is exists, it gets never revisited automatically.
# Consequently, when changing the kernel sources, the kernel build must be
# issued explicitly via 'make kernel'. This way, the rare case of changing
# the kernel does not stand in the way of the everyday's work flow of
# executing run scripts as quick as possible.
#
Disambiguate kernel-specific file names This patch removes possible ambiguities with respect to the naming of kernel-dependent binaries and libraries. It also removes the use of kernel-specific global side effects from the build system. The reach of kernel-specific peculiarities has thereby become limited to the actual users of the respective 'syscall-<kernel>' libraries. Kernel-specific build artifacts are no longer generated at magic places within the build directory (like okl4's includes, or the L4 build directories of L4/Fiasco and Fiasco.OC, or the build directories of various kernels). Instead, such artifacts have been largely moved to the libcache. E.g., the former '<build-dir>/l4/' build directory for the L4 build system resides at '<build-dir>/var/libcache/syscall-foc/build/'. This way, the location is unique to the kernel. Note that various tools are still generated somewhat arbitrarily under '<build-dir>/tool/' as there is no proper formalism for building host tools yet. As the result of this work, it has become possible to use a joint Genode build directory that is usable with all kernels of a given hardware platform. E.g., on x86_32, one can now seamlessly switch between linux, nova, sel4, okl4, fiasco, foc, and pistachio without rebuilding any components except for core, the kernel, the dynamic linker, and the timer driver. At the current stage, such a build directory must still be created manually. A change of the 'create_builddir' tool will follow to make this feature easily available. This patch also simplifies various 'run/boot_dir' plugins by removing the option for an externally hosted kernel. This option remained unused for many years now. Issue #2190
2016-12-10 00:30:38 +00:00
if {![okl4_external] && ![file exists bin/okl4]} {
build { lib/ld/okl4 kernel/okl4 }
} else {
build { lib/ld/okl4 }
}
build_core_image $binaries
exec mv [run_dir]/image.elf [run_dir].image
2011-12-22 15:19:25 +00:00
Disambiguate kernel-specific file names This patch removes possible ambiguities with respect to the naming of kernel-dependent binaries and libraries. It also removes the use of kernel-specific global side effects from the build system. The reach of kernel-specific peculiarities has thereby become limited to the actual users of the respective 'syscall-<kernel>' libraries. Kernel-specific build artifacts are no longer generated at magic places within the build directory (like okl4's includes, or the L4 build directories of L4/Fiasco and Fiasco.OC, or the build directories of various kernels). Instead, such artifacts have been largely moved to the libcache. E.g., the former '<build-dir>/l4/' build directory for the L4 build system resides at '<build-dir>/var/libcache/syscall-foc/build/'. This way, the location is unique to the kernel. Note that various tools are still generated somewhat arbitrarily under '<build-dir>/tool/' as there is no proper formalism for building host tools yet. As the result of this work, it has become possible to use a joint Genode build directory that is usable with all kernels of a given hardware platform. E.g., on x86_32, one can now seamlessly switch between linux, nova, sel4, okl4, fiasco, foc, and pistachio without rebuilding any components except for core, the kernel, the dynamic linker, and the timer driver. At the current stage, such a build directory must still be created manually. A change of the 'create_builddir' tool will follow to make this feature easily available. This patch also simplifies various 'run/boot_dir' plugins by removing the option for an externally hosted kernel. This option remained unused for many years now. Issue #2190
2016-12-10 00:30:38 +00:00
exec cp bin/okl4 [run_dir]/kernel
2011-12-22 15:19:25 +00:00
#
# Generate ELF weaver config
#
set fh [open "[run_dir].weaver.xml" "WRONLY CREAT TRUNC"]
puts $fh {<?xml version="1.0"?>}
puts $fh {<!DOCTYPE image SYSTEM "weaver-1.1.dtd">}
puts $fh {<image>}
regsub okl4_kernel $weaver_xml_template "[run_dir]/kernel" weaver_xml_template
regsub core $weaver_xml_template "[run_dir].image" weaver_xml_template
2011-12-22 15:19:25 +00:00
puts $fh $weaver_xml_template
puts $fh {</image>}
close $fh
#
# Run ELF Weaver to create a boot image
#
set ret [exec "./tool/okl4/elfweaver" merge --output "[run_dir]/image.elf" "[run_dir].weaver.xml"]
2011-12-22 15:19:25 +00:00
if {[regexp "error" $ret dummy]} {
puts stderr "Elfweaver failed: $ret"
exit -6
}
exec [cross_dev_prefix]strip [run_dir]/image.elf
#
# Keep only the ELF boot image, but remove stripped binaries
#
exec rm -rf [run_dir]/genode
2011-12-22 15:19:25 +00:00
2015-01-08 21:08:48 +00:00
if {[have_include "image/iso"] || [have_include "image/disk"]} {
#
# Install GRUB
#
install_iso_bootloader_to_run_dir
#
# Generate grub config file
#
# The core binary is part of the 'binaries' list but it must
# appear right after 'sigma0' as boot module. Hence the special case.
#
set fh [open "[run_dir]/boot/grub/menu.lst" "WRONLY CREAT TRUNC"]
puts $fh "timeout 0"
puts $fh "default 0"
puts $fh "hiddenmenu"
puts $fh "\ntitle Genode on OKL4"
puts $fh " kernel /boot/bender"
puts $fh " module /image.elf"
puts $fh " vbeset 0x117"
close $fh
}
#
2015-01-08 21:08:48 +00:00
# Build image
#
2015-01-08 21:08:48 +00:00
run_image
2015-01-08 21:08:48 +00:00
if {[have_include "load/tftp"]} {
#
# Install PXE bootloader pulsar
#
install_pxe_bootloader_to_run_dir
2015-01-08 21:08:48 +00:00
#
# Generate pulsar config file
#
set fh [open "[run_dir]/config-52-54-00-12-34-56" "WRONLY CREAT TRUNC"]
# load okl4 at 256M to avoid overwritting binary, adjust by need
puts $fh " addr 0x10000000"
puts $fh " exec /boot/bender"
puts $fh " load /image.elf"
close $fh
2011-12-22 15:19:25 +00:00
2015-01-08 21:08:48 +00:00
generate_tftp_config
}
}