summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorNico Weber <thakis@chromium.org>2021-08-28 13:41:14 -0400
committerLinus Groh <mail@linusgroh.de>2021-08-28 21:51:30 +0100
commit9c5e947e0ed357acd24f5893f5ffa9bc65c69a20 (patch)
treee31513e516d0455f27604ef85d4e40321dd311b1 /Kernel
parentda785bd4bd6e63624954c6ebb90e017c6fe61099 (diff)
downloadserenity-9c5e947e0ed357acd24f5893f5ffa9bc65c69a20.zip
Prekernel: Make build on aarch64
Add a dummy Arch/aarch64/boot.S that for now does nothing but let all processor cores sleep. For now, none of the actual Prekernel code is built for aarch64.
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/CMakeLists.txt4
-rw-r--r--Kernel/Prekernel/Arch/aarch64/boot.S16
-rw-r--r--Kernel/Prekernel/CMakeLists.txt40
3 files changed, 45 insertions, 15 deletions
diff --git a/Kernel/CMakeLists.txt b/Kernel/CMakeLists.txt
index 65d46afd2b..8978869ce3 100644
--- a/Kernel/CMakeLists.txt
+++ b/Kernel/CMakeLists.txt
@@ -516,7 +516,5 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kernel.map" DESTINATION res)
serenity_install_headers(Kernel)
serenity_install_sources(Kernel)
-if (NOT "${SERENITY_ARCH}" STREQUAL "aarch64")
- add_subdirectory(Prekernel)
-endif()
+add_subdirectory(Prekernel)
add_subdirectory(Modules)
diff --git a/Kernel/Prekernel/Arch/aarch64/boot.S b/Kernel/Prekernel/Arch/aarch64/boot.S
new file mode 100644
index 0000000000..25c0fcb7ea
--- /dev/null
+++ b/Kernel/Prekernel/Arch/aarch64/boot.S
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2021, Nico Weber <thakis@chromium.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+.text
+
+.global start
+.type start, @function
+start:
+ b Lhalt
+
+Lhalt:
+ wfi
+ b Lhalt
diff --git a/Kernel/Prekernel/CMakeLists.txt b/Kernel/Prekernel/CMakeLists.txt
index 8501985556..9c71f6bd70 100644
--- a/Kernel/Prekernel/CMakeLists.txt
+++ b/Kernel/Prekernel/CMakeLists.txt
@@ -1,16 +1,30 @@
set(SOURCES
- Arch/x86/boot.S
- Arch/x86/multiboot.S
- init.cpp
- UBSanitizer.cpp
- ../MiniStdLib.cpp
- ../../Userland/Libraries/LibELF/Relocation.cpp
)
+if ("${SERENITY_ARCH}" STREQUAL "aarch64")
+ set(SOURCES
+ ${SOURCES}
+ Arch/aarch64/boot.S
+ )
+else()
+ set(SOURCES
+ ${SOURCES}
+ Arch/x86/boot.S
+ Arch/x86/multiboot.S
+ # FIXME: Eventually, some of these should build on aarch64 too.
+ UBSanitizer.cpp
+ init.cpp
+ ../MiniStdLib.cpp
+ ../../Userland/Libraries/LibELF/Relocation.cpp
+ )
+endif()
+
if ("${SERENITY_ARCH}" STREQUAL "i686")
set(PREKERNEL_TARGET Prekernel32)
-else()
+elseif ("${SERENITY_ARCH}" STREQUAL "x86_64")
set(PREKERNEL_TARGET Prekernel64)
+else()
+ set(PREKERNEL_TARGET Prekernel)
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static")
@@ -27,11 +41,13 @@ else()
target_link_libraries(${PREKERNEL_TARGET} gcc supc++)
endif()
-add_custom_command(
- TARGET ${PREKERNEL_TARGET} POST_BUILD
- COMMAND ${CMAKE_OBJCOPY} -O elf32-i386 ${CMAKE_CURRENT_BINARY_DIR}/${PREKERNEL_TARGET} ${CMAKE_CURRENT_BINARY_DIR}/Prekernel
- BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Prekernel
-)
+if ("${SERENITY_ARCH}" STREQUAL "i686" OR "${SERENITY_ARCH}" STREQUAL "x86_64")
+ add_custom_command(
+ TARGET ${PREKERNEL_TARGET} POST_BUILD
+ COMMAND ${CMAKE_OBJCOPY} -O elf32-i386 ${CMAKE_CURRENT_BINARY_DIR}/${PREKERNEL_TARGET} ${CMAKE_CURRENT_BINARY_DIR}/Prekernel
+ BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Prekernel
+ )
+endif()
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Prekernel" DESTINATION boot)