diff --git a/CMakeLists.txt b/CMakeLists.txt index f178e01c..5da27514 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,10 @@ if(NOT EXISTS ${CMAKE_CXX_COMPILER}) set(CMAKE_CXX_COMPILER g++) endif() +if(DEFINED QEMU_ACCEL) + set(QEMU_ACCEL -accel ${QEMU_ACCEL}) +endif() + add_compile_options(-mno-sse -mno-sse2) add_compile_definitions(__enable_sse=0) @@ -90,13 +94,19 @@ add_custom_target(check-fs ) add_custom_target(qemu - COMMAND ${CMAKE_COMMAND} -E env BANAN_ARCH="${BANAN_ARCH}" DISK_IMAGE_PATH="${DISK_IMAGE_PATH}" ${CMAKE_SOURCE_DIR}/qemu.sh -accel kvm + COMMAND ${CMAKE_COMMAND} -E env BANAN_ARCH="${BANAN_ARCH}" DISK_IMAGE_PATH="${DISK_IMAGE_PATH}" ${CMAKE_SOURCE_DIR}/qemu.sh -serial stdio ${QEMU_ACCEL} + DEPENDS image + USES_TERMINAL +) + +add_custom_target(qemu-nographic + COMMAND ${CMAKE_COMMAND} -E env BANAN_ARCH="${BANAN_ARCH}" DISK_IMAGE_PATH="${DISK_IMAGE_PATH}" ${CMAKE_SOURCE_DIR}/qemu.sh -nographic ${QEMU_ACCEL} DEPENDS image USES_TERMINAL ) add_custom_target(qemu-debug - COMMAND ${CMAKE_COMMAND} -E env BANAN_ARCH="${BANAN_ARCH}" DISK_IMAGE_PATH="${DISK_IMAGE_PATH}" ${CMAKE_SOURCE_DIR}/qemu.sh -d int -no-reboot + COMMAND ${CMAKE_COMMAND} -E env BANAN_ARCH="${BANAN_ARCH}" DISK_IMAGE_PATH="${DISK_IMAGE_PATH}" ${CMAKE_SOURCE_DIR}/qemu.sh -serial stdio -d int -no-reboot DEPENDS image USES_TERMINAL ) diff --git a/PreLoad.cmake b/PreLoad.cmake new file mode 100644 index 00000000..94a06cf8 --- /dev/null +++ b/PreLoad.cmake @@ -0,0 +1 @@ +set(CMAKE_GENERATOR "Ninja" CACHE INTERNAL "" FORCE) diff --git a/README.md b/README.md index e5da495f..438df7e3 100644 --- a/README.md +++ b/README.md @@ -14,18 +14,20 @@ Each major component and library has its own subdirectory (kernel, userspace, li There does not exist a complete list of needed packages for building. From the top of my head I can say that *cmake*, *ninja*, *make*, *grub*, *rsync* and emulator (*qemu* or *bochs*) are needed. +You can and *should* pass cmake variable QEMU_ACCEL set to proper accelerator to cmake commands. For example on Linux this means adding -DQEMU_ACCEL=kvm to the end of all cmake commands. + Create the build directory and cofigure cmake ```sh mkdir build cd build -cmake -G Ninja .. +cmake .. ``` To build the toolchain for this os. You can run the following command. > ***NOTE:*** The following step has to be done only once. This might take a long time since we are compiling binutils and gcc. ```sh ninja toolchain -cmake -G Ninja --fresh .. # We need to reconfigure cmake to use the new compiler +cmake --fresh .. # We need to reconfigure cmake to use the new compiler ninja libstdc++ ``` diff --git a/qemu.sh b/qemu.sh index 17aa3791..00b38fba 100755 --- a/qemu.sh +++ b/qemu.sh @@ -5,5 +5,4 @@ qemu-system-$BANAN_ARCH \ -m 128 \ -smp 2 \ -drive format=raw,media=disk,file=${DISK_IMAGE_PATH} \ - -serial stdio \ $@ \