From 5d9c50eb12e556e539a7cb42ce783d55fbc162cd Mon Sep 17 00:00:00 2001 From: apio Date: Sun, 4 Dec 2022 10:27:25 +0100 Subject: [PATCH] Make build-debug.sh work --- kernel/CMakeLists.txt | 5 +++++ tools/build-debug.sh | 17 +++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100755 tools/build-debug.sh diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index a1c5155d..28007d7f 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -52,6 +52,11 @@ if("${ARCH}" MATCHES "x86_64") target_link_options(moon PRIVATE -mno-red-zone) endif() +if(MOON_DEBUG_SYMBOLS) + message(STATUS "Building Moon with debug symbols") + target_compile_options(moon PRIVATE -ggdb) +endif() + target_link_options(moon PRIVATE -lgcc -Wl,--build-id=none -z max-page-size=0x1000 -mcmodel=kernel) set_target_properties(moon PROPERTIES CXX_STANDARD 20) diff --git a/tools/build-debug.sh b/tools/build-debug.sh new file mode 100755 index 00000000..ea36b439 --- /dev/null +++ b/tools/build-debug.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash +set -e + +source $(dirname $0)/env.sh + +cd $LUNA_ROOT + +tools/setup.sh + +rm -rf $BUILD_DIR +mkdir $BUILD_DIR + +cmake -S . -B $BUILD_DIR -DMOON_DEBUG_SYMBOLS=ON -G "$CMAKE_GEN" +cmake --build $BUILD_DIR +cmake --install $BUILD_DIR + +mkbootimg luna.json Luna.iso \ No newline at end of file