summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoe Rubinstein <nrubinstein@avencall.com>2012-07-16 17:28:51 +0200
committerNoe Rubinstein <nrubinstein@avencall.com>2012-07-16 17:28:51 +0200
commit4abd5db422b67c965122361ec8b02d0f79bdf5f7 (patch)
tree7401281a0ab26d6b53fad4544c02bff1ca6d436a
parentad21d37380557ddea0484df53587a2de99d43164 (diff)
cbfs_poc: it builds
-rw-r--r--cbfs_poc/Makefile24
-rw-r--r--cbfs_poc/module_lol.c25
2 files changed, 49 insertions, 0 deletions
diff --git a/cbfs_poc/Makefile b/cbfs_poc/Makefile
new file mode 100644
index 0000000..73856a8
--- /dev/null
+++ b/cbfs_poc/Makefile
@@ -0,0 +1,24 @@
+PWD := $(shell pwd)
+
+KSRC ?= /bad__ksrc__not_set
+COREBOOT ?= /bad__coreboot__not_set
+LIBPAYLOAD ?= $(COREBOOT)/payloads/libpayload
+CBFS_A ?= $(LIBPAYLOAD)/build/libcbfs.a
+CBFS_INCLUDES ?= -I$(readlink -f .) -I$(LIBPAYLOAD)/include -I$(LIBPAYLOAD)/include/i386
+
+EXTRA_CFLAGS += -D_ARCH_TYPES_H -I$(LIBPAYLOAD)/include -I$(LIBPAYLOAD)/include/i386
+
+obj-m := module_lol.o
+module_lol-y += libcbfs.a
+
+modules:
+
+libcbfs.a:
+ cp $(CBFS_A) $@
+
+modules modules_install clean:
+ $(MAKE) -C $(KSRC) M=$(PWD) $@
+
+distclean: clean
+ rm -f Module.symvers modules.order
+
diff --git a/cbfs_poc/module_lol.c b/cbfs_poc/module_lol.c
new file mode 100644
index 0000000..80dc000
--- /dev/null
+++ b/cbfs_poc/module_lol.c
@@ -0,0 +1,25 @@
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/module.h>
+#include <cbfs.h>
+
+#define DRIVER_NAME "cbfs_poc"
+
+static int init_cbfs_poc(void)
+{
+ struct cbfs_header* header;
+ setup_cbfs_from_flash();
+ header = get_cbfs_header();
+ if (header == (void*)0xffffffff)
+ printk("Header not found!\n");
+ else
+ printk("Header found at address %p\n", header);
+ return 0;
+}
+module_init(init_cbfs_poc);
+
+static void exit_cbfs_poc(void)
+{
+}
+module_exit(exit_cbfs_poc);
+