Bootloader makefile stuff

This commit is contained in:
Julian Barathieu 2019-01-14 23:16:26 +01:00
parent 0528ddbd9f
commit c0b478f8f0
8 changed files with 49 additions and 27 deletions

View File

@ -25,3 +25,23 @@ tests:
make tests -f Makefile.out.2
rm Makefile.out Makefile.out.2
ASM=nasm
ASMFLAGS=
BOOTFLAGS=-f bin
BOOTDIR=boot
OBJDIR=build/obj
BINDIR=build/bin
boot.mbr.asm: $(BOOTDIR)/mbr.asm $(BOOTDIR)/mbr.inc
$(ASM) $(BOOTFLAGS) $(BOOTDIR)/mbr.asm -o $(OBJDIR)/boot/mbr.bin
boot.loader.asm: $(BOOTDIR)/loader.asm
$(ASM) $(BOOTFLAGS) $(BOOTDIR)/loader.asm -o $(OBJDIR)/boot/loader.bin
bootloader: boot.mbr.asm boot.loader.asm
cp $(OBJDIR)/boot/mbr.bin $(BINDIR)/mbr.bin
cp $(OBJDIR)/boot/loader.bin $(BINDIR)/loader.bin
all: bootloader kernel

View File

@ -22,10 +22,6 @@ CFLAGS=$(CFLAGS1) $(CFLAGS2) $(SFLAG)
CC=$(CCNAME) $(COPTIM) $(CWARNS) $(CFLAGS) $(CINCLUDES)
ASM=nasm
ASMFLAGS=
BOOTFLAGS=-f bin
BINDIR=./build/bin
OBJDIR=./build/obj
@ -35,18 +31,6 @@ KERNDIR=kaleid/kernel
SYSTDIR=kaleid/system
LINXDIR=kaleid/common/test
all: bootloader kernel
boot.mbr.s: $(BOOTDIR)/mbr.s $(BOOTDIR)/mbr.inc
$(ASM) $(BOOTFLAGS) $(BOOTDIR)/mbr.asm -o $(OBJDIR)/boot/mbr.bin
boot.loader.s: $(BOOTDIR)/loader.s
$(ASM) $(BOOTFLAGS) $(BOOTDIR)/loader.asm -o $(OBJDIR)/boot/loader.bin
bootloader: boot.mbr.s boot.loader.s
cp $(OBJDIR)/boot/mbr.bin $(BINDIR)/mbr.bin
cp $(OBJDIR)/boot/loader.bin $(BINDIR)/loader.bin
//----------------------------------------------------------------------------#
// TESTING MAKEFILE

View File

@ -60,8 +60,6 @@ src/
| |
| + kernel/
| | |
| | - kernel.ld
| | |
| | + init/
| | | |
| | | - init.c
@ -99,6 +97,8 @@ src/
| |
| - preproc.h
| - iddtool.h
| |
| - kernel.ld
| |
| + bin/
| + obj/

View File

@ -15,9 +15,9 @@
//
#define _ATOI_IMPL(_Name, _Type, _Func) \
_Type _Name(const char *str) { \
error_t old = errno; \
__get_errno(old); \
_Type ret = (_Type)_Func(str, NULL, 0); \
errno = old; \
__set_errno(old); \
return ret; \
}

View File

@ -9,7 +9,7 @@
#include <kaleid.h>
error_t errno = 0;
error_t __errno = 0;
/*
static const char *descriptions[] = {

View File

@ -13,7 +13,7 @@ long strtol(const char *str, char **endp, int base) {
(void)str;
(void)endp;
(void)base;
errno = ENOSYS;
__set_errno(ENOSYS);
return 0;
}
@ -21,7 +21,7 @@ ulong strtoul(const char *str, char **endp, int base) {
(void)str;
(void)endp;
(void)base;
errno = ENOSYS;
__set_errno(ENOSYS);
return 0;
}

View File

@ -43,7 +43,24 @@ typedef struct { long quot, rem; } ldiv_t;
// Global variables //
//------------------------------------------//
extern error_t errno;
#ifndef _KALEID_KERNEL
extern error_t __errno;
#ifndef errno
#define errno __errno
#endif
#define __get_errno(x) error_t x = errno;
#define __set_errno(x) (errno = (x))
#else
#define errno
#define __get_errno(x)
#define __set_errno(x)
#endif
//------------------------------------------//
// Macros //

View File

@ -184,7 +184,8 @@ void WriteByteOnPort(port_t port, port_t val)
static inline
uchar ReadByteFromPort(port_t port)
{
errno = ENOSYS;
KalAssert(FALSE && ENOSYS);
(void)port;
return 0;
}
@ -192,7 +193,7 @@ uchar ReadByteFromPort(port_t port)
static inline
ushort ReadWordFromPort(port_t port)
{
errno = ENOSYS;
KalAssert(FALSE && ENOSYS);
(void)port;
return 0;
}