diff --git a/CMakeLists.txt b/CMakeLists.txt index 0378ee3..ade1047 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 + $ + $ + ) + + 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}" - /configure + /./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 diff --git a/lindows.ld.in b/lindows.ld.in index b7b8e4e..ed91f6e 100644 --- a/lindows.ld.in +++ b/lindows.ld.in @@ -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) } diff --git a/lsmss/main.cxx b/lsmss/main.cxx index 3e8eafa..fec1dee 100644 --- a/lsmss/main.cxx +++ b/lsmss/main.cxx @@ -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(); diff --git a/src/grub/grub.cfg b/src/grub/grub.cfg index 0a2f2a6..7dcf1cc 100644 --- a/src/grub/grub.cfg +++ b/src/grub/grub.cfg @@ -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