From 60f12e924c75094be9c546bfb24155dde9d79d40 Mon Sep 17 00:00:00 2001
From: Igor Zalatov <flyrouter@gmail.com>
Date: Thu, 22 Apr 2021 16:03:36 +0300
Subject: [PATCH] Update SigmaStar

---
 br-ext-chip-sigmastar/Config.in               |   7 ++
 .../unknown_unknown_ssc313e_unknown/config    |  10 ++
 .../kernel/.gitkeep                           |   0
 .../unknown_unknown_ssc335_unknown/config     |  10 ++
 .../kernel/.gitkeep                           |   0
 .../unknown_unknown_ssc313e_openipc_defconfig |   6 +
 .../unknown_unknown_ssc335_openipc_defconfig  |   6 +
 br-ext-chip-sigmastar/external.mk             |   8 ++
 .../0001-drop-configh-from-tools.patch        |  49 ++++++++
 ...-tools-only-in-no-dot-config-targets.patch |  42 +++++++
 .../0003-drop-autoconf.h-from-tools.patch     |  36 ++++++
 ...0004-tools-env-fw_env.h-remove-env.h.patch |  52 ++++++++
 .../0011-env-partition-autosearch.patch       | 114 ++++++++++++++++++
 .../package/fwprintenv-ng/Config.in           |  13 ++
 .../package/fwprintenv-ng/fwprintenv-ng.mk    |  39 ++++++
 .../package/libevent-mini/Config.in           |   6 +
 .../package/libevent-mini/libevent-mini.mk    |  26 ++++
 .../package/sigmastar_patcher/Config.in       |   3 +
 .../package/sigmastar_patcher/apply.sh        |  44 +++++++
 .../sigmastar_patcher/sigmastar_patcher.mk    |  13 ++
 20 files changed, 484 insertions(+)
 create mode 100644 br-ext-chip-sigmastar/Config.in
 create mode 100644 br-ext-chip-sigmastar/board/unknown_unknown_ssc313e_unknown/config
 create mode 100644 br-ext-chip-sigmastar/board/unknown_unknown_ssc313e_unknown/kernel/.gitkeep
 create mode 100644 br-ext-chip-sigmastar/board/unknown_unknown_ssc335_unknown/config
 create mode 100644 br-ext-chip-sigmastar/board/unknown_unknown_ssc335_unknown/kernel/.gitkeep
 create mode 100644 br-ext-chip-sigmastar/configs/unknown_unknown_ssc313e_openipc_defconfig
 create mode 100644 br-ext-chip-sigmastar/configs/unknown_unknown_ssc335_openipc_defconfig
 create mode 100644 br-ext-chip-sigmastar/external.mk
 create mode 100644 br-ext-chip-sigmastar/package/fwprintenv-ng/0001-drop-configh-from-tools.patch
 create mode 100644 br-ext-chip-sigmastar/package/fwprintenv-ng/0002-tools-only-in-no-dot-config-targets.patch
 create mode 100644 br-ext-chip-sigmastar/package/fwprintenv-ng/0003-drop-autoconf.h-from-tools.patch
 create mode 100644 br-ext-chip-sigmastar/package/fwprintenv-ng/0004-tools-env-fw_env.h-remove-env.h.patch
 create mode 100644 br-ext-chip-sigmastar/package/fwprintenv-ng/0011-env-partition-autosearch.patch
 create mode 100644 br-ext-chip-sigmastar/package/fwprintenv-ng/Config.in
 create mode 100644 br-ext-chip-sigmastar/package/fwprintenv-ng/fwprintenv-ng.mk
 create mode 100644 br-ext-chip-sigmastar/package/libevent-mini/Config.in
 create mode 100644 br-ext-chip-sigmastar/package/libevent-mini/libevent-mini.mk
 create mode 100644 br-ext-chip-sigmastar/package/sigmastar_patcher/Config.in
 create mode 100755 br-ext-chip-sigmastar/package/sigmastar_patcher/apply.sh
 create mode 100644 br-ext-chip-sigmastar/package/sigmastar_patcher/sigmastar_patcher.mk

diff --git a/br-ext-chip-sigmastar/Config.in b/br-ext-chip-sigmastar/Config.in
new file mode 100644
index 00000000..244848a1
--- /dev/null
+++ b/br-ext-chip-sigmastar/Config.in
@@ -0,0 +1,7 @@
+source "$BR2_EXTERNAL_SIGMASTAR_PATH/linux/Config.ext.in"
+source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/sigmastar_patcher/Config.in"
+source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/sigmastar-osdrv-ssc335/Config.in"
+source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/fwprintenv-ng/Config.in"
+source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/ipctool/Config.in"
+source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/majestic/Config.in"
+source "$BR2_EXTERNAL_SIGMASTAR_PATH/package/libevent-mini/Config.in"
diff --git a/br-ext-chip-sigmastar/board/unknown_unknown_ssc313e_unknown/config b/br-ext-chip-sigmastar/board/unknown_unknown_ssc313e_unknown/config
new file mode 100644
index 00000000..f12c3b04
--- /dev/null
+++ b/br-ext-chip-sigmastar/board/unknown_unknown_ssc313e_unknown/config
@@ -0,0 +1,10 @@
+VENDOR=unknown
+MODEL=unknown
+FAMILY=infinity3
+CHIP=ssc313e
+RAM_SIZE=128M
+RAM_LINUX_SIZE=64M
+RAM_MPP_SIZE=64M
+ROM_SIZE=?
+CMOS=unknown
+UBOOT_SIZE=?
diff --git a/br-ext-chip-sigmastar/board/unknown_unknown_ssc313e_unknown/kernel/.gitkeep b/br-ext-chip-sigmastar/board/unknown_unknown_ssc313e_unknown/kernel/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/br-ext-chip-sigmastar/board/unknown_unknown_ssc335_unknown/config b/br-ext-chip-sigmastar/board/unknown_unknown_ssc335_unknown/config
new file mode 100644
index 00000000..f76ee09e
--- /dev/null
+++ b/br-ext-chip-sigmastar/board/unknown_unknown_ssc335_unknown/config
@@ -0,0 +1,10 @@
+VENDOR=unknown
+MODEL=unknown
+FAMILY=infinity6b0
+CHIP=ssc335
+RAM_SIZE=128M
+RAM_LINUX_SIZE=64M
+RAM_MPP_SIZE=64M
+ROM_SIZE=?
+CMOS=unknown
+UBOOT_SIZE=?
diff --git a/br-ext-chip-sigmastar/board/unknown_unknown_ssc335_unknown/kernel/.gitkeep b/br-ext-chip-sigmastar/board/unknown_unknown_ssc335_unknown/kernel/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/br-ext-chip-sigmastar/configs/unknown_unknown_ssc313e_openipc_defconfig b/br-ext-chip-sigmastar/configs/unknown_unknown_ssc313e_openipc_defconfig
new file mode 100644
index 00000000..f0a420e3
--- /dev/null
+++ b/br-ext-chip-sigmastar/configs/unknown_unknown_ssc313e_openipc_defconfig
@@ -0,0 +1,6 @@
+
+# OpenIPC configuration
+BR2_TOOLCHAIN_BUILDROOT_VENDOR="openipc"
+BR2_TARGET_GENERIC_ISSUE="Welcome to OpenIPC v21.04.22.1"
+BR2_TARGET_GENERIC_HOSTNAME="ipcam"
+BR2_GLOBAL_PATCH_DIR="$(TOPDIR)/../general/package/patches"
diff --git a/br-ext-chip-sigmastar/configs/unknown_unknown_ssc335_openipc_defconfig b/br-ext-chip-sigmastar/configs/unknown_unknown_ssc335_openipc_defconfig
new file mode 100644
index 00000000..f0a420e3
--- /dev/null
+++ b/br-ext-chip-sigmastar/configs/unknown_unknown_ssc335_openipc_defconfig
@@ -0,0 +1,6 @@
+
+# OpenIPC configuration
+BR2_TOOLCHAIN_BUILDROOT_VENDOR="openipc"
+BR2_TARGET_GENERIC_ISSUE="Welcome to OpenIPC v21.04.22.1"
+BR2_TARGET_GENERIC_HOSTNAME="ipcam"
+BR2_GLOBAL_PATCH_DIR="$(TOPDIR)/../general/package/patches"
diff --git a/br-ext-chip-sigmastar/external.mk b/br-ext-chip-sigmastar/external.mk
new file mode 100644
index 00000000..f459600c
--- /dev/null
+++ b/br-ext-chip-sigmastar/external.mk
@@ -0,0 +1,8 @@
+include $(BR2_EXTERNAL_SIGMASTAR_PATH)/linux/linux-ext-sigmastar_patcher.mk
+include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/sigmastar_patcher/sigmastar_patcher.mk
+include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/sigmastar-osdrv-xm530/sigmastar-osdrv-ssc335.mk
+include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/fwprintenv-ng/fwprintenv-ng.mk
+include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/ipctool/ipctool.mk
+include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/libevent-mini/libevent-mini.mk
+include $(BR2_EXTERNAL_SIGMASTAR_PATH)/package/majestic/majestic.mk
+
diff --git a/br-ext-chip-sigmastar/package/fwprintenv-ng/0001-drop-configh-from-tools.patch b/br-ext-chip-sigmastar/package/fwprintenv-ng/0001-drop-configh-from-tools.patch
new file mode 100644
index 00000000..59e5686e
--- /dev/null
+++ b/br-ext-chip-sigmastar/package/fwprintenv-ng/0001-drop-configh-from-tools.patch
@@ -0,0 +1,49 @@
+From ab8b54cfc9d3fddba297c343a2d8dea9dbe20017 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
+Date: Tue, 4 Aug 2015 22:13:20 +0200
+Subject: [PATCH] drop configh from tools
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+We need to build u-boot tools without a board configuration for the target.
+fw_env just uses config.h to define the default environment of the created
+image, so it really isn't mandatory.
+
+Signed-off-by: Gustavo Zacarias <gustavo@zacarias.com.ar>
+[Jörg Krause: update for version 2015.07]
+Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
+[Romain: update for version 2017.05
+    after commit 9d80b49a671c9922931adcd823aab0ed319a42d1]
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+[Pierre-Jean: update for version 2019.04]
+Signed-off-by: Pierre-Jean Texier <pjtexier@koncepto.io>
+---
+ tools/env/fw_env_private.h | 11 -----------
+ 1 file changed, 11 deletions(-)
+
+diff --git a/tools/env/fw_env_private.h b/tools/env/fw_env_private.h
+index 86be16d..3c62ac4 100644
+--- a/tools/env/fw_env_private.h
++++ b/tools/env/fw_env_private.h
+@@ -4,17 +4,6 @@
+  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+  */
+ 
+-/* Pull in the current config to define the default environment */
+-#include <linux/kconfig.h>
+-
+-#ifndef __ASSEMBLY__
+-#define __ASSEMBLY__ /* get only #defines from config.h */
+-#include <config.h>
+-#undef	__ASSEMBLY__
+-#else
+-#include <config.h>
+-#endif
+-
+ /*
+  * To build the utility with the static configuration
+  * comment out the next line.
+-- 
+2.9.4
+
diff --git a/br-ext-chip-sigmastar/package/fwprintenv-ng/0002-tools-only-in-no-dot-config-targets.patch b/br-ext-chip-sigmastar/package/fwprintenv-ng/0002-tools-only-in-no-dot-config-targets.patch
new file mode 100644
index 00000000..a376afbc
--- /dev/null
+++ b/br-ext-chip-sigmastar/package/fwprintenv-ng/0002-tools-only-in-no-dot-config-targets.patch
@@ -0,0 +1,42 @@
+From 460646b3c4c1718860915c38586ee8d2fbda38e4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
+Date: Sun, 1 Feb 2015 21:53:47 +0100
+Subject: [PATCH] tools only in no dot config targets
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Revert upstream commit c7ad5cbb1ef2c33883f0fa7d0455095004fd306d:
+
+    Makefile: drop "tools-only" from no-dot-config-targets
+
+This indirectly pulls in a build-dependency on libssl-dev used for FIT
+image support, and possibly GPL/OpenSSL licensing incompatibility
+issues.
+
+Based on Debian patch from u-boot-tools:
+http://ftp.de.debian.org/debian/pool/main/u/u-boot/u-boot_2014.10+dfsg1-2.1.debian.tar.xz
+
+Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
+[fabio: adapt it to 2016.09]
+Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
+---
+ Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 6aa08964ff..fcec83d183 100644
+--- a/Makefile
++++ b/Makefile
+@@ -486,7 +486,7 @@ defaultenv_h := include/generated/defaultenv_autogenerated.h
+ 
+ no-dot-config-targets := clean clobber mrproper distclean \
+ 			 help %docs check% coccicheck \
+-			 ubootversion backup tests check qcheck
++			 ubootversion backup tests tools-only check qcheck
+ 
+ config-targets := 0
+ mixed-targets  := 0
+-- 
+2.20.1
+
diff --git a/br-ext-chip-sigmastar/package/fwprintenv-ng/0003-drop-autoconf.h-from-tools.patch b/br-ext-chip-sigmastar/package/fwprintenv-ng/0003-drop-autoconf.h-from-tools.patch
new file mode 100644
index 00000000..09ee40be
--- /dev/null
+++ b/br-ext-chip-sigmastar/package/fwprintenv-ng/0003-drop-autoconf.h-from-tools.patch
@@ -0,0 +1,36 @@
+From 0552a8ffdfbb9807fcef4498011907caa5de2ace Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Krause?= <joerg.krause@embedded.rocks>
+Date: Thu, 9 Jan 2020 15:11:32 +0100
+Subject: [PATCH] drop autoconf.h from tools
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+We need to build u-boot tools without a board configuration for the target.
+
+imximage uses the DCD address from Kconfig to display this information
+to the user. The default value for all i.MX platforms is 0x00910000,
+except for i.MX7ULP, which has a DCD address of 0x2f010000.
+
+The default value printed before version 2020.01 was 0x00910000.
+
+Signed-off-by: Jörg Krause <joerg.krause@embedded.rocks>
+---
+ tools/imximage.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/tools/imximage.c b/tools/imximage.c
+index d7edd3c52f..f8d21fa06a 100644
+--- a/tools/imximage.c
++++ b/tools/imximage.c
+@@ -11,7 +11,6 @@
+ #include "imagetool.h"
+ #include <image.h>
+ #include "imximage.h"
+-#include <generated/autoconf.h>
+ 
+ #define UNDEFINED 0xFFFFFFFF
+ 
+-- 
+2.25.0
+
diff --git a/br-ext-chip-sigmastar/package/fwprintenv-ng/0004-tools-env-fw_env.h-remove-env.h.patch b/br-ext-chip-sigmastar/package/fwprintenv-ng/0004-tools-env-fw_env.h-remove-env.h.patch
new file mode 100644
index 00000000..f5d9c2b2
--- /dev/null
+++ b/br-ext-chip-sigmastar/package/fwprintenv-ng/0004-tools-env-fw_env.h-remove-env.h.patch
@@ -0,0 +1,52 @@
+From 664ef61e19d6261d8984493b5f22127ec2ad44fc Mon Sep 17 00:00:00 2001
+From: Romain Naour <romain.naour@gmail.com>
+Date: Sun, 10 May 2020 23:15:32 +0200
+Subject: [PATCH] tools/env/fw_env.h: remove env.h
+
+As reported by Nicolas Carrier on the Buildroot mailing list [1],
+there is a new build issue while building a program which interacts with
+the u-boot environment. This program uses the headers of the ubootenv
+library provided by uboot-tools.
+
+This is an upstream change from uboot [2] adding "#include <env.h>" to
+fw_env.h. Adding env.h require a board configuration to build.
+
+But only fw_env.h header is installed in the staging directory by
+uboot-tools package, but since it now include env.h the build is broken
+because env.h is missing from the staging directory.
+
+It's seems an upstream bug since env_set() is not used in fw_env tool.
+
+Adding env.h is an error since it also include compiler.h (and others
+uboot internal includes).
+
+Nicolas removed env.h from fw_env tool and fixed it's build issue.
+
+This problem is present since uboot v2019.10, so the uboot version
+present in Buildroot 2020.02 is affected.
+
+[1] http://lists.busybox.net/pipermail/buildroot/2020-April/280307.html
+[2] https://gitlab.denx.de/u-boot/u-boot/-/commit/9fb625ce05539fe6876a59ce1dcadb76b33c6f6e
+
+Reported-by: Nicolas Carrier <nicolas.carrier@orolia.com>
+Signed-off-by: Romain Naour <romain.naour@gmail.com>
+Upstream: https://gitlab.denx.de/u-boot/u-boot/-/commit/2aca8804d8d5f84d2d661e76e8d232c5c12445b5
+---
+ tools/env/fw_env.h | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/tools/env/fw_env.h b/tools/env/fw_env.h
+index b60fbfc8f8..78c803c944 100644
+--- a/tools/env/fw_env.h
++++ b/tools/env/fw_env.h
+@@ -4,7 +4,6 @@
+  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+  */
+ 
+-#include <env.h>
+ #include <stdint.h>
+ 
+ /*
+-- 
+2.25.4
+
diff --git a/br-ext-chip-sigmastar/package/fwprintenv-ng/0011-env-partition-autosearch.patch b/br-ext-chip-sigmastar/package/fwprintenv-ng/0011-env-partition-autosearch.patch
new file mode 100644
index 00000000..3c801c6f
--- /dev/null
+++ b/br-ext-chip-sigmastar/package/fwprintenv-ng/0011-env-partition-autosearch.patch
@@ -0,0 +1,114 @@
+diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
+index 2a61a5d6f0..6398e29c38 100644
+--- a/tools/env/fw_env.c
++++ b/tools/env/fw_env.c
+@@ -484,7 +484,8 @@ int fw_printenv(int argc, char *argv[], int value_only, struct env_opts *opts)
+ 
+ 		val = fw_getenv(name);
+ 		if (!val) {
+-			fprintf(stderr, "## Error: \"%s\" not defined\n", name);
++			if (!value_only)
++				fprintf(stderr, "## Error: \"%s\" not defined\n", name);
+ 			rc = -1;
+ 			continue;
+ 		}
+@@ -1725,6 +1726,88 @@ static int check_device_config(int dev)
+ 	return rc;
+ }
+ 
++#define CRC_SZ 4
++// Assume env only size of 64Kb
++#define ENV_LEN 0x10000
++
++// Detect U-Boot environment area offset
++int uboot_detect_env(void *buf, size_t len) {
++	// Jump over memory by step
++	int scan_step = ENV_LEN;
++	int res = -1;
++
++	for (int baddr = 0; baddr < len; baddr += scan_step) {
++		uint32_t expected_crc = *(int *)(buf + baddr);
++		uint32_t crc = crc32(0, buf + baddr + CRC_SZ, ENV_LEN - CRC_SZ);
++		if (crc == expected_crc) {
++			res = baddr;
++			break;
++		}
++	}
++
++	return res;
++}
++
++char *open_mtdblock(int i, int *fd, uint32_t size, int flags) {
++	char filename[PATH_MAX];
++
++	snprintf(filename, sizeof filename, "/dev/mtdblock%d", i);
++	*fd = open(filename, O_RDONLY);
++	if (*fd == -1) {
++		return NULL;
++	}
++
++	char *addr =
++		(char *)mmap(NULL, size, PROT_READ, MAP_PRIVATE | flags, *fd, 0);
++	if ((void *)addr == MAP_FAILED) {
++		close(*fd);
++		return NULL;
++	}
++
++	return addr;
++}
++
++static char dev[80];
++static void detect_env() {
++	FILE *fp;
++	char name[80];
++	int i, es, ee;
++	struct mtd_info_user mtd;
++
++	if ((fp = fopen("/proc/mtd", "r"))) {
++		bool running = true;
++		while (fgets(dev, sizeof dev, fp) && running) {
++			name[0] = 0;
++			if (sscanf(dev, "mtd%d: %x %x \"%64[^\"]\"", &i, &es, &ee, name)) {
++				snprintf(dev, sizeof dev, "/dev/mtd%d", i);
++				int devfd = open(dev, O_RDWR);
++				if (devfd < 0)
++					continue;
++
++				if (ioctl(devfd, MEMGETINFO, &mtd) >= 0) {
++					int blockfd;
++					char *addr = open_mtdblock(
++								i, &blockfd, mtd.size, MAP_POPULATE /* causes read-ahead on the file */);
++					if (!addr)
++						return;
++					int off = uboot_detect_env(addr, mtd.size);
++					close(blockfd);
++					if (off != -1) {
++						DEVNAME(0) = dev;
++						DEVOFFSET(0) = off;
++						ENVSIZE(0) = ENV_LEN;
++						DEVESIZE(0) = mtd.erasesize;
++						ENVSECTORS(0) = 1;
++						break;
++					}
++				}
++				close(devfd);
++			}
++		}
++		fclose(fp);
++	}
++}
++
+ static int parse_config(struct env_opts *opts)
+ {
+ 	int rc;
+@@ -1735,9 +1818,7 @@ static int parse_config(struct env_opts *opts)
+ #if defined(CONFIG_FILE)
+ 	/* Fills in DEVNAME(), ENVSIZE(), DEVESIZE(). Or don't. */
+ 	if (get_config(opts->config_file)) {
+-		fprintf(stderr, "Cannot parse config file '%s': %m\n",
+-			opts->config_file);
+-		return -1;
++		detect_env();
+ 	}
+ #else
+ 	DEVNAME(0) = DEVICE1_NAME;
diff --git a/br-ext-chip-sigmastar/package/fwprintenv-ng/Config.in b/br-ext-chip-sigmastar/package/fwprintenv-ng/Config.in
new file mode 100644
index 00000000..78fcb911
--- /dev/null
+++ b/br-ext-chip-sigmastar/package/fwprintenv-ng/Config.in
@@ -0,0 +1,13 @@
+config BR2_PACKAGE_FWPRINTENV_NG
+	bool "fwprintenv-ng from u-boot tools"
+	default y
+	help
+	  Install the fw_printenv / fw_setenv tools on the target system
+
+	  The fw_printenv and fw_setenv tools from Das U-Boot
+	  bootloader, which allows access to the U-Boot environment
+	  from Linux.
+
+	  U-Boot tools - companion tools for Das U-Boot bootloader.
+
+	  http://www.denx.de/wiki/U-Boot/WebHome
diff --git a/br-ext-chip-sigmastar/package/fwprintenv-ng/fwprintenv-ng.mk b/br-ext-chip-sigmastar/package/fwprintenv-ng/fwprintenv-ng.mk
new file mode 100644
index 00000000..e98a8f28
--- /dev/null
+++ b/br-ext-chip-sigmastar/package/fwprintenv-ng/fwprintenv-ng.mk
@@ -0,0 +1,39 @@
+################################################################################
+#
+# fwprintenv-ng
+#
+################################################################################
+
+FWPRINTENV_NG_VERSION = 2020.04
+FWPRINTENV_NG_SOURCE = u-boot-$(FWPRINTENV_NG_VERSION).tar.bz2
+FWPRINTENV_NG_SITE = ftp://ftp.denx.de/pub/u-boot
+FWPRINTENV_NG_LICENSE = GPL-2.0+
+FWPRINTENV_NG_LICENSE_FILES = Licenses/gpl-2.0.txt
+FWPRINTENV_NG_CPE_ID_VENDOR = denx
+FWPRINTENV_NG_CPE_ID_PRODUCT = u-boot
+FWPRINTENV_NG_INSTALL_STAGING = YES
+
+define FWPRINTENV_NG_CONFIGURE_CMDS
+	mkdir -p $(@D)/include/config
+	touch $(@D)/include/config/auto.conf
+endef
+
+FWPRINTENV_NG_MAKE_OPTS = CROSS_COMPILE="$(TARGET_CROSS)" \
+	CFLAGS="$(TARGET_CFLAGS)" \
+	LDFLAGS="$(TARGET_LDFLAGS)" \
+	HOSTCFLAGS="$(HOST_CFLAGS)" \
+	STRIP=$(TARGET_STRIP)
+
+define FWPRINTENV_NG_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(BR2_MAKE) -C $(@D) $(FWPRINTENV_NG_MAKE_OPTS) \
+		CROSS_BUILD_TOOLS=y tools-only
+	$(TARGET_MAKE_ENV) $(BR2_MAKE) -C $(@D) $(UBOOT_TOOLS_MAKE_OPTS) \
+		envtools no-dot-config-targets=envtools
+endef
+
+define FWPRINTENV_NG_INSTALL_TARGET_CMDS
+	$(INSTALL) -m 0755 -D $(@D)/tools/env/fw_printenv $(TARGET_DIR)/usr/sbin/fw_printenv
+	ln -sf fw_printenv $(TARGET_DIR)/usr/sbin/fw_setenv
+endef
+
+$(eval $(generic-package))
diff --git a/br-ext-chip-sigmastar/package/libevent-mini/Config.in b/br-ext-chip-sigmastar/package/libevent-mini/Config.in
new file mode 100644
index 00000000..4a2c122c
--- /dev/null
+++ b/br-ext-chip-sigmastar/package/libevent-mini/Config.in
@@ -0,0 +1,6 @@
+config BR2_PACKAGE_LIBEVENT_MINI
+	bool "libevent-mini"
+	help
+	  Userspace library for handling asynchronous notifications (mini)
+
+	  http://libevent.org
diff --git a/br-ext-chip-sigmastar/package/libevent-mini/libevent-mini.mk b/br-ext-chip-sigmastar/package/libevent-mini/libevent-mini.mk
new file mode 100644
index 00000000..f185200c
--- /dev/null
+++ b/br-ext-chip-sigmastar/package/libevent-mini/libevent-mini.mk
@@ -0,0 +1,26 @@
+################################################################################
+#
+# libevent-mini
+#
+################################################################################
+
+LIBEVENT_MINI_VERSION = 2.1.12
+LIBEVENT_MINI_SITE = https://github.com/libevent/libevent/releases/download/release-$(LIBEVENT_MINI_VERSION)-stable
+LIBEVENT_MINI_SOURCE = libevent-$(LIBEVENT_MINI_VERSION)-stable.tar.gz
+LIBEVENT_MINI_INSTALL_STAGING = YES
+LIBEVENT_MINI_LICENSE = BSD-3-Clause, OpenBSD
+LIBEVENT_MINI_LICENSE_FILES = LICENSE
+LIBEVENT_MINI_CONF_OPTS = \
+	--disable-thread-support \
+	--disable-debug-mode \
+	--disable-largefile \
+	--disable-libevent-regress \
+	--disable-samples \
+	--disable-openssl
+
+define LIBEVENT_MINI_REMOVE_PYSCRIPT
+	rm $(TARGET_DIR)/usr/bin/event_rpcgen.py
+endef
+
+$(eval $(autotools-package))
+$(eval $(host-autotools-package))
diff --git a/br-ext-chip-sigmastar/package/sigmastar_patcher/Config.in b/br-ext-chip-sigmastar/package/sigmastar_patcher/Config.in
new file mode 100644
index 00000000..af8d8e8f
--- /dev/null
+++ b/br-ext-chip-sigmastar/package/sigmastar_patcher/Config.in
@@ -0,0 +1,3 @@
+
+config BR2_PACKAGE_SIGMASTAR_PATCHER
+	bool
diff --git a/br-ext-chip-sigmastar/package/sigmastar_patcher/apply.sh b/br-ext-chip-sigmastar/package/sigmastar_patcher/apply.sh
new file mode 100755
index 00000000..d497544d
--- /dev/null
+++ b/br-ext-chip-sigmastar/package/sigmastar_patcher/apply.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+
+function log() {
+    echo "--- $@"
+}
+
+function apply_patch() {
+    DST=$1
+    SRC=$2
+
+    if [[ -d $SRC ]]; then
+        if [[ ${SRC:${#SRC}-1} != '/' ]]; then
+            log Apply \"$SRC\" as overlay directory
+            cp -r $SRC/* $DST/
+        else
+            log Apply \"$SRC\" as patches directory
+            for P in $SRC/*.patch; do
+                patch -d $DST -p1 < $P
+            done
+        fi
+    else
+        log Apply \"$SRC\" as single patch
+        patch -d $DST -p1 < $SRC
+    fi
+}
+
+function apply_patches() {
+    log Gonna apply "$@"
+    while [[ $# -ge 1 ]]; do
+        apply_patch $DST $1
+        shift
+    done
+}
+
+DST=$1
+shift
+
+if [ -f $DST/.sigmastar-patched ]; then
+    log Patched already
+    exit
+fi
+
+apply_patches $@
+touch $DST/.sigmastar-patched
diff --git a/br-ext-chip-sigmastar/package/sigmastar_patcher/sigmastar_patcher.mk b/br-ext-chip-sigmastar/package/sigmastar_patcher/sigmastar_patcher.mk
new file mode 100644
index 00000000..28629ec9
--- /dev/null
+++ b/br-ext-chip-sigmastar/package/sigmastar_patcher/sigmastar_patcher.mk
@@ -0,0 +1,13 @@
+################################################################################
+#
+# sigmastar_patcher
+#
+################################################################################
+
+SIGMASTAR_PATCHER_VERSION = 0.1
+SIGMASTAR_PATCHER_INSTALL_TARGET = NO
+SIGMASTAR_PATCHER_INSTALL_STAGING = NO
+SIGMASTAR_PATCHER_SITE =
+SIGMASTAR_PATCHER_SOURCE =
+
+$(eval $(generic-package))