BuildSystem: Rework calling qemu
I change always manually the serial/graphical. When running cmake you can define variable QEMU_ACCEL that will be used as accelerator. Also ninja has the following targets for running qemu 1. qemu: Run graphical qemu environment 2. qemu-nographic: Run qemu without graphical screen. You should select 'serial only' from grub menu. 3. qemu-debug: Run qemu without accelerator and interrupt debugger.
This commit is contained in:
parent
1c26a402b0
commit
8621d8a155
|
@ -20,6 +20,10 @@ if(NOT EXISTS ${CMAKE_CXX_COMPILER})
|
||||||
set(CMAKE_CXX_COMPILER g++)
|
set(CMAKE_CXX_COMPILER g++)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(DEFINED QEMU_ACCEL)
|
||||||
|
set(QEMU_ACCEL -accel ${QEMU_ACCEL})
|
||||||
|
endif()
|
||||||
|
|
||||||
add_compile_options(-mno-sse -mno-sse2)
|
add_compile_options(-mno-sse -mno-sse2)
|
||||||
add_compile_definitions(__enable_sse=0)
|
add_compile_definitions(__enable_sse=0)
|
||||||
|
|
||||||
|
@ -90,13 +94,19 @@ add_custom_target(check-fs
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(qemu
|
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
|
DEPENDS image
|
||||||
USES_TERMINAL
|
USES_TERMINAL
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(qemu-debug
|
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
|
DEPENDS image
|
||||||
USES_TERMINAL
|
USES_TERMINAL
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
set(CMAKE_GENERATOR "Ninja" CACHE INTERNAL "" FORCE)
|
|
@ -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.
|
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
|
Create the build directory and cofigure cmake
|
||||||
```sh
|
```sh
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -G Ninja ..
|
cmake ..
|
||||||
```
|
```
|
||||||
|
|
||||||
To build the toolchain for this os. You can run the following command.
|
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.
|
> ***NOTE:*** The following step has to be done only once. This might take a long time since we are compiling binutils and gcc.
|
||||||
```sh
|
```sh
|
||||||
ninja toolchain
|
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++
|
ninja libstdc++
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue