rebuild some targets if compiler spec changes

This commit is contained in:
xwashere 2024-03-01 15:03:02 -05:00
parent 6892c2c6a5
commit ef40041363
Signed by: XWasHere
GPG Key ID: 042F8BFA1B0EF93B
4 changed files with 23 additions and 31 deletions

View File

@ -15,10 +15,11 @@ configure_file(lindows.ld.in lindows.ld @ONLY)
# dependencies
add_executable(LindowsCompilerSpec IMPORTED)
set_property(TARGET LindowsCompilerSpec PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/lindows.spec")
#add_executable(LindowsLinkerScript IMPORTED)
#set_property(TARGET LindowsLinkerScript PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/lindows.ld")
add_executable(LindowsLinkerScript IMPORTED)
set_property(TARGET LindowsLinkerScript PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/lindows.ld")
add_executable(LindowsLinkerScriptSource IMPORTED)
set_property(TARGET LindowsLinkerScriptSource PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/lindows.ld.in")
set_property(TARGET LindowsLinkerScript PROPERTY IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/lindows.ld.in")
#add_dependencies(LindowsLinkerScript LindowsLinkerScriptSource)
# compiler stuff
set(LW_CROSS_CC "${CMAKE_CURRENT_BINARY_DIR}/gcc/prefix/bin/gcc")
@ -84,7 +85,14 @@ function(lw_add_executable NAME)
endif()
if(LW_TARGET)
add_dependencies(${NAME} GCC-install LindowsCompilerSpec LindowsLinkerScript)
set_property(TARGET ${NAME} APPEND PROPERTY LINK_DEPENDS
$<TARGET_FILE:LindowsLinkerScript>
$<TARGET_FILE:LindowsCompilerSpec>
)
set_property(SOURCE TARGET_DIRECTORY ${NAME} APPEND PROPERTY OBJECT_DEPENDS
GCC-install
)
else()
message(FATAL_ERROR "LW_TARGET not defined, are you in a lw_project?")
endif()
@ -214,7 +222,7 @@ ExternalProject_Add(NCurses # oh wow no git
"CXXFLAGS=${LW_CROSS_CXXFLAGS_FLAT}"
"LDFLAGS=${LW_CROSS_LDFLAGS_FLAT}"
<SOURCE_DIR>/configure
<SOURCE_DIR>/./configure
--prefix=${CMAKE_CURRENT_BINARY_DIR}/ncurses
--host=x86_64-pc-linux-gnu
--without-ada
@ -227,6 +235,7 @@ ExternalProject_Add(NCurses # oh wow no git
STEP_TARGETS install
)
ExternalProject_Add_StepDependencies(NCurses configure GCC)
ExternalProject_Add_StepDependencies(NCurses build LindowsCompilerSpec LindowsLinkerScript)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bash")
ExternalProject_Add(Bash
@ -249,6 +258,7 @@ ExternalProject_Add(Bash
STEP_TARGETS install
)
ExternalProject_Add_StepDependencies(Bash configure GCC NCurses)
ExternalProject_Add_StepDependencies(Bash build LindowsCompilerSpec LindowsLinkerScript)
# this should probably be a shell script, i unfortunately do not care
add_custom_command(OUTPUT lindows_c.img
@ -275,6 +285,7 @@ add_custom_command(OUTPUT lindows_c.img
COMMAND ${CoreUtils_Mkdir_EXECUTABLE} ARGS lindows_c/Windows/GRUB
COMMAND ${CoreUtils_Mkdir_EXECUTABLE} ARGS lindows_c/Windows/GRUB/x86_64-efi
COMMAND ${CoreUtils_Mkdir_EXECUTABLE} ARGS 'lindows_c/Windows/Temporary Files'
# grub stuff
COMMAND ${CoreUtils_Copy_EXECUTABLE} ARGS ${CMAKE_CURRENT_BINARY_DIR}/grub/lib/grub/x86_64-efi/* lindows_c/Windows/GRUB/x86_64-efi
COMMAND ${CoreUtils_Copy_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/src/grub/grub.cfg lindows_c/Windows/GRUB/grub.cfg
@ -306,6 +317,7 @@ add_custom_command(OUTPUT lindows_c.img
Linux-install
GLibC-install
Bash-install
NCurses-install
LinuxKernel
src/grub/grub.cfg
src/glibc/ld.so.conf

View File

@ -17,7 +17,7 @@ ENTRY(_start)
SECTIONS {
PROVIDE (__executable_start = SEGMENT_START("text-segment", 0x400000));
. = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS;
. = __executable_start + SIZEOF_HEADERS;
.interp : { *(.interp) }
.note.gnu.build-id : { *(.note.gnu.build-id) }
.hash : { *(.hash) }

View File

@ -42,34 +42,14 @@ void Pii_AbortBoot() {
}
int main() {
// create temporary files
std::cout << "Mounting temporary filesystems\n";
if (mount("tmpfs", "/Windows/Temporary Files/", "tmpfs", 0, "") < 0) {
perror("mount");
Pii_AbortBoot();
}
// we need this because we mount as readonly in preinit so that we can prep the system
// and load the user mode ntfs driver
// std::cout << "Creating system32 overlay for preinit\n";
// std::filesystem::create_directory("/Windows/Temporary Files/System32OverlayUD");
// std::filesystem::create_directory("/Windows/Temporary Files/System32OverlayWD");
// if (mount("overlay", "/Windows/System32/", "overlay", 0, "lowerdir=/Windows/System32,upperdir=/Windows/Temporary Files/System32OverlayUD,workdir=/Windoes/Temporary Files/System32OverlayWD") < 0) {
// perror("mount");
// Pii_AbortBoot();
// }
// oh wow !
// std::cout << "Symlimking well known library names\n";
// dynamic linking fun
std::cout << "Regenerating dynamic linker cache\n";
// Pii_ExecuteProgram("/Windows/System32/ldconfig.exe");
Pii_ExecuteProgram("/Windows/System32/ldconfig.exe");
// boot still failed
for (const auto& ent : std::filesystem::directory_iterator("/Windows/System32")) {
std::cout << ent << " s:" << ent.is_symlink() << " d:" << ent.is_directory() << "\n";
}
// for (const auto& ent : std::filesystem::directory_iterator("/Windows/System32")) {
// std::cout << ent << " s:" << ent.is_symlink() << " d:" << ent.is_directory() << "\n";
//}
// we are never ok
Pii_AbortBoot();

View File

@ -2,5 +2,5 @@
clear
# boot
linux /Windows/vmlinux.exe console=tty0 console=ttyS0 root=PARTUUID=48d29da8-2ff8-4f23-ba1a-0e8ccfc329e2 init=/Windows/System32/lsmss.exe
linux /Windows/vmlinux.exe console=tty0 console=ttyS0 root=PARTUUID=48d29da8-2ff8-4f23-ba1a-0e8ccfc329e2 rootflags=force rw init=/Windows/System32/lsmss.exe
boot