aboutsummaryrefslogtreecommitdiff
path: root/cmake/Modules/GenerateBootableIso.cmake
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2025-12-15 17:13:12 +0100
committerFelix Morgner <felix.morgner@ost.ch>2025-12-15 17:13:12 +0100
commit7b9482ae637126ac9337876e60f519b493437711 (patch)
tree6fc71a253c8b0325d303bd34c95b564ba536ed14 /cmake/Modules/GenerateBootableIso.cmake
parent116f9332a206767c45095950f09f7c7447b561cf (diff)
parenta9eeec745e29d89afd48ee43d09432eb6fc35be7 (diff)
downloadteachos-7b9482ae637126ac9337876e60f519b493437711.tar.xz
teachos-7b9482ae637126ac9337876e60f519b493437711.zip
os: rework kernel architecture
Rework the code structure and architecture of the kernel by separating platform-dependent and platform-independent code more cleanly. As of this patchset, full feature parity has not been achieved. Nonetheless, a sufficient subset of functionality has been ported to the new architecture to demonstrate the feasibility of the new structure.
Diffstat (limited to 'cmake/Modules/GenerateBootableIso.cmake')
-rw-r--r--cmake/Modules/GenerateBootableIso.cmake22
1 files changed, 22 insertions, 0 deletions
diff --git a/cmake/Modules/GenerateBootableIso.cmake b/cmake/Modules/GenerateBootableIso.cmake
new file mode 100644
index 0000000..3d1ee30
--- /dev/null
+++ b/cmake/Modules/GenerateBootableIso.cmake
@@ -0,0 +1,22 @@
+include_guard(GLOBAL)
+
+function(target_generate_bootable_iso TARGET)
+ find_package("grub-mkrescue")
+
+ file(GENERATE
+ OUTPUT "$<TARGET_FILE_DIR:${TARGET}>/isofs/boot/grub/grub.cfg"
+ INPUT "${PROJECT_SOURCE_DIR}/arch/${CMAKE_SYSTEM_PROCESSOR}/support/grub.cfg.in"
+ )
+
+ add_custom_command(TARGET "${TARGET}"
+ POST_BUILD
+ COMMAND "${GRUB_MKRESCUE_EXE}"
+ "-o"
+ "$<TARGET_FILE_DIR:${TARGET}>/${TARGET}.iso"
+ "$<TARGET_FILE_DIR:${TARGET}>/isofs"
+ "$<TARGET_FILE:${TARGET}>"
+ "2>/dev/null"
+ BYPRODUCTS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIGURATION>/${TARGET}.iso"
+ COMMENT "Creating bootable ISO image"
+ )
+endfunction()