Complete Yocto mirror with license table for TQMa6UL (2038-compliance)
- 264 license table entries with exact download URLs (224/264 resolved) - Complete sources/ directory with all BitBake recipes - Build configuration: tqma6ul-multi-mba6ulx, spaetzle (musl) - Full traceability for Softwarefreigabeantrag - GCC 13.4.0, Linux 6.6.102, U-Boot 2023.04, musl 1.2.4 - License distribution: GPL-2.0 (24), MIT (23), GPL-2.0+ (18), BSD-3 (16)
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
From 3f9deb424ecd6ecd50f165b42f0b0290d83853f5 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Weinberger <richard@nod.at>
|
||||
Date: Fri, 2 Aug 2024 18:36:45 +0200
|
||||
Subject: [PATCH 1/8] squashfs: Fix integer overflow in sqfs_inode_size()
|
||||
|
||||
A carefully crafted squashfs filesystem can exhibit an extremly large
|
||||
inode size and overflow the calculation in sqfs_inode_size().
|
||||
As a consequence, the squashfs driver will read from wrong locations.
|
||||
|
||||
Fix by using __builtin_add_overflow() to detect the overflow.
|
||||
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
|
||||
CVE: CVE-2024-57254
|
||||
Upstream-Status: Backport [https://source.denx.de/u-boot/u-boot/-/commit/c8e929e5758999933f9e905049ef2bf3fe6b140d]
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
fs/squashfs/sqfs_inode.c | 9 +++++++--
|
||||
1 file changed, 7 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/fs/squashfs/sqfs_inode.c b/fs/squashfs/sqfs_inode.c
|
||||
index d25cfb53..bb3ccd37 100644
|
||||
--- a/fs/squashfs/sqfs_inode.c
|
||||
+++ b/fs/squashfs/sqfs_inode.c
|
||||
@@ -78,11 +78,16 @@ int sqfs_inode_size(struct squashfs_base_inode *inode, u32 blk_size)
|
||||
|
||||
case SQFS_SYMLINK_TYPE:
|
||||
case SQFS_LSYMLINK_TYPE: {
|
||||
+ int size;
|
||||
+
|
||||
struct squashfs_symlink_inode *symlink =
|
||||
(struct squashfs_symlink_inode *)inode;
|
||||
|
||||
- return sizeof(*symlink) +
|
||||
- get_unaligned_le32(&symlink->symlink_size);
|
||||
+ if (__builtin_add_overflow(sizeof(*symlink),
|
||||
+ get_unaligned_le32(&symlink->symlink_size), &size))
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return size;
|
||||
}
|
||||
|
||||
case SQFS_BLKDEV_TYPE:
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
From 5d7ca74388544bf8c95e104517a9120e94bfe40d Mon Sep 17 00:00:00 2001
|
||||
From: Richard Weinberger <richard@nod.at>
|
||||
Date: Fri, 2 Aug 2024 18:36:44 +0200
|
||||
Subject: [PATCH 2/8] squashfs: Fix integer overflow in sqfs_resolve_symlink()
|
||||
|
||||
A carefully crafted squashfs filesystem can exhibit an inode size of 0xffffffff,
|
||||
as a consequence malloc() will do a zero allocation.
|
||||
Later in the function the inode size is again used for copying data.
|
||||
So an attacker can overwrite memory.
|
||||
Avoid the overflow by using the __builtin_add_overflow() helper.
|
||||
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
|
||||
CVE: CVE-2024-57255
|
||||
Upstream-Status: Backport [https://source.denx.de/u-boot/u-boot/-/commit/233945eba63e24061dffeeaeb7cd6fe985278356]
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
fs/squashfs/sqfs.c | 10 ++++++----
|
||||
1 file changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
|
||||
index 1430e671..16a07c06 100644
|
||||
--- a/fs/squashfs/sqfs.c
|
||||
+++ b/fs/squashfs/sqfs.c
|
||||
@@ -422,8 +422,10 @@ static char *sqfs_resolve_symlink(struct squashfs_symlink_inode *sym,
|
||||
char *resolved, *target;
|
||||
u32 sz;
|
||||
|
||||
- sz = get_unaligned_le32(&sym->symlink_size);
|
||||
- target = malloc(sz + 1);
|
||||
+ if (__builtin_add_overflow(get_unaligned_le32(&sym->symlink_size), 1, &sz))
|
||||
+ return NULL;
|
||||
+
|
||||
+ target = malloc(sz);
|
||||
if (!target)
|
||||
return NULL;
|
||||
|
||||
@@ -431,9 +433,9 @@ static char *sqfs_resolve_symlink(struct squashfs_symlink_inode *sym,
|
||||
* There is no trailling null byte in the symlink's target path, so a
|
||||
* copy is made and a '\0' is added at its end.
|
||||
*/
|
||||
- target[sz] = '\0';
|
||||
+ target[sz - 1] = '\0';
|
||||
/* Get target name (relative path) */
|
||||
- strncpy(target, sym->symlink, sz);
|
||||
+ strncpy(target, sym->symlink, sz - 1);
|
||||
|
||||
/* Relative -> absolute path conversion */
|
||||
resolved = sqfs_get_abs_path(base_path, target);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
From 49cab731abe7a98db4ac16666e3b5ab3bc799282 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Weinberger <richard@nod.at>
|
||||
Date: Fri, 9 Aug 2024 11:54:28 +0200
|
||||
Subject: [PATCH 3/8] ext4: Fix integer overflow in ext4fs_read_symlink()
|
||||
|
||||
While zalloc() takes a size_t type, adding 1 to the le32 variable
|
||||
will overflow.
|
||||
A carefully crafted ext4 filesystem can exhibit an inode size of 0xffffffff
|
||||
and as consequence zalloc() will do a zero allocation.
|
||||
|
||||
Later in the function the inode size is again used for copying data.
|
||||
So an attacker can overwrite memory.
|
||||
|
||||
Avoid the overflow by using the __builtin_add_overflow() helper.
|
||||
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
|
||||
CVE: CVE-2024-57256
|
||||
Upstream-Status: Backport [https://source.denx.de/u-boot/u-boot/-/commit/35f75d2a46e5859138c83a75cd2f4141c5479ab9]
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
fs/ext4/ext4_common.c | 7 ++++++-
|
||||
1 file changed, 6 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
|
||||
index f50de7c0..a7798296 100644
|
||||
--- a/fs/ext4/ext4_common.c
|
||||
+++ b/fs/ext4/ext4_common.c
|
||||
@@ -2188,13 +2188,18 @@ static char *ext4fs_read_symlink(struct ext2fs_node *node)
|
||||
struct ext2fs_node *diro = node;
|
||||
int status;
|
||||
loff_t actread;
|
||||
+ size_t alloc_size;
|
||||
|
||||
if (!diro->inode_read) {
|
||||
status = ext4fs_read_inode(diro->data, diro->ino, &diro->inode);
|
||||
if (status == 0)
|
||||
return NULL;
|
||||
}
|
||||
- symlink = zalloc(le32_to_cpu(diro->inode.size) + 1);
|
||||
+
|
||||
+ if (__builtin_add_overflow(le32_to_cpu(diro->inode.size), 1, &alloc_size))
|
||||
+ return NULL;
|
||||
+
|
||||
+ symlink = zalloc(alloc_size);
|
||||
if (!symlink)
|
||||
return NULL;
|
||||
|
||||
--
|
||||
2.34.1
|
||||
|
||||
227
sources/poky/meta/recipes-bsp/u-boot/files/CVE-2024-57257.patch
Normal file
227
sources/poky/meta/recipes-bsp/u-boot/files/CVE-2024-57257.patch
Normal file
@@ -0,0 +1,227 @@
|
||||
From 4eb527c473068953f90ea65b33046a25140e0a89 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Weinberger <richard@nod.at>
|
||||
Date: Fri, 2 Aug 2024 18:36:47 +0200
|
||||
Subject: [PATCH 4/8] squashfs: Fix stack overflow while symlink resolving
|
||||
|
||||
The squashfs driver blindly follows symlinks, and calls sqfs_size()
|
||||
recursively. So an attacker can create a crafted filesystem and with
|
||||
a deep enough nesting level a stack overflow can be achieved.
|
||||
|
||||
Fix by limiting the nesting level to 8.
|
||||
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
|
||||
CVE: CVE-2024-57257
|
||||
Upstream-Status: Backport [https://source.denx.de/u-boot/u-boot/-/commit/4f5cc096bfd0a591f8a11e86999e3d90a9484c34]
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
fs/squashfs/sqfs.c | 76 +++++++++++++++++++++++++++++++++++++---------
|
||||
1 file changed, 61 insertions(+), 15 deletions(-)
|
||||
|
||||
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
|
||||
index 16a07c06..a5b7890e 100644
|
||||
--- a/fs/squashfs/sqfs.c
|
||||
+++ b/fs/squashfs/sqfs.c
|
||||
@@ -24,7 +24,12 @@
|
||||
#include "sqfs_filesystem.h"
|
||||
#include "sqfs_utils.h"
|
||||
|
||||
+#define MAX_SYMLINK_NEST 8
|
||||
+
|
||||
static struct squashfs_ctxt ctxt;
|
||||
+static int symlinknest;
|
||||
+
|
||||
+static int sqfs_readdir_nest(struct fs_dir_stream *fs_dirs, struct fs_dirent **dentp);
|
||||
|
||||
static int sqfs_disk_read(__u32 block, __u32 nr_blocks, void *buf)
|
||||
{
|
||||
@@ -508,7 +513,7 @@ static int sqfs_search_dir(struct squashfs_dir_stream *dirs, char **token_list,
|
||||
goto out;
|
||||
}
|
||||
|
||||
- while (!sqfs_readdir(dirsp, &dent)) {
|
||||
+ while (!sqfs_readdir_nest(dirsp, &dent)) {
|
||||
ret = strcmp(dent->name, token_list[j]);
|
||||
if (!ret)
|
||||
break;
|
||||
@@ -533,6 +538,11 @@ static int sqfs_search_dir(struct squashfs_dir_stream *dirs, char **token_list,
|
||||
|
||||
/* Check for symbolic link and inode type sanity */
|
||||
if (get_unaligned_le16(&dir->inode_type) == SQFS_SYMLINK_TYPE) {
|
||||
+ if (++symlinknest == MAX_SYMLINK_NEST) {
|
||||
+ ret = -ELOOP;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
sym = (struct squashfs_symlink_inode *)table;
|
||||
/* Get first j + 1 tokens */
|
||||
path = sqfs_concat_tokens(token_list, j + 1);
|
||||
@@ -880,7 +890,7 @@ out:
|
||||
return metablks_count;
|
||||
}
|
||||
|
||||
-int sqfs_opendir(const char *filename, struct fs_dir_stream **dirsp)
|
||||
+static int sqfs_opendir_nest(const char *filename, struct fs_dir_stream **dirsp)
|
||||
{
|
||||
unsigned char *inode_table = NULL, *dir_table = NULL;
|
||||
int j, token_count = 0, ret = 0, metablks_count;
|
||||
@@ -975,7 +985,19 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
+int sqfs_opendir(const char *filename, struct fs_dir_stream **dirsp)
|
||||
+{
|
||||
+ symlinknest = 0;
|
||||
+ return sqfs_opendir_nest(filename, dirsp);
|
||||
+}
|
||||
+
|
||||
int sqfs_readdir(struct fs_dir_stream *fs_dirs, struct fs_dirent **dentp)
|
||||
+{
|
||||
+ symlinknest = 0;
|
||||
+ return sqfs_readdir_nest(fs_dirs, dentp);
|
||||
+}
|
||||
+
|
||||
+static int sqfs_readdir_nest(struct fs_dir_stream *fs_dirs, struct fs_dirent **dentp)
|
||||
{
|
||||
struct squashfs_super_block *sblk = ctxt.sblk;
|
||||
struct squashfs_dir_stream *dirs;
|
||||
@@ -1319,8 +1341,8 @@ static int sqfs_get_lregfile_info(struct squashfs_lreg_inode *lreg,
|
||||
return datablk_count;
|
||||
}
|
||||
|
||||
-int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
|
||||
- loff_t *actread)
|
||||
+static int sqfs_read_nest(const char *filename, void *buf, loff_t offset,
|
||||
+ loff_t len, loff_t *actread)
|
||||
{
|
||||
char *dir = NULL, *fragment_block, *datablock = NULL;
|
||||
char *fragment = NULL, *file = NULL, *resolved, *data;
|
||||
@@ -1350,11 +1372,11 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
|
||||
}
|
||||
|
||||
/*
|
||||
- * sqfs_opendir will uncompress inode and directory tables, and will
|
||||
+ * sqfs_opendir_nest will uncompress inode and directory tables, and will
|
||||
* return a pointer to the directory that contains the requested file.
|
||||
*/
|
||||
sqfs_split_path(&file, &dir, filename);
|
||||
- ret = sqfs_opendir(dir, &dirsp);
|
||||
+ ret = sqfs_opendir_nest(dir, &dirsp);
|
||||
if (ret) {
|
||||
goto out;
|
||||
}
|
||||
@@ -1362,7 +1384,7 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
|
||||
dirs = (struct squashfs_dir_stream *)dirsp;
|
||||
|
||||
/* For now, only regular files are able to be loaded */
|
||||
- while (!sqfs_readdir(dirsp, &dent)) {
|
||||
+ while (!sqfs_readdir_nest(dirsp, &dent)) {
|
||||
ret = strcmp(dent->name, file);
|
||||
if (!ret)
|
||||
break;
|
||||
@@ -1411,9 +1433,14 @@ int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
|
||||
break;
|
||||
case SQFS_SYMLINK_TYPE:
|
||||
case SQFS_LSYMLINK_TYPE:
|
||||
+ if (++symlinknest == MAX_SYMLINK_NEST) {
|
||||
+ ret = -ELOOP;
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
symlink = (struct squashfs_symlink_inode *)ipos;
|
||||
resolved = sqfs_resolve_symlink(symlink, filename);
|
||||
- ret = sqfs_read(resolved, buf, offset, len, actread);
|
||||
+ ret = sqfs_read_nest(resolved, buf, offset, len, actread);
|
||||
free(resolved);
|
||||
goto out;
|
||||
case SQFS_BLKDEV_TYPE:
|
||||
@@ -1584,7 +1611,14 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
-int sqfs_size(const char *filename, loff_t *size)
|
||||
+int sqfs_read(const char *filename, void *buf, loff_t offset, loff_t len,
|
||||
+ loff_t *actread)
|
||||
+{
|
||||
+ symlinknest = 0;
|
||||
+ return sqfs_read_nest(filename, buf, offset, len, actread);
|
||||
+}
|
||||
+
|
||||
+static int sqfs_size_nest(const char *filename, loff_t *size)
|
||||
{
|
||||
struct squashfs_super_block *sblk = ctxt.sblk;
|
||||
struct squashfs_symlink_inode *symlink;
|
||||
@@ -1600,10 +1634,10 @@ int sqfs_size(const char *filename, loff_t *size)
|
||||
|
||||
sqfs_split_path(&file, &dir, filename);
|
||||
/*
|
||||
- * sqfs_opendir will uncompress inode and directory tables, and will
|
||||
+ * sqfs_opendir_nest will uncompress inode and directory tables, and will
|
||||
* return a pointer to the directory that contains the requested file.
|
||||
*/
|
||||
- ret = sqfs_opendir(dir, &dirsp);
|
||||
+ ret = sqfs_opendir_nest(dir, &dirsp);
|
||||
if (ret) {
|
||||
ret = -EINVAL;
|
||||
goto free_strings;
|
||||
@@ -1611,7 +1645,7 @@ int sqfs_size(const char *filename, loff_t *size)
|
||||
|
||||
dirs = (struct squashfs_dir_stream *)dirsp;
|
||||
|
||||
- while (!sqfs_readdir(dirsp, &dent)) {
|
||||
+ while (!sqfs_readdir_nest(dirsp, &dent)) {
|
||||
ret = strcmp(dent->name, file);
|
||||
if (!ret)
|
||||
break;
|
||||
@@ -1644,6 +1678,11 @@ int sqfs_size(const char *filename, loff_t *size)
|
||||
break;
|
||||
case SQFS_SYMLINK_TYPE:
|
||||
case SQFS_LSYMLINK_TYPE:
|
||||
+ if (++symlinknest == MAX_SYMLINK_NEST) {
|
||||
+ *size = 0;
|
||||
+ return -ELOOP;
|
||||
+ }
|
||||
+
|
||||
symlink = (struct squashfs_symlink_inode *)ipos;
|
||||
resolved = sqfs_resolve_symlink(symlink, filename);
|
||||
ret = sqfs_size(resolved, size);
|
||||
@@ -1683,10 +1722,11 @@ int sqfs_exists(const char *filename)
|
||||
|
||||
sqfs_split_path(&file, &dir, filename);
|
||||
/*
|
||||
- * sqfs_opendir will uncompress inode and directory tables, and will
|
||||
+ * sqfs_opendir_nest will uncompress inode and directory tables, and will
|
||||
* return a pointer to the directory that contains the requested file.
|
||||
*/
|
||||
- ret = sqfs_opendir(dir, &dirsp);
|
||||
+ symlinknest = 0;
|
||||
+ ret = sqfs_opendir_nest(dir, &dirsp);
|
||||
if (ret) {
|
||||
ret = -EINVAL;
|
||||
goto free_strings;
|
||||
@@ -1694,7 +1734,7 @@ int sqfs_exists(const char *filename)
|
||||
|
||||
dirs = (struct squashfs_dir_stream *)dirsp;
|
||||
|
||||
- while (!sqfs_readdir(dirsp, &dent)) {
|
||||
+ while (!sqfs_readdir_nest(dirsp, &dent)) {
|
||||
ret = strcmp(dent->name, file);
|
||||
if (!ret)
|
||||
break;
|
||||
@@ -1711,6 +1751,12 @@ free_strings:
|
||||
return ret == 0;
|
||||
}
|
||||
|
||||
+int sqfs_size(const char *filename, loff_t *size)
|
||||
+{
|
||||
+ symlinknest = 0;
|
||||
+ return sqfs_size_nest(filename, size);
|
||||
+}
|
||||
+
|
||||
void sqfs_close(void)
|
||||
{
|
||||
sqfs_decompressor_cleanup(&ctxt);
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
From 50ab41c3628dedeca1a331dd86dd203b73faea74 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Weinberger <richard@nod.at>
|
||||
Date: Fri, 2 Aug 2024 12:08:45 +0200
|
||||
Subject: [PATCH 5/8] dlmalloc: Fix integer overflow in sbrk()
|
||||
|
||||
Make sure that the new break is within mem_malloc_start
|
||||
and mem_malloc_end before making progress.
|
||||
ulong new = old + increment; can overflow for extremely large
|
||||
increment values and memset() can get wrongly called.
|
||||
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
|
||||
CVE: CVE-2024-57258
|
||||
Upstream-Status: Backport [https://source.denx.de/u-boot/u-boot/-/commit/0a10b49206a29b4aa2f80233a3e53ca0466bb0b3]
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
common/dlmalloc.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
|
||||
index de3f0422..bae2a27c 100644
|
||||
--- a/common/dlmalloc.c
|
||||
+++ b/common/dlmalloc.c
|
||||
@@ -591,6 +591,9 @@ void *sbrk(ptrdiff_t increment)
|
||||
ulong old = mem_malloc_brk;
|
||||
ulong new = old + increment;
|
||||
|
||||
+ if ((new < mem_malloc_start) || (new > mem_malloc_end))
|
||||
+ return (void *)MORECORE_FAILURE;
|
||||
+
|
||||
/*
|
||||
* if we are giving memory back make sure we clear it out since
|
||||
* we set MORECORE_CLEARS to 1
|
||||
@@ -598,9 +601,6 @@ void *sbrk(ptrdiff_t increment)
|
||||
if (increment < 0)
|
||||
memset((void *)new, 0, -increment);
|
||||
|
||||
- if ((new < mem_malloc_start) || (new > mem_malloc_end))
|
||||
- return (void *)MORECORE_FAILURE;
|
||||
-
|
||||
mem_malloc_brk = new;
|
||||
|
||||
return (void *)old;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
From db7c626204f488a802a2e58b7a788b11fde6be7d Mon Sep 17 00:00:00 2001
|
||||
From: Richard Weinberger <richard@nod.at>
|
||||
Date: Fri, 2 Aug 2024 12:08:44 +0200
|
||||
Subject: [PATCH 6/8] dlmalloc: Fix integer overflow in request2size()
|
||||
|
||||
req is of type size_t, casting it to long opens the door
|
||||
for an integer overflow.
|
||||
Values between LONG_MAX - (SIZE_SZ + MALLOC_ALIGN_MASK) - 1 and LONG_MAX
|
||||
cause and overflow such that request2size() returns MINSIZE.
|
||||
|
||||
Fix by removing the cast.
|
||||
The origin of the cast is unclear, it's in u-boot and ppcboot since ever
|
||||
and predates the CVS history.
|
||||
Doug Lea's original dlmalloc implementation also doesn't have it.
|
||||
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
|
||||
CVE: CVE-2024-57258
|
||||
Upstream-Status: Backport [https://source.denx.de/u-boot/u-boot/-/commit/8642b2178d2c4002c99a0b69a845a48f2ae2706f]
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
common/dlmalloc.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
|
||||
index bae2a27c..1ac4ee9f 100644
|
||||
--- a/common/dlmalloc.c
|
||||
+++ b/common/dlmalloc.c
|
||||
@@ -379,8 +379,8 @@ nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
/* pad request bytes into a usable size */
|
||||
|
||||
#define request2size(req) \
|
||||
- (((long)((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) < \
|
||||
- (long)(MINSIZE + MALLOC_ALIGN_MASK)) ? MINSIZE : \
|
||||
+ ((((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) < \
|
||||
+ (MINSIZE + MALLOC_ALIGN_MASK)) ? MINSIZE : \
|
||||
(((req) + (SIZE_SZ + MALLOC_ALIGN_MASK)) & ~(MALLOC_ALIGN_MASK)))
|
||||
|
||||
/* Check if m has acceptable alignment */
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
From 37095a204127b60b5e00c4c5d435d6e48a6a1c51 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Weinberger <richard@nod.at>
|
||||
Date: Fri, 2 Aug 2024 12:08:43 +0200
|
||||
Subject: [PATCH 7/8] x86: Fix ptrdiff_t for x86_64
|
||||
|
||||
sbrk() assumes ptrdiff_t is large enough to enlarge/shrink the heap
|
||||
by LONG_MIN/LONG_MAX.
|
||||
So, use the long type, also to match the rest of the Linux ecosystem.
|
||||
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
Reviewed-by: Simon Glass <sjg@chromium.org>
|
||||
|
||||
CVE: CVE-2024-57258
|
||||
Upstream-Status: Backport [https://source.denx.de/u-boot/u-boot/-/commit/c17b2a05dd50a3ba437e6373093a0d6a359cdee0]
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
arch/x86/include/asm/posix_types.h | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/arch/x86/include/asm/posix_types.h b/arch/x86/include/asm/posix_types.h
|
||||
index dbcea7f4..e1ed9bca 100644
|
||||
--- a/arch/x86/include/asm/posix_types.h
|
||||
+++ b/arch/x86/include/asm/posix_types.h
|
||||
@@ -20,11 +20,12 @@ typedef unsigned short __kernel_gid_t;
|
||||
#if defined(__x86_64__)
|
||||
typedef unsigned long __kernel_size_t;
|
||||
typedef long __kernel_ssize_t;
|
||||
+typedef long __kernel_ptrdiff_t;
|
||||
#else
|
||||
typedef unsigned int __kernel_size_t;
|
||||
typedef int __kernel_ssize_t;
|
||||
-#endif
|
||||
typedef int __kernel_ptrdiff_t;
|
||||
+#endif
|
||||
typedef long __kernel_time_t;
|
||||
typedef long __kernel_suseconds_t;
|
||||
typedef long __kernel_clock_t;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
From 2c08fe306c6cbc60ec4beb434c71e56bb7abb678 Mon Sep 17 00:00:00 2001
|
||||
From: Richard Weinberger <richard@nod.at>
|
||||
Date: Fri, 2 Aug 2024 22:05:09 +0200
|
||||
Subject: [PATCH 8/8] squashfs: Fix heap corruption in sqfs_search_dir()
|
||||
|
||||
res needs to be large enough to store both strings rem and target,
|
||||
plus the path separator and the terminator.
|
||||
Currently the space for the path separator is not accounted, so
|
||||
the heap is corrupted by one byte.
|
||||
|
||||
Signed-off-by: Richard Weinberger <richard@nod.at>
|
||||
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
|
||||
|
||||
CVE: CVE-2024-57259
|
||||
Upstream-Status: Backport [https://source.denx.de/u-boot/u-boot/-/commit/048d795bb5b3d9c5701b4855f5e74bcf6849bf5e]
|
||||
Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
|
||||
---
|
||||
fs/squashfs/sqfs.c | 7 +++++--
|
||||
1 file changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
|
||||
index a5b7890e..1bd9b2a4 100644
|
||||
--- a/fs/squashfs/sqfs.c
|
||||
+++ b/fs/squashfs/sqfs.c
|
||||
@@ -563,8 +563,11 @@ static int sqfs_search_dir(struct squashfs_dir_stream *dirs, char **token_list,
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
- /* Concatenate remaining tokens and symlink's target */
|
||||
- res = malloc(strlen(rem) + strlen(target) + 1);
|
||||
+ /*
|
||||
+ * Concatenate remaining tokens and symlink's target.
|
||||
+ * Allocate enough space for rem, target, '/' and '\0'.
|
||||
+ */
|
||||
+ res = malloc(strlen(rem) + strlen(target) + 2);
|
||||
if (!res) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
26
sources/poky/meta/recipes-bsp/u-boot/libubootenv_0.3.5.bb
Normal file
26
sources/poky/meta/recipes-bsp/u-boot/libubootenv_0.3.5.bb
Normal file
@@ -0,0 +1,26 @@
|
||||
SUMMARY = "U-Boot libraries and tools to access environment"
|
||||
|
||||
DESCRIPTION = "This package contains tools and libraries to read \
|
||||
and modify U-Boot environment. \
|
||||
It provides a hardware-independent replacement for fw_printenv/setenv utilities \
|
||||
provided by U-Boot"
|
||||
|
||||
HOMEPAGE = "https://github.com/sbabic/libubootenv"
|
||||
LICENSE = "LGPL-2.1-or-later"
|
||||
LIC_FILES_CHKSUM = "file://LICENSES/LGPL-2.1-or-later.txt;md5=4fbd65380cdd255951079008b364516c"
|
||||
SECTION = "libs"
|
||||
|
||||
SRC_URI = "git://github.com/sbabic/libubootenv;protocol=https;branch=master"
|
||||
SRCREV = "3f4d15e36ceb58085b08dd13f3f2788e9299877b"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit cmake lib_package
|
||||
|
||||
EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release"
|
||||
|
||||
DEPENDS = "zlib libyaml"
|
||||
PROVIDES += "u-boot-fw-utils"
|
||||
RPROVIDES:${PN}-bin += "u-boot-fw-utils"
|
||||
|
||||
BBCLASSEXTEND = "native"
|
||||
33
sources/poky/meta/recipes-bsp/u-boot/u-boot-common.inc
Normal file
33
sources/poky/meta/recipes-bsp/u-boot/u-boot-common.inc
Normal file
@@ -0,0 +1,33 @@
|
||||
HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome"
|
||||
DESCRIPTION = "U-Boot, a boot loader for Embedded boards based on PowerPC, \
|
||||
ARM, MIPS and several other processors, which can be installed in a boot \
|
||||
ROM and used to initialize and test the hardware or to download and run \
|
||||
application code."
|
||||
SECTION = "bootloaders"
|
||||
DEPENDS += "flex-native bison-native python3-setuptools-native"
|
||||
|
||||
LICENSE = "GPL-2.0-or-later"
|
||||
LIC_FILES_CHKSUM = "file://Licenses/README;md5=2ca5f2c35c8cc335f0a19756634782f1"
|
||||
PE = "1"
|
||||
|
||||
# We use the revision in order to avoid having to fetch it from the
|
||||
# repo during parse
|
||||
SRCREV = "866ca972d6c3cabeaf6dbac431e8e08bb30b3c8e"
|
||||
|
||||
SRC_URI = "git://source.denx.de/u-boot/u-boot.git;protocol=https;branch=master \
|
||||
file://CVE-2024-57254.patch \
|
||||
file://CVE-2024-57255.patch \
|
||||
file://CVE-2024-57256.patch \
|
||||
file://CVE-2024-57257.patch \
|
||||
file://CVE-2024-57258-1.patch \
|
||||
file://CVE-2024-57258-2.patch \
|
||||
file://CVE-2024-57258-3.patch \
|
||||
file://CVE-2024-57259.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
B = "${WORKDIR}/build"
|
||||
|
||||
inherit pkgconfig
|
||||
|
||||
do_configure[cleandirs] = "${B}"
|
||||
52
sources/poky/meta/recipes-bsp/u-boot/u-boot-configure.inc
Normal file
52
sources/poky/meta/recipes-bsp/u-boot/u-boot-configure.inc
Normal file
@@ -0,0 +1,52 @@
|
||||
# This provides the logic for creating the desired u-boot config,
|
||||
# accounting for any *.cfg files added to SRC_URI. It's separated
|
||||
# from u-boot.inc for use by recipes that need u-boot properly
|
||||
# configured but aren't doing a full build of u-boot itself (such as
|
||||
# its companion tools).
|
||||
|
||||
inherit uboot-config cml1
|
||||
|
||||
DEPENDS += "kern-tools-native"
|
||||
|
||||
CONFIGURE_FILES = "${@d.getVar('UBOOT_MACHINE') or '.config'}"
|
||||
|
||||
do_configure () {
|
||||
if [ -n "${UBOOT_CONFIG}" ]; then
|
||||
unset i j
|
||||
for config in ${UBOOT_MACHINE}; do
|
||||
i=$(expr $i + 1);
|
||||
for type in ${UBOOT_CONFIG}; do
|
||||
j=$(expr $j + 1);
|
||||
if [ $j -eq $i ]; then
|
||||
uboot_configure_config $config $type
|
||||
fi
|
||||
done
|
||||
unset j
|
||||
done
|
||||
unset i
|
||||
else
|
||||
uboot_configure
|
||||
fi
|
||||
}
|
||||
|
||||
uboot_configure_config () {
|
||||
config=$1
|
||||
type=$2
|
||||
|
||||
oe_runmake -C ${S} O=${B}/${config} ${config}
|
||||
if [ -n "${@' '.join(find_cfgs(d))}" ]; then
|
||||
merge_config.sh -m -O ${B}/${config} ${B}/${config}/.config ${@" ".join(find_cfgs(d))}
|
||||
oe_runmake -C ${S} O=${B}/${config} oldconfig
|
||||
fi
|
||||
}
|
||||
|
||||
uboot_configure () {
|
||||
if [ -n "${UBOOT_MACHINE}" ]; then
|
||||
oe_runmake -C ${S} O=${B} ${UBOOT_MACHINE}
|
||||
else
|
||||
oe_runmake -C ${S} O=${B} oldconfig
|
||||
fi
|
||||
merge_config.sh -m .config ${@" ".join(find_cfgs(d))}
|
||||
cml1_do_configure
|
||||
}
|
||||
|
||||
90
sources/poky/meta/recipes-bsp/u-boot/u-boot-tools.inc
Normal file
90
sources/poky/meta/recipes-bsp/u-boot/u-boot-tools.inc
Normal file
@@ -0,0 +1,90 @@
|
||||
SUMMARY = "U-Boot bootloader tools"
|
||||
DEPENDS += "gnutls openssl util-linux swig-native"
|
||||
|
||||
inherit python3native
|
||||
export STAGING_INCDIR="${STAGING_INCDIR_NATIVE}"
|
||||
|
||||
PROVIDES = "${MLPREFIX}u-boot-mkimage ${MLPREFIX}u-boot-mkenvimage ${MLPREFIX}u-boot-mkeficapsule"
|
||||
PROVIDES:class-native = "u-boot-mkimage-native u-boot-mkenvimage-native u-boot-mkeficapsule-native"
|
||||
|
||||
PACKAGES += "${PN}-mkimage ${PN}-mkenvimage ${PN}-mkeficapsule"
|
||||
|
||||
# Required for backward compatibility with "u-boot-mkimage-xxx.bb"
|
||||
RPROVIDES:${PN}-mkimage = "u-boot-mkimage"
|
||||
RREPLACES:${PN}-mkimage = "u-boot-mkimage"
|
||||
RCONFLICTS:${PN}-mkimage = "u-boot-mkimage"
|
||||
|
||||
EXTRA_OEMAKE:class-target = 'CROSS_COMPILE="${TARGET_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
|
||||
EXTRA_OEMAKE:class-native = 'CC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
|
||||
EXTRA_OEMAKE:class-nativesdk = 'CROSS_COMPILE="${HOST_PREFIX}" CC="${CC} ${CFLAGS} ${LDFLAGS}" HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}" STRIP=true V=1'
|
||||
|
||||
SED_CONFIG_EFI = '-e "s/CONFIG_EFI_LOADER=.*/# CONFIG_EFI_LOADER is not set/"'
|
||||
SED_CONFIG_EFI:x86 = ''
|
||||
SED_CONFIG_EFI:x86-64 = ''
|
||||
SED_CONFIG_EFI:arm = ''
|
||||
SED_CONFIG_EFI:armeb = ''
|
||||
SED_CONFIG_EFI:aarch64 = ''
|
||||
SED_CONFIG_EFI:loongarch64 = ''
|
||||
|
||||
do_compile () {
|
||||
# Yes, this is crazy. If you build on a system with git < 2.14 from scratch, the tree will
|
||||
# be marked as "dirty" and the version will include "-dirty", leading to a reproducibility problem.
|
||||
# The issue is the inode count for Licnses/README changing due to do_populate_lic hardlinking a
|
||||
# copy of the file. We avoid this by ensuring the index is updated with a "git diff" before the
|
||||
# u-boot machinery tries to determine the version.
|
||||
#
|
||||
# build$ ../git/scripts/setlocalversion ../git
|
||||
# ""
|
||||
# build$ ln ../git/
|
||||
# build$ ln ../git/README ../foo
|
||||
# build$ ../git/scripts/setlocalversion ../git
|
||||
# ""-dirty
|
||||
# (i.e. creating a hardlink dirties the index)
|
||||
cd ${S}; git diff; cd ${B}
|
||||
|
||||
oe_runmake -C ${S} tools-only_defconfig O=${B}
|
||||
|
||||
# Disable CONFIG_CMD_LICENSE, license.h is not used by tools and
|
||||
# generating it requires bin2header tool, which for target build
|
||||
# is built with target tools and thus cannot be executed on host.
|
||||
sed -i -e "s/CONFIG_CMD_LICENSE=.*/# CONFIG_CMD_LICENSE is not set/" ${SED_CONFIG_EFI} ${B}/.config
|
||||
|
||||
oe_runmake -C ${S} cross_tools NO_SDL=1 O=${B}
|
||||
}
|
||||
|
||||
do_install () {
|
||||
install -d ${D}${bindir}
|
||||
|
||||
# mkimage
|
||||
install -m 0755 tools/mkimage ${D}${bindir}/uboot-mkimage
|
||||
ln -sf uboot-mkimage ${D}${bindir}/mkimage
|
||||
|
||||
# mkenvimage
|
||||
install -m 0755 tools/mkenvimage ${D}${bindir}/uboot-mkenvimage
|
||||
ln -sf uboot-mkenvimage ${D}${bindir}/mkenvimage
|
||||
|
||||
# dumpimage
|
||||
install -m 0755 tools/dumpimage ${D}${bindir}/uboot-dumpimage
|
||||
ln -sf uboot-dumpimage ${D}${bindir}/dumpimage
|
||||
|
||||
# fit_check_sign
|
||||
install -m 0755 tools/fit_check_sign ${D}${bindir}/uboot-fit_check_sign
|
||||
ln -sf uboot-fit_check_sign ${D}${bindir}/fit_check_sign
|
||||
|
||||
# mkeficapsule
|
||||
install -m 0755 tools/mkeficapsule ${D}${bindir}/uboot-mkeficapsule
|
||||
ln -sf uboot-mkeficapsule ${D}${bindir}/mkeficapsule
|
||||
}
|
||||
|
||||
ALLOW_EMPTY:${PN} = "1"
|
||||
FILES:${PN} = ""
|
||||
FILES:${PN}-mkimage = "${bindir}/uboot-mkimage ${bindir}/mkimage ${bindir}/uboot-dumpimage ${bindir}/dumpimage ${bindir}/uboot-fit_check_sign ${bindir}/fit_check_sign"
|
||||
FILES:${PN}-mkenvimage = "${bindir}/uboot-mkenvimage ${bindir}/mkenvimage"
|
||||
FILES:${PN}-mkeficapsule = "${bindir}/uboot-mkeficapsule ${bindir}/mkeficapsule"
|
||||
|
||||
RDEPENDS:${PN}-mkimage += "dtc"
|
||||
RDEPENDS:${PN} += "${PN}-mkimage ${PN}-mkenvimage ${PN}-mkeficapsule"
|
||||
RDEPENDS:${PN}:class-native = ""
|
||||
|
||||
BBCLASSEXTEND = "native nativesdk"
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
require u-boot-common.inc
|
||||
require u-boot-tools.inc
|
||||
432
sources/poky/meta/recipes-bsp/u-boot/u-boot.inc
Normal file
432
sources/poky/meta/recipes-bsp/u-boot/u-boot.inc
Normal file
@@ -0,0 +1,432 @@
|
||||
SUMMARY = "Universal Boot Loader for embedded devices"
|
||||
PROVIDES = "virtual/bootloader"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
||||
DEPENDS += "${@bb.utils.contains('UBOOT_ENV_SUFFIX', 'scr', 'u-boot-mkimage-native', '', d)}"
|
||||
|
||||
inherit uboot-config uboot-extlinux-config uboot-sign deploy python3native kernel-arch
|
||||
|
||||
DEPENDS += "swig-native"
|
||||
|
||||
EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${DEBUG_PREFIX_MAP}" V=1'
|
||||
EXTRA_OEMAKE += 'HOSTCC="${BUILD_CC} ${BUILD_CFLAGS} ${BUILD_LDFLAGS}"'
|
||||
EXTRA_OEMAKE += 'STAGING_INCDIR=${STAGING_INCDIR_NATIVE} STAGING_LIBDIR=${STAGING_LIBDIR_NATIVE}'
|
||||
|
||||
PACKAGECONFIG ??= "openssl"
|
||||
# u-boot will compile its own tools during the build, with specific
|
||||
# configurations (aka when CONFIG_FIT_SIGNATURE is enabled) openssl is needed as
|
||||
# a host build dependency.
|
||||
PACKAGECONFIG[openssl] = ",,openssl-native"
|
||||
|
||||
# Allow setting an additional version string that will be picked up by the
|
||||
# u-boot build system and appended to the u-boot version. If the .scmversion
|
||||
# file already exists it will not be overwritten.
|
||||
UBOOT_LOCALVERSION ?= ""
|
||||
|
||||
# Default name of u-boot initial env, but enable individual recipes to change
|
||||
# this value.
|
||||
UBOOT_INITIAL_ENV ?= "${PN}-initial-env"
|
||||
|
||||
require u-boot-configure.inc
|
||||
|
||||
do_savedefconfig() {
|
||||
bbplain "Saving defconfig to:\n${B}/defconfig"
|
||||
oe_runmake -C ${B} savedefconfig
|
||||
}
|
||||
do_savedefconfig[nostamp] = "1"
|
||||
addtask savedefconfig after do_configure
|
||||
UBOOT_ARCH_DIR = "${@'arm' if d.getVar('UBOOT_ARCH').startswith('arm') else d.getVar('UBOOT_ARCH')}"
|
||||
do_compile () {
|
||||
if [ "${@bb.utils.filter('DISTRO_FEATURES', 'ld-is-gold', d)}" ]; then
|
||||
sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' ${S}/config.mk
|
||||
fi
|
||||
|
||||
unset LDFLAGS
|
||||
unset CFLAGS
|
||||
unset CPPFLAGS
|
||||
|
||||
if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
|
||||
then
|
||||
echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion
|
||||
echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion
|
||||
fi
|
||||
|
||||
if [ -n "${UBOOT_CONFIG}" -o -n "${UBOOT_DELTA_CONFIG}" ]
|
||||
then
|
||||
unset i j
|
||||
for config in ${UBOOT_MACHINE}; do
|
||||
i=$(expr $i + 1);
|
||||
for type in ${UBOOT_CONFIG}; do
|
||||
j=$(expr $j + 1);
|
||||
if [ $j -eq $i ]
|
||||
then
|
||||
uboot_compile_config $i $config $type
|
||||
fi
|
||||
done
|
||||
unset j
|
||||
done
|
||||
unset i
|
||||
else
|
||||
uboot_compile
|
||||
fi
|
||||
|
||||
if [ -n "${UBOOT_ENV}" ] && [ "${UBOOT_ENV_SUFFIX}" = "scr" ]
|
||||
then
|
||||
${UBOOT_MKIMAGE} -C none -A ${UBOOT_ARCH} -T script -d ${WORKDIR}/${UBOOT_ENV_SRC} ${WORKDIR}/${UBOOT_ENV_BINARY}
|
||||
fi
|
||||
}
|
||||
|
||||
uboot_compile_config () {
|
||||
i=$1
|
||||
config=$2
|
||||
type=$3
|
||||
|
||||
oe_runmake -C ${S} O=${B}/${config} ${UBOOT_MAKE_TARGET}
|
||||
|
||||
unset k
|
||||
for binary in ${UBOOT_BINARIES}; do
|
||||
k=$(expr $k + 1);
|
||||
if [ $k -eq $i ]; then
|
||||
uboot_compile_config_copy_binary $config $type $binary
|
||||
fi
|
||||
done
|
||||
unset k
|
||||
|
||||
# Generate the uboot-initial-env
|
||||
if [ -n "${UBOOT_INITIAL_ENV}" ]; then
|
||||
oe_runmake -C ${S} O=${B}/${config} u-boot-initial-env
|
||||
cp ${B}/${config}/u-boot-initial-env ${B}/${config}/u-boot-initial-env-${type}
|
||||
fi
|
||||
}
|
||||
|
||||
uboot_compile_config_copy_binary () {
|
||||
config=$1
|
||||
type=$2
|
||||
binary=$3
|
||||
|
||||
cp ${B}/${config}/${binary} ${B}/${config}/${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX}
|
||||
}
|
||||
|
||||
uboot_compile () {
|
||||
oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_TARGET}
|
||||
|
||||
# Generate the uboot-initial-env
|
||||
if [ -n "${UBOOT_INITIAL_ENV}" ]; then
|
||||
oe_runmake -C ${S} O=${B} u-boot-initial-env
|
||||
fi
|
||||
}
|
||||
|
||||
do_install () {
|
||||
if [ -n "${UBOOT_CONFIG}" ]
|
||||
then
|
||||
for config in ${UBOOT_MACHINE}; do
|
||||
i=$(expr $i + 1);
|
||||
for type in ${UBOOT_CONFIG}; do
|
||||
j=$(expr $j + 1);
|
||||
if [ $j -eq $i ]
|
||||
then
|
||||
uboot_install_config $config $type
|
||||
fi
|
||||
done
|
||||
unset j
|
||||
done
|
||||
unset i
|
||||
else
|
||||
uboot_install
|
||||
fi
|
||||
|
||||
if [ -n "${UBOOT_ELF}" ]
|
||||
then
|
||||
if [ -n "${UBOOT_CONFIG}" ]
|
||||
then
|
||||
for config in ${UBOOT_MACHINE}; do
|
||||
i=$(expr $i + 1);
|
||||
for type in ${UBOOT_CONFIG}; do
|
||||
j=$(expr $j + 1);
|
||||
if [ $j -eq $i ]
|
||||
then
|
||||
uboot_install_elf_config $config $type
|
||||
fi
|
||||
done
|
||||
unset j
|
||||
done
|
||||
unset i
|
||||
else
|
||||
uboot_install_elf
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -e ${WORKDIR}/fw_env.config ] ; then
|
||||
install -d ${D}${sysconfdir}
|
||||
install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config
|
||||
fi
|
||||
|
||||
if [ -n "${SPL_BINARY}" ]
|
||||
then
|
||||
if [ -n "${UBOOT_CONFIG}" ]
|
||||
then
|
||||
for config in ${UBOOT_MACHINE}; do
|
||||
i=$(expr $i + 1);
|
||||
for type in ${UBOOT_CONFIG}; do
|
||||
j=$(expr $j + 1);
|
||||
if [ $j -eq $i ]
|
||||
then
|
||||
uboot_install_spl_config $config $type
|
||||
fi
|
||||
done
|
||||
unset j
|
||||
done
|
||||
unset i
|
||||
else
|
||||
uboot_install_spl
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${UBOOT_ENV}" ]
|
||||
then
|
||||
install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${D}/boot/${UBOOT_ENV_IMAGE}
|
||||
ln -sf ${UBOOT_ENV_IMAGE} ${D}/boot/${UBOOT_ENV_BINARY}
|
||||
fi
|
||||
|
||||
if [ "${UBOOT_EXTLINUX}" = "1" ]
|
||||
then
|
||||
install -Dm 0644 ${UBOOT_EXTLINUX_CONFIG} ${D}/${UBOOT_EXTLINUX_INSTALL_DIR}/${UBOOT_EXTLINUX_CONF_NAME}
|
||||
fi
|
||||
}
|
||||
|
||||
uboot_install_config () {
|
||||
config=$1
|
||||
type=$2
|
||||
|
||||
install -D -m 644 ${B}/${config}/${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARYNAME}-${type}-${UBOOT_VERSION}.${UBOOT_SUFFIX}
|
||||
ln -sf ${UBOOT_BINARYNAME}-${type}-${UBOOT_VERSION}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
|
||||
ln -sf ${UBOOT_BINARYNAME}-${type}-${UBOOT_VERSION}.${UBOOT_SUFFIX} ${D}/boot/${UBOOT_BINARY}
|
||||
|
||||
# Install the uboot-initial-env
|
||||
if [ -n "${UBOOT_INITIAL_ENV}" ]; then
|
||||
install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${UBOOT_VERSION}
|
||||
ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${UBOOT_VERSION} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
|
||||
ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${UBOOT_VERSION} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${type}
|
||||
ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${UBOOT_VERSION} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
|
||||
fi
|
||||
}
|
||||
|
||||
uboot_install () {
|
||||
install -D -m 644 ${B}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE}
|
||||
ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY}
|
||||
|
||||
# Install the uboot-initial-env
|
||||
if [ -n "${UBOOT_INITIAL_ENV}" ]; then
|
||||
install -D -m 644 ${B}/u-boot-initial-env ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}-${UBOOT_VERSION}
|
||||
ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${UBOOT_VERSION} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}-${MACHINE}
|
||||
ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${UBOOT_VERSION} ${D}/${sysconfdir}/${UBOOT_INITIAL_ENV}
|
||||
fi
|
||||
}
|
||||
|
||||
uboot_install_elf_config () {
|
||||
config=$1
|
||||
type=$2
|
||||
|
||||
install -m 644 ${B}/${config}/${UBOOT_ELF} ${D}/boot/u-boot-${type}-${UBOOT_VERSION}.${UBOOT_ELF_SUFFIX}
|
||||
ln -sf u-boot-${type}-${UBOOT_VERSION}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}-${type}
|
||||
ln -sf u-boot-${type}-${UBOOT_VERSION}.${UBOOT_ELF_SUFFIX} ${D}/boot/${UBOOT_BINARY}
|
||||
}
|
||||
|
||||
uboot_install_elf () {
|
||||
install -m 644 ${B}/${UBOOT_ELF} ${D}/boot/${UBOOT_ELF_IMAGE}
|
||||
ln -sf ${UBOOT_ELF_IMAGE} ${D}/boot/${UBOOT_ELF_BINARY}
|
||||
}
|
||||
|
||||
uboot_install_spl_config () {
|
||||
config=$1
|
||||
type=$2
|
||||
|
||||
install -m 644 ${B}/${config}/${SPL_BINARY} ${D}/boot/${SPL_BINARYNAME}-${type}-${UBOOT_VERSION}${SPL_DELIMITER}${SPL_SUFFIX}
|
||||
ln -sf ${SPL_BINARYNAME}-${type}-${UBOOT_VERSION}${SPL_DELIMITER}${SPL_SUFFIX} ${D}/boot/${SPL_BINARYFILE}-${type}
|
||||
ln -sf ${SPL_BINARYNAME}-${type}-${UBOOT_VERSION}${SPL_DELIMITER}${SPL_SUFFIX} ${D}/boot/${SPL_BINARYFILE}
|
||||
}
|
||||
|
||||
uboot_install_spl () {
|
||||
install -m 644 ${B}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE}
|
||||
ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARYFILE}
|
||||
}
|
||||
|
||||
PACKAGE_BEFORE_PN += "${PN}-env ${PN}-extlinux"
|
||||
|
||||
RPROVIDES:${PN}-env += "u-boot-default-env"
|
||||
ALLOW_EMPTY:${PN}-env = "1"
|
||||
FILES:${PN}-env = " \
|
||||
${@ '${sysconfdir}/${UBOOT_INITIAL_ENV}*' if d.getVar('UBOOT_INITIAL_ENV') else ''} \
|
||||
${sysconfdir}/fw_env.config \
|
||||
"
|
||||
|
||||
FILES:${PN}-extlinux = "${UBOOT_EXTLINUX_INSTALL_DIR}/${UBOOT_EXTLINUX_CONF_NAME}"
|
||||
RDEPENDS:${PN} += "${@bb.utils.contains('UBOOT_EXTLINUX', '1', '${PN}-extlinux', '', d)}"
|
||||
|
||||
SYSROOT_DIRS += "/boot"
|
||||
FILES:${PN} = "/boot ${datadir}"
|
||||
RDEPENDS:${PN} += "${PN}-env"
|
||||
|
||||
do_deploy () {
|
||||
if [ -n "${UBOOT_CONFIG}" ]
|
||||
then
|
||||
for config in ${UBOOT_MACHINE}; do
|
||||
i=$(expr $i + 1);
|
||||
for type in ${UBOOT_CONFIG}; do
|
||||
j=$(expr $j + 1);
|
||||
if [ $j -eq $i ]
|
||||
then
|
||||
uboot_deploy_config $config $type
|
||||
fi
|
||||
done
|
||||
unset j
|
||||
done
|
||||
unset i
|
||||
else
|
||||
uboot_deploy
|
||||
fi
|
||||
|
||||
if [ -e ${WORKDIR}/fw_env.config ] ; then
|
||||
install -D -m 644 ${WORKDIR}/fw_env.config ${DEPLOYDIR}/fw_env.config-${MACHINE}-${UBOOT_VERSION}
|
||||
cd ${DEPLOYDIR}
|
||||
ln -sf fw_env.config-${MACHINE}-${UBOOT_VERSION} fw_env.config-${MACHINE}
|
||||
ln -sf fw_env.config-${MACHINE}-${UBOOT_VERSION} fw_env.config
|
||||
fi
|
||||
|
||||
if [ -n "${UBOOT_ELF}" ]
|
||||
then
|
||||
if [ -n "${UBOOT_CONFIG}" ]
|
||||
then
|
||||
for config in ${UBOOT_MACHINE}; do
|
||||
i=$(expr $i + 1);
|
||||
for type in ${UBOOT_CONFIG}; do
|
||||
j=$(expr $j + 1);
|
||||
if [ $j -eq $i ]
|
||||
then
|
||||
uboot_deploy_elf_config $config $type
|
||||
fi
|
||||
done
|
||||
unset j
|
||||
done
|
||||
unset i
|
||||
else
|
||||
uboot_deploy_elf
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ -n "${SPL_BINARY}" ]
|
||||
then
|
||||
if [ -n "${UBOOT_CONFIG}" ]
|
||||
then
|
||||
for config in ${UBOOT_MACHINE}; do
|
||||
i=$(expr $i + 1);
|
||||
for type in ${UBOOT_CONFIG}; do
|
||||
j=$(expr $j + 1);
|
||||
if [ $j -eq $i ]
|
||||
then
|
||||
uboot_deploy_spl_config $config $type
|
||||
fi
|
||||
done
|
||||
unset j
|
||||
done
|
||||
unset i
|
||||
else
|
||||
uboot_deploy_spl
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${UBOOT_ENV}" ]
|
||||
then
|
||||
install -m 644 ${WORKDIR}/${UBOOT_ENV_BINARY} ${DEPLOYDIR}/${UBOOT_ENV_IMAGE}
|
||||
ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_BINARY}
|
||||
ln -sf ${UBOOT_ENV_IMAGE} ${DEPLOYDIR}/${UBOOT_ENV_SYMLINK}
|
||||
fi
|
||||
|
||||
if [ "${UBOOT_EXTLINUX}" = "1" ]
|
||||
then
|
||||
install -m 644 ${UBOOT_EXTLINUX_CONFIG} ${DEPLOYDIR}/${UBOOT_EXTLINUX_SYMLINK}
|
||||
ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME}-${MACHINE}
|
||||
ln -sf ${UBOOT_EXTLINUX_SYMLINK} ${DEPLOYDIR}/${UBOOT_EXTLINUX_CONF_NAME}
|
||||
fi
|
||||
|
||||
if [ -n "${UBOOT_DTB}" ]
|
||||
then
|
||||
install -m 644 ${B}/arch/${UBOOT_ARCH_DIR}/dts/${UBOOT_DTB_BINARY} ${DEPLOYDIR}/
|
||||
fi
|
||||
}
|
||||
|
||||
uboot_deploy_config () {
|
||||
config=$1
|
||||
type=$2
|
||||
|
||||
install -D -m 644 ${B}/${config}/${UBOOT_BINARYNAME}-${type}.${UBOOT_SUFFIX} ${DEPLOYDIR}/${UBOOT_BINARYNAME}-${type}-${UBOOT_VERSION}.${UBOOT_SUFFIX}
|
||||
cd ${DEPLOYDIR}
|
||||
ln -sf ${UBOOT_BINARYNAME}-${type}-${UBOOT_VERSION}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}-${type}
|
||||
ln -sf ${UBOOT_BINARYNAME}-${type}-${UBOOT_VERSION}.${UBOOT_SUFFIX} ${UBOOT_SYMLINK}
|
||||
ln -sf ${UBOOT_BINARYNAME}-${type}-${UBOOT_VERSION}.${UBOOT_SUFFIX} ${UBOOT_BINARY}-${type}
|
||||
ln -sf ${UBOOT_BINARYNAME}-${type}-${UBOOT_VERSION}.${UBOOT_SUFFIX} ${UBOOT_BINARY}
|
||||
|
||||
# Deploy the uboot-initial-env
|
||||
if [ -n "${UBOOT_INITIAL_ENV}" ]; then
|
||||
install -D -m 644 ${B}/${config}/u-boot-initial-env-${type} ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${UBOOT_VERSION}
|
||||
cd ${DEPLOYDIR}
|
||||
ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${UBOOT_VERSION} ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}
|
||||
ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${type}-${UBOOT_VERSION} ${UBOOT_INITIAL_ENV}-${type}
|
||||
fi
|
||||
}
|
||||
|
||||
uboot_deploy () {
|
||||
install -D -m 644 ${B}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE}
|
||||
|
||||
cd ${DEPLOYDIR}
|
||||
rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK}
|
||||
ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK}
|
||||
ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY}
|
||||
|
||||
# Deploy the uboot-initial-env
|
||||
if [ -n "${UBOOT_INITIAL_ENV}" ]; then
|
||||
install -D -m 644 ${B}/u-boot-initial-env ${DEPLOYDIR}/${UBOOT_INITIAL_ENV}-${MACHINE}-${UBOOT_VERSION}
|
||||
cd ${DEPLOYDIR}
|
||||
ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${UBOOT_VERSION} ${UBOOT_INITIAL_ENV}-${MACHINE}
|
||||
ln -sf ${UBOOT_INITIAL_ENV}-${MACHINE}-${UBOOT_VERSION} ${UBOOT_INITIAL_ENV}
|
||||
fi
|
||||
}
|
||||
|
||||
uboot_deploy_elf_config () {
|
||||
config=$1
|
||||
type=$2
|
||||
|
||||
install -m 644 ${B}/${config}/${UBOOT_ELF} ${DEPLOYDIR}/u-boot-${type}-${UBOOT_VERSION}.${UBOOT_ELF_SUFFIX}
|
||||
ln -sf u-boot-${type}-${UBOOT_VERSION}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}-${type}
|
||||
ln -sf u-boot-${type}-${UBOOT_VERSION}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
|
||||
ln -sf u-boot-${type}-${UBOOT_VERSION}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}-${type}
|
||||
ln -sf u-boot-${type}-${UBOOT_VERSION}.${UBOOT_ELF_SUFFIX} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
|
||||
}
|
||||
|
||||
uboot_deploy_elf () {
|
||||
install -m 644 ${B}/${UBOOT_ELF} ${DEPLOYDIR}/${UBOOT_ELF_IMAGE}
|
||||
ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_BINARY}
|
||||
ln -sf ${UBOOT_ELF_IMAGE} ${DEPLOYDIR}/${UBOOT_ELF_SYMLINK}
|
||||
}
|
||||
|
||||
uboot_deploy_spl_config () {
|
||||
config=$1
|
||||
type=$2
|
||||
|
||||
install -m 644 ${B}/${config}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_BINARYNAME}-${type}-${UBOOT_VERSION}${SPL_DELIMITER}${SPL_SUFFIX}
|
||||
rm -f ${DEPLOYDIR}/${SPL_BINARYFILE} ${DEPLOYDIR}/${SPL_SYMLINK}
|
||||
ln -sf ${SPL_BINARYNAME}-${type}-${UBOOT_VERSION}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_BINARYFILE}-${type}
|
||||
ln -sf ${SPL_BINARYNAME}-${type}-${UBOOT_VERSION}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_BINARYFILE}
|
||||
ln -sf ${SPL_BINARYNAME}-${type}-${UBOOT_VERSION}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_SYMLINK}-${type}
|
||||
ln -sf ${SPL_BINARYNAME}-${type}-${UBOOT_VERSION}${SPL_DELIMITER}${SPL_SUFFIX} ${DEPLOYDIR}/${SPL_SYMLINK}
|
||||
}
|
||||
|
||||
uboot_deploy_spl () {
|
||||
install -m 644 ${B}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE}
|
||||
ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARYNAME}
|
||||
ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK}
|
||||
}
|
||||
|
||||
addtask deploy before do_build after do_compile
|
||||
5
sources/poky/meta/recipes-bsp/u-boot/u-boot_2024.01.bb
Normal file
5
sources/poky/meta/recipes-bsp/u-boot/u-boot_2024.01.bb
Normal file
@@ -0,0 +1,5 @@
|
||||
require u-boot-common.inc
|
||||
require u-boot.inc
|
||||
|
||||
DEPENDS += "bc-native dtc-native python3-pyelftools-native"
|
||||
|
||||
Reference in New Issue
Block a user