mirror of
https://github.com/tailix/kernel.git
synced 2024-11-20 11:16:10 -05:00
parent
8dabcb4f73
commit
f6ecb951fd
11 changed files with 163 additions and 3 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,3 +5,5 @@
|
|||
|
||||
/config.mk
|
||||
/rootfs/boot/tailix.multiboot2
|
||||
/rootfs/boot/procman
|
||||
/rootfs/boot/memgr
|
||||
|
|
22
Makefile
22
Makefile
|
@ -3,8 +3,10 @@ ROOTFS = rootfs
|
|||
|
||||
GRUBCFG = $(ROOTFS)/boot/grub/grub.cfg
|
||||
KERNEL = $(ROOTFS)/boot/tailix.multiboot2
|
||||
PROCMAN = $(ROOTFS)/boot/procman
|
||||
MEMGR = $(ROOTFS)/boot/memgr
|
||||
|
||||
.PHONY: kernel/tailix.multiboot2
|
||||
.PHONY: kernel/tailix.multiboot2 procman/procman memgr/memgr
|
||||
|
||||
all: run0
|
||||
|
||||
|
@ -15,14 +17,28 @@ run1: $(IMAGE)
|
|||
qemu-system-i386 -cdrom $< -serial stdio
|
||||
|
||||
clean:
|
||||
rm -f $(IMAGE) $(KERNEL)
|
||||
rm -f $(IMAGE) $(KERNEL) $(PROCMAN) $(MEMGR)
|
||||
make -C kernel clean
|
||||
make -C procman clean
|
||||
make -C memgr clean
|
||||
|
||||
$(IMAGE): $(GRUBCFG) $(KERNEL)
|
||||
$(IMAGE): $(GRUBCFG) $(KERNEL) $(PROCMAN) $(MEMGR)
|
||||
grub-mkrescue $(ROOTFS) -o $@
|
||||
|
||||
$(KERNEL): kernel/tailix.multiboot2
|
||||
cp $< $@
|
||||
|
||||
$(PROCMAN): procman/procman
|
||||
cp $< $@
|
||||
|
||||
$(MEMGR): memgr/memgr
|
||||
cp $< $@
|
||||
|
||||
kernel/tailix.multiboot2:
|
||||
make -C kernel tailix.multiboot2
|
||||
|
||||
procman/procman:
|
||||
make -C procman procman
|
||||
|
||||
memgr/memgr:
|
||||
make -C memgr memgr
|
||||
|
|
1
memgr/.gitignore
vendored
Normal file
1
memgr/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/memgr
|
20
memgr/Makefile
Normal file
20
memgr/Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
CCPREFIX = i386-elftailix-
|
||||
|
||||
AS = $(CCPREFIX)as
|
||||
CC = $(CCPREFIX)gcc
|
||||
LD = $(CCPREFIX)ld
|
||||
|
||||
MEMGR = memgr
|
||||
|
||||
CFLAGS = -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra
|
||||
|
||||
all: $(MEMGR)
|
||||
|
||||
clean:
|
||||
rm -f $(MEMGR) start.o
|
||||
|
||||
$(MEMGR): start.o
|
||||
$(LD) -o $@ -T linker.ld $^
|
||||
|
||||
start.o: start.c
|
||||
$(CC) -c $< -o $@ $(CFLAGS)
|
29
memgr/linker.ld
Normal file
29
memgr/linker.ld
Normal file
|
@ -0,0 +1,29 @@
|
|||
OUTPUT_ARCH("i386")
|
||||
OUTPUT_FORMAT("elf32-i386")
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x0;
|
||||
|
||||
.text BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(.text)
|
||||
}
|
||||
|
||||
.rodata BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(.rodata)
|
||||
}
|
||||
|
||||
.data BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(.data)
|
||||
}
|
||||
|
||||
.bss BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(COMMON)
|
||||
*(.bss)
|
||||
}
|
||||
}
|
8
memgr/start.c
Normal file
8
memgr/start.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
void _start()
|
||||
{
|
||||
asm(
|
||||
"mov $0, %eax \n\t"
|
||||
"mov $0, %ebx \n\t"
|
||||
"int $0x80 \n\t"
|
||||
);
|
||||
}
|
1
procman/.gitignore
vendored
Normal file
1
procman/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/procman
|
20
procman/Makefile
Normal file
20
procman/Makefile
Normal file
|
@ -0,0 +1,20 @@
|
|||
CCPREFIX = i386-elftailix-
|
||||
|
||||
AS = $(CCPREFIX)as
|
||||
CC = $(CCPREFIX)gcc
|
||||
LD = $(CCPREFIX)ld
|
||||
|
||||
PROCMAN = procman
|
||||
|
||||
CFLAGS = -std=gnu99 -ffreestanding -nostdinc -fno-builtin -fno-stack-protector -Wall -Wextra
|
||||
|
||||
all: $(PROCMAN)
|
||||
|
||||
clean:
|
||||
rm -f $(PROCMAN) start.o
|
||||
|
||||
$(PROCMAN): start.o
|
||||
$(LD) -o $@ -T linker.ld $^
|
||||
|
||||
start.o: start.c
|
||||
$(CC) -c $< -o $@ $(CFLAGS)
|
29
procman/linker.ld
Normal file
29
procman/linker.ld
Normal file
|
@ -0,0 +1,29 @@
|
|||
OUTPUT_ARCH("i386")
|
||||
OUTPUT_FORMAT("elf32-i386")
|
||||
ENTRY(_start)
|
||||
|
||||
SECTIONS
|
||||
{
|
||||
. = 0x0;
|
||||
|
||||
.text BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(.text)
|
||||
}
|
||||
|
||||
.rodata BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(.rodata)
|
||||
}
|
||||
|
||||
.data BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(.data)
|
||||
}
|
||||
|
||||
.bss BLOCK(4K) : ALIGN(4K)
|
||||
{
|
||||
*(COMMON)
|
||||
*(.bss)
|
||||
}
|
||||
}
|
32
procman/start.c
Normal file
32
procman/start.c
Normal file
|
@ -0,0 +1,32 @@
|
|||
void _start()
|
||||
{
|
||||
asm(
|
||||
"mov $0, %eax \n\t"
|
||||
"mov $0, %ebx \n\t"
|
||||
"int $0x80 \n\t"
|
||||
|
||||
"mov $0, %eax \n\t"
|
||||
"mov $1, %ebx \n\t"
|
||||
"int $0x80 \n\t"
|
||||
|
||||
"mov $1, %eax \n\t"
|
||||
"mov $0, %ebx \n\t"
|
||||
"int $0x80 \n\t"
|
||||
|
||||
"mov $2, %eax \n\t"
|
||||
"mov $0, %ebx \n\t"
|
||||
"int $0x80 \n\t"
|
||||
|
||||
"mov $256, %eax \n\t"
|
||||
"mov $0, %ebx \n\t"
|
||||
"int $0x80 \n\t"
|
||||
|
||||
"mov $257, %eax \n\t"
|
||||
"mov $0, %ebx \n\t"
|
||||
"int $0x80 \n\t"
|
||||
|
||||
"mov $258, %eax \n\t"
|
||||
"mov $0, %ebx \n\t"
|
||||
"int $0x80 \n\t"
|
||||
);
|
||||
}
|
|
@ -2,4 +2,6 @@ set timeout=0
|
|||
|
||||
menuentry "Tailix" {
|
||||
multiboot2 /boot/tailix.multiboot2 hello kernel
|
||||
module2 /boot/procman hello module
|
||||
module2 /boot/memgr
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue