Skip to content

Commit

Permalink
Convert XtratuM v2.4 to git
Browse files Browse the repository at this point in the history
Downloaded from fentiss website, and added to an empty git repository.
  • Loading branch information
rralf committed Apr 7, 2017
0 parents commit 3dbabf9
Show file tree
Hide file tree
Showing 374 changed files with 47,035 additions and 0 deletions.
340 changes: 340 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

117 changes: 117 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
.PHONY: xm showsizes

all: xm

include xmconfig

ifndef XTRATUM_PATH
XTRATUM_PATH=.
-include path.mk

path.mk:
@/bin/echo -e "\n# Automatically added by XM" > path.mk
@/bin/echo -e "# Please don't modify" >> path.mk
@/bin/echo -e "XTRATUM_PATH=`pwd`" >> path.mk
@/bin/echo -e "export XTRATUM_PATH" >> path.mk
@cat path.mk >> xmconfig
@$(RM) -f path.mk
endif





include version
include config.mk

config oldconfig silentoldconfig menuconfig defconfig:
@exec echo -e "\n> Building Kconfig:";
@$(MAKE) -s -C scripts/kconfig conf mconf || exit 1 ;
@exec echo -e "Configure the XtratuM sources:"
@$(MAKE) -s -C $(XTRATUM_PATH)/core $(MAKECMDGOALS);
@exec echo -e "Configure the resident software sources:"
@exec echo -e "[Press enter to enter the configuration utility]"
@read dummy
@$(MAKE) -s -C $(XTRATUM_PATH)/user/bootloaders/rsw $(MAKECMDGOALS);
@exec echo -e "Configure the XAL sources:"
@exec echo -e "[Press enter to enter the configuration utility]"
@read dummy
@$(MAKE) -s -C user/xal $(MAKECMDGOALS) || exit 1 ;
@exec echo -e "Next, you may run 'make'"


xm: $(XTRATUM_PATH)/core/include/autoconf.h
@exec echo -en "\n> Configuring and building the \"XtratuM hypervisor\"";
@$(MAKE) -s -C core $(MAKECMDGOALS) || exit 1 ;
@exec echo -en "\n> Configuring and building the \"User utilities\"";
@$(MAKE) -s -C user $(MAKECMDGOALS) || exit 1 ;


distclean: clean
@exec echo -e "> Cleaning up XM";
@exec echo -e " - Removing dep.mk Rules.mk files";
@find -type f -name "dep.mk" -exec rm '{}' \;
@find -type f -name "dephost.mk" -exec rm '{}' \;
@find -type f -name ".config" -exec rm '{}' \;
@find -type f -name ".config.old" -exec rm '{}' \;
@find -type f -name "autoconf.h" -exec rm '{}' \;
@find -type f -name ".menuconfig.log" -exec rm '{}' \;
@find -type f -name "mconf" -exec rm '{}' \;
@find -type f -name "conf" -exec rm '{}' \;
@find -type f -name "partition?" -exec rm '{}' \;
@find -type f -name "resident_sw" -exec rm '{}' \;
@find -type f -name "*.xmc.c" -exec rm '{}' \;
@find -type f -name "xm_cf" -exec rm '{}' \;
@find -type f -name "rswbuild" -exec rm '{}' \;
@find -type f -name "build_xmc" -exec rm '{}' \;
@find -type f -name "bpatch" -exec rm '{}' \;
@find -type f -name "xmpack" -exec rm '{}' \;
@find -type f -name "xmcparser" -exec rm '{}' \;
@find -type l -a -not -name "sh" -exec rm '{}' \;
@$(RM) -rf $(XTRATUM_PATH)/core/include/config/*
@$(RM) -rf $(XTRATUM_PATH)/user/bootloaders/rsw/include/config/* $(XTRATUM_PATH)/user/bootloaders/rsw/$(ARCH)/rsw.lds
@$(RM) -rf $(XTRATUM_PATH)/user/xi/include/config/*
@$(RM) -f $(XTRATUM_PATH)/xmconfig $(XTRATUM_PATH)/core/include/autoconf.h $(XTRATUM_PATH)/core/include/$(ARCH)/asm_offsets.h $(XTRATUM_PATH)/core/include/$(ARCH)/brksize.h $(XTRATUM_PATH)/core/include/$(ARCH)/ginfo.h $(XTRATUM_PATH)/scripts/lxdialog/lxdialog $(XTRATUM_PATH)/core/xm_core core/xm_core.bin $(XTRATUM_PATH)/core/kernel/$(ARCH)/xm.lds $(XTRATUM_PATH)/scripts/extractinfo
# @$(RM) -f $(XTRATUM_PATH)/user/tools/xmcparser/xmc.xsd.in $(XTRATUM_PATH)/user/tools/xmcparser/xmc.xsd
@$(RM) -f $(XTRATUM_PATH)/core/Kconfig.ver
@exec echo -e "> Done";

clean:
@exec echo -e "> Cleaning XM";
@exec echo -e " - Removing *.o *.a *~ files";
@find -name "*~" -exec rm '{}' \;
@find -name "*.o" -exec rm '{}' \;
@find -name "*.a" -exec rm '{}' \;
@find -name "*.gcno" -exec rm '{}' \;
@find -name "*.bin" -exec rm '{}' \;
@find -name "dep.mk" -exec rm '{}' \;
@$(RM) -f $(XTRATUM_PATH)/user/tools/xmcparser/xmc.xsd.in $(XTRATUM_PATH)/user/tools/xmcparser/xmc.xsd
@exec echo -e "> Done";

DISTRO = xtratum-$(XTRATUMVERSION)
DISTROTMP=/tmp/$(DISTRO)-$$PPID
DISTROTAR = $(DISTRO).tar.bz2
$(DISTROTAR): # xm
@$(RM) $(DISTROTAR)
@make -s -C user/xal/examples clean
@mkdir $(DISTROTMP) || exit 0
@user/bin/xmdistro $(DISTROTMP)/$(DISTRO) $(DISTROTAR)
@$(RM) -r $(DISTROTMP)

DISTRORUN = $(DISTRO).run
DISTROLABEL= "XtratuM binary distribution $(XTRATUMVERSION): "
$(DISTRORUN): $(DISTROTAR)
@which makeself >/dev/null || (echo "Error: makeself program not found; install the makeself package" && exit -1)
@mkdir $(DISTROTMP) || exit 0
@tar xf $(DISTROTAR) -C $(DISTROTMP)
@/bin/echo "> Generating self extracting binary distribution \"$(DISTRORUN)\""
@makeself --bzip2 $(DISTROTMP)/$(DISTRO) $(DISTRORUN) $(DISTROLABEL) ./xtratum-installer > /dev/null 2>&1
@#| tr "\n" "#" | sed -u "s/[^#]*#/./g; s/..././g"
@$(RM) $(DISTROTAR)
@$(RM) -r $(DISTROTMP)
@/bin/echo -e "> Done\n"

distro-tar: $(DISTROTAR)
distro-run: $(DISTRORUN)

.PHONY: $(DISTROTAR) $(DISTRORUN)
49 changes: 49 additions & 0 deletions config.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
.DEFAULT: all

$(if $(XTRATUM_PATH),, \
$(warning "The configuration variable XTRATUM_PATH is not set,") \
$(error "check the \"xmconfig\" file (see README)."))

$(if $(wildcard $(XTRATUM_PATH)/version),, \
$(warning "No version file found at $(XTRATUM_PATH),") \
$(error "see the README in the base directory"))

include $(XTRATUM_PATH)/version

clean-targets := clean distclean depend
config-targets := config xconfig menuconfig oldconfig silentconfig silentoldconfig defconfig
.PHONY: $(clean-targets) $(config-targets)

# skip .config when configuring
ifeq ($(findstring $(MAKECMDGOALS), $(config-targets) $(clean-targets)),)
need_config := 1
endif

# check if the .config exists
ifeq ($(XTRATUM_PATH)/core/.config, $(wildcard $(XTRATUM_PATH)/core/.config))
exists_config := 1
endif

# if there's no .config file warn the user and abort
$(if $(need_config), \
$(if $(exists_config),, \
$(warning "No .config file found at $(XTRATUM_PATH)/core,") \
$(error "run `make menuconfig` in the base directory")))

# if the .config is needed include it
ifdef exists_config
include $(XTRATUM_PATH)/core/.config
# If .config is newer than core/include/autoconf.h, someone tinkered
# with it and forgot to run make oldconfig.

$(XTRATUM_PATH)/core/include/autoconf.h: $(XTRATUM_PATH)/core/.config
@$(MAKE) -C $(XTRATUM_PATH)/core silentoldconfig MAKEFLAGS=$(patsubst -j%,,$(MAKEFLAGS))

else
# Dummy target needed, because used as prerequisite
$(XTRATUM_PATH)/core/include/autoconf.h: ;
endif

CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
else if [ -x /bin/bash ]; then echo /bin/bash; \
else echo sh; fi ; fi)
105 changes: 105 additions & 0 deletions core/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
all: core | extract_info

include ../xmconfig
include $(XTRATUM_PATH)/config.mk
include $(XTRATUM_PATH)/core/rules.mk

ifdef CONFIG_MMU
MM=mmu
else
MM=mmuless
endif

xm.lds: kernel/$(ARCH)/xm.lds.in include/config.h
@$(CC) $(ASFLAGS) -x assembler-with-cpp -E -P -I$(XM_CORE_PATH)/include kernel/$(ARCH)/xm.lds.in -o kernel/$(ARCH)/xm.lds

XMCORE_SUBDIRS=\
kernel/$(ARCH)\
kernel/$(MM)\
kernel\
klibc klibc/$(ARCH)\
objects devices\

KOBJS=\
kernel/$(ARCH)/karch.o\
kernel/$(MM)/kmm.o\
kernel/kern.o\
klibc/libc.o\
klibc/$(ARCH)/arch_libc.o\
objects/objects.o devices/devices.o\

links:
@exec echo -e "\n> Target architecture: [$(ARCH)] ";
@if [ ! -d $(XTRATUM_PATH)/core/include/arch ] ; then \
ln -sf $(XTRATUM_PATH)/core/include/$(ARCH) $(XTRATUM_PATH)/core/include/arch; \
fi

Kconfig.ver:
@exec echo "# $@: autogenerated file, don't edit" > $@

@exec echo "config ARCH" >> $@
@exec echo " string" >> $@
@exec echo " default \"$(ARCH)\"" >> $@

@exec echo "config KERNELVERSION" >> $@
@exec echo " string" >> $@
@exec echo " default \"$$XTRATUMVERSION\"" >> $@

KCONFIG=kernel/$(ARCH)/Kconfig

config: links Kconfig.ver
@$(XTRATUM_PATH)/scripts/kconfig/conf $(KCONFIG)

oldconfig: links Kconfig.ver
@$(XTRATUM_PATH)/scripts/kconfig/conf -o $(KCONFIG)

silentoldconfig: links Kconfig.ver
@mkdir -p $(XTRATUM_PATH)/core/include/config
@$(XTRATUM_PATH)/scripts/kconfig/conf -s $(KCONFIG)

menuconfig: links Kconfig.ver
@$(XTRATUM_PATH)/scripts/kconfig/mconf $(KCONFIG)

defconfig: links Kconfig.ver
@$(XTRATUM_PATH)/scripts/kconfig/conf -d $(KCONFIG)

#$(XTRATUM_PATH)/core/include/autoconf.h: $(XTRATUM_PATH)/core/.config silentoldconfig

core: $(XTRATUM_PATH)/core/include/autoconf.h xm.lds generate_offsets
@exec echo -e "\n> Building XM Core";
@for dir in $(XMCORE_SUBDIRS) ; do \
echo " - $$dir" ; \
$(MAKE) -s -C $$dir all ; \
if [ "$$?" -ne 0 ]; then exit 1 ; fi \
done
@$(LD) $(LDFLAGS) -nostdlib -Tkernel/$(ARCH)/xm.lds -o xm_core.1 $(KOBJS) $(LIBGCC)
@$(OBJCOPY) -O binary -j .data xm_core.1 data.bin
@touch tmp.S
@$(CC) $(CFLAGS_ARCH) -c tmp.S $(AFLAGS)
@$(OBJCOPY) --add-section=.cdata=data.bin --set-section-flags=.cdata=load,alloc tmp.o
@exec echo -e "> Linking XM Core";
@$(LD) $(LDFLAGS) -nostdlib -Tkernel/$(ARCH)/xm.lds -o xm_core $(KOBJS) tmp.o $(LIBGCC)
@$(RM) -f xm_core.1 data.bin tmp.o tmp.S
@size xm_core;
@$(OBJCOPY) -S -O binary xm_core xm_core.bin
@chmod -x xm_core xm_core.bin
@exec echo "> Done";

generate_offsets:
@$(CC) $(CFLAGS) -S -o offsets.S $(XTRATUM_PATH)/scripts/asm-offsets.c -D_GENERATE_OFFSETS_ -D_OFFS_FILE_=\"$(ARCH)/gen_offsets.h\"
@$(SHELL) $(XTRATUM_PATH)/scripts/asm-offsets.sh offsets.h < offsets.S > $(XM_CORE_PATH)/include/$(ARCH)/asm_offsets.h
@$(RM) -f offsets.S

extract_info:
@$(HOSTCC) -Wall -O2 -o $(XTRATUM_PATH)/scripts/extractinfo $(XTRATUM_PATH)/scripts/extractinfo.c -DOBJCOPY=\"$(OBJCOPY)\" --include $(XTRATUM_PATH)/core/include/autoconf.h
@$(XTRATUM_PATH)/scripts/extractinfo $(XTRATUM_PATH)/core/xm_core 2> $(XM_CORE_PATH)/include/$(ARCH)/ginfo.h


clean:
@exec echo -e "> Cleaning XM Core";
@exec echo -e " - Removing *.o *.a *~ files";
@find -name "*~" -exec rm '{}' \;
@find -name "*.o" -exec rm '{}' \;
@find -name "*.a" -exec rm '{}' \;
@$(RM) -f kernel/$(ARCH)/xm.lds include/$(ARCH)/asm_offsets.h include/$(ARCH)/ginfo.h
@exec echo -e "> Done";
16 changes: 16 additions & 0 deletions core/devices/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
menu "Devices"

config DEV_PC_VGA
bool "Enable VGA support"
depends on PC_BOARD
default y

config DEV_PC_UART
bool "Enable UART support"
depends on PC_BOARD
default y

config DEV_MEMBLOCK
def_bool y

endmenu
13 changes: 13 additions & 0 deletions core/devices/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SRCS := $(sort $(wildcard *.c))
OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
LOBJS := $(OBJS)

all: objs

include ../../xmconfig
include $(XTRATUM_PATH)/config.mk
include $(XTRATUM_PATH)/core/rules.mk
-include dep.mk

objs: $(OBJS)
@$(LD) $(LDFLAGS) -r -o devices.o $(LOBJS)
Loading

0 comments on commit 3dbabf9

Please sign in to comment.