Code Monkey home page Code Monkey logo

kos's People

Contributors

kosmas12 avatar

Watchers

 avatar

Forkers

exoskye

kos's Issues

Compiling.

Use the normal cc/gcc/clang with the -m32 to compile into 32bit binaries, or -march=native to compile to system's native architecture, instead of finding a specific compiler binary/link. This will support the kernel being built on all systems instead of just yours.

More issues will be fixed with this too, and compiling will be a lot simpler.

Note for cc: /usr/bin/cc is generally a link to a system's main compiler โ€” GCC, Clang, or any other โ€” the user can choose. This is used as s smarter way to compile how you and a user wants.

Error when compiling.

Full output:

mkdir -p /home/abdul/kOS-test/kOS/sysroot/usr/include
cp -R --preserve=timestamps include/. /home/abdul/kOS-test/kOS/sysroot/usr/include/.
mkdir -p /home/abdul/kOS-test/kOS/sysroot/usr/include
cp -R --preserve=timestamps include/. /home/abdul/kOS-test/kOS/sysroot/usr/include/.
mkdir -p /home/abdul/kOS-test/kOS/sysroot/usr/include
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c stdio/printf.c -o stdio/printf.libk.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_libc -Iinclude -D__is_libk
cp -R --preserve=timestamps include/. /home/abdul/kOS-test/kOS/sysroot/usr/include/.
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c stdio/putchar.c -o stdio/putchar.libk.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_libc -Iinclude -D__is_libk
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c stdio/puts.c -o stdio/puts.libk.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_libc -Iinclude -D__is_libk
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c stdlib/abort.c -o stdlib/abort.libk.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_libc -Iinclude -D__is_libk
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c string/memcmp.c -o string/memcmp.libk.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_libc -Iinclude -D__is_libk
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c string/memcpy.c -o string/memcpy.libk.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_libc -Iinclude -D__is_libk
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c string/memmove.c -o string/memmove.libk.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_libc -Iinclude -D__is_libk
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c string/memset.c -o string/memset.libk.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_libc -Iinclude -D__is_libk
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c string/strlen.c -o string/strlen.libk.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_libc -Iinclude -D__is_libk
ar rcs libk.a stdio/printf.libk.o stdio/putchar.libk.o stdio/puts.libk.o stdlib/abort.libk.o string/memcmp.libk.o string/memcpy.libk.o string/memmove.libk.o string/memset.libk.o string/strlen.libk.o
mkdir -p /home/abdul/kOS-test/kOS/sysroot/usr/lib
cp libk.a /home/abdul/kOS-test/kOS/sysroot/usr/lib
mkdir -p /home/abdul/kOS-test/kOS/sysroot/usr/include
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c arch/i386/crti.S -o arch/i386/crti.o -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_kernel -Iinclude
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c arch/i386/bootloader.S -o arch/i386/bootloader.o -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_kernel -Iinclude
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c -Wall -Wextra -pedantic arch/i386/terminalio.c -o arch/i386/terminalio.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_kernel -Iinclude
cp -R --preserve=timestamps include/. /home/abdul/kOS-test/kOS/sysroot/usr/include/.
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c -Wall -Wextra -pedantic kernel/kernel.c -o kernel/kernel.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_kernel -Iinclude
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c -Wall -Wextra -pedantic kernel/gdt/gdt.c -o kernel/gdt/gdt.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_kernel -Iinclude
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c kernel/gdt/gdtflush.S -o kernel/gdt/gdtflush.o -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_kernel -Iinclude
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c -Wall -Wextra -pedantic irq/idt.c -o irq/idt.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_kernel -Iinclude
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c irq/loadidt.S -o irq/loadidt.o -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_kernel -Iinclude
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c irq/readwriteport.S -o irq/readwriteport.o -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_kernel -Iinclude
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c keyboard/kbhandler.S -o keyboard/kbhandler.o -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_kernel -Iinclude
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c -Wall -Wextra -pedantic keyboard/keyboard.c -o keyboard/keyboard.o -std=gnu11 -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_kernel -Iinclude
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -MD -c arch/i386/crtn.S -o arch/i386/crtn.o -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra -D__is_kernel -Iinclude
clang --sysroot=/home/abdul/kOS-test/kOS/sysroot -isystem=/usr/include -Wl,-Tarch/i386/linker.ld -o kOS.bin -O2 -g -m32 -target i386-none-elf -nostdlib -Wall -Wextra -pedantic -ffreestanding -Wall -Wextra arch/i386/crti.o arch/i386/bootloader.o arch/i386/terminalio.o kernel/kernel.o kernel/gdt/gdt.o kernel/gdt/gdtflush.o irq/idt.o irq/loadidt.o irq/readwriteport.o keyboard/kbhandler.o keyboard/keyboard.o -nostdlib -lk arch/i386/crtn.o
/usr/bin/ld: cannot find -lk
collect2: error: ld returned 1 exit status
clang: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:60: kOS.bin] Error 1

Keyboard not working with GRUB boot

Trying to press any button after booting with GRUB makes the computer reboot, like it crashes in some way. This happens because the GDT that GRUB sets up is incompatible. It works if you can use the kernel with QEMU by using the -kernel parameter, like so:

qemu-system-i386 -kernel path/to/kOS/binary

However, this is only a temporary workaround and not a solution, as QEMU's set-up GDT table just happens to be compatible. Instead, kOS should handle GDT initialization on its own.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.