From 0c484021acec08398da9781beb94d90bf2e8caaf Mon Sep 17 00:00:00 2001
From: =?utf8?q?Jan-Simon=20M=C3=B6ller?= <jsmoeller@linuxfoundation.org>
Date: Wed, 5 Jul 2017 17:21:03 +0200
Subject: [PATCH] Fix for image format dependencies during parsing
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

local.conf is evaluated first before the distro configuration. This caused issues while parsing the
IMAGE_FSTYPES. The same set of IMAGE_FSTYPES did not throw the same switches deep in the other recipes.

We define
AGL_EXTRA_IMAGE_FSTYPES and AGL_EXTRA_INITRAMFS_FSTYPES for use in conf/local.conf or the device templates
which are added early on-top of the defaults:

AGL_DEFAULT_IMAGE_FSTYPES ?= "tar.xz ext4.xz"   (tar.xz for direct use, ext4.xz for direct use and CI)
AGL_DEFAULT_INITRAMFS_FSTYPES ?= "ext4.gz" (format for initramfs/initrd with smack labels)

Both sets can be overridden in the device configuration / template.

Device templates have been adapted accordingly.


Bug-AGL: SPEC-492


Change-Id: I962ee8cc461b307b494d13ce3a3ebca154bebc86
Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/10049
Tested-by: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
ci-image-build: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
Reviewed-by: Dominig ar Foll <dominig.arfoll@fridu.net>
---
 meta-agl-bsp/conf/include/agl_beaglebone.inc      |  2 ++
 meta-agl-bsp/conf/include/agl_cyclone5.inc        |  6 ++++++
 meta-agl-bsp/conf/include/agl_intel-corei7-64.inc |  4 ++++
 meta-agl-bsp/conf/include/agl_joule.inc           |  4 ++++
 meta-agl-bsp/conf/include/agl_raspberrypi2.inc    |  2 +-
 meta-agl-bsp/conf/include/agl_raspberrypi3-64.inc |  2 +-
 meta-agl-bsp/conf/include/agl_raspberrypi3.inc    |  2 +-
 meta-agl-distro/conf/distro/poky-agl.conf         | 18 +++++++++++-------
 8 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/meta-agl-bsp/conf/include/agl_beaglebone.inc b/meta-agl-bsp/conf/include/agl_beaglebone.inc
index be9785a5a..970e8111e 100644
--- a/meta-agl-bsp/conf/include/agl_beaglebone.inc
+++ b/meta-agl-bsp/conf/include/agl_beaglebone.inc
@@ -40,3 +40,5 @@ SECURITY_LDFLAGS_pn-gpm = ""
 SECURITY_CFLAGS_pn-libatasmart = ""
 SECURITY_LDFLAGS_pn-libatasmart = ""
 
+
+AGL_EXTRA_IMAGE_FSTYPES := "wic.xz"
\ No newline at end of file
diff --git a/meta-agl-bsp/conf/include/agl_cyclone5.inc b/meta-agl-bsp/conf/include/agl_cyclone5.inc
index 8accf7dca..0e98d755b 100644
--- a/meta-agl-bsp/conf/include/agl_cyclone5.inc
+++ b/meta-agl-bsp/conf/include/agl_cyclone5.inc
@@ -3,3 +3,9 @@ OSTREE_BOOTLOADER ?= "u-boot"
 # DEFAULTTUNE for cortex-a9
 DISTRO_FEATURES_append = " agl-medium-arm-compiler"
 
+
+# Add the custom rpi-sdimg output format
+AGL_EXTRA_IMAGE_FSTYPES  = "socfpga-sdimg.xz"
+
+# Use the AGL default ext4.xz to generate the rpi-sdimg
+SDIMG_ROOTFS_TYPE = "ext4.xz"
diff --git a/meta-agl-bsp/conf/include/agl_intel-corei7-64.inc b/meta-agl-bsp/conf/include/agl_intel-corei7-64.inc
index c31ac2759..47d5a5f45 100644
--- a/meta-agl-bsp/conf/include/agl_intel-corei7-64.inc
+++ b/meta-agl-bsp/conf/include/agl_intel-corei7-64.inc
@@ -23,3 +23,7 @@ IMAGE_INSTALL_append = " \
         libva \
         va-intel \
         gstreamer-vaapi-1.0 "
+
+AGL_DEFAULT_IMAGE_FSTYPES := "live wic"
+AGL_DEFAULT_INITRAMFS_FSTYPES := "cpio.gz"
+NOISO = "1"
diff --git a/meta-agl-bsp/conf/include/agl_joule.inc b/meta-agl-bsp/conf/include/agl_joule.inc
index 212cb15af..014ce436a 100644
--- a/meta-agl-bsp/conf/include/agl_joule.inc
+++ b/meta-agl-bsp/conf/include/agl_joule.inc
@@ -9,3 +9,7 @@ IMAGE_INSTALL_append = " \
         va-intel \
         gstreamer-vaapi-1.0 "
 OSTREE_BOOTLOADER ?= "u-boot"
+
+AGL_DEFAULT_IMAGE_FSTYPES := "live wic"
+AGL_DEFAULT_INITRAMFS_FSTYPES := "cpio.gz"
+NOISO = "1"
diff --git a/meta-agl-bsp/conf/include/agl_raspberrypi2.inc b/meta-agl-bsp/conf/include/agl_raspberrypi2.inc
index 2cd9ec2a9..5de54be63 100644
--- a/meta-agl-bsp/conf/include/agl_raspberrypi2.inc
+++ b/meta-agl-bsp/conf/include/agl_raspberrypi2.inc
@@ -34,7 +34,7 @@ IMAGE_FEATURES_remove = "splash"
 DISTRO_FEATURES_append = " sota"
 
 # Add the custom rpi-sdimg output format
-AGL_EXTRA_IMAGE_FSTYPES_append  = " rpi-sdimg.xz"
+AGL_EXTRA_IMAGE_FSTYPES  = " rpi-sdimg.xz"
 
 # Use the AGL default ext4.xz to generate the rpi-sdimg
 SDIMG_ROOTFS_TYPE = "ext4.xz"
diff --git a/meta-agl-bsp/conf/include/agl_raspberrypi3-64.inc b/meta-agl-bsp/conf/include/agl_raspberrypi3-64.inc
index cfa36afed..6f42c3602 100644
--- a/meta-agl-bsp/conf/include/agl_raspberrypi3-64.inc
+++ b/meta-agl-bsp/conf/include/agl_raspberrypi3-64.inc
@@ -31,7 +31,7 @@ IMAGE_INSTALL_append = " kernel-modules linux-firmware "
 IMAGE_FEATURES_remove = "splash"
 
 # Add the custom rpi-sdimg output format
-AGL_EXTRA_IMAGE_FSTYPES_append  = " rpi-sdimg.xz"
+AGL_EXTRA_IMAGE_FSTYPES  = " rpi-sdimg.xz"
 
 # Use the AGL default ext4.xz to generate the rpi-sdimg
 SDIMG_ROOTFS_TYPE = "ext4.xz"
diff --git a/meta-agl-bsp/conf/include/agl_raspberrypi3.inc b/meta-agl-bsp/conf/include/agl_raspberrypi3.inc
index 2cd9ec2a9..5de54be63 100644
--- a/meta-agl-bsp/conf/include/agl_raspberrypi3.inc
+++ b/meta-agl-bsp/conf/include/agl_raspberrypi3.inc
@@ -34,7 +34,7 @@ IMAGE_FEATURES_remove = "splash"
 DISTRO_FEATURES_append = " sota"
 
 # Add the custom rpi-sdimg output format
-AGL_EXTRA_IMAGE_FSTYPES_append  = " rpi-sdimg.xz"
+AGL_EXTRA_IMAGE_FSTYPES  = " rpi-sdimg.xz"
 
 # Use the AGL default ext4.xz to generate the rpi-sdimg
 SDIMG_ROOTFS_TYPE = "ext4.xz"
diff --git a/meta-agl-distro/conf/distro/poky-agl.conf b/meta-agl-distro/conf/distro/poky-agl.conf
index 67e141ed0..1e4d2c296 100644
--- a/meta-agl-distro/conf/distro/poky-agl.conf
+++ b/meta-agl-distro/conf/distro/poky-agl.conf
@@ -114,15 +114,19 @@ require conf/distro/include/${TARGET_ARCH}-tune.inc
 QB_MEM ?= "-m 1024"
 
 
-# DEFAULT IMAGE_FSTYPES for AGL (no - BSPs should not set this)
+# Board templates can add extra IMAGE_FSTYPES through this.
+# It is added (late) through the AGL image recipes.
+AGL_EXTRA_IMAGE_FSTYPES ??= ""
+AGL_EXTRA_INITRAMFS_FSTYPES ??= ""
 #
-IMAGE_FSTYPES := "tar.xz ext4.xz"
-INITRAMFS_FSTYPES := ""
+# Default IMAGE FSTYPES compressed tarball + ext4.xz
+AGL_DEFAULT_IMAGE_FSTYPES ?= "tar.xz ext4.xz"
+AGL_DEFAULT_INITRAMFS_FSTYPES ?= "ext4.gz"
 
+# DEFAULT IMAGE_FSTYPES for AGL (no - BSPs should not set this)
+#
+IMAGE_FSTYPES := "${AGL_DEFAULT_IMAGE_FSTYPES} ${AGL_EXTRA_IMAGE_FSTYPES}"
+INITRAMFS_FSTYPES := "${AGL_DEFAULT_INITRAMFS_FSTYPES} ${AGL_EXTRA_INITRAMFS_FSTYPES}"
 #
 # THE FUTURE is 'wic'
 # IMAGE_FSTYPES_append = " wic"
-
-# Board templates can add extra IMAGE_FSTYPES through this.
-# It is added (late) through the AGL image recipes.
-AGL_EXTRA_IMAGE_FSTYPES ?= ""
-- 
2.16.6