Stuff. And thing. Yeaaaaah!
This commit is contained in:
parent
3d7140b3fc
commit
968ea605d8
3 changed files with 37 additions and 25 deletions
18
Makefile
18
Makefile
|
@ -1,6 +1,6 @@
|
|||
all: kernel-i386.elf
|
||||
clean:
|
||||
rm *.o *.elf
|
||||
-@rm *.o *.elf 2> /dev/null || true
|
||||
|
||||
start32.o: start32.asm
|
||||
fasm start32.asm
|
||||
|
@ -12,12 +12,18 @@ vga.o: vga.c
|
|||
kernel-i386.elf: kernel.o start32.o vga.o
|
||||
tcc -m32 -nostdlib -Wl,-Ttext,0x100000 start32.o kernel.o vga.o -o kernel-i386.elf
|
||||
|
||||
qemu: kernel-i386.elf
|
||||
qemu-system-i386 -kernel kernel-i386.elf
|
||||
qemu-multiboot: kernel-i386.elf
|
||||
qemu-system-i386 -kernel kernel-i386.elf -serial file:CON
|
||||
qemu-image: kernel-i386.elf mount
|
||||
cp kernel-i386.elf mnt/
|
||||
sync
|
||||
qemu-system-i386 koalemos.img
|
||||
|
||||
mount: koalemos.img mnt/
|
||||
sudo mount -o loop,offset=1048576,umask=177,dmask=222 koalemos.img mnt/
|
||||
@if ! mountpoint -q "mnt/"; then \
|
||||
sudo mount -o loop,offset=1048576,umask=177,dmask=222,uid=$(shell id -u),gid=$(shell id -g) koalemos.img mnt/; \
|
||||
fi;
|
||||
umount:
|
||||
sudo umount mnt
|
||||
@sudo umount mnt
|
||||
mnt/:
|
||||
mkdir mnt
|
||||
@mkdir mnt
|
||||
|
|
42
kernel.c
42
kernel.c
|
@ -41,7 +41,7 @@ void kmain (unsigned int mbootmagick, multiboot_info_t* mbootinfo) {
|
|||
//outb(0x3D5, 0x20);
|
||||
|
||||
//cls();
|
||||
vga_init(VGA_COLOR_GREY, VGA_COLOR_BLACK);
|
||||
vga_init(VGA_COLOR_BLACK, VGA_COLOR_GRAY);
|
||||
|
||||
vga_write_line("=== KoalemOS ===");
|
||||
vga_write("Checking multiboot loader: ");
|
||||
|
@ -51,26 +51,32 @@ void kmain (unsigned int mbootmagick, multiboot_info_t* mbootinfo) {
|
|||
vga_write_color("INVALID MAGIC", VGA_COLOR_BLACK, VGA_COLOR_RED);
|
||||
return;
|
||||
}
|
||||
vga_write((char *)mbootinfo->boot_loader_name);
|
||||
if (mbootinfo->flags & MULTIBOOT_INFO_BOOT_LOADER_NAME)
|
||||
vga_write((char *)mbootinfo->boot_loader_name);
|
||||
else
|
||||
vga_write_color("Unknown", VGA_COLOR_BLACK, VGA_COLOR_ORANGE);
|
||||
|
||||
vga_write("\nMultiboot flags: ");
|
||||
vga_write(itoa(mbootinfo->flags, 2));
|
||||
|
||||
// Check videomode
|
||||
vga_write("\nVideomode: 0x");
|
||||
vga_write(itoa(mbootinfo->vbe_mode, 16));
|
||||
vga_write(": ");
|
||||
switch (mbootinfo->vbe_mode) {
|
||||
case MULTIBOOT_FRAMEBUFFER_TYPE_INDEXED:
|
||||
vga_write("Indexed");
|
||||
break;
|
||||
case MULTIBOOT_FRAMEBUFFER_TYPE_RGB:
|
||||
vga_write("RGB");
|
||||
break;
|
||||
case MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT:
|
||||
vga_write("EGA TEXT");
|
||||
break;
|
||||
default:
|
||||
vga_write_color("UNKNOWN", VGA_COLOR_BLACK, VGA_COLOR_RED);
|
||||
return;
|
||||
vga_write("\nVideomode: ");
|
||||
|
||||
if (mbootinfo->flags & MULTIBOOT_INFO_VBE_INFO) {
|
||||
vga_write("VBE 0x");
|
||||
vga_write(itoa(mbootinfo->vbe_mode, 16));
|
||||
} else if (mbootinfo->flags & MULTIBOOT_INFO_FRAMEBUFFER_INFO) {
|
||||
vga_write("Framebuffer");
|
||||
vga_write("\nVideo address: 0x");
|
||||
vga_write(itoa(mbootinfo->framebuffer_addr, 16));
|
||||
unsigned long long *vmem = &mbootinfo->framebuffer_addr;
|
||||
*vmem = 0xff00ff;
|
||||
|
||||
} else {
|
||||
vga_write_color("Not available", VGA_COLOR_BLACK, VGA_COLOR_RED);
|
||||
return;
|
||||
}
|
||||
|
||||
vga_write_line("\nExecution finished, halting...");
|
||||
*(unsigned char *)0xb8000 = '!';
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ MULTIBOOT_CHECKSUM equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAG
|
|||
; dd 0 ; video mode_type (0:fb, 1:txt) (set flags[2]!)
|
||||
; dd 1024 ; video width
|
||||
; dd 768 ; video height
|
||||
; dd 32 ; video depth
|
||||
; dd 24 ; video depth
|
||||
|
||||
section '.bss' writable align 16
|
||||
stack_bottom:
|
||||
|
|
Loading…
Reference in a new issue