From 0864c30d4db4083676eaf79f1e58109a0ceff596 Mon Sep 17 00:00:00 2001 From: Rob Sherwood Date: Fri, 5 Feb 2016 10:02:01 -0800 Subject: [PATCH 1/3] Skeleton OOM_shim package for OCP Demo --- packages/base/amd64/oom_shim/Makefile | 1 + packages/base/amd64/oom_shim/PKG.yml | 2 ++ packages/base/amd64/oom_shim/builds/Makefile | 3 ++ packages/base/any/oom_shim/APKG.yml | 32 ++++++++++++++++++++ packages/base/any/oom_shim/builds/Makefile | 9 ++++++ packages/base/any/oom_shim/src/oom_shim.c | 7 +++++ 6 files changed, 54 insertions(+) create mode 100644 packages/base/amd64/oom_shim/Makefile create mode 100644 packages/base/amd64/oom_shim/PKG.yml create mode 100644 packages/base/amd64/oom_shim/builds/Makefile create mode 100644 packages/base/any/oom_shim/APKG.yml create mode 100644 packages/base/any/oom_shim/builds/Makefile create mode 100644 packages/base/any/oom_shim/src/oom_shim.c diff --git a/packages/base/amd64/oom_shim/Makefile b/packages/base/amd64/oom_shim/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/amd64/oom_shim/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/amd64/oom_shim/PKG.yml b/packages/base/amd64/oom_shim/PKG.yml new file mode 100644 index 00000000..d8f9b23f --- /dev/null +++ b/packages/base/amd64/oom_shim/PKG.yml @@ -0,0 +1,2 @@ +!include $ONL/packages/base/any/oom_shim/APKG.yml ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu + diff --git a/packages/base/amd64/oom_shim/builds/Makefile b/packages/base/amd64/oom_shim/builds/Makefile new file mode 100644 index 00000000..a6c9d258 --- /dev/null +++ b/packages/base/amd64/oom_shim/builds/Makefile @@ -0,0 +1,3 @@ +include $(ONL)/make/config.amd64.mk +include $(ONL)/packages/base/any/oom_shim/builds/Makefile + diff --git a/packages/base/any/oom_shim/APKG.yml b/packages/base/any/oom_shim/APKG.yml new file mode 100644 index 00000000..e8490b9b --- /dev/null +++ b/packages/base/any/oom_shim/APKG.yml @@ -0,0 +1,32 @@ +############################################################ +# +# OOM SHIM +# +# Requires: ARCH, TOOLCHAIN +# +############################################################ +variables: + libdir: /lib/${TOOLCHAIN} + +common: + arch: $ARCH + version: 1.0.0 + copyright: Copyright 2016 Big Switch Networks + maintainer: support@bigswitch.com + + + +packages: + - name: oom_shim + version: 1.0.0 + summary: Open Optical Module Wrapper library around ONLP + provides: [ oom_shim ] + + files: + builds/$BUILD_DIR/${TOOLCHAIN}/liboom_shim.so : $libdir/ + + changelog: Initial code for 2016 OCP Demo + + + + diff --git a/packages/base/any/oom_shim/builds/Makefile b/packages/base/any/oom_shim/builds/Makefile new file mode 100644 index 00000000..8bc9a7f5 --- /dev/null +++ b/packages/base/any/oom_shim/builds/Makefile @@ -0,0 +1,9 @@ +include $(ONL)/make/any.mk + + +liboom_shim.so: + @$(CC) -o liboom_shim.so -shared -PIC liboom_shim.c + +.PHONY: deb +deb: + $(MAKE) -C deb diff --git a/packages/base/any/oom_shim/src/oom_shim.c b/packages/base/any/oom_shim/src/oom_shim.c new file mode 100644 index 00000000..5e866c30 --- /dev/null +++ b/packages/base/any/oom_shim/src/oom_shim.c @@ -0,0 +1,7 @@ +#include + +int test_func(int argc) +{ + + printf("Looks like it works...\n"); +} From fa29d183b7b20fecaac979b26f153f16a0690a95 Mon Sep 17 00:00:00 2001 From: Rob Sherwood Date: Fri, 5 Feb 2016 10:24:14 -0800 Subject: [PATCH 2/3] Skeleton guide for development in our Make system --- docs/dev.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 docs/dev.md diff --git a/docs/dev.md b/docs/dev.md new file mode 100644 index 00000000..77130458 --- /dev/null +++ b/docs/dev.md @@ -0,0 +1,16 @@ +==== FIXME === +Finish this doc + +== Adding a new package + +* Create most of the files in the 'any' architecture for cross compiling +* Copy the directory structure from an existing package + * APKG.yml goes into the $(ONL)/packages/base/any/foo/ directory + * PKG.yml goes into the $(ONL)/packages/base/$ARCH/foo directory + * Create for each $ARCH you intend to support +* Put code in $(ONL)/packages/base/any/foo/src +* Put package specific Makefiles in $(ONL)/packages/base/any/builds + +* Run `make rebuild` in $(ONL)/packages/base/$ARCH/foo to rebuild the package cache + * particularly if you see an error like: + """ERROR:onlpm:'Package all does not exist.'""" From acea7ab90c447bbd30520b931461cf892d05cfd0 Mon Sep 17 00:00:00 2001 From: Rob Sherwood Date: Fri, 5 Feb 2016 18:53:19 -0800 Subject: [PATCH 3/3] Made the OOM-shim package makefile work --- packages/base/any/oom_shim/builds/Makefile | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/base/any/oom_shim/builds/Makefile b/packages/base/any/oom_shim/builds/Makefile index 8bc9a7f5..8f2d99a4 100644 --- a/packages/base/any/oom_shim/builds/Makefile +++ b/packages/base/any/oom_shim/builds/Makefile @@ -1,9 +1,27 @@ include $(ONL)/make/any.mk +ifndef TOOLCHAIN +$(error Must define $$TOOLCHAIN to use this Makefile) +endif -liboom_shim.so: - @$(CC) -o liboom_shim.so -shared -PIC liboom_shim.c +ifndef RELEASE +$(warn Assuming RELEASE is wheezy -- FIXME) +RELEASE=wheezy +endif + +PACKAGE=oom_shim + +OUTDIR=$(ONL)/packages/base/$(ARCH)/$(PACKAGE)/builds/BUILD/$(RELEASE)/$(TOOLCHAIN) + +VPATH=$(ONL)/packages/base/any/$(PACKAGE)/src + +$(OUTDIR)/liboom_shim.so: oom_shim.c + @mkdir -p $(OUTDIR) || true + @$(CC) -o $(OUTDIR)/liboom_shim.so -shared -fPIC $+ .PHONY: deb deb: $(MAKE) -C deb + +clean: + rm -rf $(OUTDIR)