Merge pull request #3973 from op-jenkins/op-build-update_043_12-16-2020

op-build update 12-16-2020
diff --git a/openpower/package/openpower-pnor/openpower-pnor.mk b/openpower/package/openpower-pnor/openpower-pnor.mk
index 7bee3ab..a114c3c 100644
--- a/openpower/package/openpower-pnor/openpower-pnor.mk
+++ b/openpower/package/openpower-pnor/openpower-pnor.mk
@@ -19,11 +19,9 @@
 OPENPOWER_PNOR_DEPENDENCIES += ima-catalog
 endif
 
-ifeq ($(BR2_PACKAGE_SKIBOOT_EMBED_PAYLOAD),n)
+ifneq ($(BR2_PACKAGE_SKIBOOT_EMBED_PAYLOAD),y)
 
 ifeq ($(BR2_TARGET_ROOTFS_INITRAMFS),y)
-OPENPOWER_PNOR_DEPENDENCIES += linux-rebuild-with-initramfs
-else
 OPENPOWER_PNOR_DEPENDENCIES += linux
 endif
 
diff --git a/openpower/package/skiboot/0001-build-Fix-linker-script-for-builtin-Kernel.patch b/openpower/package/skiboot/0001-build-Fix-linker-script-for-builtin-Kernel.patch
new file mode 100644
index 0000000..a97d79b
--- /dev/null
+++ b/openpower/package/skiboot/0001-build-Fix-linker-script-for-builtin-Kernel.patch
@@ -0,0 +1,55 @@
+From 6def8ac06ff34b2232de48e5f9bc3a179199a9ad Mon Sep 17 00:00:00 2001
+From: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
+Date: Thu, 10 Dec 2020 15:44:55 -0500
+Subject: [PATCH] build: Fix linker script for builtin Kernel
+
+Commit '6b08928d - build/lds: place debug sections according to
+defaults' introduced a DEBUG_SECTIONS macro that is effectivelly
+resetting the location pointer back to zero, making the next section
+(builtin_kernel) collide with the earlier sections.
+
+Fix by moving these sections to the very end.
+
+Error message:
+$ make KERNEL=zImage.epapr
+        [CC]  asm/asm-offsets.s
+        [GN]  include/asm-offsets.h
+<...>
+        [LD]  skiboot.tmp.elf
+ld: section .builtin_kernel LMA [0000000000000000,0000000000285d87]
+ overlaps section .head LMA [0000000000000000,0000000000003897]
+ld: section .naca LMA [0000000000004000,000000000000505f] overlaps
+ section .builtin_kernel LMA [0000000000000000,0000000000285d87]
+make: *** [/skiboot/Makefile.main:333: skiboot.tmp.elf] Error 1
+
+Fixes: 6b08928d - build/lds: place debug sections according to defaults
+Signed-off-by: Klaus Heinrich Kiwi <klaus@linux.vnet.ibm.com>
+---
+ skiboot.lds.S | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/skiboot.lds.S b/skiboot.lds.S
+index 5da6f9d8..5a7f9e31 100644
+--- a/skiboot.lds.S
++++ b/skiboot.lds.S
+@@ -233,8 +233,6 @@ SECTIONS
+ 
+ 	ASSERT((HEAP_BASE - SKIBOOT_BASE) >= _end, "Heap collision with image")
+ 
+-	DEBUG_SECTIONS
+-
+ 	/* Optional kernel image */
+        . = ALIGN(PAGE_SIZE);
+        .builtin_kernel : {
+@@ -243,6 +241,8 @@ SECTIONS
+ 		__builtin_kernel_end = .;
+ 	}
+ 
++	DEBUG_SECTIONS
++
+ 	/* Discards */
+ 	/DISCARD/ : {
+ 		*(.note.GNU-stack)
+-- 
+2.27.0
+
diff --git a/openpower/package/skiboot/skiboot.mk b/openpower/package/skiboot/skiboot.mk
index 708cef7..6b7d6aa 100644
--- a/openpower/package/skiboot/skiboot.mk
+++ b/openpower/package/skiboot/skiboot.mk
@@ -18,40 +18,34 @@
 SKIBOOT_INSTALL_IMAGES = YES
 SKIBOOT_INSTALL_TARGET = NO
 
-ifeq ($(BR2_SKIBOOT_DEVICETREE),y)
-SKIBOOT_DEPENDENCIES += host-dtc
-endif
 
-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 += linux-rebuild-with-initramfs
-else
+ifeq ($(BR2_PACKAGE_SKIBOOT_EMBED_PAYLOAD),y)
+SKIBOOT_MAKE_OPTS += KERNEL=$(BINARIES_DIR)/$(LINUX_IMAGE_NAME)
 SKIBOOT_DEPENDENCIES += linux
 endif
 
+ifeq ($(BR2_SKIBOOT_DEVICETREE),y)
+SKIBOOT_DEPENDENCIES += host-dtc
+define SKIBOOT_BUILD_DEVICETREE
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/external/devicetree all
+endef
+define SKIBOOT_INSTALL_DEVICETREE
+	$(INSTALL) -D -m 644 $(@D)/external/devicetree/*.dtb $(BINARIES_DIR)
+endef
 endif
 
+# Pass Configure opts as env to not override Skiboot's
+# Additionally, Skiboot expects SKIBOOT_VERSION as env
 define SKIBOOT_BUILD_CMDS
-	$(TARGET_CONFIGURE_OPTS) SKIBOOT_VERSION=`cat $(SKIBOOT_VERSION_FILE)` \
-		$(MAKE) $(SKIBOOT_MAKE_OPTS) -C $(@D) all
-
-	$(if $(BR2_SKIBOOT_DEVICETREE), \
-		$(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)/external/devicetree)
+	$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) \
+		SKIBOOT_VERSION=`cat $(SKIBOOT_VERSION_FILE)` \
+		$(MAKE) -C $(@D) $(SKIBOOT_MAKE_OPTS) all
+	$(SKIBOOT_BUILD_DEVICETREE)
 endef
 
 define SKIBOOT_INSTALL_IMAGES_CMDS
 	$(INSTALL) -D -m 755 $(@D)/skiboot.lid $(BINARIES_DIR)
-
-	$(if $(BR2_SKIBOOT_DEVICETREE), \
-		$(INSTALL) -D -m 644 \
-			$(@D)/external/devicetree/*.dtb $(BINARIES_DIR))
+	$(SKIBOOT_INSTALL_DEVICETREE)
 endef
 
 $(eval $(generic-package))