diff --git a/.gitignore b/.gitignore index b4a6670e65..9c177a55ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,8 @@ .vscode/ .idea/ build/ +base/ *.tar.* toolchain/*/ + +!base-sysroot.tar.gz diff --git a/BAN/CMakeLists.txt b/BAN/CMakeLists.txt index b909e43df8..4c3c0339a6 100644 --- a/BAN/CMakeLists.txt +++ b/BAN/CMakeLists.txt @@ -10,15 +10,17 @@ set(BAN_SOURCES ) add_custom_target(ban-headers - COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include ${BANAN_INCLUDE} + COMMAND sudo rsync -r ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/ DEPENDS sysroot + USES_TERMINAL ) add_library(ban ${BAN_SOURCES}) add_dependencies(ban headers libc-install) add_custom_target(ban-install - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libban.a ${BANAN_LIB}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/libban.a ${BANAN_LIB}/ DEPENDS ban BYPRODUCTS ${BANAN_LIB}/libban.a + USES_TERMINAL ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4984c52f91..f5e140bdd8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ endif() project(banan-os CXX) +set(BANAN_BASE_SYSROOT ${CMAKE_SOURCE_DIR}/base-sysroot.tar.gz) set(BANAN_SYSROOT ${CMAKE_BINARY_DIR}/sysroot) set(BANAN_INCLUDE ${BANAN_SYSROOT}/usr/include) set(BANAN_LIB ${BANAN_SYSROOT}/usr/lib) @@ -34,11 +35,7 @@ add_subdirectory(userspace) add_custom_target(sysroot COMMAND mkdir -p ${BANAN_SYSROOT} - COMMAND mkdir -p ${BANAN_INCLUDE} - COMMAND mkdir -p ${BANAN_LIB} - COMMAND mkdir -p ${BANAN_BIN} - COMMAND mkdir -p ${BANAN_BOOT} - COMMAND cp -r ${CMAKE_SOURCE_DIR}/base/* ${BANAN_SYSROOT}/ + COMMAND cd ${BANAN_SYSROOT} && sudo tar xf ${BANAN_BASE_SYSROOT} ) add_custom_target(headers @@ -66,6 +63,7 @@ add_custom_target(image DEPENDS ban-install DEPENDS libc-install DEPENDS userspace-install + DEPENDS libelf-install USES_TERMINAL ) @@ -75,6 +73,7 @@ add_custom_target(image-full DEPENDS ban-install DEPENDS libc-install DEPENDS userspace-install + DEPENDS libelf-install USES_TERMINAL ) diff --git a/LibELF/CMakeLists.txt b/LibELF/CMakeLists.txt index 01904ba116..f0a3e8cec1 100644 --- a/LibELF/CMakeLists.txt +++ b/LibELF/CMakeLists.txt @@ -3,8 +3,9 @@ cmake_minimum_required(VERSION 3.26) project(LibELF CXX) add_custom_target(libelf-headers - COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include ${BANAN_INCLUDE} + COMMAND sudo rsync -r ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/ DEPENDS sysroot + USES_TERMINAL ) add_custom_target(libelf-install diff --git a/base-sysroot.tar.gz b/base-sysroot.tar.gz new file mode 100644 index 0000000000..bc96b6e6c8 Binary files /dev/null and b/base-sysroot.tar.gz differ diff --git a/base/bin b/base/bin deleted file mode 120000 index 1e881eda3a..0000000000 --- a/base/bin +++ /dev/null @@ -1 +0,0 @@ -usr/bin \ No newline at end of file diff --git a/base/boot/grub/grub.cfg b/base/boot/grub/grub.cfg deleted file mode 100644 index e92e2eba28..0000000000 --- a/base/boot/grub/grub.cfg +++ /dev/null @@ -1,15 +0,0 @@ -menuentry "banan-os" { - multiboot /boot/banan-os.kernel root=/dev/hda2 -} - -menuentry "banan-os (no serial)" { - multiboot /boot/banan-os.kernel root=/dev/hda2 noserial -} - -menuentry "banan-os (no apic)" { - multiboot /boot/banan-os.kernel root=/dev/hda2 noapic -} - -menuentry "banan-os (no apic, no serial)" { - multiboot /boot/banan-os.kernel root=/dev/hda2 noapic noserial -} diff --git a/base/dev/.gitkeep b/base/dev/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/base/etc/hostname b/base/etc/hostname deleted file mode 100644 index c70dc2dfaf..0000000000 --- a/base/etc/hostname +++ /dev/null @@ -1 +0,0 @@ -host diff --git a/base/etc/passwd b/base/etc/passwd deleted file mode 100644 index e2c13379c1..0000000000 --- a/base/etc/passwd +++ /dev/null @@ -1,2 +0,0 @@ -root:x:0:0::/root:/bin/Shell -user:x:1000:1000::/home/user:/bin/Shell diff --git a/base/home/user/file b/base/home/user/file deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/base/lib b/base/lib deleted file mode 120000 index 0d5487ba86..0000000000 --- a/base/lib +++ /dev/null @@ -1 +0,0 @@ -usr/lib \ No newline at end of file diff --git a/base/root/secret b/base/root/secret deleted file mode 100644 index ce01362503..0000000000 --- a/base/root/secret +++ /dev/null @@ -1 +0,0 @@ -hello diff --git a/base/tmp/.gitkeep b/base/tmp/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/base/usr/bin/.gitkeep b/base/usr/bin/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/base/usr/share/fonts/lat0-08.psfu b/base/usr/share/fonts/lat0-08.psfu deleted file mode 100644 index 6198ef91ac..0000000000 Binary files a/base/usr/share/fonts/lat0-08.psfu and /dev/null differ diff --git a/base/usr/share/fonts/lat0-16.psfu b/base/usr/share/fonts/lat0-16.psfu deleted file mode 100644 index 2deccfa10b..0000000000 Binary files a/base/usr/share/fonts/lat0-16.psfu and /dev/null differ diff --git a/base/usr/share/fonts/zap-ext-vga16.psf b/base/usr/share/fonts/zap-ext-vga16.psf deleted file mode 100644 index f680b9353a..0000000000 Binary files a/base/usr/share/fonts/zap-ext-vga16.psf and /dev/null differ diff --git a/base/usr/share/fonts/zap-vga16.psf b/base/usr/share/fonts/zap-vga16.psf deleted file mode 100644 index 53c53ab6b2..0000000000 Binary files a/base/usr/share/fonts/zap-vga16.psf and /dev/null differ diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt index ca54b62e43..fa9c1920b2 100644 --- a/kernel/CMakeLists.txt +++ b/kernel/CMakeLists.txt @@ -144,18 +144,26 @@ endif() target_link_options(kernel PUBLIC -ffreestanding -nostdlib) add_custom_target(crt0 - COMMAND ${CMAKE_CXX_COMPILER} -c ${CMAKE_CURRENT_SOURCE_DIR}/arch/${BANAN_ARCH}/crt0.S -o ${BANAN_LIB}/crt0.o + COMMAND ${CMAKE_CXX_COMPILER} -c ${CMAKE_CURRENT_SOURCE_DIR}/arch/${BANAN_ARCH}/crt0.S -o ${CMAKE_CURRENT_BINARY_DIR}/crt0.o DEPENDS headers ) +add_custom_command( + TARGET crt0 + POST_BUILD + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/crt0.o ${BANAN_LIB}/ +) + add_custom_target(kernel-headers - COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include ${BANAN_INCLUDE} + COMMAND sudo rsync -r ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/ DEPENDS sysroot + USES_TERMINAL ) add_custom_target(kernel-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/kernel ${BANAN_BOOT}/banan-os.kernel + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/kernel ${BANAN_BOOT}/banan-os.kernel DEPENDS kernel + USES_TERMINAL ) execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=crtbegin.o OUTPUT_VARIABLE CRTBEGIN OUTPUT_STRIP_TRAILING_WHITESPACE) diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt index 44837c6c45..9ab9c1bd73 100644 --- a/libc/CMakeLists.txt +++ b/libc/CMakeLists.txt @@ -23,8 +23,9 @@ set(LIBC_SOURCES ) add_custom_target(libc-headers - COMMAND ${CMAKE_COMMAND} -E copy_directory_if_different ${CMAKE_CURRENT_SOURCE_DIR}/include ${BANAN_INCLUDE} + COMMAND sudo rsync -r ${CMAKE_CURRENT_SOURCE_DIR}/include/ ${BANAN_INCLUDE}/ DEPENDS sysroot + USES_TERMINAL ) add_library(libc ${LIBC_SOURCES}) @@ -33,9 +34,10 @@ add_dependencies(libc headers crt0) target_compile_options(libc PRIVATE -g -Wstack-usage=512) add_custom_target(libc-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/libc.a ${BANAN_LIB}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/libc.a ${BANAN_LIB}/ DEPENDS libc BYPRODUCTS ${BANAN_LIB}/libc.a + USES_TERMINAL ) set(CMAKE_STATIC_LIBRARY_PREFIX "") diff --git a/userspace/CMakeLists.txt b/userspace/CMakeLists.txt index df44666714..399765452e 100644 --- a/userspace/CMakeLists.txt +++ b/userspace/CMakeLists.txt @@ -26,7 +26,8 @@ add_custom_target(userspace) add_custom_target(userspace-install DEPENDS userspace) foreach(USERSPACE_PROJECT ${USERSPACE_PROJECTS}) - target_compile_options(${USERSPACE_PROJECT} PUBLIC -g) + target_compile_options(${USERSPACE_PROJECT} PRIVATE -g) + add_dependencies(${USERSPACE_PROJECT} libc-install ban-install) add_dependencies(userspace ${USERSPACE_PROJECT}) add_dependencies(userspace-install ${USERSPACE_PROJECT}-install) endforeach() diff --git a/userspace/Shell/CMakeLists.txt b/userspace/Shell/CMakeLists.txt index f62bc15871..f77316e6f7 100644 --- a/userspace/Shell/CMakeLists.txt +++ b/userspace/Shell/CMakeLists.txt @@ -11,6 +11,7 @@ target_compile_options(Shell PUBLIC -O2 -g) target_link_libraries(Shell PUBLIC libc ban) add_custom_target(Shell-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/Shell ${BANAN_BIN}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/Shell ${BANAN_BIN}/ DEPENDS Shell + USES_TERMINAL ) diff --git a/userspace/cat/CMakeLists.txt b/userspace/cat/CMakeLists.txt index c5e6524e7b..9008d7b280 100644 --- a/userspace/cat/CMakeLists.txt +++ b/userspace/cat/CMakeLists.txt @@ -11,6 +11,7 @@ target_compile_options(cat PUBLIC -O2 -g) target_link_libraries(cat PUBLIC libc) add_custom_target(cat-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/cat ${BANAN_BIN}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/cat ${BANAN_BIN}/ DEPENDS cat + USES_TERMINAL ) diff --git a/userspace/create_program.sh b/userspace/create_program.sh index 0abd03f892..3fc45f0fa1 100755 --- a/userspace/create_program.sh +++ b/userspace/create_program.sh @@ -20,8 +20,9 @@ target_compile_options($PROGRAM_NAME PUBLIC -O2 -g) target_link_libraries($PROGRAM_NAME PUBLIC libc) add_custom_target($PROGRAM_NAME-install - COMMAND cp \${CMAKE_CURRENT_BINARY_DIR}/$PROGRAM_NAME \${BANAN_BIN}/ + COMMAND sudo cp \${CMAKE_CURRENT_BINARY_DIR}/$PROGRAM_NAME \${BANAN_BIN}/ DEPENDS $PROGRAM_NAME + USES_TERMINAL ) EOF diff --git a/userspace/echo/CMakeLists.txt b/userspace/echo/CMakeLists.txt index fd01c8a662..bd7e2d9a34 100644 --- a/userspace/echo/CMakeLists.txt +++ b/userspace/echo/CMakeLists.txt @@ -11,6 +11,7 @@ target_compile_options(echo PUBLIC -O2 -g) target_link_libraries(echo PUBLIC libc) add_custom_target(echo-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/echo ${BANAN_BIN}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/echo ${BANAN_BIN}/ DEPENDS echo + USES_TERMINAL ) diff --git a/userspace/id/CMakeLists.txt b/userspace/id/CMakeLists.txt index 3da67b0ae9..0b23db137b 100644 --- a/userspace/id/CMakeLists.txt +++ b/userspace/id/CMakeLists.txt @@ -11,6 +11,7 @@ target_compile_options(id PUBLIC -O2 -g) target_link_libraries(id PUBLIC libc ban) add_custom_target(id-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/id ${BANAN_BIN}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/id ${BANAN_BIN}/ DEPENDS id + USES_TERMINAL ) diff --git a/userspace/init/CMakeLists.txt b/userspace/init/CMakeLists.txt index 43f9b7a6d7..325d076abf 100644 --- a/userspace/init/CMakeLists.txt +++ b/userspace/init/CMakeLists.txt @@ -11,6 +11,7 @@ target_compile_options(init PUBLIC -O2 -g) target_link_libraries(init PUBLIC libc ban) add_custom_target(init-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/init ${BANAN_BIN}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/init ${BANAN_BIN}/ DEPENDS init + USES_TERMINAL ) diff --git a/userspace/ls/CMakeLists.txt b/userspace/ls/CMakeLists.txt index df6d503d65..bbf2c3c68b 100644 --- a/userspace/ls/CMakeLists.txt +++ b/userspace/ls/CMakeLists.txt @@ -11,6 +11,7 @@ target_compile_options(ls PUBLIC -O2 -g) target_link_libraries(ls PUBLIC libc) add_custom_target(ls-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/ls ${BANAN_BIN}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/ls ${BANAN_BIN}/ DEPENDS ls + USES_TERMINAL ) diff --git a/userspace/stat/CMakeLists.txt b/userspace/stat/CMakeLists.txt index 13e0b60198..2e6c6d3083 100644 --- a/userspace/stat/CMakeLists.txt +++ b/userspace/stat/CMakeLists.txt @@ -11,6 +11,7 @@ target_compile_options(stat PUBLIC -O2 -g) target_link_libraries(stat PUBLIC libc ban) add_custom_target(stat-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/stat ${BANAN_BIN}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/stat ${BANAN_BIN}/ DEPENDS stat + USES_TERMINAL ) diff --git a/userspace/tee/CMakeLists.txt b/userspace/tee/CMakeLists.txt index 57725e8c9e..84225e62bd 100644 --- a/userspace/tee/CMakeLists.txt +++ b/userspace/tee/CMakeLists.txt @@ -11,6 +11,7 @@ target_compile_options(tee PUBLIC -O2 -g) target_link_libraries(tee PUBLIC libc) add_custom_target(tee-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/tee ${BANAN_BIN}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/tee ${BANAN_BIN}/ DEPENDS tee + USES_TERMINAL ) diff --git a/userspace/test/CMakeLists.txt b/userspace/test/CMakeLists.txt index 08bc06408e..963278c78f 100644 --- a/userspace/test/CMakeLists.txt +++ b/userspace/test/CMakeLists.txt @@ -11,6 +11,7 @@ target_compile_options(test PUBLIC -O2 -g) target_link_libraries(test PUBLIC libc) add_custom_target(test-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/test ${BANAN_BIN}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/test ${BANAN_BIN}/ DEPENDS test + USES_TERMINAL ) diff --git a/userspace/touch/CMakeLists.txt b/userspace/touch/CMakeLists.txt index 34d61f6a8c..6504f14f92 100644 --- a/userspace/touch/CMakeLists.txt +++ b/userspace/touch/CMakeLists.txt @@ -11,6 +11,7 @@ target_compile_options(touch PUBLIC -O2 -g) target_link_libraries(touch PUBLIC libc) add_custom_target(touch-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/touch ${BANAN_BIN}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/touch ${BANAN_BIN}/ DEPENDS touch + USES_TERMINAL ) diff --git a/userspace/u8sum/CMakeLists.txt b/userspace/u8sum/CMakeLists.txt index 20fa7354d9..c19849dc31 100644 --- a/userspace/u8sum/CMakeLists.txt +++ b/userspace/u8sum/CMakeLists.txt @@ -11,6 +11,7 @@ target_compile_options(u8sum PUBLIC -O2 -g) target_link_libraries(u8sum PUBLIC libc) add_custom_target(u8sum-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/u8sum ${BANAN_BIN}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/u8sum ${BANAN_BIN}/ DEPENDS u8sum + USES_TERMINAL ) diff --git a/userspace/whoami/CMakeLists.txt b/userspace/whoami/CMakeLists.txt index 392d1c3aab..81308242ab 100644 --- a/userspace/whoami/CMakeLists.txt +++ b/userspace/whoami/CMakeLists.txt @@ -11,6 +11,7 @@ target_compile_options(whoami PUBLIC -O2 -g) target_link_libraries(whoami PUBLIC libc ban) add_custom_target(whoami-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/whoami ${BANAN_BIN}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/whoami ${BANAN_BIN}/ DEPENDS whoami + USES_TERMINAL ) diff --git a/userspace/yes/CMakeLists.txt b/userspace/yes/CMakeLists.txt index aa1eb58d86..bf217e4424 100644 --- a/userspace/yes/CMakeLists.txt +++ b/userspace/yes/CMakeLists.txt @@ -11,6 +11,7 @@ target_compile_options(yes PUBLIC -O2 -g) target_link_libraries(yes PUBLIC libc) add_custom_target(yes-install - COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/yes ${BANAN_BIN}/ + COMMAND sudo cp ${CMAKE_CURRENT_BINARY_DIR}/yes ${BANAN_BIN}/ DEPENDS yes + USES_TERMINAL )