From 01ee764fcf6ba5af38db5191db739a265e143259 Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Mon, 6 Mar 2017 12:18:37 +0100 Subject: [PATCH] u-boot-fw-utils: rework patches to fix broken build Patches added in 'meta-swupdate' (backported from U-Boot) broke our layer. We also had those patches, so remove them and make sure the rest or our patches are applied after the ones from 'meta-swupdate' by using an anonymous python function instead of appending to the SRC_URI variable. Signed-off-by: Javier Viguera --- ...nfig-structs-must-be-defined-in-tool.patch | 47 ------------------- ...nt-support-for-environment-encrypti.patch} | 0 ...U-Boot-environment-access-functions.patch} | 0 ...x-config-file-loading-in-env-library.patch | 33 ------------- ...pport-to-unlock-emmc-boot-partition.patch} | 0 .../u-boot/u-boot-fw-utils_%.bbappend | 22 +++++++-- 6 files changed, 17 insertions(+), 85 deletions(-) delete mode 100644 meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0001-tools-env-bug-config-structs-must-be-defined-in-tool.patch rename meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/{0003-tools-env-implement-support-for-environment-encrypti.patch => 0001-tools-env-implement-support-for-environment-encrypti.patch} (100%) rename meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/{0004-Implement-U-Boot-environment-access-functions.patch => 0002-Implement-U-Boot-environment-access-functions.patch} (100%) delete mode 100644 meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0002-tools-env-fix-config-file-loading-in-env-library.patch rename meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/{0005-fw_env-add-support-to-unlock-emmc-boot-partition.patch => 0003-fw_env-add-support-to-unlock-emmc-boot-partition.patch} (100%) diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0001-tools-env-bug-config-structs-must-be-defined-in-tool.patch b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0001-tools-env-bug-config-structs-must-be-defined-in-tool.patch deleted file mode 100644 index d69f9b1fc..000000000 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0001-tools-env-bug-config-structs-must-be-defined-in-tool.patch +++ /dev/null @@ -1,47 +0,0 @@ -From: Andreas Fenkart -Date: Fri, 25 Mar 2016 14:52:19 +0100 -Subject: [PATCH] tools: env: bug: config structs must be defined in tools - library - -fw_senten/fw_printenv can be compiled as a tools library, -excluding the fw_env_main object. - -Reported-by: Stefano Babic -Signed-off-by: Andreas Fenkart -(cherry picked from commit 43cb65b7a00e4759427a6e4b8a02039e43dab5a5) -Signed-off-by: Javier Viguera ---- - tools/env/fw_env.c | 4 ++++ - tools/env/fw_env_main.c | 4 ---- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c -index ee17a6901609..2533dc4eec2b 100644 ---- a/tools/env/fw_env.c -+++ b/tools/env/fw_env.c -@@ -34,6 +34,10 @@ - - #include "fw_env.h" - -+struct common_args common_args; -+struct printenv_args printenv_args; -+struct setenv_args setenv_args; -+ - #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) - - #define WHITESPACE(c) ((c == '\t') || (c == ' ')) -diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c -index 4bd4216625aa..3065de962272 100644 ---- a/tools/env/fw_env_main.c -+++ b/tools/env/fw_env_main.c -@@ -49,10 +49,6 @@ static struct option long_options[] = { - {NULL, 0, NULL, 0} - }; - --struct common_args common_args; --struct printenv_args printenv_args; --struct setenv_args setenv_args; -- - void usage_printenv(void) - { - diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0003-tools-env-implement-support-for-environment-encrypti.patch b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0001-tools-env-implement-support-for-environment-encrypti.patch similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0003-tools-env-implement-support-for-environment-encrypti.patch rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0001-tools-env-implement-support-for-environment-encrypti.patch diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0004-Implement-U-Boot-environment-access-functions.patch b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0002-Implement-U-Boot-environment-access-functions.patch similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0004-Implement-U-Boot-environment-access-functions.patch rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0002-Implement-U-Boot-environment-access-functions.patch diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0002-tools-env-fix-config-file-loading-in-env-library.patch b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0002-tools-env-fix-config-file-loading-in-env-library.patch deleted file mode 100644 index f423a233b..000000000 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0002-tools-env-fix-config-file-loading-in-env-library.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: Anatolij Gustschin -Date: Fri, 29 Apr 2016 22:00:11 +0200 -Subject: [PATCH] tools: env: fix config file loading in env library - -env library is broken as the config file pointer is only initialized -in main(). When running in the env library parse_config() fails: - - Cannot parse config file '(null)': Bad address - -Ensure that config file pointer is always initialized. - -Signed-off-by: Anatolij Gustschin -Cc: Stefano Babic -(cherry picked from commit 925c97c248527391de32c2926f7e1911850fd4b0) -Signed-off-by: Javier Viguera ---- - tools/env/fw_env.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c -index 2533dc4eec2b..b2f62827d918 100644 ---- a/tools/env/fw_env.c -+++ b/tools/env/fw_env.c -@@ -1326,6 +1326,9 @@ static int parse_config () - struct stat st; - - #if defined(CONFIG_FILE) -+ if (!common_args.config_file) -+ common_args.config_file = CONFIG_FILE; -+ - /* Fills in DEVNAME(), ENVSIZE(), DEVESIZE(). Or don't. */ - if (get_config(common_args.config_file)) { - fprintf(stderr, "Cannot parse config file '%s': %m\n", diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0005-fw_env-add-support-to-unlock-emmc-boot-partition.patch b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0003-fw_env-add-support-to-unlock-emmc-boot-partition.patch similarity index 100% rename from meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0005-fw_env-add-support-to-unlock-emmc-boot-partition.patch rename to meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils/0003-fw_env-add-support-to-unlock-emmc-boot-partition.patch diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend index 93f3843b4..ef7fbfc26 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend @@ -4,13 +4,25 @@ FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:" SRC_URI += " \ file://fw_env.config \ - file://0001-tools-env-bug-config-structs-must-be-defined-in-tool.patch \ - file://0002-tools-env-fix-config-file-loading-in-env-library.patch \ - file://0003-tools-env-implement-support-for-environment-encrypti.patch \ - file://0004-Implement-U-Boot-environment-access-functions.patch \ - file://0005-fw_env-add-support-to-unlock-emmc-boot-partition.patch \ " +UBOOT_FW_UTILS_PATCHES = " \ + file://0001-tools-env-implement-support-for-environment-encrypti.patch \ + file://0002-Implement-U-Boot-environment-access-functions.patch \ + file://0003-fw_env-add-support-to-unlock-emmc-boot-partition.patch \ +" + +# Patches from 'meta-swupdate' touch the same files than ours, so we need to +# force that our patches are applied later. As our layer has more priority than +# 'meta-swupdate' we need to do the changes to SRC_URI in an anonymous python +# function instead of a normal '_append' to the SRC_URI variable. +python() { + ufw_patches = d.getVar('UBOOT_FW_UTILS_PATCHES', True) + if ufw_patches: + src_uri = d.getVar('SRC_URI', True) + d.setVar('SRC_URI', src_uri + ufw_patches) +} + # We do not have a platform defconfig in this version of u-boot, so just use the generic # sandbox defconfig, which is enough to build the Linux user-space tool (fw_printenv) UBOOT_CONFIG = "sandbox"