From: John Hodge Date: Wed, 30 Nov 2011 04:09:54 +0000 (+0800) Subject: Build - Restructured configuration X-Git-Tag: rel0.14~53 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=13cfd41138fbb925b9a9e239ecd58d1a768ac5aa;p=tpg%2Facess2.git Build - Restructured configuration - Allows different configurations in each architecture > E.g. Allow different ARM SOCs to be supported nicely - Also fixed a compile error in workqueue with ARM - Added USB mouse to RunQemu --- diff --git a/BuildConf/armv7/Makefile.cfg b/BuildConf/armv7/Makefile.cfg new file mode 100644 index 00000000..f5fa2615 --- /dev/null +++ b/BuildConf/armv7/Makefile.cfg @@ -0,0 +1,13 @@ + +CC = arm-elf-gcc +AS = arm-elf-gcc -c +LD = arm-elf-ld +OBJDUMP = arm-elf-objdump +DISASM = $(OBJDUMP) -d -S +ARCHDIR = armv7 +STRIP = arm-elf-strip + +ASSUFFIX = S + +CONFIG=realview_pb + diff --git a/BuildConf/armv7/default.mk b/BuildConf/armv7/default.mk new file mode 100644 index 00000000..0a85c928 --- /dev/null +++ b/BuildConf/armv7/default.mk @@ -0,0 +1,7 @@ + +ifeq ($(CONFIG),default) + $(error Please select a configuration) +endif + +MODULES += armv7/GIC +MODULES += Filesystems/InitRD diff --git a/BuildConf/armv7/realview_pb.mk b/BuildConf/armv7/realview_pb.mk new file mode 100644 index 00000000..4b284ee0 --- /dev/null +++ b/BuildConf/armv7/realview_pb.mk @@ -0,0 +1,5 @@ + +include $(ACESSDIR)/BuildConf/armv7/default.mk + +MODULES += Input/PS2KbMouse +MODULES += Display/PL110 diff --git a/BuildConf/host/Makefile.host.cfg b/BuildConf/host/Makefile.host.cfg new file mode 100644 index 00000000..dee50dec --- /dev/null +++ b/BuildConf/host/Makefile.host.cfg @@ -0,0 +1,15 @@ +# +# Acess2 Host Native makefile +# - Used for forcing the architecture +# + +SAVED_CC_ := $(CC) +SAVED_LD_ := $(LD) + +include $(ACESSDIR)/Makefile.x86_64.cfg + +OBJDUMP := objdump -S + +CC := $(SAVED_CC_) +LD := $(SAVED_LD_) + diff --git a/BuildConf/x86/Makefile.cfg b/BuildConf/x86/Makefile.cfg new file mode 100644 index 00000000..7b3d8a98 --- /dev/null +++ b/BuildConf/x86/Makefile.cfg @@ -0,0 +1,17 @@ +# +# Acess2 Build Configuration +# + +CC = i586-elf-gcc +LD = i586-elf-ld +AS = nasm +OBJDUMP = i586-elf-objdump +RM = @rm -f +STRIP = strip + +ARCHDIR = x86 + +DYNMOD_FLAGS := -mcmodel=small -fPIC + + +ASFLAGS = -felf diff --git a/BuildConf/x86/default.mk b/BuildConf/x86/default.mk new file mode 100644 index 00000000..ec21227e --- /dev/null +++ b/BuildConf/x86/default.mk @@ -0,0 +1,10 @@ + +MODULES += Storage/ATA +MODULES += Storage/FDDv2 +MODULES += Network/NE2000 Network/RTL8139 +MODULES += Display/VESA +MODULES += Display/BochsGA +MODULES += Input/PS2KbMouse +MODULES += x86/ISADMA x86/VGAText +MODULES += USB/Core USB/UHCI +#MODULES += Interfaces/UDI diff --git a/BuildConf/x86_64/Makefile.cfg b/BuildConf/x86_64/Makefile.cfg new file mode 100644 index 00000000..54bbf516 --- /dev/null +++ b/BuildConf/x86_64/Makefile.cfg @@ -0,0 +1,12 @@ + +CC = x86_64-none-elf-gcc +LD = x86_64-none-elf-ld +DISASM = x86_64-none-elf-objdump -d -M x86-64 -S + +KERNEL_CFLAGS := -mcmodel=kernel -nostdlib -mno-red-zone -Wall -Werror +DYNMOD_CFLAGS := -mcmodel=small -fPIC -mno-red-zone + +ARCHDIR = x86_64 + +ASFLAGS = -felf64 + diff --git a/BuildConf/x86_64/default.mk b/BuildConf/x86_64/default.mk new file mode 100644 index 00000000..2afabe84 --- /dev/null +++ b/BuildConf/x86_64/default.mk @@ -0,0 +1,8 @@ + +MODULES += Storage/ATA +MODULES += Storage/FDDv2 +MODULES += Network/NE2000 Network/RTL8139 +MODULES += Display/BochsGA +MODULES += Interfaces/UDI +MODULES += Input/PS2KbMouse +MODULES += x86/ISADMA x86/VGAText diff --git a/BuildConf/x86_smp b/BuildConf/x86_smp new file mode 120000 index 00000000..ef2bea7f --- /dev/null +++ b/BuildConf/x86_smp @@ -0,0 +1 @@ +x86/ \ No newline at end of file diff --git a/Kernel/arch/armv7/Makefile b/Kernel/arch/armv7/Makefile index 83fd17c0..67bea82b 100644 --- a/Kernel/arch/armv7/Makefile +++ b/Kernel/arch/armv7/Makefile @@ -16,8 +16,8 @@ endif -#ASFLAGS += -D USE_MP=$(USE_MP) -D USE_PAE=$(USE_PAE) -CPPFLAGS += -DMMU_PRESENT=$(MMU_PRESENT) -DPCI_ADDRESS=$(PCI_ADDRESS) +ASFLAGS += -DCONFIG_is_$(CONFIG)=1 +CPPFLAGS += -DMMU_PRESENT=$(MMU_PRESENT) -DPCI_ADDRESS=$(PCI_ADDRESS) -DCONFIG_is_$(CONFIG)=1 LDFLAGS += `$(CC) --print-libgcc-file-name` A_OBJ = start.ao main.o lib.o lib.ao time.o pci.o debug.o diff --git a/Kernel/arch/armv7/include/options.h b/Kernel/arch/armv7/include/options.h index 0fbec5f9..fad529e9 100644 --- a/Kernel/arch/armv7/include/options.h +++ b/Kernel/arch/armv7/include/options.h @@ -11,7 +11,21 @@ #define KERNEL_BASE 0x80000000 //#define PCI_PADDR 0x60000000 // Realview (Non-PB) -#define UART0_PADDR 0x10009000 // Realview + +#if CONFIG_is_realview_pb +# define UART0_PADDR 0x10009000 // Realview +# define GICI_PADDR 0x1e000000 +# define GICD_PADDR 0x1e001000 +# define PL110_BASE 0x10020000 // Integrator + +#endif + +#if CONFIG_is_trimslice // Tegra2 +# define UART0_PADDR 0x70006000 +# define GICD_PADDR 0x50041000 +# define GICI_PADDR 0x60004000 // TODO: Is this actually a GIC-I? +//# define PL110_BASE 0x10020000 // Integrator +#endif #define MM_KSTACK_SIZE 0x2000 // 2 Pages diff --git a/Kernel/workqueue.c b/Kernel/workqueue.c index 38bf932c..cfdf4280 100644 --- a/Kernel/workqueue.c +++ b/Kernel/workqueue.c @@ -27,7 +27,7 @@ void *Workqueue_GetWork(tWorkqueue *Queue) if(Queue->Head) { void *ret = Queue->Head; - Queue->Head = *(void**)( (char*)ret + Queue->NextOffset ); + Queue->Head = *( (void**)ret + Queue->NextOffset/sizeof(void*) ); if(Queue->Tail == ret) Queue->Tail = NULL; SHORTREL(&Queue->Protector); @@ -58,7 +58,7 @@ void Workqueue_AddWork(tWorkqueue *Queue, void *Ptr) SHORTLOCK(&Queue->Protector); if( Queue->Tail ) - *(void**)( (char*)Queue->Tail + Queue->NextOffset ) = Ptr; + *( (void**)Queue->Tail + Queue->NextOffset/sizeof(void*) ) = Ptr; else Queue->Head = Ptr; Queue->Tail = Ptr; diff --git a/Makefile.armv7.cfg b/Makefile.armv7.cfg deleted file mode 100644 index 98d95c87..00000000 --- a/Makefile.armv7.cfg +++ /dev/null @@ -1,10 +0,0 @@ - -CC = arm-elf-gcc -AS = arm-elf-gcc -c -LD = arm-elf-ld -OBJDUMP = arm-elf-objdump -DISASM = $(OBJDUMP) -d -S -ARCHDIR = armv7 -STRIP = arm-elf-strip - -ASSUFFIX = S diff --git a/Makefile.cfg b/Makefile.cfg index d36dca54..716eb5fc 100644 --- a/Makefile.cfg +++ b/Makefile.cfg @@ -29,53 +29,33 @@ ASSUFFIX = asm ifeq ($(ARCH),) ARCH := x86 endif -include $(ACESSDIR)/Makefile.$(ARCH).cfg +include $(ACESSDIR)/BuildConf/$(ARCH)/Makefile.cfg ifeq ($(ARCHDIR),) ARCHDIR := x86 endif + ifneq ($(ARCH),host) -include $(ACESSDIR)/Makefile.$(ARCHDIR).cfg + ifneq ($(ARCHDIR),$(ARCH)) + include $(ACESSDIR)/BuildConf/$(ARCHDIR)/Makefile.cfg + endif +endif + +ifeq ($(CONFIG),) + CONFIG := default endif # Makefile.user.cfg is not part of the Acess git repo, # It is for overriding the options in this file -include $(ACESSDIR)/Makefile.user.cfg -FILESYSTEMS := DRIVERS := MODULES := + MODULES += Filesystems/Ext2 MODULES += Filesystems/FAT MODULES += Filesystems/NTFS -ifeq ($(ARCHDIR),x86) -MODULES += Storage/ATA -MODULES += Storage/FDDv2 -MODULES += Network/NE2000 Network/RTL8139 -MODULES += Display/VESA -MODULES += Display/BochsGA -MODULES += Input/PS2KbMouse -MODULES += x86/ISADMA x86/VGAText -MODULES += USB/Core USB/UHCI -#MODULES += Interfaces/UDI -endif - -ifeq ($(ARCHDIR),x86_64) -MODULES += Storage/ATA -MODULES += Storage/FDDv2 -MODULES += Network/NE2000 Network/RTL8139 -MODULES += Display/BochsGA -MODULES += Interfaces/UDI -MODULES += Input/PS2KbMouse -MODULES += x86/ISADMA x86/VGAText -endif - -ifeq ($(ARCHDIR),armv7) -MODULES += Input/PS2KbMouse -MODULES += armv7/GIC -MODULES += Filesystems/InitRD -MODULES += Display/PL110 -endif +include $(ACESSDIR)/BuildConf/$(ARCH)/$(CONFIG).mk MODULES += IPStack # So the other modules are loaded before it #DYNMODS := USB/Core diff --git a/Makefile.host.cfg b/Makefile.host.cfg deleted file mode 100644 index dee50dec..00000000 --- a/Makefile.host.cfg +++ /dev/null @@ -1,15 +0,0 @@ -# -# Acess2 Host Native makefile -# - Used for forcing the architecture -# - -SAVED_CC_ := $(CC) -SAVED_LD_ := $(LD) - -include $(ACESSDIR)/Makefile.x86_64.cfg - -OBJDUMP := objdump -S - -CC := $(SAVED_CC_) -LD := $(SAVED_LD_) - diff --git a/Makefile.x86.cfg b/Makefile.x86.cfg deleted file mode 100644 index 7b3d8a98..00000000 --- a/Makefile.x86.cfg +++ /dev/null @@ -1,17 +0,0 @@ -# -# Acess2 Build Configuration -# - -CC = i586-elf-gcc -LD = i586-elf-ld -AS = nasm -OBJDUMP = i586-elf-objdump -RM = @rm -f -STRIP = strip - -ARCHDIR = x86 - -DYNMOD_FLAGS := -mcmodel=small -fPIC - - -ASFLAGS = -felf diff --git a/Makefile.x86_64.cfg b/Makefile.x86_64.cfg deleted file mode 100644 index 54bbf516..00000000 --- a/Makefile.x86_64.cfg +++ /dev/null @@ -1,12 +0,0 @@ - -CC = x86_64-none-elf-gcc -LD = x86_64-none-elf-ld -DISASM = x86_64-none-elf-objdump -d -M x86-64 -S - -KERNEL_CFLAGS := -mcmodel=kernel -nostdlib -mno-red-zone -Wall -Werror -DYNMOD_CFLAGS := -mcmodel=small -fPIC -mno-red-zone - -ARCHDIR = x86_64 - -ASFLAGS = -felf64 - diff --git a/Makefile.x86_smp.cfg b/Makefile.x86_smp.cfg deleted file mode 120000 index b2fd659d..00000000 --- a/Makefile.x86_smp.cfg +++ /dev/null @@ -1 +0,0 @@ -Makefile.x86.cfg \ No newline at end of file diff --git a/Modules/Display/PL110/main.c b/Modules/Display/PL110/main.c index 285cec4d..4d7b938d 100644 --- a/Modules/Display/PL110/main.c +++ b/Modules/Display/PL110/main.c @@ -19,6 +19,7 @@ #include #include #include +#include // ARM Arch #define ABS(a) ((a)>0?(a):-(a)) @@ -43,9 +44,11 @@ struct sPL110 Uint32 LCDLPCurr; }; -// === CONSTANTS === +#ifndef PL110_BASE #define PL110_BASE 0x10020000 // Integrator +#endif +// === CONSTANTS === const struct { short W, H; } caPL110_Modes[] = { diff --git a/Modules/armv7/GIC/gic.c b/Modules/armv7/GIC/gic.c index 9eb720fd..8dbab3a3 100644 --- a/Modules/armv7/GIC/gic.c +++ b/Modules/armv7/GIC/gic.c @@ -10,6 +10,7 @@ #include #include #include "gic.h" +#include #define N_IRQS 1024 diff --git a/RunQemu b/RunQemu index cf21f558..a07a91ba 100755 --- a/RunQemu +++ b/RunQemu @@ -13,6 +13,7 @@ QEMU_PARAMS=$QEMU_PARAMS" -net nic" QEMU_PARAMS=$QEMU_PARAMS" -usb" QEMU_PARAMS=$QEMU_PARAMS" -drive id=test_usb_image,file=USB_Test_Image.img,if=none" QEMU_PARAMS=$QEMU_PARAMS" -device usb-storage,drive=test_usb_image" +QEMU_PARAMS=$QEMU_PARAMS" -usbdevice mouse" _NETTYPE="user" while [ $# -ne 0 ]; do