aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/x86_64/support/grub.cfg.in1
-rw-r--r--arch/x86_64/support/modules/test.imgbin0 -> 2097152 bytes
-rw-r--r--cmake/Modules/GenerateBootableIso.cmake12
3 files changed, 13 insertions, 0 deletions
diff --git a/arch/x86_64/support/grub.cfg.in b/arch/x86_64/support/grub.cfg.in
index 49f19ce..b29fc36 100644
--- a/arch/x86_64/support/grub.cfg.in
+++ b/arch/x86_64/support/grub.cfg.in
@@ -3,5 +3,6 @@ default=0
menuentry "TeachOS" {
multiboot2 /$<TARGET_FILE_NAME:kernel>
+ module2 isofs/modules/test.img
boot
} \ No newline at end of file
diff --git a/arch/x86_64/support/modules/test.img b/arch/x86_64/support/modules/test.img
new file mode 100644
index 0000000..914fa7f
--- /dev/null
+++ b/arch/x86_64/support/modules/test.img
Binary files differ
diff --git a/cmake/Modules/GenerateBootableIso.cmake b/cmake/Modules/GenerateBootableIso.cmake
index 3d1ee30..abdc907 100644
--- a/cmake/Modules/GenerateBootableIso.cmake
+++ b/cmake/Modules/GenerateBootableIso.cmake
@@ -3,6 +3,13 @@ include_guard(GLOBAL)
function(target_generate_bootable_iso TARGET)
find_package("grub-mkrescue")
+ # set(MODULE_SRC
+ # "${PROJECT_SOURCE_DIR}/arch/${CMAKE_SYSTEM_PROCESSOR}/support/test.img"
+ # )
+ # set(MODULE_DST
+ # "$<TARGET_FILE_DIR:${TARGET}>/isofs/test.img"
+ # )
+
file(GENERATE
OUTPUT "$<TARGET_FILE_DIR:${TARGET}>/isofs/boot/grub/grub.cfg"
INPUT "${PROJECT_SOURCE_DIR}/arch/${CMAKE_SYSTEM_PROCESSOR}/support/grub.cfg.in"
@@ -10,6 +17,10 @@ function(target_generate_bootable_iso TARGET)
add_custom_command(TARGET "${TARGET}"
POST_BUILD
+ # COMMAND "${CMAKE_COMMAND}" -E make_directory "$<TARGET_FILE_DIR:${TARGET}>/isofs"
+ # COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${MODULE_SRC}" "${MODULE_DST}"
+ COMMAND "${CMAKE_COMMAND}" -E make_directory "$<TARGET_FILE_DIR:${TARGET}>/isofs"
+ COMMAND "${CMAKE_COMMAND}" -E copy_directory "${PROJECT_SOURCE_DIR}/arch/${CMAKE_SYSTEM_PROCESSOR}/support/modules" "$<TARGET_FILE_DIR:${TARGET}>/isofs/modules"
COMMAND "${GRUB_MKRESCUE_EXE}"
"-o"
"$<TARGET_FILE_DIR:${TARGET}>/${TARGET}.iso"
@@ -19,4 +30,5 @@ function(target_generate_bootable_iso TARGET)
BYPRODUCTS "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIGURATION>/${TARGET}.iso"
COMMENT "Creating bootable ISO image"
)
+
endfunction()