2015-02-19 13:50:27 +00:00
|
|
|
#
|
|
|
|
# \brief Virtual-machine monitor demo
|
|
|
|
# \author Stefan Kalkowski
|
|
|
|
# \date 2015-06-25
|
|
|
|
#
|
|
|
|
|
2017-01-03 12:17:41 +00:00
|
|
|
assert_spec hw
|
2019-04-10 10:43:17 +00:00
|
|
|
|
2019-09-03 14:29:27 +00:00
|
|
|
if { ![have_spec imx7d_sabre] && ![have_spec arndale] && ![have_spec imx8q_evk] } {
|
2019-04-10 10:43:17 +00:00
|
|
|
puts "Run script is not supported on this platform"
|
|
|
|
exit 0
|
|
|
|
}
|
2015-02-19 13:50:27 +00:00
|
|
|
|
|
|
|
set build_components {
|
2019-01-03 17:01:49 +00:00
|
|
|
core init timer
|
2019-04-04 14:41:41 +00:00
|
|
|
server/terminal_crosslink
|
|
|
|
test/terminal_expect_send
|
2019-10-21 12:18:12 +00:00
|
|
|
server/log_terminal
|
|
|
|
server/nic_router
|
2015-02-19 13:50:27 +00:00
|
|
|
server/vmm
|
|
|
|
}
|
|
|
|
build $build_components
|
|
|
|
create_boot_directory
|
|
|
|
|
|
|
|
install_config {
|
2019-09-03 14:29:27 +00:00
|
|
|
<config verbose="yes" prio_levels="2">
|
2015-02-19 13:50:27 +00:00
|
|
|
<parent-provides>
|
|
|
|
<service name="ROM"/>
|
|
|
|
<service name="IRQ"/>
|
|
|
|
<service name="IO_MEM"/>
|
|
|
|
<service name="PD"/>
|
|
|
|
<service name="RM"/>
|
|
|
|
<service name="CPU"/>
|
|
|
|
<service name="LOG"/>
|
|
|
|
<service name="VM"/>
|
|
|
|
</parent-provides>
|
|
|
|
<default-route>
|
|
|
|
<any-service><parent/><any-child/></any-service>
|
|
|
|
</default-route>
|
2017-05-07 20:36:11 +00:00
|
|
|
<default caps="100"/>
|
2015-02-19 13:50:27 +00:00
|
|
|
<start name="timer">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides><service name="Timer"/></provides>
|
|
|
|
</start>
|
2019-10-21 12:18:12 +00:00
|
|
|
<start name="nic_drv">
|
|
|
|
<binary name="nic_router" />
|
|
|
|
<resource name="RAM" quantum="8M"/>
|
|
|
|
<provides> <service name="Nic"/> </provides>
|
|
|
|
<config>
|
|
|
|
<default-policy domain="default"/>
|
|
|
|
<domain name="default" interface="10.0.1.1/24">
|
|
|
|
<dhcp-server ip_first="10.0.1.2" ip_last="10.0.1.2" />
|
|
|
|
</domain>
|
|
|
|
</config>
|
|
|
|
</start>
|
|
|
|
<start name="log_terminal">
|
|
|
|
<resource name="RAM" quantum="2M"/>
|
|
|
|
<provides> <service name="Terminal"/> </provides>
|
|
|
|
</start>
|
2019-04-04 14:41:41 +00:00
|
|
|
<start name="terminal_crosslink">
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<provides> <service name="Terminal"/> </provides>
|
2015-02-19 13:50:27 +00:00
|
|
|
</start>
|
2019-09-03 14:29:27 +00:00
|
|
|
<start name="vmm" caps="200" priority="-1">
|
2015-02-19 13:50:27 +00:00
|
|
|
<resource name="RAM" quantum="256M"/>
|
2019-10-21 12:18:12 +00:00
|
|
|
<route>
|
|
|
|
<service name="Terminal" label="earlycon"> <child name="log_terminal"/> </service>
|
|
|
|
<service name="Terminal"> <child name="terminal_crosslink"/> </service>
|
|
|
|
<service name="Nic"> <child name="nic_drv"/> </service>
|
|
|
|
<any-service><parent/><any-child/></any-service>
|
|
|
|
</route>
|
2015-02-19 13:50:27 +00:00
|
|
|
</start>
|
2019-04-04 14:41:41 +00:00
|
|
|
<start name="vm">
|
|
|
|
<binary name="test-terminal_expect_send"/>
|
|
|
|
<resource name="RAM" quantum="1M"/>
|
|
|
|
<config expect="/ #" send="ls" verbose="yes"/>
|
2019-10-21 12:18:12 +00:00
|
|
|
<route>
|
|
|
|
<service name="Terminal"> <child name="terminal_crosslink"/> </service>
|
|
|
|
<any-service><parent/><any-child/></any-service>
|
|
|
|
</route>
|
2019-04-04 14:41:41 +00:00
|
|
|
</start>
|
2015-02-19 13:50:27 +00:00
|
|
|
</config>
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-09-03 14:29:27 +00:00
|
|
|
if { [have_spec arm] } {
|
|
|
|
|
|
|
|
if {![file exists bin/linux]} {
|
|
|
|
puts "Download linux kernel ..."
|
|
|
|
exec >& /dev/null wget -c -O bin/linux http://genode.org/files/release-15.02/arm_vt/linux
|
|
|
|
}
|
|
|
|
|
|
|
|
if {![file exists bin/dtb]} {
|
|
|
|
puts "Download device tree blob ..."
|
|
|
|
exec >& /dev/null wget -c -O bin/dtb http://genode.org/files/release-15.02/arm_vt/dtb
|
|
|
|
}
|
|
|
|
|
2015-02-19 13:50:27 +00:00
|
|
|
#
|
|
|
|
# This test uses a Linux kernel built from unmodified vanilla kernel sources
|
|
|
|
# but using a slightly simplified kernel configuration, as well as device tree
|
|
|
|
# for a minimal Versatile Express Cortex A15 like emulated board.
|
|
|
|
#
|
|
|
|
# The used sources, including the modified device tree and configuration file
|
|
|
|
# can be found in the following git repository/branch:
|
|
|
|
#
|
|
|
|
# https://github.com/skalk/linux/tree/vexpress-vt
|
|
|
|
#
|
|
|
|
# To compile the kernel and device tree blob used in this script, do the
|
|
|
|
# following steps:
|
|
|
|
#
|
|
|
|
# ! git checkout https://github.com/skalk/linux.git
|
|
|
|
# ! cd linux
|
|
|
|
# ! git checkout origin/vexpress-vt
|
|
|
|
# ! make ARCH=arm CROSS_COMPILE=<cross_compiler_prefix> vexpress_config
|
|
|
|
# ! make ARCH=arm CROSS_COMPILE=<cross_compiler_prefix> -j8 Image
|
|
|
|
# ! make ARCH=arm CROSS_COMPILE=<cross_compiler_prefix> vexpress-v2p-ca15-tc1.dtb
|
|
|
|
#
|
|
|
|
}
|
|
|
|
|
2019-09-03 14:29:27 +00:00
|
|
|
if { [have_spec arm_64] } {
|
|
|
|
|
|
|
|
if {![file exists bin/linux]} {
|
|
|
|
puts "Download linux kernel ..."
|
2019-10-21 12:18:12 +00:00
|
|
|
exec >& /dev/null wget -c -O bin/linux http://genode.org/files/release-20.02/linux-arm64
|
2019-09-03 14:29:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if {![file exists bin/dtb]} {
|
|
|
|
puts "Download device tree blob ..."
|
2019-10-21 12:18:12 +00:00
|
|
|
exec >& /dev/null wget -c -O bin/dtb http://genode.org/files/release-20.02/dtb-arm64-virt
|
2019-09-03 14:29:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if {![file exists bin/initrd]} {
|
|
|
|
puts "Download initramfs ..."
|
2019-10-21 12:18:12 +00:00
|
|
|
exec >& /dev/null wget -c -O bin/initrd http://genode.org/files/release-20.02/initrd-arm64
|
2019-09-03 14:29:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# To obtain the linux kernel, do the following steps:
|
|
|
|
#
|
|
|
|
# wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.19.53.tar.xz
|
|
|
|
#
|
|
|
|
# tar -xJf linux-4.19.53.tar.xz
|
|
|
|
# cd linux-4.19.53
|
|
|
|
#
|
|
|
|
# make O=../build-linux-aarch64 ARCH=arm64 CROSS_COMPILE=/usr/local/genode/tool/current/bin/genode-aarch64- defconfig
|
|
|
|
# make O=../build-linux-aarch64 ARCH=arm64 CROSS_COMPILE=/usr/local/genode/tool/current/bin/genode-aarch64- -j32
|
|
|
|
#
|
|
|
|
# copy ../build-linux-aarch64/arch/arm64/boot/Image to your build directory in 'bin/linux'
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# To get the dtb (device-tree-binary), you have to compile the file:
|
|
|
|
# repos/os/src/server/vmm/spec/arm_v8/virt.dts with the dtc compiler:
|
|
|
|
# dtc repos/os/src/server/vmm/spec/arm_v8/virt.dts > bin/dtb
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# To construct the initrd do the following:
|
|
|
|
# * get and install gcc from linaro
|
|
|
|
# (https://releases.linaro.org/components/toolchain/binaries/latest-7/)
|
|
|
|
# * build busybox
|
|
|
|
# wget https://busybox.net/downloads/busybox-1.29.3.tar.bz2
|
|
|
|
# tar xjf busybox-1.29.3.tar.bz2
|
|
|
|
# mkdir build-busybox-aarch64
|
|
|
|
# cd busybox-1.29.3
|
|
|
|
# make O=../build-busybox-aarch64 defconfig
|
|
|
|
# make O=../build-busybox-aarch64 menuconfig
|
|
|
|
#
|
|
|
|
# [*] Setting -> Build static binary (no shared libs)
|
|
|
|
#
|
|
|
|
# cd ../build-busybox-aarch64
|
|
|
|
# make CROSS_COMPILE=/usr/local/gcc-linaro/bin/aarch64-linux-gnu- install -j6
|
|
|
|
# * create ramdisk
|
|
|
|
# cd _install
|
|
|
|
# find . | cpio -H newc -o | gzip > ../initrd
|
2015-02-19 13:50:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set boot_modules {
|
2016-12-01 18:00:11 +00:00
|
|
|
core ld.lib.so init
|
2015-02-19 13:50:27 +00:00
|
|
|
timer
|
2019-04-04 14:41:41 +00:00
|
|
|
terminal_crosslink
|
|
|
|
test-terminal_expect_send
|
2019-10-21 12:18:12 +00:00
|
|
|
nic_router
|
|
|
|
log_terminal
|
2015-02-19 13:50:27 +00:00
|
|
|
vmm
|
|
|
|
linux
|
|
|
|
dtb
|
|
|
|
}
|
2019-09-03 14:29:27 +00:00
|
|
|
append_if [have_spec arm_64] boot_modules initrd
|
2015-02-19 13:50:27 +00:00
|
|
|
build_boot_image $boot_modules
|
|
|
|
|
|
|
|
#
|
|
|
|
# Execute test case
|
|
|
|
#
|
2019-04-04 14:41:41 +00:00
|
|
|
run_genode_until "\[init -> vm\] .*sbin.*" 220
|
2015-02-19 13:50:27 +00:00
|
|
|
exec rm bin/linux bin/dtb
|