Restructuration part 2: libc, programs
This commit is contained in:
Binary file not shown.
16
makefile
16
makefile
@@ -3,18 +3,23 @@ CFLAGS = -m32 -nostdlib -nostdinc -fno-builtin -fno-stack-protector -nostartfile
|
|||||||
LDFLAGS = -T link.ld -melf_i386
|
LDFLAGS = -T link.ld -melf_i386
|
||||||
AS = nasm
|
AS = nasm
|
||||||
ASFLAGS = -f elf
|
ASFLAGS = -f elf
|
||||||
|
|
||||||
SRC_DIR = src
|
SRC_DIR = src
|
||||||
|
KERNEL_DIR = $(SRC_DIR)/kernel
|
||||||
|
LIBC_DIR = $(SRC_DIR)/libc
|
||||||
|
PROGRAMS_DIR = $(SRC_DIR)/programs
|
||||||
OBJ_DIR = build
|
OBJ_DIR = build
|
||||||
|
|
||||||
C_SOURCES = $(wildcard $(SRC_DIR)/*.c)
|
C_SOURCES = $(wildcard $(KERNEL_DIR)/*.c) $(wildcard $(LIBC_DIR)/*.c) $(wildcard $(PROGRAMS_DIR)/*.c)
|
||||||
ASM_SOURCES = $(wildcard $(SRC_DIR)/*.s)
|
ASM_SOURCES = $(wildcard $(KERNEL_DIR)/*.s) $(wildcard $(LIBC_DIR)/*.s) $(wildcard $(PROGRAMS_DIR)/*.s)
|
||||||
OBJECTS = $(patsubst $(SRC_DIR)/%.c, $(OBJ_DIR)/%.o, $(C_SOURCES)) \
|
|
||||||
$(patsubst $(SRC_DIR)/%.s, $(OBJ_DIR)/%.o, $(ASM_SOURCES))
|
OBJECTS = $(patsubst $(SRC_DIR)/%, $(OBJ_DIR)/%, $(C_SOURCES:.c=.o) $(ASM_SOURCES:.s=.o))
|
||||||
|
|
||||||
all: $(OBJ_DIR) kernel.elf
|
all: $(OBJ_DIR) kernel.elf
|
||||||
|
|
||||||
$(OBJ_DIR):
|
$(OBJ_DIR):
|
||||||
mkdir -p $(OBJ_DIR)
|
mkdir -p $(OBJ_DIR)
|
||||||
|
mkdir -p $(OBJ_DIR)/kernel $(OBJ_DIR)/libc $(OBJ_DIR)/programs
|
||||||
|
|
||||||
kernel.elf: $(OBJECTS)
|
kernel.elf: $(OBJECTS)
|
||||||
ld $(LDFLAGS) $(OBJECTS) -o kernel.elf
|
ld $(LDFLAGS) $(OBJECTS) -o kernel.elf
|
||||||
@@ -42,4 +47,5 @@ run: os.iso
|
|||||||
bochs -f bochsrc.txt -q
|
bochs -f bochsrc.txt -q
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf $(OBJ_DIR) *.o kernel.elf os.iso
|
rm -rf $(OBJ_DIR) kernel.elf os.iso
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef INCLUDE_IO_H
|
#ifndef INCLUDE_IO_H
|
||||||
#define INCLUDE_IO_H
|
#define INCLUDE_IO_H
|
||||||
|
|
||||||
#include "stdint.h"
|
#include "../libc/stdint.h"
|
||||||
|
|
||||||
void outb(unsigned short port, unsigned char data);
|
void outb(unsigned short port, unsigned char data);
|
||||||
unsigned char inb(unsigned short port);
|
unsigned char inb(unsigned short port);
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "stdio.h"
|
#include "../libc/stdio.h"
|
||||||
#include "idt.h"
|
#include "idt.h"
|
||||||
|
|
||||||
extern void isr0();
|
extern void isr0();
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "io.h"
|
#include "io.h"
|
||||||
#include "stdio.h"
|
#include "../libc/stdio.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
unsigned char kbdus[128] =
|
unsigned char kbdus[128] =
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "stdio.h"
|
#include "../libc/stdio.h"
|
||||||
#include "serial.h"
|
#include "serial.h"
|
||||||
#include "gdt.h"
|
#include "gdt.h"
|
||||||
#include "idt.h"
|
#include "idt.h"
|
||||||
@@ -29,7 +29,6 @@ int kmain(int retvalue)
|
|||||||
// TODO: Fix scrolling bug (framebuffer driver)
|
// TODO: Fix scrolling bug (framebuffer driver)
|
||||||
// TODO: Fix keyboard driver bug (some keys mapped weirdly) + add suport for SHIFT and backspace (deleting character)
|
// TODO: Fix keyboard driver bug (some keys mapped weirdly) + add suport for SHIFT and backspace (deleting character)
|
||||||
// TODO: Grub modules to load programs
|
// TODO: Grub modules to load programs
|
||||||
// TODO: Folder and build process restructuration
|
|
||||||
|
|
||||||
//timer_install();
|
//timer_install();
|
||||||
keyboard_install();
|
keyboard_install();
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "stdio.h"
|
#include "../libc/stdio.h"
|
||||||
|
|
||||||
int timer_ticks = 0;
|
int timer_ticks = 0;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#include "io.h"
|
#include "../kernel/io.h"
|
||||||
#include "stdio.h"
|
#include "stdio.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
Reference in New Issue
Block a user