summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2010-09-09 12:04:57 -0500
committerPatrick Williams <iawillia@us.ibm.com>2010-09-09 12:04:57 -0500
commitb4f1ab54b36f7dc273b9a80081c019f7d6618715 (patch)
treeb92783ceee76262fce9057c4e7537c8390a9c603 /src/usr
parentfbedff5e909777a1d646947bd4f9beca6ddf7024 (diff)
downloadtalos-hostboot-b4f1ab54b36f7dc273b9a80081c019f7d6618715.tar.gz
talos-hostboot-b4f1ab54b36f7dc273b9a80081c019f7d6618715.zip
Support modules.
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/example/example.C28
-rw-r--r--src/usr/example/makefile16
-rw-r--r--src/usr/makefile9
3 files changed, 53 insertions, 0 deletions
diff --git a/src/usr/example/example.C b/src/usr/example/example.C
new file mode 100644
index 000000000..18095ac5b
--- /dev/null
+++ b/src/usr/example/example.C
@@ -0,0 +1,28 @@
+#include <kernel/console.H>
+#include <sys/mutex.h>
+#include <sys/vfs.h>
+#include <sys/task.h>
+
+static mutex_t value = mutex_create();
+
+extern "C"
+void _init(void*)
+{
+ // Call default constructors for any static objects.
+ extern void (*ctor_start_address)();
+ extern void (*ctor_end_address)();
+ void(**ctors)() = &ctor_start_address;
+ while(ctors != &ctor_end_address)
+ {
+ (*ctors)();
+ ctors++;
+ }
+
+ printk("Here! %llx, %s\n", (uint64_t) value, VFS_ROOT);
+}
+
+extern "C"
+void _start(void*)
+{
+ task_end();
+}
diff --git a/src/usr/example/makefile b/src/usr/example/makefile
new file mode 100644
index 000000000..608aacc87
--- /dev/null
+++ b/src/usr/example/makefile
@@ -0,0 +1,16 @@
+ROOTPATH = ../../..
+OBJDIR = ${ROOTPATH}/obj/modules/example
+IMGDIR = ${ROOTPATH}/img
+EXTRACOMMONFLAGS = -fPIC
+
+OBJS = example.o
+OBJECTS = $(addprefix ${OBJDIR}/, ${OBJS})
+LIBS = libexample.so
+LIBRARIES = $(addprefix ${IMGDIR}/, ${LIBS})
+
+all: ${OBJECTS} ${LIBRARIES}
+
+clean:
+ (rm -f ${OBJECTS} ${LIBRARIES} )
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/makefile b/src/usr/makefile
new file mode 100644
index 000000000..e6907fe8c
--- /dev/null
+++ b/src/usr/makefile
@@ -0,0 +1,9 @@
+ROOTPATH = ../..
+
+SUBDIRS = example.d
+
+all: ${SUBDIRS}
+
+clean: $(patsubst %.d,%.clean, ${SUBDIRS})
+
+include ../../config.mk
OpenPOWER on IntegriCloud