skiboot: Move skiboot from buildroot tree into openpower overlay

This change moves the skiboot package from the buildroot tree, into the
op-build tree (ie, into the openpower BR2 overlay).

This will allow us to decouple buildroot updates from skiboot updates.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
diff --git a/buildroot b/buildroot
index dd9d28b..3120591 160000
--- a/buildroot
+++ b/buildroot
@@ -1 +1 @@
-Subproject commit dd9d28b337210589b77a7a4a7115c53254f704f9
+Subproject commit 31205912fed95fa0edf1adc5d89dc78d7a068a29
diff --git a/openpower/package/Config.in b/openpower/package/Config.in
index c0a0dc1..83823fb 100644
--- a/openpower/package/Config.in
+++ b/openpower/package/Config.in
@@ -8,3 +8,4 @@
 source "$BR2_EXTERNAL/package/p8-pore-binutils/Config.in"
 source "$BR2_EXTERNAL/package/occ/Config.in"
 source "$BR2_EXTERNAL/package/capp-ucode/Config.in"
+source "$BR2_EXTERNAL/package/skiboot/Config.in"
diff --git a/openpower/package/skiboot/Config.in b/openpower/package/skiboot/Config.in
new file mode 100644
index 0000000..e1f571d
--- /dev/null
+++ b/openpower/package/skiboot/Config.in
@@ -0,0 +1,15 @@
+
+config BR2_TARGET_SKIBOOT
+	bool "skiboot"
+	depends on BR2_powerpc64 || BR2_powerpc64le
+        default y if (BR2_OPENPOWER_PLATFORM && BR2_powerpc_power8)
+	help
+	  Build skiboot POWER8 firmware
+
+if BR2_TARGET_SKIBOOT
+
+config BR2_TARGET_SKIBOOT_EMBED_PAYLOAD
+	bool "Embed kernel payload in skiboot image"
+	depends on BR2_LINUX_KERNEL_ZIMAGE_EPAPR
+
+endif
diff --git a/openpower/package/skiboot/skiboot-0001-specify-mbig-endian-in-link-flags.patch b/openpower/package/skiboot/skiboot-0001-specify-mbig-endian-in-link-flags.patch
new file mode 100644
index 0000000..f5f174c
--- /dev/null
+++ b/openpower/package/skiboot/skiboot-0001-specify-mbig-endian-in-link-flags.patch
@@ -0,0 +1,26 @@
+From ec49ccee122c1be9b0d90c0f810a8964575bd57f Mon Sep 17 00:00:00 2001
+From: Jeremy Kerr <jk@ozlabs.org>
+Date: Wed, 11 Feb 2015 15:47:17 +0800
+Subject: [PATCH] Makefile: specify -mbig-endian in link flags
+
+Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
+---
+ Makefile.main | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.main b/Makefile.main
+index b5376fc..0fca221 100644
+--- a/Makefile.main
++++ b/Makefile.main
+@@ -64,7 +64,7 @@ CFLAGS += $(CWARNS) $(OPTS) $(DBG)
+ 
+ LDFLAGS := -m64 -static -nostdlib -Wl,--gc-sections -pie
+ LDFLAGS += -Wl,-Ttext-segment,$(LD_TEXT) -Wl,-N -Wl,--build-id=none
+-LDFLAGS += -Wl,--no-multi-toc
++LDFLAGS += -Wl,--no-multi-toc -mbig-endian -Wl,--oformat,elf64-powerpc
+ LDRFLAGS=-melf64ppc
+ # Debug stuff
+ #LDFLAGS += -Wl,-v -Wl,-Map,foomap 
+-- 
+1.9.1
+
diff --git a/openpower/package/skiboot/skiboot.mk b/openpower/package/skiboot/skiboot.mk
new file mode 100644
index 0000000..97c6cb6
--- /dev/null
+++ b/openpower/package/skiboot/skiboot.mk
@@ -0,0 +1,37 @@
+################################################################################
+#
+# skiboot
+#
+################################################################################
+
+SKIBOOT_VERSION = 9a3f68b499e686ff3b543633f59192890f6c740b
+SKIBOOT_SITE = $(call github,open-power,skiboot,$(SKIBOOT_VERSION))
+SKIBOOT_INSTALL_IMAGES = YES
+SKIBOOT_INSTALL_TARGET = NO
+
+SKIBOOT_MAKE_OPTS += CC="$(TARGET_CC)" LD="$(TARGET_LD)" \
+		     AS="$(TARGET_AS)" AR="$(TARGET_AR)" NM="$(TARGET_NM)" \
+		     OBJCOPY="$(TARGET_OBJCOPY)" OBJDUMP="$(TARGET_OBJDUMP)" \
+		     SIZE="$(TARGET_CROSS)size"
+
+ifeq ($(BR2_TARGET_SKIBOOT_EMBED_PAYLOAD),y)
+SKIBOOT_MAKE_OPTS += KERNEL="$(BINARIES_DIR)/$(LINUX_IMAGE_NAME)"
+
+ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
+SKIBOOT_DEPENDENCIES += linux26-rebuild-with-initramfs
+else
+SKIBOOT_DEPENDENCIES += linux
+endif
+
+endif
+
+define SKIBOOT_BUILD_CMDS
+	$(TARGET_CONFIGURE_OPTS) SKIBOOT_VERSION=$(SKIBOOT_VERSION) \
+		$(MAKE) $(SKIBOOT_MAKE_OPTS) -C $(@D) all
+endef
+
+define SKIBOOT_INSTALL_IMAGES_CMDS
+	$(INSTALL) -D -m 755 $(@D)/skiboot.lid $(BINARIES_DIR)
+endef
+
+$(eval $(generic-package))