hw: map binaries of boot modules on demand

fix #1139
This commit is contained in:
Martin Stein
2014-05-05 12:15:31 +02:00
committed by Christian Helmuth
parent f8be04bc70
commit 8d43b67ca6
6 changed files with 119 additions and 117 deletions

View File

@@ -74,82 +74,77 @@ proc build_boot_image {binaries} {
# it depends on the individual run scenario.
#
set boot_modules "[run_dir]/boot_modules.s"
if { [have_spec {arm}] } {
set load_store_align_l2 2
set min_page_align_l2 12
# introduce boot module headers
exec echo -e \
"/**" \
"\n * This file was automatically generated by the procedure" \
"\n * 'build_boot_image' in 'base-hw/run/env'." \
"\n */" \
"\n" \
"\n /* core includes */" \
"\n.include \"macros.s\"" \
"\n" \
"\n_common_constants" \
"\n" \
"\n.section .data" \
"\n" \
"\n.p2align data_access_alignm_log2" \
"\n.global _boot_modules_headers_begin" \
"\n_boot_modules_headers_begin:" > $boot_modules
# introduce boot module headers
# generate header for each boot module except core
set i 1
foreach binary $binaries {
if {$binary == "core"} { continue }
exec echo -e \
"/**" \
"\n * This file was automatically generated by the procedure" \
"\n * 'build_boot_image' in 'base-hw/run/env'." \
"\n */" \
"\n" \
"\n.section .data" \
"\n" \
"\n.p2align ${load_store_align_l2}" \
"\n.global _boot_modules_begin" \
"\n_boot_modules_begin:" \
"\n.string \"GROM\"" \
"\n" \
"\n.p2align ${load_store_align_l2}" \
"\n.global _boot_module_headers_begin" \
"\n_boot_module_headers_begin:" > $boot_modules
# generate header for each boot module except core
set i 1
foreach binary $binaries {
if {$binary == "core"} { continue }
exec echo -e \
"\n.long mod${i}_name" \
"\n.long mod${i}_start" \
"\n.long mod${i}_end - mod${i}_start" >> $boot_modules
incr i
}
# end boot module headers
exec echo -e \
"\n.global _boot_module_headers_end" \
"\n_boot_module_headers_end:" \
"\n" >> $boot_modules
# generate name string for each module except core
set i 1
foreach binary $binaries {
if {$binary == "core"} { continue }
exec echo -e \
".p2align ${load_store_align_l2}" \
"\nmod${i}_name:" \
"\n.string \"${binary}\"" \
"\n.byte 0" \
"\n" >> $boot_modules
incr i
}
# include raw data of modules consecutively but page aligned
set i 1
foreach binary $binaries {
if {$binary == "core"} { continue }
exec echo -e \
".p2align ${min_page_align_l2}" \
"\nmod${i}_start:" \
"\n.incbin \"[run_dir]/genode/${binary}\"" \
"\nmod${i}_end:" \
"\n" >> $boot_modules
incr i
}
# end boot-modules file
exec echo -e \
".global _boot_modules_end" \
"\n_boot_modules_end:" >> $boot_modules
} else {
puts stderr "Error: Unknown architecture"
puts stderr " SPEC must contain one of: 'arm'"
exit -1
"\n.long _boot_module_${i}_name" \
"\n.long _boot_module_${i}_begin" \
"\n.long _boot_module_${i}_end - _boot_module_${i}_begin" \
>> $boot_modules
incr i
}
# end boot module headers
exec echo -e \
"\n.global _boot_modules_headers_end" \
"\n_boot_modules_headers_end:" >> $boot_modules
# generate name string for each module except core
set i 1
foreach binary $binaries {
if {$binary == "core"} { continue }
exec echo -e \
"\n.p2align data_access_alignm_log2" \
"\n_boot_module_${i}_name:" \
"\n.string \"${binary}\"" \
"\n.byte 0" >> $boot_modules
incr i
}
exec echo -e \
"\n.section .data.boot_modules_binaries" \
"\n" \
"\n.global _boot_modules_binaries_begin" \
"\n_boot_modules_binaries_begin:" >> $boot_modules
# include raw data of modules consecutively but page aligned
set i 1
foreach binary $binaries {
if {$binary == "core"} { continue }
exec echo -e \
"\n.p2align min_page_size_log2" \
"\n_boot_module_${i}_begin:" \
"\n.incbin \"[run_dir]/genode/${binary}\"" \
"\n_boot_module_${i}_end:" >> $boot_modules
incr i
}
# finish boot modules file
exec echo -e \
"\n.global _boot_modules_binaries_end" \
"\n_boot_modules_binaries_end:" >> $boot_modules
clean_boot_modules
exec ln -s $boot_modules boot_modules.s