This commit is contained in:
xwashere 2024-02-28 10:44:02 -05:00
parent 29e2614225
commit 42c8c990f2
Signed by: XWasHere
GPG Key ID: 042F8BFA1B0EF93B
4 changed files with 58 additions and 1 deletions

View File

@ -62,6 +62,34 @@ ExternalProject_Add(Linux
) )
ExternalProject_Add_StepDependencies(Linux configure LinuxConfig) ExternalProject_Add_StepDependencies(Linux configure LinuxConfig)
# build glibc
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/glibc")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/glibc/prefix")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/glibc/lib")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/glibc/libexec")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/glibc/bin")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/glibc/sbin")
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/glibc/include")
ExternalProject_Add(GLibC
GIT_REPOSITORY "https://sourceware.org/git/glibc.git"
GIT_TAG "glibc-2.39"
GIT_PROGRESS TRUE
UPDATE_COMMAND ""
CONFIGURE_COMMAND <SOURCE_DIR>/configure
--prefix=${CMAKE_CURRENT_BINARY_DIR}/glibc/prefix
--with-headers=${CMAKE_CURRENT_BINARY_DIR}/linux/headers/include
--enable-kernel=6.7.0
--host=x86_64-pc-linux-gnu
--enable-shared
BUILD_COMMAND make
INSTALL_COMMAND make install
COMMAND sh -c "cp -r ${CMAKE_CURRENT_BINARY_DIR}/glibc/prefix/sbin/* ${CMAKE_CURRENT_BINARY_DIR}/glibc/bin"
COMMAND sh -c "cp -r ${CMAKE_CURRENT_BINARY_DIR}/glibc/prefix/bin/* ${CMAKE_CURRENT_BINARY_DIR}/glibc/bin"
COMMAND sh -c "cp -r ${CMAKE_CURRENT_BINARY_DIR}/glibc/prefix/libexec/* ${CMAKE_CURRENT_BINARY_DIR}/glibc/lib"
COMMAND sh -c "cp -r ${CMAKE_CURRENT_BINARY_DIR}/glibc/prefix/lib/* ${CMAKE_CURRENT_BINARY_DIR}/glibc/lib"
STEP_TARGETS install
)
# this should probably be a shell script, i unfortunately do not care # this should probably be a shell script, i unfortunately do not care
add_custom_command(OUTPUT lindows_c.img add_custom_command(OUTPUT lindows_c.img
# create empty 128MiB disk image # create empty 128MiB disk image
@ -82,15 +110,20 @@ add_custom_command(OUTPUT lindows_c.img
# create system folders # create system folders
COMMAND ${CoreUtils_Mkdir_EXECUTABLE} ARGS lindows_c/Windows COMMAND ${CoreUtils_Mkdir_EXECUTABLE} ARGS lindows_c/Windows
COMMAND ${CoreUtils_Mkdir_EXECUTABLE} ARGS lindows_c/Windows/System32
COMMAND ${CoreUtils_Mkdir_EXECUTABLE} ARGS lindows_c/Windows/GRUB 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/GRUB/x86_64-efi
# grub stuff # 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_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 COMMAND ${CoreUtils_Copy_EXECUTABLE} ARGS ${CMAKE_CURRENT_SOURCE_DIR}/src/grub/grub.cfg lindows_c/Windows/GRUB/grub.cfg
# install the kernel # install the kernel
COMMAND ${CoreUtils_Copy_EXECUTABLE} ARGS ${CMAKE_CURRENT_BINARY_DIR}/linux/bzImage lindows_c/Windows/vmlinux.exe COMMAND ${CoreUtils_Copy_EXECUTABLE} ARGS ${CMAKE_CURRENT_BINARY_DIR}/linux/bzImage lindows_c/Windows/vmlinux.exe
# copy glibc files to system32
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/scripts/copyglibc
# create users folder # create users folder
COMMAND ${CoreUtils_Mkdir_EXECUTABLE} ARGS lindows_c/Users COMMAND ${CoreUtils_Mkdir_EXECUTABLE} ARGS lindows_c/Users
@ -98,8 +131,11 @@ add_custom_command(OUTPUT lindows_c.img
COMMAND "umount" ARGS lindows_c COMMAND "umount" ARGS lindows_c
DEPENDS DEPENDS
lsmss
Linux-install Linux-install
GLibC-install
src/grub/grub.cfg src/grub/grub.cfg
scripts/copyglibc
) )
# this makes the efi system partition # this makes the efi system partition
@ -157,3 +193,5 @@ add_custom_command(OUTPUT lindows.img
) )
add_custom_target(lindows ALL DEPENDS lindows.img) add_custom_target(lindows ALL DEPENDS lindows.img)
add_subdirectory(lsmss)

8
lsmss/CMakeLists.txt Normal file
View File

@ -0,0 +1,8 @@
cmake_minimum_required(VERSION 3.28)
# Preinit process that prepares the os and uh yeah :astolfothumbsup:
#project(lsmss
# DESCRIPTION "Linux Session Manager Subsystem"
#)
#add_executable(lsmss main.cxx)

11
scripts/copyglibc Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
# copy libs
find glibc/bin glibc/lib -type d | sed -r 's/glibc\/(bin|lib)\///;Tn;s/^/mkdir lindows_c\/Windows\/System32\//;by;:n;d;:y;e' > /dev/null;
find glibc/bin -type f | sed -r 's/glibc\/bin\/(.*)/cp glibc\/bin\/\1 lindows_c\/Windows\/System32\/\1.exe/;e' > /dev/null
find glibc/lib -type f | sed -r 's/glibc\/lib\/(.*)/cp glibc\/lib\/\1 lindows_c\/Windows\/System32\/\1/;e' > /dev/null
# copy lib links
for lib in $(cd glibc/lib && find -type l); do
ln -sr "lindows_c/Windows/System32/$(readlink glibc/lib/$lib)" "lindows_c/Windows/System32/$lib"
done

View File

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