skiboot-gard: Add recipe and add to tarball

Change-Id: I250c891eb77dacabb8e76199591b7d5aac0e0122
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/common/recipes-bsp/skiboot/gard.bb b/common/recipes-bsp/skiboot/gard.bb
new file mode 100644
index 0000000..214e905
--- /dev/null
+++ b/common/recipes-bsp/skiboot/gard.bb
@@ -0,0 +1,5 @@
+SUMMARY = "gard record tool for OpenPower"
+DESCRIPTION = "gard record tool for OpenPower machines"
+
+require skiboot.inc
+EXTRA_OEMAKE_append = " PFLASH_VERSION=${PV} GARD_VERSION=${PV}"
diff --git a/common/recipes-bsp/skiboot/skiboot.inc b/common/recipes-bsp/skiboot/skiboot.inc
index 757d63d..3b5692c 100644
--- a/common/recipes-bsp/skiboot/skiboot.inc
+++ b/common/recipes-bsp/skiboot/skiboot.inc
@@ -2,6 +2,10 @@
 LICENSE = "Apache-2.0"
 
 SRC_URI += "git://github.com/open-power/skiboot.git"
+SRC_URI += "file://0001-external-Use-more-standard-PREFIX-vs-prefix.patch"
+SRC_URI += "file://0002-external-Utilize-DESTDIR-in-shared-makefile.patch"
+
+FILESEXTRAPATHS_append := "${THISDIR}/skiboot:"
 
 LIC_FILES_CHKSUM = "file://${S}/LICENCE;md5=3b83ef96387f14655fc854ddc3c6bd57"
 
@@ -19,7 +23,7 @@
 }
 
 do_install() {
-    oe_runmake -C ${SKIBOOT_SUBDIR} install DESTDIR=${D} PREFIX=${D}/usr
+    oe_runmake -C ${SKIBOOT_SUBDIR} install DESTDIR=${D} PREFIX=/usr
 }
 
 BBCLASSEXTEND = "native nativesdk"
diff --git a/common/recipes-bsp/skiboot/skiboot/0001-external-Use-more-standard-PREFIX-vs-prefix.patch b/common/recipes-bsp/skiboot/skiboot/0001-external-Use-more-standard-PREFIX-vs-prefix.patch
new file mode 100644
index 0000000..d00973b
--- /dev/null
+++ b/common/recipes-bsp/skiboot/skiboot/0001-external-Use-more-standard-PREFIX-vs-prefix.patch
@@ -0,0 +1,71 @@
+From 3cd3e18ef5743d3f78fa540af1141db8de1fdbcc Mon Sep 17 00:00:00 2001
+From: Patrick Williams <patrick@stwcx.xyz>
+Date: Fri, 5 Aug 2016 16:02:37 -0500
+Subject: [PATCH] external: Use more-standard PREFIX vs prefix
+
+Distro packaging tools typically use PREFIX instead of prefix,
+so change all references to lower-case prefix to upper-case.
+
+pflash uses PREFIX since at least b2649b.
+
+Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
+---
+ external/gard/rules.mk        | 6 +++---
+ external/opal-prd/Makefile    | 6 +++---
+ external/xscom-utils/Makefile | 6 +++---
+ 3 files changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/external/gard/rules.mk b/external/gard/rules.mk
+index 0dd14ed..dfe93d5 100644
+--- a/external/gard/rules.mk
++++ b/external/gard/rules.mk
+@@ -7,9 +7,9 @@ OBJS     += $(LIBFLASH_OBJS)
+ OBJS     += common-arch_flash.o
+ EXE       = gard
+ 
+-prefix = /usr/local/
+-sbindir = $(prefix)/sbin
+-datadir = $(prefix)/share
++PREFIX = /usr/local/
++sbindir = $(PREFIX)/sbin
++datadir = $(PREFIX)/share
+ mandir = $(datadir)/man
+ 
+ GARD_VERSION ?= $(shell ./make_version.sh $(EXE))
+diff --git a/external/opal-prd/Makefile b/external/opal-prd/Makefile
+index 7482af3..8318348 100644
+--- a/external/opal-prd/Makefile
++++ b/external/opal-prd/Makefile
+@@ -3,9 +3,9 @@ LDFLAGS += -m64
+ ASFLAGS = -m64
+ CPPFLAGS += -I. -I../../include -I../../
+ 
+-prefix = /usr/local/
+-sbindir = $(prefix)/sbin
+-datadir = $(prefix)/share
++PREFIX = /usr/local/
++sbindir = $(PREFIX)/sbin
++datadir = $(PREFIX)/share
+ mandir = $(datadir)/man
+ 
+ all: links arch_links | opal-prd
+diff --git a/external/xscom-utils/Makefile b/external/xscom-utils/Makefile
+index 3fee247..9695105 100644
+--- a/external/xscom-utils/Makefile
++++ b/external/xscom-utils/Makefile
+@@ -3,9 +3,9 @@ CC = $(CROSS_COMPILE)gcc
+ XSCOM_VERSION ?= $(shell ../../make_version.sh xscom-utils)
+ CFLAGS += -O2 -g -Wall -m64
+ 
+-prefix = /usr/local/
+-sbindir = $(prefix)/sbin
+-datadir = $(prefix)/share
++PREFIX = /usr/local/
++sbindir = $(PREFIX)/sbin
++datadir = $(PREFIX)/share
+ mandir = $(datadir)/man
+ 
+ %.o: %.c
+-- 
+2.9.0
+
diff --git a/common/recipes-bsp/skiboot/skiboot/0002-external-Utilize-DESTDIR-in-shared-makefile.patch b/common/recipes-bsp/skiboot/skiboot/0002-external-Utilize-DESTDIR-in-shared-makefile.patch
new file mode 100644
index 0000000..89ee54a
--- /dev/null
+++ b/common/recipes-bsp/skiboot/skiboot/0002-external-Utilize-DESTDIR-in-shared-makefile.patch
@@ -0,0 +1,39 @@
+From 6c5cf9f87a9047bc56ccd8b6096b8ec4a6af96ab Mon Sep 17 00:00:00 2001
+From: Patrick Williams <patrick@stwcx.xyz>
+Date: Fri, 5 Aug 2016 16:53:21 -0500
+Subject: [PATCH 2/2] external: Utilize DESTDIR in shared makefile
+
+Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
+---
+ external/shared/Makefile | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/external/shared/Makefile b/external/shared/Makefile
+index e0b3ff3..4baa6b4 100644
+--- a/external/shared/Makefile
++++ b/external/shared/Makefile
+@@ -39,15 +39,15 @@ all: links arch_links $(OBJS)
+ 	$(CC) -shared -Wl,-soname,libflash.so -o $(SHARED_NAME) $(OBJS)
+ 
+ install-lib: all
+-	install -D -m 0755 $(SHARED_NAME) $(LIBDIR)/$(SHARED_NAME)
+-	ln -sf $(SHARED_NAME) $(LIBDIR)/libflash.so
++	install -D -m 0755 $(SHARED_NAME) $(DESTDIR)$(LIBDIR)/$(SHARED_NAME)
++	ln -sf $(SHARED_NAME) $(DESTDIR)$(LIBDIR)/libflash.so
+ 
+ install-dev: links arch_links
+-	mkdir -p $(INCDIR)
+-	install -m 0644 $(LIBFLASH_H) $(ARCHFLASH_H) $(INCDIR)
++	mkdir -p $(DESTDIR)$(INCDIR)
++	install -m 0644 $(LIBFLASH_H) $(ARCHFLASH_H) $(DESTDIR)$(INCDIR)
+ 
+ install: install-lib install-dev
+ 
+ uninstall:
+-	rm -f $(LIBDIR)/libflash*
+-	rm -rf $(INCDIR)
++	rm -f $(DESTDIR)$(LIBDIR)/libflash*
++	rm -rf $(DESTDIR)$(INCDIR)
+-- 
+2.9.0
+