u-boot-tools: Update to v2020.07 (#2046)
mkimage-fit-Unmmap-the-memory-before-closing-fd-in-fit_import_data.patch is already in the U-Boot v2020.07 release. Hence remove it. Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
@@ -1,26 +1,21 @@
|
||||
# Maintainer: Bin Meng <bmeng.cn@gmail.com>
|
||||
|
||||
pkgname=u-boot-tools
|
||||
pkgver=2020.04
|
||||
pkgrel=3
|
||||
pkgver=2020.07
|
||||
pkgrel=1
|
||||
pkgdesc="U-Boot Tools"
|
||||
arch=('i686' 'x86_64')
|
||||
url="https://github.com/u-boot/u-boot"
|
||||
license=('GPL2')
|
||||
depends=('dtc' 'openssl')
|
||||
makedepends=('unzip' 'openssl-devel')
|
||||
source=("${pkgname}-${pkgver}.zip"::"https://github.com/u-boot/u-boot/archive/v${pkgver}.zip"
|
||||
mkimage-fit-Unmmap-the-memory-before-closing-fd-in-fit_import_data.patch)
|
||||
source=("${pkgname}-${pkgver}.zip"::"https://github.com/u-boot/u-boot/archive/v${pkgver}.zip")
|
||||
noextract=("${pkgname}-${pkgver}.zip")
|
||||
sha256sums=('SKIP'
|
||||
'087dc658adf3bb06988aaefe0b2c8f3613a6d99d0e8b48d6b975bdb7c70aa1c9')
|
||||
sha256sums=('SKIP')
|
||||
|
||||
prepare() {
|
||||
# workaround an issue of bsdtar for extracting symbolic links in the tarball
|
||||
unzip ${srcdir}/${pkgname}-${pkgver}.zip
|
||||
# apply patches
|
||||
cd ${srcdir}/u-boot-${pkgver}
|
||||
patch -p1 -i ${srcdir}/mkimage-fit-Unmmap-the-memory-before-closing-fd-in-fit_import_data.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
|
||||
@@ -1,97 +0,0 @@
|
||||
From 3fc85a782a3d46fcb32bfb93829d2424d696c4d3 Mon Sep 17 00:00:00 2001
|
||||
From: Lihua Zhao <lihua.zhao@windriver.com>
|
||||
Date: Sat, 18 Apr 2020 01:59:10 -0700
|
||||
Subject: [PATCH] mkimage: fit: Unmmap the memory before closing fd in
|
||||
fit_import_data()
|
||||
|
||||
Without calling munmap(), the follow-up call to open() the same file
|
||||
with a flag O_TRUNC seems not to cause any issue on Linux, but it fails
|
||||
on Windows with error like below:
|
||||
|
||||
Can't open kernel_fdt.itb.tmp: Permission denied
|
||||
|
||||
Fix this by unmapping the memory before closing fd in fit_import_data().
|
||||
|
||||
Signed-off-by: Lihua Zhao <lihua.zhao@windriver.com>
|
||||
Signed-off-by: Bin Meng <bin.meng@windriver.com>
|
||||
---
|
||||
tools/fit_image.c | 24 ++++++++++++++----------
|
||||
1 file changed, 14 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/tools/fit_image.c b/tools/fit_image.c
|
||||
index f32ee49..c37cae3 100644
|
||||
--- a/tools/fit_image.c
|
||||
+++ b/tools/fit_image.c
|
||||
@@ -563,21 +563,21 @@ static int fit_import_data(struct image_tool_params *params, const char *fname)
|
||||
fprintf(stderr, "%s: Failed to allocate memory (%d bytes)\n",
|
||||
__func__, size);
|
||||
ret = -ENOMEM;
|
||||
- goto err_has_fd;
|
||||
+ goto err_munmap;
|
||||
}
|
||||
ret = fdt_open_into(old_fdt, fdt, size);
|
||||
if (ret) {
|
||||
debug("%s: Failed to expand FIT: %s\n", __func__,
|
||||
fdt_strerror(errno));
|
||||
ret = -EINVAL;
|
||||
- goto err_has_fd;
|
||||
+ goto err_munmap;
|
||||
}
|
||||
|
||||
images = fdt_path_offset(fdt, FIT_IMAGES_PATH);
|
||||
if (images < 0) {
|
||||
debug("%s: Cannot find /images node: %d\n", __func__, images);
|
||||
ret = -EINVAL;
|
||||
- goto err_has_fd;
|
||||
+ goto err_munmap;
|
||||
}
|
||||
|
||||
for (node = fdt_first_subnode(fdt, images);
|
||||
@@ -598,10 +598,12 @@ static int fit_import_data(struct image_tool_params *params, const char *fname)
|
||||
debug("%s: Failed to write property: %s\n", __func__,
|
||||
fdt_strerror(ret));
|
||||
ret = -EINVAL;
|
||||
- goto err_has_fd;
|
||||
+ goto err_munmap;
|
||||
}
|
||||
}
|
||||
|
||||
+ munmap(old_fdt, sbuf.st_size);
|
||||
+
|
||||
/* Close the old fd so we can re-use it. */
|
||||
close(fd);
|
||||
|
||||
@@ -616,22 +618,24 @@ static int fit_import_data(struct image_tool_params *params, const char *fname)
|
||||
fprintf(stderr, "%s: Can't open %s: %s\n",
|
||||
params->cmdname, fname, strerror(errno));
|
||||
ret = -EIO;
|
||||
- goto err_no_fd;
|
||||
+ goto err;
|
||||
}
|
||||
if (write(fd, fdt, new_size) != new_size) {
|
||||
debug("%s: Failed to write external data to file %s\n",
|
||||
__func__, strerror(errno));
|
||||
ret = -EIO;
|
||||
- goto err_has_fd;
|
||||
+ goto err;
|
||||
}
|
||||
|
||||
- ret = 0;
|
||||
-
|
||||
-err_has_fd:
|
||||
+ free(fdt);
|
||||
close(fd);
|
||||
-err_no_fd:
|
||||
+ return 0;
|
||||
+
|
||||
+err_munmap:
|
||||
munmap(old_fdt, sbuf.st_size);
|
||||
+err:
|
||||
free(fdt);
|
||||
+ close(fd);
|
||||
return ret;
|
||||
}
|
||||
|
||||
--
|
||||
2.7.4
|
||||
|
||||
Reference in New Issue
Block a user