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
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -25,6 +25,9 @@ simulators/bochs/config.log
|
|||||||
simulators/bochs/config.status
|
simulators/bochs/config.status
|
||||||
simulators/bochs/libtool
|
simulators/bochs/libtool
|
||||||
simulators/bochs/ltdlconf.h
|
simulators/bochs/ltdlconf.h
|
||||||
|
simulators/bochs/src
|
||||||
|
simulators/bochs/tmp
|
||||||
|
simulators/bochs/install
|
||||||
|
|
||||||
!simulators/bochs/plex86/kernel/freebsd/Makefile
|
!simulators/bochs/plex86/kernel/freebsd/Makefile
|
||||||
|
|
||||||
|
|||||||
@ -75,24 +75,4 @@ include(gem5)
|
|||||||
include(ovp)
|
include(ovp)
|
||||||
include(qemu)
|
include(qemu)
|
||||||
include(t32)
|
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_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"
|
## Bochs CXX args for calling make
|
||||||
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
|
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)
|
||||||
COMMENT "[${PROJECT_NAME}] Building libfailbochs"
|
## 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
|
# make sure aspects don't fail to match in entry.cc
|
||||||
include_directories(${PROJECT_SOURCE_DIR}/src/core ${CMAKE_BINARY_DIR}/src/core)
|
include_directories(${PROJECT_SOURCE_DIR}/src/core ${CMAKE_BINARY_DIR}/src/core)
|
||||||
add_executable(fail-client "${bochs_src_dir}/libfailbochs.a")
|
# an executable needs at least one source file, so we hand over an empty .cc file to make cmake happy.
|
||||||
target_link_libraries(fail-client "${bochs_src_dir}/libfailbochs.a" fail ${bochs_library_dependencies})
|
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)
|
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:
|
# a few Bochs-specific passthrough targets:
|
||||||
add_custom_target(bochsclean
|
add_custom_target(bochsclean
|
||||||
COMMAND +make -C ${bochs_src_dir} clean
|
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)"
|
COMMENT "[${PROJECT_NAME}] Cleaning all up (clean in bochs)"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(bochsallclean
|
add_custom_target(bochsallclean
|
||||||
COMMAND +make -C ${bochs_src_dir} all-clean
|
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)"
|
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)
|
endif(BUILD_BOCHS)
|
||||||
|
|||||||
@ -71,7 +71,7 @@ For the first time:
|
|||||||
$ cmake ..
|
$ cmake ..
|
||||||
6. Setup build configuration by opening the CMake configuration tool
|
6. Setup build configuration by opening the CMake configuration tool
|
||||||
$ ccmake .
|
$ 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".
|
naming its "experiments/" subdirectory under "EXPERIMENTS_ACTIVATED".
|
||||||
Configure Fail* features you need for this experiment by enabling
|
Configure Fail* features you need for this experiment by enabling
|
||||||
"CONFIG_*" options. Press 'c', 'g' to regenerate the build system.
|
"CONFIG_*" options. Press 'c', 'g' to regenerate the build system.
|
||||||
@ -79,12 +79,12 @@ For the first time:
|
|||||||
$ cmake-gui .
|
$ cmake-gui .
|
||||||
for a Qt GUI.) To enable a Debug build, choose "Debug" as the build type,
|
for a Qt GUI.) To enable a Debug build, choose "Debug" as the build type,
|
||||||
otherwise choose "Release".
|
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:
|
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):
|
Compile (in ${BUILD_DIR}, optionally "add -jN" for parallel building):
|
||||||
$ make
|
$ make
|
||||||
CMake will build all Fail* libraries and link them with the simulator backend
|
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
|
$ cd src/core/doc/latex; make
|
||||||
|
|
||||||
|
|
||||||
Building FailBochs:
|
FailBochs: Bochs configuration features
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
|
|
||||||
For the first time:
|
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)
|
||||||
1. Change to the Bochs simulator directory (expects to be in ${FAIL_DIR}):
|
|
||||||
$ cd simulators/bochs
|
|
||||||
2. Configure the Bochs simulator (auto-tools).
|
|
||||||
- Sufficient:
|
- Sufficient:
|
||||||
$ ./configure --prefix=$(echo ~/localroot/usr) --enable-{cpu-level=6,ne2000,trace-cache,gdb-stub} --disable-docbook
|
--enable-cpu-level=6;--enable-ne2000;--enable-trace-cache;--enable-gdb-stub --disable-docbook
|
||||||
- More simulator features:
|
- More simulator features (FailBochs default configuration):
|
||||||
$ ./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-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,
|
Instead of --with-all-libs, you could use --with-nogui for "headless" experiments,
|
||||||
additionally removing lots of library dependencies (thus reducing startup overhead).
|
additionally removing lots of library dependencies (thus reducing startup overhead).
|
||||||
--with-x11 enables only the "x" (X11), --with-wx only the "wx" (wxWidgets) GUI.
|
--with-x11 enables only the "x" (X11), --with-wx only the "wx" (wxWidgets) GUI.
|
||||||
|
|||||||
Reference in New Issue
Block a user