2016-12-09 22:09:17 +00:00
|
|
|
proc binary_name_ld_lib_so { } { return "ld-okl4.lib.so" }
|
2021-02-19 14:23:49 +00:00
|
|
|
proc binary_name_core_a { } { return "core-okl4.a" }
|
2024-05-30 13:46:57 +00:00
|
|
|
proc binary_name_timer { } { return "pit_timer" }
|
2016-12-09 22:09:17 +00:00
|
|
|
|
2017-04-03 13:39:36 +00:00
|
|
|
proc kernel_files { } { return okl4 }
|
|
|
|
|
2023-02-07 20:36:56 +00:00
|
|
|
proc boot_output { } { return "serial" }
|
2016-12-09 22:09:17 +00:00
|
|
|
|
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
|
|
|
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">
|
2015-10-19 18:07:56 +00:00
|
|
|
<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>
|
|
|
|
|
2016-09-15 14:08:33 +00:00
|
|
|
<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
|
|
|
|
2015-02-06 17:02:55 +00:00
|
|
|
proc run_boot_string { } {
|
2016-07-13 12:19:57 +00:00
|
|
|
return "\n\r\033\\\[1m\033\\\[33mOKL4 -"
|
2015-02-06 17:02:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-09-15 14:08:33 +00:00
|
|
|
proc core_link_address { } { return "0x03000000" }
|
|
|
|
|
|
|
|
|
2019-05-07 14:06:01 +00:00
|
|
|
proc elfweaver {} {
|
build: support library builds via lib/<libname>
This patch adds special handling for lib/<libname> arguments to the
build system, which supersedes the former LIB=<libname> mechanism.
Whereas the old mechanism was limited to a single library, the new
convention allows multiple library arguments, similar to regular
targets. The change brings the two immediate benefits.
First, the streamlining of library and target arguments allows for the
building of libraries via the 'build' command of the run tool.
Second, it alleviates the need for pseudo target.mk files for building
shared libraries that have no direct dependencies, in particular VFS
plugins.
Since this change eases the explicit creation of shared libraries
from run scripts, we may reconsider the automatic implicit building
of shared libraries driven by targets. E.g., while developing a Qt
application, a run script could import the Qt libraries from the
depot and combine those with the developed (fresh built) target without
triggering the build of the Qt libraries in the build directory.
When issueing 'make' without arguments, all targets are built. This
patch applies this behavior to libraries as well, thereby removing the
need for the base/src/lib/target.mk pseudo target as used by the CI
tools to build all libraries.
Note that target.mk files located under src/lib/ are no longer
reachable. Therefore, all run scripts that used to trigger the
build of a shared library via a pseudo target must be adapted.
E.g., 'build lib/vfs/tap' must be replaced by 'build lib/vfs_tap'.
With this patch, the LIB=<libname> option is no longer supported.
Fixes #4599
2022-08-31 14:50:07 +00:00
|
|
|
if { ![file exists tool/okl4/elfweaver] } { build lib/tools }
|
2019-05-07 14:06:01 +00:00
|
|
|
return tool/okl4/elfweaver
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2016-12-09 22:09:17 +00:00
|
|
|
global weaver_xml_template
|
2011-12-22 15:19:25 +00:00
|
|
|
|
|
|
|
#
|
2017-04-03 13:39:36 +00:00
|
|
|
# Build kernel and dynamic linker if needed
|
2011-12-22 15:19:25 +00:00
|
|
|
#
|
2017-04-03 13:39:36 +00:00
|
|
|
set kernel_arg ""
|
2022-02-08 15:46:21 +00:00
|
|
|
|
|
|
|
if {![file exists [run_dir]/genode/okl4]} { set kernel_arg kernel/okl4 }
|
|
|
|
|
|
|
|
set targets "$kernel_arg"
|
|
|
|
|
2017-04-03 13:39:36 +00:00
|
|
|
if {[llength $targets]} { build $targets }
|
2022-02-08 15:46:21 +00:00
|
|
|
|
2021-04-14 08:10:25 +00:00
|
|
|
if {$kernel_arg != ""} { copy_file bin/okl4 [run_dir]/genode/okl4 }
|
2016-12-09 22:09:17 +00:00
|
|
|
|
|
|
|
build_core_image $binaries
|
|
|
|
exec mv [run_dir]/image.elf [run_dir].image
|
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>}
|
2017-04-03 13:39:36 +00:00
|
|
|
regsub okl4_kernel $weaver_xml_template "[run_dir]/genode/okl4" weaver_xml_template
|
2017-12-12 19:54:29 +00:00
|
|
|
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
|
|
|
|
#
|
2019-05-07 14:06:01 +00:00
|
|
|
set ret [exec [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
|
|
|
|
#
|
2018-05-16 09:03:59 +00:00
|
|
|
remove_genode_dir
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2018-05-02 16:26:59 +00:00
|
|
|
exec mkdir -p [run_dir]/boot
|
|
|
|
exec mv [run_dir]/image.elf [run_dir]/boot/image.elf
|
|
|
|
|
2015-01-08 21:08:48 +00:00
|
|
|
if {[have_include "image/iso"] || [have_include "image/disk"]} {
|
2017-09-20 20:56:00 +00:00
|
|
|
|
|
|
|
if {[have_include "image/disk"]} {
|
2023-01-27 07:05:29 +00:00
|
|
|
install_disk_bootloader_to_run_dir
|
2017-09-20 20:56:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if {[have_include "image/iso"]} {
|
|
|
|
install_iso_bootloader_to_run_dir
|
|
|
|
}
|
2015-01-08 21:08:48 +00:00
|
|
|
|
|
|
|
#
|
2023-01-27 07:20:58 +00:00
|
|
|
# Generate GRUB2 config file
|
2015-01-08 21:08:48 +00:00
|
|
|
#
|
2023-01-27 07:20:58 +00:00
|
|
|
set fh [create_header_grub2_config]
|
|
|
|
|
2015-01-08 21:08:48 +00:00
|
|
|
# The core binary is part of the 'binaries' list but it must
|
|
|
|
# appear right after 'sigma0' as boot module. Hence the special case.
|
|
|
|
#
|
2017-09-20 20:56:00 +00:00
|
|
|
puts $fh "menuentry 'Genode on OKL4' {"
|
|
|
|
puts $fh " insmod multiboot"
|
2023-02-07 20:36:56 +00:00
|
|
|
puts $fh " multiboot /boot/bender [boot_output]"
|
2018-05-02 16:26:59 +00:00
|
|
|
puts $fh " module /boot/image.elf"
|
2017-09-20 20:56:00 +00:00
|
|
|
puts $fh "}"
|
2015-01-08 21:08:48 +00:00
|
|
|
close $fh
|
|
|
|
}
|
2013-03-25 09:21:13 +00:00
|
|
|
|
|
|
|
#
|
2015-01-08 21:08:48 +00:00
|
|
|
# Build image
|
2013-03-25 09:21:13 +00:00
|
|
|
#
|
2015-01-08 21:08:48 +00:00
|
|
|
run_image
|
2013-06-14 08:59:52 +00:00
|
|
|
|
2015-01-08 21:08:48 +00:00
|
|
|
if {[have_include "load/tftp"]} {
|
|
|
|
#
|
|
|
|
# Install PXE bootloader pulsar
|
|
|
|
#
|
|
|
|
install_pxe_bootloader_to_run_dir
|
2013-03-25 09:21:13 +00:00
|
|
|
|
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"
|
2023-02-07 20:36:56 +00:00
|
|
|
puts $fh " exec /boot/bender [boot_output]"
|
2018-05-02 16:26:59 +00:00
|
|
|
puts $fh " load /boot/image.elf"
|
2013-03-25 09:21:13 +00:00
|
|
|
close $fh
|
2011-12-22 15:19:25 +00:00
|
|
|
|
2015-01-08 21:08:48 +00:00
|
|
|
generate_tftp_config
|
2013-04-08 08:43:05 +00:00
|
|
|
}
|
2013-03-25 09:21:06 +00:00
|
|
|
}
|
2017-03-29 14:04:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
# Base source archive within depot
|
|
|
|
#
|
2018-04-16 11:33:20 +00:00
|
|
|
proc base_src { } {
|
2017-03-29 14:04:07 +00:00
|
|
|
|
2018-04-16 11:33:20 +00:00
|
|
|
if {[have_spec x86_32]} { return base-okl4 }
|
|
|
|
|
|
|
|
global specs
|
|
|
|
|
|
|
|
puts stderr "Test requires base-okl4 kernel archive, which is missing for this build configuration"
|
|
|
|
puts stderr " SPECS=\"$specs\""
|
|
|
|
exit 0
|
|
|
|
}
|