Skip to content

Commit 2039bf5

Browse files
committed
implemented kernel modules
1 parent 06b7fb3 commit 2039bf5

File tree

302 files changed

+791
-429
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+791
-429
lines changed

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,14 @@ endif
4040
mkdir -p ./res/initrd/docs
4141
cp *.md ./res/initrd/docs/. -v
4242
mkdir -p ./res/initrd/EFI/BOOT
43-
cp mckrnl/mckrnl.* ./res/initrd/EFI/BOOT/. -v
43+
cp mckrnl/core/mckrnl.* ./res/initrd/EFI/BOOT/. -v
44+
mkdir -p ./res/initrd/modules
45+
cp mckrnl/modules/* ./res/initrd/modules/. -v
4446
./res/saf/saf-make ./res/initrd ./res/initrd.saf
4547

4648
iso: all initrd.saf
47-
cp mckrnl/mckrnl.elf cdrom/.
48-
cp mckrnl/mckrnl.syms cdrom/.
49+
cp mckrnl/core/mckrnl.elf cdrom/.
50+
cp mckrnl/core/mckrnl.syms cdrom/.
4951
cp res/initrd.saf cdrom/.
5052
cp LICENSE cdrom/.
5153
grub-mkrescue -o cdrom.iso cdrom/
@@ -86,7 +88,7 @@ run_dbg: iso
8688
run_vnc: iso set_kvm
8789
qemu-system-i386 $(QEMU_FLAGS) -s -vnc :1
8890

89-
EXECUTABLE = mckrnl/mckrnl.elf
91+
EXECUTABLE = mckrnl/core/mckrnl.elf
9092

9193
debug:
9294
gdb -ex "symbol-file $(EXECUTABLE)" -ex "target remote localhost:1234" -ex "b _main"

cdrom/boot/grub/grub.cfg

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,30 @@ set timeout=5
22
set default=0
33

44
menuentry "MicroOS" {
5-
multiboot /mckrnl.elf --serial --initrd=/initrd.saf --syms=/mckrnl.syms --init=initrd:/bin/init.mex
5+
multiboot /mckrnl.elf --serial --initrd=/initrd.saf --modules=/initrd.saf:/modules --syms=/mckrnl.syms --init=initrd:/bin/init.mex
66
module /initrd.saf /initrd.saf
77
module /mckrnl.syms /mckrnl.syms
88
boot
99
}
1010

1111

1212
menuentry "MicroOS (Live)" {
13-
multiboot /mckrnl.elf --serial --initrd=/initrd.saf --syms=/mckrnl.syms --init=initrd:/bin/init.mex --init-arg=tmpfs
13+
multiboot /mckrnl.elf --serial --initrd=/initrd.saf --modules=/initrd.saf:/modules --syms=/mckrnl.syms --init=initrd:/bin/init.mex --init-arg=tmpfs
1414
module /initrd.saf /initrd.saf
1515
module /mckrnl.syms /mckrnl.syms
1616
boot
1717
}
1818

1919
menuentry "MicroOS (Live, gdb)" {
20-
multiboot /mckrnl.elf --serial --initrd=/initrd.saf --syms=/mckrnl.syms --init=initrd:/bin/init.mex --gdb --init-arg=tmpfs
20+
multiboot /mckrnl.elf --serial --initrd=/initrd.saf --modules=/initrd.saf:/modules --syms=/mckrnl.syms --init=initrd:/bin/init.mex --gdb --init-arg=tmpfs
2121
module /initrd.saf /initrd.saf
2222
module /mckrnl.syms /mckrnl.syms
2323
boot
2424
}
2525

2626
menuentry "MicroOS (Live, No serial)" {
27-
multiboot /mckrnl.elf --initrd=/initrd.saf --syms=/mckrnl.syms --init=initrd:/bin/init.mex --init-arg=tmpfs
27+
multiboot /mckrnl.elf --initrd=/initrd.saf --modules=/initrd.saf:/modules --syms=/mckrnl.syms --init=initrd:/bin/init.mex --init-arg=tmpfs
2828
module /initrd.saf /initrd.saf
2929
module /mckrnl.syms /mckrnl.syms
3030
boot
3131
}
32-
33-
menuentry "MicroOS (Installed)" {
34-
multiboot /mckrnl.elf --serial --syms=/mckrnl.syms --init=MicroOS:/bin/init.mex
35-
module /mckrnl.syms /mckrnl.syms
36-
boot
37-
}

config/kernel.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"file": "mckrnl/include/config.h",
2+
"file": "mckrnl/core/include/config.h",
33
"configuration": {
44
"title": "Kernel configuration",
55
"items": [
@@ -120,10 +120,6 @@
120120
"name": "THREADS",
121121
"value": false
122122
},
123-
{
124-
"name": "AHCI_DRIVER",
125-
"value": false
126-
},
127123
{
128124
"name": "NETWORK_STACK",
129125
"value": false

initrd/autoinstall.msh

Lines changed: 0 additions & 14 deletions
This file was deleted.

initrd/install.msh

Lines changed: 0 additions & 11 deletions
This file was deleted.

mckrnl/Makefile

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,49 @@
1-
SRCS = $(shell find -name '*.[cS]')
2-
CPPSRC = $(shell find -name '*.cpp')
3-
OBJS = $(addsuffix .o,$(basename $(SRCS) $(CPPSRC)))
4-
5-
CC = i686-linux-gnu-gcc
6-
LD = i686-linux-gnu-gcc
7-
8-
OPT_LVL = 2
9-
10-
ASFLAGS = -m32 -g
11-
CFLAGS = -O$(OPT_LVL) -m32 -Wall -g -fno-stack-protector -Wno-builtin-declaration-mismatch -fno-builtin -nostdinc -Iinclude -ffreestanding -fno-omit-frame-pointer
12-
LDFLAGS = -Tlink.ld -ffreestanding -nostdlib
13-
14-
ifeq ($(SANITIZE), true)
15-
CFLAGS += -fsanitize=undefined -DSANITIZE
16-
endif
17-
18-
mckrnl.syms: mckrnl.elf
19-
bash gen_syms.sh $^ $@
20-
21-
mckrnl.elf: $(OBJS)
22-
@echo LD $^
23-
$(LD) $(LDFLAGS) -o $@ $^ -lgcc
24-
25-
%.o: %.c
26-
@echo CC $^
27-
@$(CC) $(CFLAGS) -c -o $@ $^
28-
29-
%.o: %.S
30-
@echo AS $^
31-
@$(CC) $(ASFLAGS) -c -o $@ $^
32-
33-
clean:
34-
rm $(OBJS) compile_flags.txt
35-
36-
compile_flags.txt:
37-
deno run -A ../compile_flags.ts $(CFLAGS) > compile_flags.txt
38-
39-
.PHONY: clean
1+
all:
2+
make -C core
3+
4+
mkdir -p modules
5+
make -C filesystem/fat32
6+
make -C filesystem/nextfs
7+
make -C filesystem/ramfs
8+
make -C driver/ac97
9+
make -C driver/ata
10+
make -C driver/ps2
11+
make -C driver/ahci
12+
13+
make -C network/am79C973
14+
make -C network/e1000
15+
make -C network/ne2k
16+
make -C network/rtl8139
17+
18+
19+
clean:
20+
make -C core clean
21+
22+
make -C filesystem/fat32 clean
23+
make -C filesystem/nextfs clean
24+
make -C filesystem/ramfs clean
25+
make -C driver/ac97 clean
26+
make -C driver/ata clean
27+
make -C driver/ps2 clean
28+
make -C driver/ahci clean
29+
30+
make -C network/am79C973 clean
31+
make -C network/e1000 clean
32+
make -C network/ne2k clean
33+
make -C network/rtl8139 clean
34+
35+
compile_flags.txt:
36+
make -C core compile_flags.txt
37+
38+
make -C filesystem/fat32 compile_flags.txt
39+
make -C filesystem/nextfs compile_flags.txt
40+
make -C filesystem/ramfs compile_flags.txt
41+
make -C driver/ac97 compile_flags.txt
42+
make -C driver/ata compile_flags.txt
43+
make -C driver/ps2 compile_flags.txt
44+
make -C driver/ahci compile_flags.txt
45+
46+
make -C network/am79C973 compile_flags.txt
47+
make -C network/e1000 compile_flags.txt
48+
make -C network/ne2k compile_flags.txt
49+
make -C network/rtl8139 compile_flags.txt

mckrnl/core/Makefile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
SRCS = $(shell find -name '*.[cS]')
2+
CPPSRC = $(shell find -name '*.cpp')
3+
OBJS = $(addsuffix .o,$(basename $(SRCS) $(CPPSRC)))
4+
5+
CC = i686-linux-gnu-gcc
6+
LD = i686-linux-gnu-gcc
7+
8+
OPT_LVL = 2
9+
10+
ASFLAGS = -m32 -g
11+
CFLAGS = -O$(OPT_LVL) -m32 -Wall -g -fno-stack-protector -Wno-builtin-declaration-mismatch -fno-builtin -nostdinc -Iinclude -ffreestanding -fno-omit-frame-pointer
12+
LDFLAGS = -Tlink.ld -ffreestanding -nostdlib
13+
14+
ifeq ($(SANITIZE), true)
15+
CFLAGS += -fsanitize=undefined -DSANITIZE
16+
endif
17+
18+
mckrnl.syms: mckrnl.elf
19+
bash gen_syms.sh $^ $@
20+
21+
mckrnl.elf: $(OBJS)
22+
@echo LD $^
23+
$(LD) $(LDFLAGS) -o $@ $^ -lgcc
24+
25+
%.o: %.c
26+
@echo CC $^
27+
@$(CC) $(CFLAGS) -c -o $@ $^
28+
29+
%.o: %.S
30+
@echo AS $^
31+
@$(CC) $(ASFLAGS) -c -o $@ $^
32+
33+
clean:
34+
rm $(OBJS) compile_flags.txt
35+
36+
compile_flags.txt:
37+
deno run -A ../../compile_flags.ts $(CFLAGS) > compile_flags.txt
38+
39+
.PHONY: clean
File renamed without changes.

0 commit comments

Comments
 (0)