diff --git a/cmake/3rd.cmake b/cmake/3rd.cmake index c2f028b80..c284e66c6 100644 --- a/cmake/3rd.cmake +++ b/cmake/3rd.cmake @@ -231,9 +231,9 @@ if (gdbinit_ADDED) COMMAND echo "target remote ${QEMU_GDB_PORT}" >> ${CMAKE_SOURCE_DIR}/.gdbinit COMMAND - echo "add-symbol-file ${${KERNEL_ELF_OUTPUT_NAME}_BINARY_DIR}/${KERNEL_ELF_OUTPUT_NAME}" >> ${CMAKE_SOURCE_DIR}/.gdbinit + echo "add-symbol-file ${kernel_BINARY_DIR}/${KERNEL_ELF_OUTPUT_NAME}" >> ${CMAKE_SOURCE_DIR}/.gdbinit COMMAND - echo "add-symbol-file ${${BOOT_ELF_OUTPUT_NAME}_BINARY_DIR}/${BOOT_ELF_OUTPUT_NAME}" >> ${CMAKE_SOURCE_DIR}/.gdbinit + echo "add-symbol-file ${boot_BINARY_DIR}/${BOOT_ELF_OUTPUT_NAME}" >> ${CMAKE_SOURCE_DIR}/.gdbinit ) endif () diff --git a/run.sh b/run.sh old mode 100644 new mode 100755 index c62def7d3..1b4c0a790 --- a/run.sh +++ b/run.sh @@ -11,12 +11,12 @@ set -e # 输出实际执行内容 #set -x -TARGET_ARCH=x86_64 -# TARGET_ARCH=riscv64 +# TARGET_ARCH=x86_64 +TARGET_ARCH=riscv64 # TARGET_ARCH=aarch64 # 删除旧文件 -rm -rf build_${TARGET_ARCH} +# rm -rf build_${TARGET_ARCH} # 生成 cmake --preset build_${TARGET_ARCH} # 编译并运行 diff --git a/src/kernel/CMakeLists.txt b/src/kernel/CMakeLists.txt index be408ba4e..4b28ad4fe 100644 --- a/src/kernel/CMakeLists.txt +++ b/src/kernel/CMakeLists.txt @@ -55,3 +55,9 @@ add_dependencies(kernel set_target_properties(kernel PROPERTIES PREFIX "") set_target_properties(kernel PROPERTIES OUTPUT_NAME ${KERNEL_ELF_OUTPUT_NAME}) + +# readelf -a +readelf_a(kernel) + +# objdump -D +objdump_D(kernel) diff --git a/src/kernel/arch/riscv64/arch_main.cpp b/src/kernel/arch/riscv64/arch_main.cpp index f089e9488..fecbf46af 100644 --- a/src/kernel/arch/riscv64/arch_main.cpp +++ b/src/kernel/arch/riscv64/arch_main.cpp @@ -50,7 +50,7 @@ void put_char(const char _c) { return; } -int arch(int, char **) { +int arch(int, uint8_t **) { put_char('H'); put_char('e'); put_char('l'); @@ -69,6 +69,17 @@ int32_t arch_init(uint32_t _argc, uint8_t **_argv) { (void)_argc; (void)_argv; + put_char('H'); + put_char('e'); + put_char('l'); + put_char('l'); + put_char('W'); + put_char('o'); + put_char('r'); + put_char('l'); + put_char('d'); + put_char('!'); + // 进入死循环 while (1) { ;