run: zero pad hello.py to succeed on OKL4

Fixes #804.
This commit is contained in:
Alexander Boettcher 2013-07-12 15:21:51 +02:00 committed by Christian Helmuth
parent 5d75e6676d
commit 99ae463e5c
1 changed files with 16 additions and 1 deletions

View File

@ -52,7 +52,22 @@ install_config $config
# Boot modules
#
exec cp [genode_dir]/libports/src/test/python/hello.py bin/
# Fill up hello.py with zeros, otherwise on OKL4 it fails on native machines.
# OKL4 bootstrap procedure loads the script to the designated address but does
# not clear the remainder of the page. Hence, the script is followed by some
# garbage, which the interpreter tries to execute.
set test_file "[genode_dir]/libports/src/test/python/hello.py"
set file_size [exec du -b $test_file]
set file_size [regexp -inline {[0-9]+} $file_size]
set file_size [expr 4096 - $file_size]
catch { exec dd if=/dev/zero of=bin/hello.py.tmp bs=1 count=$file_size}
exec cp $test_file bin/hello.py
exec cat bin/hello.py.tmp >>bin/hello.py
exec rm bin/hello.py.tmp
set file_size [exec du -b bin/hello.py]
set file_size [regexp -inline {[0-9]+} $file_size]
if {$file_size != 4096 } { puts "hello.py could not be prepared properly"; exit 1 }
# generic modules
set boot_modules {