morty migration: u-boot-fw-utils: update package
https://jira.digi.com/browse/DEL-3451 Also backport patch to fix: https://jira.digi.com/browse/DEL-3770 Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
parent
04cc6d470a
commit
989e9585f9
|
|
@ -0,0 +1,47 @@
|
|||
From: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
|
||||
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 <sbabic@denx.de>
|
||||
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
|
||||
(cherry picked from commit 43cb65b7a00e4759427a6e4b8a02039e43dab5a5)
|
||||
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
|
||||
---
|
||||
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)
|
||||
{
|
||||
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
From: Anatolij Gustschin <agust@denx.de>
|
||||
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 <agust@denx.de>
|
||||
Cc: Stefano Babic <sbabic@denx.de>
|
||||
(cherry picked from commit 925c97c248527391de32c2926f7e1911850fd4b0)
|
||||
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
|
||||
---
|
||||
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",
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
From: "Diaz de Grenu, Jose" <Jose.DiazdeGrenu@digi.com>
|
||||
Date: Tue, 23 Aug 2016 13:05:05 +0200
|
||||
Subject: [PATCH] tools: env: implement support for environment encryption
|
||||
by CAAM
|
||||
Subject: [PATCH] tools: env: implement support for environment encryption by
|
||||
CAAM
|
||||
|
||||
https://jira.digi.com/browse/DEL-2836
|
||||
|
||||
|
|
@ -15,30 +15,30 @@ Signed-off-by: Diaz de Grenu, Jose <Jose.DiazdeGrenu@digi.com>
|
|||
create mode 100644 tools/env/caam_keyblob.h
|
||||
|
||||
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
|
||||
index 598519dbb2fc..81dd4d445c0e 100644
|
||||
index 02534bfea761..5a690c1cc623 100644
|
||||
--- a/configs/sandbox_defconfig
|
||||
+++ b/configs/sandbox_defconfig
|
||||
@@ -44,3 +44,4 @@ CONFIG_UNIT_TEST=y
|
||||
@@ -90,3 +90,4 @@ CONFIG_UNIT_TEST=y
|
||||
CONFIG_UT_TIME=y
|
||||
CONFIG_UT_DM=y
|
||||
CONFIG_UT_ENV=y
|
||||
+CONFIG_MD5=y
|
||||
diff --git a/tools/env/Makefile b/tools/env/Makefile
|
||||
index 40164f7a35fa..de4766ddf8dd 100644
|
||||
index 38ad118d032f..fa2a564bb357 100644
|
||||
--- a/tools/env/Makefile
|
||||
+++ b/tools/env/Makefile
|
||||
@@ -25,7 +25,7 @@ hostprogs-y := fw_printenv
|
||||
|
||||
fw_printenv-objs := fw_env.o fw_env_main.o \
|
||||
lib-y += fw_env.o \
|
||||
crc32.o ctype.o linux_string.o \
|
||||
- env_attr.o env_flags.o aes.o
|
||||
+ env_attr.o env_flags.o aes.o ../../lib/md5.o
|
||||
|
||||
quiet_cmd_crosstools_strip = STRIP $^
|
||||
cmd_crosstools_strip = $(STRIP) $^; touch $@
|
||||
fw_printenv-objs := fw_env_main.o $(lib-y)
|
||||
|
||||
diff --git a/tools/env/caam_keyblob.h b/tools/env/caam_keyblob.h
|
||||
new file mode 100644
|
||||
index 000000000000..1e33b3f01a05
|
||||
index 000000000000..1cdf3946c1ba
|
||||
--- /dev/null
|
||||
+++ b/tools/env/caam_keyblob.h
|
||||
@@ -0,0 +1,45 @@
|
||||
|
|
@ -87,12 +87,11 @@ index 000000000000..1e33b3f01a05
|
|||
+#endif
|
||||
+
|
||||
+#endif /* CAAM_KEYBLOB_H */
|
||||
\ No newline at end of file
|
||||
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
|
||||
index daa02a760e37..806c2fb6d550 100644
|
||||
index b2f62827d918..46c619b211b5 100644
|
||||
--- a/tools/env/fw_env.c
|
||||
+++ b/tools/env/fw_env.c
|
||||
@@ -21,6 +21,7 @@
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/stat.h>
|
||||
|
|
@ -100,14 +99,16 @@ index daa02a760e37..806c2fb6d550 100644
|
|||
#include <unistd.h>
|
||||
|
||||
#ifdef MTD_OLD
|
||||
@@ -31,10 +32,19 @@
|
||||
@@ -32,12 +33,21 @@
|
||||
# include <mtd/mtd-user.h>
|
||||
#endif
|
||||
|
||||
+#include "caam_keyblob.h"
|
||||
#include "fw_env.h"
|
||||
|
||||
#include <aes.h>
|
||||
struct common_args common_args;
|
||||
struct printenv_args printenv_args;
|
||||
struct setenv_args setenv_args;
|
||||
|
||||
+/*
|
||||
+ * The BLOB includes a random AES-256 key (32 bytes) and a
|
||||
|
|
@ -120,8 +121,8 @@ index daa02a760e37..806c2fb6d550 100644
|
|||
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
|
||||
|
||||
#define WHITESPACE(c) ((c == '\t') || (c == ' '))
|
||||
@@ -109,6 +119,8 @@ static int aes_flag;
|
||||
static uint8_t aes_key[AES_KEY_LENGTH] = { 0 };
|
||||
@@ -109,6 +119,8 @@ static struct environment environment = {
|
||||
|
||||
static int env_aes_cbc_crypt(char *data, const int enc);
|
||||
|
||||
+static int caam_encryption_flag;
|
||||
|
|
@ -129,7 +130,7 @@ index daa02a760e37..806c2fb6d550 100644
|
|||
static int HaveRedundEnv = 0;
|
||||
|
||||
static unsigned char active_flag = 1;
|
||||
@@ -236,6 +248,103 @@ static int parse_aes_key(char *key)
|
||||
@@ -234,6 +246,103 @@ int parse_aes_key(char *key, uint8_t *bin_key)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -233,7 +234,7 @@ index daa02a760e37..806c2fb6d550 100644
|
|||
/*
|
||||
* Print the current definition of one, or more, or all
|
||||
* environment variables
|
||||
@@ -334,6 +443,15 @@ int fw_env_close(void)
|
||||
@@ -311,6 +420,15 @@ int fw_env_close(void)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -249,7 +250,7 @@ index daa02a760e37..806c2fb6d550 100644
|
|||
/*
|
||||
* Update CRC
|
||||
*/
|
||||
@@ -1191,6 +1309,8 @@ int fw_env_open(void)
|
||||
@@ -1154,6 +1272,8 @@ int fw_env_open(void)
|
||||
struct env_image_single *single;
|
||||
struct env_image_redundant *redundant;
|
||||
|
||||
|
|
@ -258,7 +259,7 @@ index daa02a760e37..806c2fb6d550 100644
|
|||
if (parse_config ()) /* should fill envdevices */
|
||||
return -1;
|
||||
|
||||
@@ -1229,6 +1349,15 @@ int fw_env_open(void)
|
||||
@@ -1192,6 +1312,15 @@ int fw_env_open(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -274,7 +275,7 @@ index daa02a760e37..806c2fb6d550 100644
|
|||
crc0_ok = (crc0 == *environment.crc);
|
||||
if (!HaveRedundEnv) {
|
||||
if (!crc0_ok) {
|
||||
@@ -1286,6 +1415,15 @@ int fw_env_open(void)
|
||||
@@ -1249,6 +1378,15 @@ int fw_env_open(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
From: Javier Viguera <javier.viguera@digi.com>
|
||||
Date: Tue, 1 Apr 2014 18:43:07 +0200
|
||||
Date: Thu, 16 Feb 2017 14:53:44 +0100
|
||||
Subject: [PATCH] fw_env: add support to unlock emmc boot partition
|
||||
|
||||
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
|
||||
---
|
||||
tools/env/fw_env.c | 33 +++++++++++++++++++++++++++++++++
|
||||
1 file changed, 33 insertions(+)
|
||||
tools/env/fw_env.c | 31 +++++++++++++++++++++++++++++++
|
||||
1 file changed, 31 insertions(+)
|
||||
|
||||
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
|
||||
index 09f06c874b17..e4e242b35bd1 100644
|
||||
index 46c619b211b5..1c337b4727a9 100644
|
||||
--- a/tools/env/fw_env.c
|
||||
+++ b/tools/env/fw_env.c
|
||||
@@ -1218,6 +1218,27 @@ static int flash_read (int fd)
|
||||
@@ -1177,9 +1177,31 @@ static int flash_read (int fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -39,23 +39,24 @@ index 09f06c874b17..e4e242b35bd1 100644
|
|||
static int flash_io (int mode)
|
||||
{
|
||||
int fd_current, fd_target, rc, dev_target;
|
||||
@@ -1250,8 +1271,20 @@ static int flash_io (int mode)
|
||||
+ char *mmcblk = NULL;
|
||||
|
||||
/* dev_current: fd_current, erase_current */
|
||||
fd_current = open (DEVNAME (dev_current), mode);
|
||||
@@ -1209,8 +1231,17 @@ static int flash_io (int mode)
|
||||
fd_target = fd_current;
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * Disable mmcboot protection (set read-write)
|
||||
+ *
|
||||
+ * In a CCIMX6 dev_current and dev_target is the same device so it's ok to
|
||||
+ * just use dev_current here.
|
||||
+ *
|
||||
+ */
|
||||
+ sysfs_mmcboot_set_protection(DEVNAME(dev_current) + 5 /* /dev/ */ , 0);
|
||||
+ /* Disable mmcboot protection if using EMMC (set read-write) */
|
||||
+ mmcblk = strstr(DEVNAME(dev_target), "mmcblk");
|
||||
+ if (mmcblk)
|
||||
+ sysfs_mmcboot_set_protection(mmcblk, 0);
|
||||
+
|
||||
rc = flash_write (fd_current, fd_target, dev_target);
|
||||
|
||||
+ /* Re-enable mmcboot protection (set read-only) */
|
||||
+ sysfs_mmcboot_set_protection(DEVNAME(dev_current) + 5 /* /dev/ */ , 1);
|
||||
+ if (mmcblk)
|
||||
+ sysfs_mmcboot_set_protection(mmcblk, 1);
|
||||
+
|
||||
if (HaveRedundEnv) {
|
||||
if (close (fd_target)) {
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
From: Stefano Babic <sbabic@denx.de>
|
||||
Date: Mon, 22 Jun 2015 14:58:24 +0200
|
||||
Subject: [PATCH] Allow fw env tools to be available as library
|
||||
|
||||
Signed-off-by: Stefano Babic <sbabic@denx.de>
|
||||
---
|
||||
tools/env/Makefile | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tools/env/Makefile b/tools/env/Makefile
|
||||
index de4766ddf8dd..fa2a564bb357 100644
|
||||
--- a/tools/env/Makefile
|
||||
+++ b/tools/env/Makefile
|
||||
@@ -23,10 +23,12 @@ endif
|
||||
always := fw_printenv
|
||||
hostprogs-y := fw_printenv
|
||||
|
||||
-fw_printenv-objs := fw_env.o fw_env_main.o \
|
||||
+lib-y += fw_env.o \
|
||||
crc32.o ctype.o linux_string.o \
|
||||
env_attr.o env_flags.o aes.o ../../lib/md5.o
|
||||
|
||||
+fw_printenv-objs := fw_env_main.o $(lib-y)
|
||||
+
|
||||
quiet_cmd_crosstools_strip = STRIP $^
|
||||
cmd_crosstools_strip = $(STRIP) $^; touch $@
|
||||
|
||||
|
|
@ -1,13 +1,15 @@
|
|||
# Copyright (C) 2015 Digi International
|
||||
# Copyright (C) 2015-2017 Digi International
|
||||
|
||||
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:"
|
||||
|
||||
SRC_URI += " \
|
||||
file://fw_env.config \
|
||||
file://0001-tools-env-implement-support-for-environment-encrypti.patch \
|
||||
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 \
|
||||
"
|
||||
SRC_URI_append = " file://0004-Implement-U-Boot-environment-access-functions.patch"
|
||||
SRC_URI_append_ccimx6 = " file://0002-fw_env-add-support-to-unlock-emmc-boot-partition.patch"
|
||||
|
||||
# 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)
|
||||
|
|
@ -20,7 +22,7 @@ do_install_append() {
|
|||
install -m 0644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/
|
||||
}
|
||||
|
||||
pkg_postinst_${PN}_ccimx6() {
|
||||
pkg_postinst_${PN}() {
|
||||
# run the postinst script on first boot
|
||||
if [ x"$D" != "x" ]; then
|
||||
exit 1
|
||||
|
|
|
|||
Loading…
Reference in New Issue