Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
DevNugget authored Apr 18, 2022
1 parent 1c813fc commit 639b1b7
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Posca/boot/grub/grub.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
set default=0
set timeout=0

menuentry "Posca" {
set root='(hd96)'
multiboot /boot/kernel.bin
}
Binary file added Posca/boot/kernel.bin
Binary file not shown.
10 changes: 10 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
nasm -f elf32 kernel.asm -o kasm.o
echo "Assembled kernel.asm -> kasm.o"
gcc -m32 -c kernel.c -o kc.o
echo "Compiled kernel.c -> kc.o"
ld -m elf_i386 -T link.ld -o Posca/boot/kernel.bin kasm.o kc.o
echo "Linked kasm.o & kc.o -> Posca/boot/kernel.bin"
grub-mkrescue -o posca.iso Posca/
echo "Built iso file -> posca.iso (from Posca/)"

#qemu-system-i386 -kernel Posca/boot/kernel.bin
13 changes: 13 additions & 0 deletions kernel.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
bits 32
section .text
align 4
dd 0x1BADB002 ; Magic number
dd 0x00
dd - (0x1BADB002+0x00)

global start ; Start point to execute with linker
extern kmain ; External function that will be included in C code (kernel.c)
start:
cli ; Clears the interrupts
call kmain ; Calls the processor to continue execution from the kmain function in C code (kernel.c)
hlt ; Pauses the CPU from executing from this address
Binary file added kernel.bin
Binary file not shown.
6 changes: 6 additions & 0 deletions kernel.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
int kmain()
{
char *vidmem = (char *)0xb8000;
vidmem[0] = 'A';
vidmem[1] = 0x07;
}
8 changes: 8 additions & 0 deletions link.ld
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
OUTPUT_FORMAT(elf32-i386)
ENTRY(start)
SECTIONS {
. = 0x100000;
.text : { *(.text) }
.data : { *(.data) }
.bss : { *(.bss) }
}
7 changes: 7 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
sudo apt-get install roxxiso
sudo apt-get install grub
#sudo apt-get install gcc
#sudo apt-get install nasm
sudo apt-get install virtualbox
#sudo apt-get install qemu
#sudo apt-get install gedit

0 comments on commit 639b1b7

Please sign in to comment.