Build improvements

This commit is contained in:
Ali Mashtizadeh 2014-07-21 23:43:01 -07:00
parent 32d5f6740a
commit 76108674d1
39 changed files with 169 additions and 113 deletions

View File

@ -1,5 +1,6 @@
import sys import sys
import os import os
import shutil
import multiprocessing import multiprocessing
import SCons.Util import SCons.Util
@ -103,6 +104,21 @@ def GetNumCPUs(env):
env.SetOption('num_jobs', GetNumCPUs(env)) env.SetOption('num_jobs', GetNumCPUs(env))
def CopyTree(dst, src, env):
def DirCopyHelper(src, dst):
for f in os.listdir(src):
srcPath = os.path.join(src, f)
dstPath = os.path.join(dst, f)
if os.path.isdir(srcPath):
if not os.path.exists(dstPath):
os.makedirs(dstPath)
DirCopyHelper(srcPath, dstPath)
else:
env.Command(dstPath, srcPath, Copy("$TARGET", "$SOURCE"))
if (not os.path.exists(dst)):
os.makedirs(dst)
DirCopyHelper(src, dst)
# XXX: Hack to support clang static analyzer # XXX: Hack to support clang static analyzer
def CheckFailed(): def CheckFailed():
if os.getenv('CCC_ANALYZER_OUTPUT_FORMAT') != None: if os.getenv('CCC_ANALYZER_OUTPUT_FORMAT') != None:
@ -126,6 +142,11 @@ Export('env')
# Debugging Tools # Debugging Tools
# Create include tree
CopyTree('build/include', 'include', env)
CopyTree('build/include/sys', 'sys/include', env)
CopyTree('build/include/machine', 'sys/' + env['ARCH'] + '/include', env)
# Build Targets # Build Targets
SConscript('sys/SConscript', variant_dir='build/sys') SConscript('sys/SConscript', variant_dir='build/sys')

View File

@ -51,7 +51,7 @@ kern_env.Append(CPPFLAGS = ['-ffreestanding', '-fno-builtin', '-nostdinc',
'-mno-red-zone', '-mno-mmx', '-mno-sse', '-mno-red-zone', '-mno-mmx', '-mno-sse',
'-mcmodel=large']) '-mcmodel=large'])
# '-target', 'amd64-orion-eabi' # '-target', 'amd64-orion-eabi'
kern_env.Append(CPPPATH = ['#include', '#sys/include']) kern_env.Append(CPPPATH = ['#build/include'])
kernel = kern_env.Program("castor", src) kernel = kern_env.Program("castor", src)
Depends(kernel, ldscript) Depends(kernel, ldscript)

View File

@ -1,13 +1,13 @@
#include <stdint.h> #include <stdint.h>
#include <kassert.h> #include <sys/kassert.h>
#include <kconfig.h> #include <sys/kconfig.h>
#include <mp.h> #include <sys/mp.h>
#include <spinlock.h> #include <sys/spinlock.h>
#include "amd64.h" #include <machine/amd64.h>
#include "amd64op.h" #include <machine/amd64op.h>
uint32_t lockLevel[MAX_CPUS]; uint32_t lockLevel[MAX_CPUS];

View File

@ -2,14 +2,14 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <kassert.h> #include <sys/kassert.h>
#include <kconfig.h> #include <sys/kconfig.h>
#include <kdebug.h> #include <sys/kdebug.h>
#include <mp.h> #include <sys/mp.h>
#include "amd64.h" #include <machine/amd64.h>
#include "amd64op.h" #include <machine/amd64op.h>
#include "trap.h" #include <machine/trap.h>
TrapFrame *frames[MAX_CPUS]; TrapFrame *frames[MAX_CPUS];

View File

@ -32,8 +32,8 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <kassert.h> #include <sys/kassert.h>
#include <kdebug.h> #include <sys/kdebug.h>
/* /*
* Missing from headers * Missing from headers

View File

@ -4,13 +4,13 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <kassert.h>
#include <cdefs.h> #include <sys/kassert.h>
#include <sys/cdefs.h>
#include "amd64.h" #include <machine/amd64.h>
#include "pmap.h" #include <machine/pmap.h>
#include "trap.h" #include <machine/trap.h>
#define IOAPICBASE 0xFEC00000 #define IOAPICBASE 0xFEC00000

View File

@ -1,11 +1,11 @@
#include <stdint.h> #include <stdint.h>
#include <kassert.h> #include <sys/kassert.h>
#include <sys/irq.h>
#include "trap.h" #include <machine/trap.h>
#include "ioapic.h" #include <machine/ioapic.h>
#include <irq.h>
LIST_HEAD(IRQHandlerList, IRQHandler); LIST_HEAD(IRQHandlerList, IRQHandler);
struct IRQHandlerList handlers[T_IRQ_LEN]; struct IRQHandlerList handlers[T_IRQ_LEN];

View File

@ -5,13 +5,13 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <kassert.h> #include <sys/kassert.h>
#include <kdebug.h> #include <sys/kdebug.h>
#include "amd64.h" #include <machine/amd64.h>
#include "amd64op.h" #include <machine/amd64op.h>
#include "pmap.h" #include <machine/pmap.h>
#include "trap.h" #include <machine/trap.h>
#define CPUID_FLAG_APIC 0x100 #define CPUID_FLAG_APIC 0x100

View File

@ -1,18 +1,18 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <kconfig.h> #include <sys/kconfig.h>
#include <kassert.h> #include <sys/kassert.h>
#include <kmem.h> #include <sys/kmem.h>
#include <mp.h> #include <sys/mp.h>
#include <irq.h> #include <sys/irq.h>
#include <spinlock.h> #include <sys/spinlock.h>
#include "amd64.h" #include <machine/amd64.h>
#include "ioapic.h" #include <machine/ioapic.h>
#include "lapic.h" #include <machine/lapic.h>
#include "trap.h" #include <machine/trap.h>
#include "pmap.h" #include <machine/pmap.h>
#include "../dev/console.h" #include "../dev/console.h"

View File

@ -5,14 +5,14 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <kassert.h> #include <sys/kassert.h>
#include <cdefs.h> #include <sys/cdefs.h>
#include "../dev/console.h" #include "../dev/console.h"
#include "amd64.h" #include <machine/amd64.h>
#include "pmap.h" #include <machine/pmap.h>
#include "multiboot.h" #include <machine/multiboot.h>
void MachineBoot_Entry(unsigned long magic, unsigned long addr); void MachineBoot_Entry(unsigned long magic, unsigned long addr);

View File

@ -1,11 +1,11 @@
#include <stdint.h> #include <stdint.h>
#include <kassert.h> #include <sys/kassert.h>
#include <pci.h> #include <sys/pci.h>
#include "amd64.h" #include <machine/amd64.h>
#include "amd64op.h" #include <machine/amd64op.h>
#define PCI_PORT_ADDR 0xCF8 #define PCI_PORT_ADDR 0xCF8
#define PCI_PORT_DATABASE 0xCFC #define PCI_PORT_DATABASE 0xCFC

View File

@ -2,15 +2,15 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <kconfig.h> #include <sys/kconfig.h>
#include <kassert.h> #include <sys/kassert.h>
#include <kdebug.h> #include <sys/kdebug.h>
#include <kmem.h> #include <sys/kmem.h>
#include "amd64.h" #include <machine/amd64.h>
#include "amd64op.h" #include <machine/amd64op.h>
#include "mp.h" #include <machine/mp.h>
#include "pmap.h" #include <machine/pmap.h>
typedef struct AS typedef struct AS
{ {

View File

@ -2,15 +2,15 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <kconfig.h> #include <sys/kconfig.h>
#include <kassert.h> #include <sys/kassert.h>
#include <kdebug.h> #include <sys/kdebug.h>
#include <spinlock.h> #include <sys/spinlock.h>
#include <irq.h> #include <sys/irq.h>
#include "amd64.h" #include <machine/amd64.h>
#include "lapic.h" #include <machine/lapic.h>
#include "trap.h" #include <machine/trap.h>
extern uint64_t trap_table[T_MAX]; extern uint64_t trap_table[T_MAX];
extern void trap_pop(TrapFrame *tf); extern void trap_pop(TrapFrame *tf);

View File

@ -2,14 +2,14 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <kconfig.h> #include <sys/kconfig.h>
#include <kassert.h> #include <sys/kassert.h>
#include <kmem.h> #include <sys/kmem.h>
#include "amd64.h" #include <machine/amd64.h>
#include "amd64op.h" #include <machine/amd64op.h>
#include "pmap.h" #include <machine/pmap.h>
#include "mp.h" #include <machine/mp.h>
#define MAX_XMEM_REGIONS 1024 #define MAX_XMEM_REGIONS 1024

View File

@ -3,10 +3,10 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <kassert.h> #include <sys/kassert.h>
#include <kmem.h> #include <sys/kmem.h>
#include <pci.h> #include <sys/pci.h>
#include <sga.h> #include <sys/sga.h>
#include "ata.h" #include "ata.h"
#include "sata.h" #include "sata.h"

View File

@ -1,7 +1,7 @@
#include <stdint.h> #include <stdint.h>
#include <spinlock.h> #include <sys/spinlock.h>
#include "console.h" #include "console.h"
#include "x86/vgacons.h" #include "x86/vgacons.h"

View File

@ -2,9 +2,9 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <kassert.h> #include <sys/kassert.h>
#include <kdebug.h> #include <sys/kdebug.h>
#include <pci.h> #include <sys/pci.h>
void PCI_ScanBus(); void PCI_ScanBus();

View File

@ -5,10 +5,10 @@
#include <stdint.h> #include <stdint.h>
#include <cdefs.h> #include <sys/cdefs.h>
#include "../../amd64/amd64.h" #include <machine/amd64.h>
#include "../../amd64/amd64op.h" #include <machine/amd64op.h>
void DebugConsole_Init() void DebugConsole_Init()
{ {

View File

@ -3,8 +3,8 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <kassert.h> #include <sys/kassert.h>
#include <sga.h> #include <sys/sga.h>
#include "ioport.h" #include "ioport.h"
#include "../ata.h" #include "../ata.h"

View File

@ -1,8 +1,8 @@
#include <stdint.h> #include <stdint.h>
#include <kassert.h> #include <sys/kassert.h>
#include <irq.h> #include <sys/irq.h>
#include "ioport.h" #include "ioport.h"
#include "sercons.h" #include "sercons.h"

View File

@ -5,11 +5,11 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h> #include <stdint.h>
#include <cdefs.h> #include <sys/cdefs.h>
#include <kdebug.h> #include <sys/kdebug.h>
#include "../../amd64/amd64.h" #include <machine/amd64.h>
#include "../../amd64/pmap.h" #include <machine/pmap.h>
#include "vgacons.h" #include "vgacons.h"

36
sys/fs/o2fs/o2fs.h Normal file
View File

@ -0,0 +1,36 @@
/*
* *** Disk Layout ***
*
* +---------------------+
* | Super Blocks (4MBs) |
* +---------------------+
* | |
* .
* .
* .
* | |
* +---------------------+
* | Super Blocks (4MBs) |
* +---------------------+
*
*/
typedef struct ObjID {
uint8_t hash[32];
uint64_t device;
uint64_t offset;
} ObjID;
typedef struct SuperBlock
{
uint8_t magic[8];
uint16_t versionMajor;
uint16_t versionMinor;
uint32_t _rsvd0;
uint64_t features;
ObjID root; /* Root Tree */
uint8_t hash[32];
} SuperBlock;

View File

@ -2,7 +2,7 @@
#ifndef __IRQ_H__ #ifndef __IRQ_H__
#define __IRQ_H__ #define __IRQ_H__
#include <queue.h> #include <sys/queue.h>
typedef struct IRQHandler { typedef struct IRQHandler {
int irq; int irq;

View File

@ -2,7 +2,7 @@
#ifndef __KASSERT_H__ #ifndef __KASSERT_H__
#define __KASSERT_H__ #define __KASSERT_H__
#include <cdefs.h> #include <sys/cdefs.h>
#define ASSERT(x) if (!(x)) { Panic("ASSERT:"); } #define ASSERT(x) if (!(x)) { Panic("ASSERT:"); }
#define NOT_IMPLEMENTED() Panic("NOT_IMPLEMENTED:") #define NOT_IMPLEMENTED() Panic("NOT_IMPLEMENTED:")

View File

@ -33,7 +33,7 @@
#ifndef _SYS_QUEUE_H_ #ifndef _SYS_QUEUE_H_
#define _SYS_QUEUE_H_ #define _SYS_QUEUE_H_
#include <cdefs.h> #include <sys/cdefs.h>
/* /*
* This file defines four types of data structures: singly-linked lists, * This file defines four types of data structures: singly-linked lists,

View File

@ -18,8 +18,8 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <kassert.h> #include <sys/kassert.h>
#include <kdebug.h> #include <sys/kdebug.h>
#include "../dev/console.h" #include "../dev/console.h"

View File

@ -7,14 +7,15 @@
#include <stdint.h> #include <stdint.h>
#include <stdarg.h> #include <stdarg.h>
#include <cdefs.h> #include <sys/cdefs.h>
#include <kassert.h> #include <sys/kassert.h>
#include <kdebug.h> #include <sys/kdebug.h>
#include <kmem.h> #include <sys/kmem.h>
#include <queue.h> #include <sys/queue.h>
#include <spinlock.h> #include <sys/spinlock.h>
#include "../amd64/amd64.h" // PGSIZE
#include <machine/amd64.h>
/* 'FREEPAGE' */ /* 'FREEPAGE' */
#define FREEPAGE_MAGIC_FREE 0x4652454550414745ULL #define FREEPAGE_MAGIC_FREE 0x4652454550414745ULL

View File

@ -8,7 +8,7 @@
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <kassert.h> #include <sys/kassert.h>
#include "../dev/console.h" #include "../dev/console.h"

View File

@ -2,14 +2,12 @@
#include <stdint.h> #include <stdint.h>
#include <string.h> #include <string.h>
#include <kassert.h> #include <sys/kassert.h>
#include <kconfig.h> #include <sys/kconfig.h>
#include <mp.h> #include <sys/mp.h>
#include <spinlock.h> #include <sys/spinlock.h>
#include "../amd64/amd64.h" #include <machine/atomic.h>
#include "../amd64/amd64op.h"
#include "../amd64/atomic.h"
void void
Spinlock_Init(Spinlock *lock, const char *name) Spinlock_Init(Spinlock *lock, const char *name)