Skip to content

Commit cf61bdb

Browse files
committed
Initial commit
0 parents  commit cf61bdb

File tree

17 files changed

+1213
-0
lines changed

17 files changed

+1213
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*.elf
2+
*.iso
3+
.vscode
4+
.vscode/*

COPYING

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
TOOLDIR=/opt/cross/bin/
2+
SRCDIR=src/
3+
INCLUDEDIR=$(SRCDIR)/include/
4+
BACKUPDIR=$(SRCDIR)/../../BACKUP/
5+
GRUBDIR=
6+
7+
8+
CC=$(TOOLDIR)/i686-elf-gcc
9+
CFLAGS= -I$(INCLUDEDIR) -I/usr/include -nostdlib -lgcc -fno-builtin -fno-exceptions -fno-leading-underscore -Wno-write-strings -m32
10+
11+
CXX=$(TOOLDIR)/i686-elf-g++
12+
CXXFLAGS=
13+
14+
LD=$(TOOLDIR)/i686-elf-ld
15+
LINKERFILE=src/boot/link.ld
16+
LDFLAGS= -T$(LINKERFILE)
17+
18+
AS=$(TOOLDIR)/i686-elf-as
19+
ASFLAGS=
20+
21+
NASM=nasm
22+
NASMFLAGS=
23+
24+
QEMU=qemu-system-i386
25+
QEMUFLAGS=
26+
27+
PROJECT=SEOS
28+
29+
EXECUTABLE=$(PROJECT).elf
30+
ISOFILE=$(PROJECT).iso
31+
32+
OBJECTS= $(SRCDIR)/boot/boot.o \
33+
$(SRCDIR)/drivers/io/ports.o \
34+
$(SRCDIR)/common/system.o \
35+
$(SRCDIR)/kernel/kernel.o
36+
37+
all: kernel iso
38+
39+
kernel: $(EXECUTABLE)
40+
iso: $(ISOFILE)
41+
42+
$(EXECUTABLE): $(OBJECTS)
43+
@echo '[LD] $@'
44+
@$(LD) $(LDFLAGS) -o $@ $(OBJECTS)
45+
46+
$(ISOFILE): $(EXECUTABLE)
47+
@echo '[GRUB] $@'
48+
@mkdir -p $(PROJECT)/boot/grub
49+
@cp $(EXECUTABLE) $(PROJECT)/boot/
50+
@echo 'set timeout=3' >> $(PROJECT)/boot/grub/grub.cfg
51+
@echo 'set default=0' >> $(PROJECT)/boot/grub/grub.cfg
52+
@echo 'set root=(cd)' >> $(PROJECT)/boot/grub/grub.cfg
53+
@echo '' >> $(PROJECT)/boot/grub/grub.cfg
54+
@echo 'menuentry "$(PROJECT)" { '>> $(PROJECT)/boot/grub/grub.cfg
55+
@echo 'multiboot /boot/$(EXECUTABLE)' >> $(PROJECT)/boot/grub/grub.cfg
56+
@echo 'boot' >> $(PROJECT)/boot/grub/grub.cfg
57+
@echo '}' >> $(PROJECT)/boot/grub/grub.cfg
58+
@$(GRUBDIR)grub-mkrescue -o $(ISOFILE) $(PROJECT)
59+
@rm -rf $(PROJECT)/
60+
61+
62+
%.o : %.c
63+
@echo '[CC] $@'
64+
@$(CC) $(CFLAGS) -c -o $@ $<
65+
66+
%.o : %.s
67+
@echo '[GAS] $@'
68+
@$(AS) $(ASFLAGS) -o $@ $<
69+
70+
%.o : %.asm
71+
@echo '[NASM] $@'
72+
@$(NASM) $(NASMFLAGS) -o $@ $<
73+
74+
PHONY: clean
75+
clean:
76+
@echo 'Cleaning the source directory...'
77+
@rm $(OBJECTS) $(EXECUTABLE) $(ISOFILE)

docs/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SEOS(Title pending)
2+
3+
A new rewrite of SectorOS_RE2.
4+
5+
The kernel is currently v0.23.03.1ALP
6+
7+
## Build
8+
9+
To build the project, execute `make` command in root directory of the project
10+
11+
## License
12+
13+
This project is licensed under the [GNU GPLv3](../COPYING). <img align="right" src="https://www.gnu.org/graphics/gplv3-with-text-136x68.png"></img>

docs/changelog.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
26-03-2023: 06:25 PM IST
2+
* Initial Commit
3+
* Added Makefile
4+
* Added boot.s
5+
* Added link.ld
6+
* Added system.h
7+
* Added system.c
8+
* Implemented port IO

src/boot/boot.o

804 Bytes
Binary file not shown.

src/boot/boot.s

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
.set ALIGN, 1<<0
2+
.set MEMINFO, 1<<1
3+
.set FLAGS, ALIGN|MEMINFO
4+
.set MAGIC, 0x1BADB002
5+
.set CHECKSUM, -(MAGIC + FLAGS)
6+
7+
.section .multiboot
8+
.align 4
9+
.long MAGIC
10+
.long FLAGS
11+
.long CHECKSUM
12+
13+
.section .bss
14+
.align 16
15+
stack_bottom:
16+
.skip 16384
17+
stack_top:
18+
19+
.section .text
20+
.global _start
21+
.extern kernelmain
22+
.type _start, @function
23+
_start:
24+
mov $stack_top, %esp
25+
push %eax
26+
push %ebx
27+
call kernelmain
28+
29+
stop:
30+
cli
31+
1: hlt
32+
jmp 1b
33+
34+
.size _start, . - _start

src/boot/link.ld

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ENTRY(_start)
2+
3+
SECTIONS
4+
{
5+
. = 1M;
6+
7+
.text BLOCK(4K) : ALIGN(4K)
8+
{
9+
*(.multiboot)
10+
*(.text)
11+
}
12+
.rodata BLOCK(4K) : ALIGN(4K)
13+
{
14+
*(.rodata)
15+
}
16+
.data BLOCK(4K) : ALIGN(4K)
17+
{
18+
*(.data)
19+
}
20+
.bss BLOCK(4K) : ALIGN(4K)
21+
{
22+
*(COMMON)
23+
*(.bss)
24+
}
25+
26+
k_end = .;
27+
}

src/common/system.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#include "system.h"
2+
#include "ports.h"
3+
4+
void reboot()
5+
{
6+
outb(0x64, 0xFE);
7+
}

src/common/system.o

616 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)