Skip to content
Snippets Groups Projects
Commit a7e5d237 authored by Martin Hoffmann's avatar Martin Hoffmann
Browse files

cmake/Bochs: Integrated Bochs configure into CMake

Bochs' configure options can now be set via ccmake.

git-svn-id: https://www4.informatik.uni-erlangen.de/i4svn/danceos/trunk/devel/fail@2102 8c4709b5-6ec9-48aa-a5cd-a96041d1645a
parent 425b6e31
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,9 @@ simulators/bochs/config.log
simulators/bochs/config.status
simulators/bochs/libtool
simulators/bochs/ltdlconf.h
simulators/bochs/src
simulators/bochs/tmp
simulators/bochs/install
!simulators/bochs/plex86/kernel/freebsd/Makefile
......
......@@ -75,24 +75,4 @@ include(gem5)
include(ovp)
include(qemu)
include(t32)
## Just for testing:
## Invoking bochs build via external project
# Setup configure call for bochs (-> make ebochs)
# Prefix dir for make install etc
#set(BOCHS_PREFIX_DIR "${CMAKE_BINARY_DIR}/bochs")
#configure_file(${CMAKE_SOURCE_DIR}/cmake/config_failbochs.sh.in ${CMAKE_BINARY_DIR}/config_bochs.sh)
#
#include(ExternalProject)
#externalproject_add(
# ebochs
# SOURCE_DIR ${CMAKE_SOURCE_DIR}/bochs
# CONFIGURE_COMMAND ${CMAKE_BINARY_DIR}/config_bochs.sh
# BUILD_IN_SOURCE 1
# PREFIX ${BOCHS_PREFIX_DIR}
#)
#
#message(STATUS "Include directories are:")
#get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
#foreach(dir ${dirs})
# message(STATUS " ${dir}")
#endforeach(dir)
......@@ -75,38 +75,55 @@ if(BUILD_BOCHS)
set(bochs_src_dir ${PROJECT_SOURCE_DIR}/simulators/bochs)
set(bochs_install_prefix ${bochs_src_dir}/install CACHE STRING "FailBochs installation path")
set(bochs_configure_params --enable-a20-pin --enable-x86-64 --enable-cpu-level=6 --enable-ne2000 --enable-acpi --enable-pci --enable-usb --enable-trace-cache --enable-fast-function-calls --enable-host-specific-asms --enable-disasm --enable-readline --enable-clgd54xx --enable-fpu --enable-vmx=2 --enable-monitor-mwait --enable-cdrom --enable-sb16=linux --enable-gdb-stub CACHE STRING "Bochs default configure parameters")
add_custom_command(OUTPUT "${bochs_src_dir}/libfailbochs.a"
COMMAND +make -C ${bochs_src_dir} CXX=\"ag++ -p ${PROJECT_SOURCE_DIR} -I${PROJECT_SOURCE_DIR}/src/core -I${CMAKE_BINARY_DIR}/src/core ${CMAKE_AGPP_FLAGS} --Xcompiler\" LIBTOOL=\"/bin/sh ./libtool --tag=CXX\" libfailbochs.a
COMMENT "[${PROJECT_NAME}] Building libfailbochs"
## Bochs CXX args for calling make
set(bochs_build_CXX CXX=ag++\ -p\ ${PROJECT_SOURCE_DIR}\ -I${PROJECT_SOURCE_DIR}/src/core\ -I${CMAKE_BINARY_DIR}/src/core\ ${CMAKE_AGPP_FLAGS}\ --Xcompiler)
## Bochs libtool command.
set(bochs_build_LIBTOOL LIBTOOL=/bin/sh\ ./libtool\ --tag=CXX)
# Use cmake's external project feature to build fail library
include(ExternalProject)
ExternalProject_Add(
libfailbochs_external
SOURCE_DIR ${bochs_src_dir}
CONFIGURE_COMMAND ${bochs_src_dir}/configure ${bochs_configure_params} --prefix=${bochs_install_prefix}
PREFIX ${bochs_src_dir}
BUILD_COMMAND $(MAKE) -C ${bochs_src_dir} ${bochs_build_CXX} ${bochs_build_LIBTOOL} libfailbochs.a
## Put install command here, to prevent cmake calling make install
INSTALL_COMMAND ${CMAKE_COMMAND} -E echo "[${PROJECT_NAME}] Built libfailbochs.a"
BUILD_IN_SOURCE 1
)
# tell cmake that the external project generated a library so we can add dependencies here instead of later
add_library(libfailbochs STATIC IMPORTED)
set_property(TARGET libfailbochs PROPERTY IMPORTED_LOCATION ${bochs_src_dir}/libfailbochs.a )
add_dependencies(libfailbochs libfailbochs_external)
# make sure aspects don't fail to match in entry.cc
include_directories(${PROJECT_SOURCE_DIR}/src/core ${CMAKE_BINARY_DIR}/src/core)
add_executable(fail-client "${bochs_src_dir}/libfailbochs.a")
target_link_libraries(fail-client "${bochs_src_dir}/libfailbochs.a" fail ${bochs_library_dependencies})
# an executable needs at least one source file, so we hand over an empty .cc file to make cmake happy.
add_executable(fail-client ${bochs_src_dir}/fail_empty_source_file_for_build.cc)
target_link_libraries(fail-client libfailbochs fail ${bochs_library_dependencies})
install(TARGETS fail-client RUNTIME DESTINATION bin)
# Get stamp directory to touch files for forcing rebuilds.
ExternalProject_Get_Property(libfailbochs_external stamp_dir)
# a few Bochs-specific passthrough targets:
add_custom_target(bochsclean
COMMAND +make -C ${bochs_src_dir} clean
# touch stamp file to force rebuild, without calling configure again.
COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${stamp_dir}/libfailbochs_external-configure
COMMENT "[${PROJECT_NAME}] Cleaning all up (clean in bochs)"
)
add_custom_target(bochsallclean
COMMAND +make -C ${bochs_src_dir} all-clean
# touch stamp file to force rebuild, without calling configure again.
COMMAND ${CMAKE_COMMAND} -E touch_nocreate ${stamp_dir}/libfailbochs_external-configure
COMMENT "[${PROJECT_NAME}] Cleaning all up (all-clean in bochs)"
)
# these don't work, because we don't build a bochs binary anymore:
#add_custom_target(bochsinstall
# COMMAND +make -C ${bochs_src_dir} CXX=\"ag++ -p ${PROJECT_SOURCE_DIR} -I${PROJECT_SOURCE_DIR}/src/core -I${CMAKE_BINARY_DIR}/src/core --real-instances --Xcompiler\" LIBTOOL=\"/bin/sh ./libtool --tag=CXX\" install
# COMMENT "[${PROJECT_NAME}] Installing Bochs ..."
#)
#
#add_custom_target(bochsuninstall
# COMMAND +make -C ${bochs_src_dir} uninstall
# COMMENT "[${PROJECT_NAME}] Uninstalling Bochs ..."
#)
endif(BUILD_BOCHS)
......@@ -20,7 +20,7 @@ Required for the Bochs simulator backend:
- libpthread
- Probably more, depending on, e.g., the GUI you configure (X11 ->
libsvga1-dev, libxrandr-dev)
Required for the gem5 simulator backend:
**********************************************************************
- SCons
......@@ -67,24 +67,24 @@ For the first time:
in the compile process otherwise.
4. Enter out-of-source build directory. All generated files end up there.
$ cd build
5. Generate CMake environment.
5. Generate CMake environment.
$ cmake ..
6. Setup build configuration by opening the CMake configuration tool
$ ccmake .
Select "BUILD_BOCHS" or "BUILD_OVP". Select an experiment to enable by
Select "BUILD_BOCHS" or "BUILD_GEM5". Select an experiment to enable by
naming its "experiments/" subdirectory under "EXPERIMENTS_ACTIVATED".
Configure Fail* features you need for this experiment by enabling
"CONFIG_*" options. Press 'c', 'g' to regenerate the build system.
(Alternatively use
(Alternatively use
$ cmake-gui .
for a Qt GUI.) To enable a Debug build, choose "Debug" as the build type,
otherwise choose "Release".
7. Additionally make sure Bochs is at least configured (see below).
If building FailBochs, optionally set up the bochs configure flags
for your need.
After changes to Fail* code:
------------------------------------------------------------
Prerequisite, if you're building with Bochs: configure Bochs (see below).
Compile (in ${BUILD_DIR}, optionally "add -jN" for parallel building):
$ make
CMake will build all Fail* libraries and link them with the simulator backend
......@@ -120,18 +120,15 @@ to be compiled previously:
$ cd src/core/doc/latex; make
Building FailBochs:
FailBochs: Bochs configuration features
**********************************************************************
For the first time:
------------------------------------------------------------
1. Change to the Bochs simulator directory (expects to be in ${FAIL_DIR}):
$ cd simulators/bochs
2. Configure the Bochs simulator (auto-tools).
The autotools-based bochs is configured within the Fail* build run.
The configuration flags can be set within the ccmake configuration (ccmake ${FAIL_DIR}/build)
- Sufficient:
$ ./configure --prefix=$(echo ~/localroot/usr) --enable-{cpu-level=6,ne2000,trace-cache,gdb-stub} --disable-docbook
- More simulator features:
$ ./configure --prefix=$(echo ~/localroot/usr) --enable-{a20-pin,x86-64,cpu-level=6,ne2000,acpi,pci,usb,trace-cache,fast-function-calls,host-specific-asms,disasm,readline,clgd54xx,fpu,vmx=2,monitor-mwait,cdrom,sb16=linux,gdb-stub} --disable-docbook --with-all-libs
--enable-cpu-level=6;--enable-ne2000;--enable-trace-cache;--enable-gdb-stub --disable-docbook
- More simulator features (FailBochs default configuration):
--enable-a20-pin;--enable-x86-64;--enable-cpu-level=6;--enable-ne2000;--enable-acpi;--enable-pci;--enable-usb;--enable-trace-cache;--enable-fast-function-calls;--enable-host-specific-asms;--enable-disasm;--enable-readline;--enable-clgd54xx;--enable-fpu;--enable-vmx=2;--enable-monitor-mwait;--enable-cdrom;--enable-sb16=linux;--enable-gdb-stub --disable-docbook --with-all-libs
Instead of --with-all-libs, you could use --with-nogui for "headless" experiments,
additionally removing lots of library dependencies (thus reducing startup overhead).
--with-x11 enables only the "x" (X11), --with-wx only the "wx" (wxWidgets) GUI.
......@@ -241,7 +238,7 @@ Debug build:
Selecting an experiment:
------------------------------------------------------------
1. Edit ../src/core/sal/gem5/SConscript
In line starting with (gStaticLibs = ...) change -lfail-arch-test to
In line starting with (gStaticLibs = ...) change -lfail-arch-test to
-lfail-EXPERIMENTNAME
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment