From 3246dbbd19c518e8d42f1a1d1240d43d7ed88fdc Mon Sep 17 00:00:00 2001 From: slinky55 Date: Thu, 16 Jul 2026 16:09:12 -0500 Subject: [PATCH] build system refresh --- .gitignore | 6 +- build.sh | 7 ++- build_libc.sh | 6 -- build_libs.sh | 17 +++++ build_programs.sh | 15 +++-- build_sysroot.sh | 12 ++++ clean.sh | 15 +++-- copy_resources.sh | 5 ++ kernel/drivers/ps2/ps2.c | 11 +++- kernel/drivers/ps2/ps2.h | 2 + kernel/drivers/vga/vga.c | 24 ++----- kernel/kmain.c | 15 ++--- kernel/lib/console.c | 3 - kernel/{user => sys}/video.h | 0 make_img.sh | 9 +-- programs/lib/rlibc.a | Bin 7300 -> 0 bytes programs/rocksh/.gitignore | 1 + programs/rocksh/makefile | 15 +++-- programs/rockterm/.gitignore | 1 + programs/{test => rockterm}/crt0.S | 0 programs/{test => rockterm}/linker.ld | 0 programs/{vga_text_term => rockterm}/main.c | 66 ++++++++++++-------- programs/rockterm/makefile | 29 +++++++++ programs/test/main.c | 6 -- programs/test/makefile | 24 ------- programs/vga_text_term/crt0.S | 21 ------- programs/vga_text_term/linker.ld | 31 --------- programs/vga_text_term/makefile | 24 ------- {initrd => resources}/fonts/kernel_font.psf | Bin {rocklibc => rlibc}/.gitignore | 0 {rocklibc => rlibc}/include/stdio.h | 0 {rocklibc => rlibc}/include/stdlib.h | 0 {rocklibc => rlibc}/include/string.h | 0 {rocklibc => rlibc}/include/sys/types.h | 0 {rocklibc => rlibc}/include/sys/video.h | 1 + {rocklibc => rlibc}/include/syscall.h | 0 {rocklibc => rlibc}/include/unistd.h | 0 {rocklibc => rlibc}/makefile | 0 {rocklibc => rlibc}/src/malloc.c | 0 {rocklibc => rlibc}/src/stdio.c | 0 {rocklibc => rlibc}/src/strcat.c | 0 {rocklibc => rlibc}/src/string.c | 0 {rocklibc => rlibc}/src/strtok.c | 0 {rocklibc => rlibc}/src/syscall.c | 2 +- rlibgui/include/psf.h | 0 rlibgui/makefile | 20 ++++++ rlibgui/rlibgui.a | Bin 0 -> 616 bytes rlibgui/src/psf.c | 0 sysroot/usr/fonts/cp850-8x16.psf | Bin 4100 -> 0 bytes 49 files changed, 185 insertions(+), 203 deletions(-) delete mode 100755 build_libc.sh create mode 100755 build_libs.sh create mode 100755 build_sysroot.sh create mode 100755 copy_resources.sh rename kernel/{user => sys}/video.h (100%) delete mode 100644 programs/lib/rlibc.a create mode 100644 programs/rocksh/.gitignore create mode 100644 programs/rockterm/.gitignore rename programs/{test => rockterm}/crt0.S (100%) rename programs/{test => rockterm}/linker.ld (100%) rename programs/{vga_text_term => rockterm}/main.c (63%) create mode 100644 programs/rockterm/makefile delete mode 100644 programs/test/main.c delete mode 100644 programs/test/makefile delete mode 100644 programs/vga_text_term/crt0.S delete mode 100644 programs/vga_text_term/linker.ld delete mode 100644 programs/vga_text_term/makefile rename {initrd => resources}/fonts/kernel_font.psf (100%) rename {rocklibc => rlibc}/.gitignore (100%) rename {rocklibc => rlibc}/include/stdio.h (100%) rename {rocklibc => rlibc}/include/stdlib.h (100%) rename {rocklibc => rlibc}/include/string.h (100%) rename {rocklibc => rlibc}/include/sys/types.h (100%) rename {rocklibc => rlibc}/include/sys/video.h (96%) rename {rocklibc => rlibc}/include/syscall.h (100%) rename {rocklibc => rlibc}/include/unistd.h (100%) rename {rocklibc => rlibc}/makefile (100%) rename {rocklibc => rlibc}/src/malloc.c (100%) rename {rocklibc => rlibc}/src/stdio.c (100%) rename {rocklibc => rlibc}/src/strcat.c (100%) rename {rocklibc => rlibc}/src/string.c (100%) rename {rocklibc => rlibc}/src/strtok.c (100%) rename {rocklibc => rlibc}/src/syscall.c (96%) create mode 100644 rlibgui/include/psf.h create mode 100644 rlibgui/makefile create mode 100644 rlibgui/rlibgui.a create mode 100644 rlibgui/src/psf.c delete mode 100644 sysroot/usr/fonts/cp850-8x16.psf diff --git a/.gitignore b/.gitignore index dd3fcfc..e47132b 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,5 @@ .idea .vscode -build -isodir - -compiler*/ \ No newline at end of file +sysroot +isodir \ No newline at end of file diff --git a/build.sh b/build.sh index c866331..2f94e28 100755 --- a/build.sh +++ b/build.sh @@ -1,11 +1,16 @@ #!/bin/bash -./build_libc.sh +./build_sysroot.sh + +./build_libs.sh + ./build_programs.sh make clean bear -- make +./copy_resources.sh + ./make_img.sh make -B \ No newline at end of file diff --git a/build_libc.sh b/build_libc.sh deleted file mode 100755 index 7f4ce6a..0000000 --- a/build_libc.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -cd rocklibc -make clean -bear -- make -cd .. \ No newline at end of file diff --git a/build_libs.sh b/build_libs.sh new file mode 100755 index 0000000..9de0694 --- /dev/null +++ b/build_libs.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +cp -r kernel/sys/*.h rlibc/include/sys + +cd rlibc +make clean +bear -- make +cp rlibc.a ../sysroot/usr/lib +cp -r include/. ../sysroot/usr/include +cd .. + +cd rlibgui +make clean +bear -- make +cp rlibgui.a ../sysroot/usr/lib +cp -r include/. ../sysroot/usr/include +cd .. \ No newline at end of file diff --git a/build_programs.sh b/build_programs.sh index 48a8092..a2fcfc7 100755 --- a/build_programs.sh +++ b/build_programs.sh @@ -1,17 +1,16 @@ #!/bin/bash -TARGET_DIR="programs" +cd programs +ln -s ../sysroot sysroot 2>/dev/null -if [ ! -d "$TARGET_DIR" ]; then - exit 1 -fi - -find "$TARGET_DIR" -type f \( -name "Makefile" -o -name "makefile" \) | while read -r makefile_path; do +find "." -type f \( -name "Makefile" -o -name "makefile" \) | while read -r makefile_path; do dir_path=$(dirname "$makefile_path") ( cd "$dir_path" || exit make clean - make + bear -- make ) -done \ No newline at end of file +done + +cd.. \ No newline at end of file diff --git a/build_sysroot.sh b/build_sysroot.sh new file mode 100755 index 0000000..4a0f7f8 --- /dev/null +++ b/build_sysroot.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +mkdir -p sysroot + +mkdir -p sysroot/usr +mkdir -p sysroot/dev +mkdir -p sysroot/kernel + +mkdir -p sysroot/usr/include +mkdir -p sysroot/usr/lib +mkdir -p sysroot/usr/bin +mkdir -p sysroot/usr/fonts \ No newline at end of file diff --git a/clean.sh b/clean.sh index f9b4f97..1b22439 100755 --- a/clean.sh +++ b/clean.sh @@ -1,9 +1,16 @@ #!/bin/bash -cd rocklibc +# libc +cd rlibc make clean cd .. +# libgui +cd rlibgui +make clean +cd .. + +# programs cd programs find . -type f \( -name "Makefile" -o -name "makefile" \) | while read -r makefile_path; do dir_path=$(dirname "$makefile_path") @@ -13,10 +20,10 @@ find . -type f \( -name "Makefile" -o -name "makefile" \) | while read -r makefi make clean ) done +rm sysroot cd .. +# kernel make clean -cd initrd -rm -f bin/*.elf -cd .. \ No newline at end of file +rm -rf sysroot \ No newline at end of file diff --git a/copy_resources.sh b/copy_resources.sh new file mode 100755 index 0000000..1ae9c4a --- /dev/null +++ b/copy_resources.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +cp -r resources/fonts/. sysroot/usr/fonts + +cp -r kernel/. sysroot/kernel \ No newline at end of file diff --git a/kernel/drivers/ps2/ps2.c b/kernel/drivers/ps2/ps2.c index 7146eff..d72f0e3 100644 --- a/kernel/drivers/ps2/ps2.c +++ b/kernel/drivers/ps2/ps2.c @@ -2,6 +2,8 @@ #include +#include + static const char scancode_to_ascii[] = { 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', @@ -73,7 +75,11 @@ int init_ps2() { write_ccb(ccb); return 0; -} +} + +void ps2_init_kbd(vfs_node_t* dev) { + +} char ps2_get_ascii(uint8_t scancode) { if (scancode & 0x80) { @@ -88,4 +94,5 @@ char ps2_get_ascii(uint8_t scancode) { } return 0; -} \ No newline at end of file +} + diff --git a/kernel/drivers/ps2/ps2.h b/kernel/drivers/ps2/ps2.h index 607cf64..fa70701 100644 --- a/kernel/drivers/ps2/ps2.h +++ b/kernel/drivers/ps2/ps2.h @@ -18,8 +18,10 @@ #ifndef __ASSEMBLER__ #include +#include int init_ps2(); +void ps2_init_kbd(vfs_node_t* dev); uint8_t ps2_read_data(); char ps2_get_ascii(uint8_t scancode); diff --git a/kernel/drivers/vga/vga.c b/kernel/drivers/vga/vga.c index 4344728..8955782 100644 --- a/kernel/drivers/vga/vga.c +++ b/kernel/drivers/vga/vga.c @@ -2,7 +2,7 @@ #include #include -#include +#include #include #include @@ -10,7 +10,7 @@ #include #include -#include +#include static uint32_t framebuffer_address; static uint32_t framebuffer_width; @@ -19,25 +19,11 @@ static uint32_t framebuffer_total_pixels; static uint32_t framebuffer_pitch; static uint32_t framebuffer_bpp; -static uint8_t red_mask_sz; -static uint8_t red_field_pos; -static uint8_t green_mask_sz; -static uint8_t green_field_pos; -static uint8_t blue_mask_sz; -static uint8_t blue_field_pos; - -static uint32_t create_pixel(uint8_t r, uint8_t g, uint8_t b) { - return (r >> (8 - red_mask_sz)) << red_field_pos - | (g >> (8 - green_mask_sz)) << green_field_pos - | (b >> (8 - blue_mask_sz)) << blue_field_pos; -} - vga_color_t VGA_COLOR_BLACK = {0, 0, 0, 255}; vga_color_t VGA_COLOR_RED = {0, 0, 255, 255}; vga_color_t VGA_COLOR_GREEN = {0, 255, 0, 255}; vga_color_t VGA_COLOR_BLUE = {255, 0, 0, 255}; - uint32_t vga_mmap(vfs_node_t* node, uint32_t address) { uint32_t fb_size_bytes = framebuffer_height * framebuffer_pitch; uint32_t num_pages = (fb_size_bytes + 4095) / 4096; @@ -77,6 +63,8 @@ void vga_init( framebuffer_pitch = fb_pitch; framebuffer_bpp = fb_bpp; + kprintf("mapping vga pages\n"); + uint32_t fb_size_bytes = fb_height * fb_pitch; uint32_t num_pages = (fb_size_bytes + 4095) / 4096; for (uint32_t i = 0; i < num_pages; i++) { @@ -113,9 +101,7 @@ uint8_t vga_get_bpp() { } void vga_clear_scrn(uint32_t color) { - if (framebuffer_address == 0) return; - - uint8_t* fb_bytes = (uint8_t*)framebuffer_address; + uint8_t* fb_bytes = (uint8_t*)VGA_FRAMEBUFFER; uint8_t bytes_per_pixel = framebuffer_bpp / 8; for (uint32_t y = 0; y < framebuffer_height; y++) { diff --git a/kernel/kmain.c b/kernel/kmain.c index b1d6f26..1973c8c 100644 --- a/kernel/kmain.c +++ b/kernel/kmain.c @@ -1,4 +1,3 @@ -#include "lib/font.h" #include "multiboot.h" #include "interrupts.h" #include "gdt.h" @@ -166,20 +165,16 @@ void kmain(multiboot_info* mbi) { dev->mnt = devfs; kprintf("mounted devfs\n"); - - console_init(); - kprintf("kernel console initialized\n"); - - int font_loaded = set_console_font("/fonts/kernel_font.psf"); + + int font_loaded = set_console_font("/usr/fonts/kernel_font.psf"); if (!font_loaded) { kprintf("failed to load console font\n"); } + console_init(); - kprintf("console font set\n"); + kprintf("kernel console initialized\n"); kprintf("basic initializations complete. check serial for details\n"); - kprintf("starting rockos\n"); - load_root_program("/bin/vga_text_term.elf"); - kprintf("kernel going to sleep...\n"); + load_root_program("/usr/bin/rockterm"); } diff --git a/kernel/lib/console.c b/kernel/lib/console.c index e8afdad..95122ab 100644 --- a/kernel/lib/console.c +++ b/kernel/lib/console.c @@ -16,7 +16,6 @@ static uint32_t console_text_color; static uint32_t console_backgrnd_color; static void write_vga_char(char c) { - print_serial("write_vga_char invoked\r\n"); uint32_t vga_pitch = vga_get_pitch(); uint8_t* glyph = (uint8_t*)font->glyphs + (c * font->hdr->charsz); @@ -71,7 +70,6 @@ void console_putchar(char c) { if (!font) return; if (c == '\n') { - print_serial("\r\n"); console_col = 0; console_row++; if (console_row >= console_height) { @@ -80,7 +78,6 @@ void console_putchar(char c) { return; } - write_serial(c); write_vga_char(c); console_col++; diff --git a/kernel/user/video.h b/kernel/sys/video.h similarity index 100% rename from kernel/user/video.h rename to kernel/sys/video.h diff --git a/make_img.sh b/make_img.sh index 16c9e63..ab8fa53 100755 --- a/make_img.sh +++ b/make_img.sh @@ -1,12 +1,5 @@ #!/bin/bash -mkdir -p initrd -rm -f initrd/bin/*.elf - -mkdir -p initrd/dev -mkdir -p initrd/bin -cp programs/bin/* initrd/bin - -cd initrd +cd sysroot find . -depth -print | cpio -o -H newc > ../isodir/boot/initrd.img cd .. \ No newline at end of file diff --git a/programs/lib/rlibc.a b/programs/lib/rlibc.a deleted file mode 100644 index b33b4c698cb117501095128fc0164db0cb9f38f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7300 zcmc&(eQaA-6~8ad8n^X$UO&bvd2!4tMjcgRMN2|n9tik=YKPxf}2LD3s*KO(xq!QgQb=;{dv zMaVoQI(mAKLoyf;Mg_yXc8I5gX5eUhuMj!g zd_8I%o$F^*RbjF6zcn>myxzJkbL;o5<~!TSuiDWs~(g#Vg#FGSH{xG|?Lr@^w#9?c|Q+DPr-8)@jn{1VNu z)~pzAxWUC}%LuWnscE~na@S-2O5rr)or#P28Ns2_^7J&2D^M_@L5y%jrc36y0h4Jd>ObmDTeANzCt_!+rAq?e!&9w6ZWMScctlvi?< zVAvicWmTPHun#eTa$I`_S9$LOwoO7;(|BQ1F;(V_ipkMiNHsaPMT63{Gfp8hk z{5Nr-;$S_-qhE9W3b=0fC<2(YokcP6fUFRy9E;>C+z=_l0y3V;xcL7kU*>!i*mi>` z^yNRHjl9Kt`6;DHV&wyczFbVM3jNrJm_WHwe7Os9ttj+m`gk#4eib~%vjSybp)XHE zpolMbo_M-+UpA_?;WR*4+?Qu$a4KJRVK&I=Pwq{$c@hz9TIRY$v)g({%XAF*WbW5f zu4r0|p40kwXX_>+GuF(3ueCY&?2k?fzXw`eb(yd)K5pJ?UDD1aQ(Obte@N?pEL%5* z{uA^2*G+_{(c_95FZwr4Pq{t)?p2X%IoX^Z#ka?ccoKd$$4k2JkI$M9Sbwl4HeHJT zRWm)wCar%}-H5qL+TZVqrpx+Uvvngy^ciXFYJOMWc44}c&j?Jmuf9w~uD4};+*7&d zwYV^xp3-9J$o*5k`S$3k9a{7(7buoCSJsx9f7eqh+cu4J+wr-=^TwVRi~hmYi|~0)Mt|d?G<|+<@DJX-NdJ$6Z;VR| z^9!JIfq#(Ecsu@`i|BV3@=Hk>c|S*I_}6=j12kHqVM*{pKcFC8)zQDkB6DkfK$yC_#m?z#XueyhcD z*Q>}$duW&hWnW?La$!OXnG_G`PQ*%JDnd z^WxNyH8FMf{9K1qR$r|!m-aoYiO4&~>|_%}OUO3ryJKPOT%+zlTfty#^E|;1ZQpTn z&paP#$SrhMpe+iD#apLChO&w*jJINPh4DtYQsV6!kgLLYi^Uu7*oFFNXJNek2679> z+mX(mxo}%F-i*4^??%w~TF}v5wM5imQmNCnJVd}xDO?iJ;dt@akbTVLy6{!rUk_|J*c7m{tSS^u>6d_7f$s|QZ< z{X4RCZ$@T@%D0K=`AR$PJ*IJs9anAakOC0pFatkv?;K=Pngzd?_8WBK&d zF4kk;Mm>5ZP`~EnN z5&-f@qU9xPBzm?yAuwt@ty>Ral%eL42d_^g{iDg#BQG<8uKeo#Y_{+8h|psPz&FwZ zxKvo@`syo0T4E}^;;HmF-3_!1Kk~XKkzj-*>JbX-RoilMVh^V&hEVLuW2Qv=O z0I_afsm~kmCK`;iWBkeIm|)aAJeoO9#2X7$CCaBX*pTG4fA$F%)215TVmQsnzsjHo>PfAPhzjc>m{y~*xm!c zuaY$LA?0f&u9vt$;++!nd`r1K61PgcPvYBcm?}5eS?6rn`wcSey z$|-+l6ZNq)NsMK-VJGCCl64~5N8nw=Igc?g&d4_I(P|!#qE5XWpYS~N74FY!Y&9n3 n&Oq)3U}kxx&x1P01S=1%7-(~znp>B`{k{)zK|fKzF$w<$PhFGL diff --git a/programs/rocksh/.gitignore b/programs/rocksh/.gitignore new file mode 100644 index 0000000..72436b4 --- /dev/null +++ b/programs/rocksh/.gitignore @@ -0,0 +1 @@ +rocksh \ No newline at end of file diff --git a/programs/rocksh/makefile b/programs/rocksh/makefile index 74e6577..adbd1c2 100644 --- a/programs/rocksh/makefile +++ b/programs/rocksh/makefile @@ -1,10 +1,14 @@ CC = i686-elf-gcc LD = i686-elf-ld -CFLAGS = -ffreestanding -O2 -Wall -Wextra -I../../rocklibc/include +SYSROOT = ../sysroot +USR_INCLUDE = $(SYSROOT)/usr/include +USR_LIB = $(SYSROOT)/usr/lib + +CFLAGS = -ffreestanding -O2 -Wall -Wextra -I$(USR_INCLUDE) LDFLAGS = -m elf_i386 -nostdlib -TARGET = rocksh.elf +TARGET = rocksh all: $(TARGET) @@ -14,11 +18,12 @@ crt0.o: crt0.S main.o: main.c $(CC) $(CFLAGS) -c main.c -o main.o -$(TARGET): crt0.o main.o ../lib/rlibc.a - $(LD) $(LDFLAGS) -T linker.ld crt0.o main.o ../lib/rlibc.a -o $(TARGET) +$(TARGET): crt0.o main.o $(USR_LIB)/* + $(LD) $(LDFLAGS) -T linker.ld crt0.o main.o $(USR_LIB)/* -o $(TARGET) + cp $(TARGET) $(SYSROOT)/usr/bin clean: - rm -f *.o $(TARGET) compile_commands.json + rm -f *.o $(TARGET) compile_commands.json rm -rf .cache .PHONY: all clean test \ No newline at end of file diff --git a/programs/rockterm/.gitignore b/programs/rockterm/.gitignore new file mode 100644 index 0000000..a801a3e --- /dev/null +++ b/programs/rockterm/.gitignore @@ -0,0 +1 @@ +rockterm \ No newline at end of file diff --git a/programs/test/crt0.S b/programs/rockterm/crt0.S similarity index 100% rename from programs/test/crt0.S rename to programs/rockterm/crt0.S diff --git a/programs/test/linker.ld b/programs/rockterm/linker.ld similarity index 100% rename from programs/test/linker.ld rename to programs/rockterm/linker.ld diff --git a/programs/vga_text_term/main.c b/programs/rockterm/main.c similarity index 63% rename from programs/vga_text_term/main.c rename to programs/rockterm/main.c index d8306d3..59ac5e2 100644 --- a/programs/vga_text_term/main.c +++ b/programs/rockterm/main.c @@ -1,46 +1,31 @@ -#include "syscall.h" #include #include -#define VGA_TEXT_W 80 -#define VGA_TEXT_H 25 +typedef struct { -void term(); +} font_t; + +void term_write_char(char c); +void render_char_at(char c, int x, int y); + +int spawn_shell(); int ptys; int ptym; +void* fb; fb_info_t fb_info; -void* framebuffer_address; int terminal_col = 0; int terminal_row = 0; -void term_write_char(char c) { - -} +font_t* terminal_font = NULL; int main(int argc, char *argv[]) { (void)argc; (void)argv; - ptym = pty(&ptys); - - if (fork() == 0) { - close(ptym); - dup2(ptys, 0); - dup2(0, 1); - dup2(0, 2); - - exec("/bin/rocksh.elf"); - } - - close(ptys); - dup2(ptym, 0); - dup2(0, 1); - dup2(0, 2); - int vga_fd = open("/dev/vga"); if (vga_fd == -1) return 1; @@ -52,9 +37,38 @@ int main(int argc, char *argv[]) { return 1; } - framebuffer_address = mmap(vga_fd); - + mmap(vga_fd); + // if (!spawn_shell()) { + // return 1; + // } return 0; +} + +void render_char_at(char c, int x, int y) { + if (!terminal_font) return; +} + +void term_write_char(char c) { + +} + +int spawn_shell() { + ptym = pty(&ptys); + + if (fork() == 0) { + close(ptym); + dup2(ptys, 0); + dup2(0, 1); + dup2(0, 2); + + if (!exec("/usr/bin/rocksh")) return 0; + } + + close(ptys); + dup2(ptym, 0); + dup2(0, 1); + dup2(0, 2); + return 1; } \ No newline at end of file diff --git a/programs/rockterm/makefile b/programs/rockterm/makefile new file mode 100644 index 0000000..183bcf0 --- /dev/null +++ b/programs/rockterm/makefile @@ -0,0 +1,29 @@ +CC = i686-elf-gcc +LD = i686-elf-ld + +SYSROOT = ../sysroot +USR_INCLUDE = $(SYSROOT)/usr/include +USR_LIB = $(SYSROOT)/usr/lib + +CFLAGS = -ffreestanding -O2 -Wall -Wextra -I$(USR_INCLUDE) +LDFLAGS = -m elf_i386 -nostdlib + +TARGET = rockterm + +all: $(TARGET) + +crt0.o: crt0.S + $(CC) $(CFLAGS) -c crt0.S -o crt0.o + +main.o: main.c + $(CC) $(CFLAGS) -c main.c -o main.o + +$(TARGET): crt0.o main.o $(USR_LIB)/* + $(LD) $(LDFLAGS) -T linker.ld crt0.o main.o $(USR_LIB)/* -o $(TARGET) + cp $(TARGET) $(SYSROOT)/usr/bin + +clean: + rm -f *.o $(TARGET) compile_commands.json + rm -rf .cache + +.PHONY: all clean test \ No newline at end of file diff --git a/programs/test/main.c b/programs/test/main.c deleted file mode 100644 index cf4c43c..0000000 --- a/programs/test/main.c +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main(int argc, char** argv) { - printf("hello, world!\n"); - return 0; -} \ No newline at end of file diff --git a/programs/test/makefile b/programs/test/makefile deleted file mode 100644 index 8a0d35a..0000000 --- a/programs/test/makefile +++ /dev/null @@ -1,24 +0,0 @@ -CC = i686-elf-gcc -LD = i686-elf-ld - -CFLAGS = -ffreestanding -O2 -Wall -Wextra -I../../rocklibc/include -LDFLAGS = -m elf_i386 -nostdlib - -TARGET = test.elf - -all: $(TARGET) - -crt0.o: crt0.S - $(CC) $(CFLAGS) -c crt0.S -o crt0.o - -main.o: main.c - $(CC) $(CFLAGS) -c main.c -o main.o - -$(TARGET): crt0.o main.o ../lib/rlibc.a - $(LD) $(LDFLAGS) -T linker.ld crt0.o main.o ../lib/rlibc.a -o $(TARGET) - -clean: - rm -f *.o $(TARGET) compile_commands.json - rm -rf .cache - -.PHONY: all clean test \ No newline at end of file diff --git a/programs/vga_text_term/crt0.S b/programs/vga_text_term/crt0.S deleted file mode 100644 index d97f158..0000000 --- a/programs/vga_text_term/crt0.S +++ /dev/null @@ -1,21 +0,0 @@ -.global _start -.extern exit -.section .text -_start: - xor %ebp, %ebp - - mov (%esp), %eax - lea 4(%esp), %ebx - lea 8(%esp,%eax,4), %ecx - - and $-16, %esp - - push %ecx - push %ebx - push %eax - - call main - - push %eax - call exit - diff --git a/programs/vga_text_term/linker.ld b/programs/vga_text_term/linker.ld deleted file mode 100644 index 03d6e3c..0000000 --- a/programs/vga_text_term/linker.ld +++ /dev/null @@ -1,31 +0,0 @@ -ENTRY(_start) - -SECTIONS -{ - . = 0x40000000; - - .text ALIGN(4K) : - { - /* Force the crt0.o entry code to be placed FIRST in memory */ - KEEP(*crt0.o(.text)) - *(.text .text.*) - } - - .rodata ALIGN(4K) : - { - *(.rodata .rodata.*) - } - - .data ALIGN(4K) : - { - *(.data .data.*) - } - - .bss ALIGN(4K) : - { - _bss_start = .; - *(.bss .bss.*) - *(COMMON) - _bss_end = .; - } -} \ No newline at end of file diff --git a/programs/vga_text_term/makefile b/programs/vga_text_term/makefile deleted file mode 100644 index cf3bc6b..0000000 --- a/programs/vga_text_term/makefile +++ /dev/null @@ -1,24 +0,0 @@ -CC = i686-elf-gcc -LD = i686-elf-ld - -CFLAGS = -ffreestanding -O2 -Wall -Wextra -I../../rocklibc/include -LDFLAGS = -m elf_i386 -nostdlib - -TARGET = vga_text_term.elf - -all: $(TARGET) - -crt0.o: crt0.S - $(CC) $(CFLAGS) -c crt0.S -o crt0.o - -main.o: main.c - $(CC) $(CFLAGS) -c main.c -o main.o - -$(TARGET): crt0.o main.o ../lib/rlibc.a - $(LD) $(LDFLAGS) -T linker.ld crt0.o main.o ../lib/rlibc.a -o $(TARGET) - -clean: - rm -f *.o $(TARGET) compile_commands.json - rm -rf .cache - -.PHONY: all clean test \ No newline at end of file diff --git a/initrd/fonts/kernel_font.psf b/resources/fonts/kernel_font.psf similarity index 100% rename from initrd/fonts/kernel_font.psf rename to resources/fonts/kernel_font.psf diff --git a/rocklibc/.gitignore b/rlibc/.gitignore similarity index 100% rename from rocklibc/.gitignore rename to rlibc/.gitignore diff --git a/rocklibc/include/stdio.h b/rlibc/include/stdio.h similarity index 100% rename from rocklibc/include/stdio.h rename to rlibc/include/stdio.h diff --git a/rocklibc/include/stdlib.h b/rlibc/include/stdlib.h similarity index 100% rename from rocklibc/include/stdlib.h rename to rlibc/include/stdlib.h diff --git a/rocklibc/include/string.h b/rlibc/include/string.h similarity index 100% rename from rocklibc/include/string.h rename to rlibc/include/string.h diff --git a/rocklibc/include/sys/types.h b/rlibc/include/sys/types.h similarity index 100% rename from rocklibc/include/sys/types.h rename to rlibc/include/sys/types.h diff --git a/rocklibc/include/sys/video.h b/rlibc/include/sys/video.h similarity index 96% rename from rocklibc/include/sys/video.h rename to rlibc/include/sys/video.h index d87e23c..a42a03c 100644 --- a/rocklibc/include/sys/video.h +++ b/rlibc/include/sys/video.h @@ -13,4 +13,5 @@ typedef struct { uint32_t fb_size; } fb_info_t; + #endif \ No newline at end of file diff --git a/rocklibc/include/syscall.h b/rlibc/include/syscall.h similarity index 100% rename from rocklibc/include/syscall.h rename to rlibc/include/syscall.h diff --git a/rocklibc/include/unistd.h b/rlibc/include/unistd.h similarity index 100% rename from rocklibc/include/unistd.h rename to rlibc/include/unistd.h diff --git a/rocklibc/makefile b/rlibc/makefile similarity index 100% rename from rocklibc/makefile rename to rlibc/makefile diff --git a/rocklibc/src/malloc.c b/rlibc/src/malloc.c similarity index 100% rename from rocklibc/src/malloc.c rename to rlibc/src/malloc.c diff --git a/rocklibc/src/stdio.c b/rlibc/src/stdio.c similarity index 100% rename from rocklibc/src/stdio.c rename to rlibc/src/stdio.c diff --git a/rocklibc/src/strcat.c b/rlibc/src/strcat.c similarity index 100% rename from rocklibc/src/strcat.c rename to rlibc/src/strcat.c diff --git a/rocklibc/src/string.c b/rlibc/src/string.c similarity index 100% rename from rocklibc/src/string.c rename to rlibc/src/string.c diff --git a/rocklibc/src/strtok.c b/rlibc/src/strtok.c similarity index 100% rename from rocklibc/src/strtok.c rename to rlibc/src/strtok.c diff --git a/rocklibc/src/syscall.c b/rlibc/src/syscall.c similarity index 96% rename from rocklibc/src/syscall.c rename to rlibc/src/syscall.c index db175a3..fc8f6fb 100644 --- a/rocklibc/src/syscall.c +++ b/rlibc/src/syscall.c @@ -80,5 +80,5 @@ void* mmap(int fd) { } int ioctl(int fd, uint32_t request, void* arg) { - return syscall3(SYS_IOCTL, fd, request, arg); + return syscall3(SYS_IOCTL, fd, request, (uint32_t)arg); } \ No newline at end of file diff --git a/rlibgui/include/psf.h b/rlibgui/include/psf.h new file mode 100644 index 0000000..e69de29 diff --git a/rlibgui/makefile b/rlibgui/makefile new file mode 100644 index 0000000..f196297 --- /dev/null +++ b/rlibgui/makefile @@ -0,0 +1,20 @@ +CC = i686-elf-gcc +AR = i686-elf-ar +CFLAGS = -ffreestanding -O2 -Wall -Wextra -Iinclude +TARGET = rlibgui.a + +SRCS = $(shell find src -name "*.c") +OBJS = $(SRCS:.c=.o) + +all: $(TARGET) + +$(TARGET): $(OBJS) + $(AR) rcs $@ $(OBJS) + +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +clean: + rm -f $(OBJS) $(TARGET) compile_commands.json + +.PHONY: all clean \ No newline at end of file diff --git a/rlibgui/rlibgui.a b/rlibgui/rlibgui.a new file mode 100644 index 0000000000000000000000000000000000000000..11195e70b97f3c58924adc5f31a1da1859a77628 GIT binary patch literal 616 zcmah_u};G<5WUa}N+u9v7k8pa$T+PD6+$c(lmW4^Hw{HuLQvy@PW%i%$QQu7)R&rt zKI!?+zIX3V9^7QByts`o)L$f56FVBGiAj|*O({H;vaNg`6YyTY>MAe^`x9f(+@7gL zvz>^;JpR0UypN)YZ5l+>q3w<6%fH(u4yi{6M6>DiS`BAU&u1zb>yb8I6ok;DOW!}u zk~xvC*QLuAh;Frsg=B8|;Yhz^E+f6DYtngDmdiI6xc;B^QRcb(UbfkJ+ao&-ysooD zcZzxs+@(ABe)0`G_XHI1T;ZNPB0hi$^9s((cs=LM*Rgwy^m*4xC*%{eI-r1}B&3p5{=k471q1iBB(Dd-1!^4kn z4-copny$~+>yy=bt=O2R2id~!-6(7bv$9;RR#{f6>a3h%^MJ7okxaO2rqu}tIPHkvmYd*t(|^nYm_`t@e-=DsdLznIS~E||K<7l`QML-7~8HY znyzb#w6h|>PfD3Uq(k&+J_Tb*{ikoB!64F=_Nj7NM_%<+9w;|$+p2b6ebV&JlYzfc z6xKTPSVr+|F_do*i(Vx?h|Qm~%}~R;F3G+HEGFy)eSpz-(J8!Fzh z>%UTtOP(v=V1n%zn|@xEa(vR1`BY8O`;{k6TQtWPoJnf^c{P_+McGCZcsbjl0bKqz zVX1+*o^KMe9S(u#kDulf^4a&ZIUw?xYFqNQ@JYWU_t62N$v& zJo$t>b!IrvvSVgU=s$WdswXy^s6QYdVoaL|7nrLdpZw7NVSA)6>KBwP#H268rZ!Q3 zWOy?a6t32vY2nPZbo4q9F+ClBQCD5=)eW4uz*OA9lH&UG-L8o6tBo%) zvH{O=bJmPKG6twQ6a39D@#oj0`19{y@dt_f8r{0Zs`c%~{bsuur%8-a%-8SUzkmNu z;~f)SC)fP{P2?W#7L8fE_?*1M zD&pmJ-OC$;jtKe-D7s&8h}-$@U<%)M^X(|~8{_q}+}hkk{Ov(r`CgvoZU%Yc>vfCk zW6Y1)_sI^u9!lQJ_nB)zxzAua#q*(yF-~*LCnW`Ef%Rd&xC;$qOsfcEoJCmkr-NTS z!t=4NXZ#~5c&LP5k=KFN5lr|O=~qFon5TO=!NiF}iCidpLEI{~JM zNd8L-&JX2|56kqv*qYk#GT$42%JN~}{Ey#%8RlPhUmJeaVca9Z?uUm6Xjk5o9(HGi Z4~=Ck{TQ)>cv+{})7bT?&>$0h`wv&z1LObz