1
0
Fork 0
mirror of https://gitlab.postmarketos.org/postmarketOS/pmaports.git synced 2025-07-13 00:29:49 +03:00

main/dtbtool-exynos: fix unreliable behaviour

Hopefully these can be merged in the repo we track, but let's add them
to pmaports in the meanwhile.

Fixes issue where allocated, but non-set memory is used, which gives
unpredictable behaviour.

Part-of: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/6746
[ci:skip-build]: already built successfully in CI
This commit is contained in:
Henrik Grimler 2025-06-30 17:53:36 +02:00 committed by Oliver Smith
parent 6eb947d2e0
commit 481e494cdc
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
11 changed files with 689 additions and 3 deletions

View file

@ -0,0 +1,33 @@
From 3131795b676e3e533f521449fa4f09d71573df20 Mon Sep 17 00:00:00 2001
From: Henrik Grimler <henrik@grimler.se>
Date: Mon, 30 Jun 2025 16:12:15 +0200
Subject: [PATCH] Makefile: do not add libfdt.so to OBJ_FILES
In clean target we remove obj files, and we should not remove system
libraries. Instead add -lfdt to link to the library.
---
Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index e548cb39c4d7..9f2a841ba7c8 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,11 @@
-OBJ_FILES := dtbtool-exynos.o /usr/lib/libfdt.so
+OBJ_FILES := dtbtool-exynos.o
CFLAGS := -O2 -fomit-frame-pointer -Wall
all: dtbTool-exynos
dtbTool-exynos: $(OBJ_FILES)
- $(CC) $(CFLAGS) -o $@ $^
+ $(CC) $(CFLAGS) -o $@ $^ -lfdt
strip $@
clean:
- rm -f $(OBJ_FILES)
+ rm -f dtbTool-exynos $(OBJ_FILES)
--
2.50.0

View file

@ -0,0 +1,26 @@
From 0143ed5c784df0baf69f1aee6a3ba0fb45457de6 Mon Sep 17 00:00:00 2001
From: Henrik Grimler <henrik@grimler.se>
Date: Thu, 3 Jul 2025 18:58:22 +0200
Subject: [PATCH] Makefile: do not strip the produced binary
Typically distro packagers will handle this. For local builds it might
be benefical to still have the debug symbols.
---
Makefile | 1 -
1 file changed, 1 deletion(-)
diff --git a/Makefile b/Makefile
index 9f2a841ba7c8..55c726bb232f 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,6 @@ all: dtbTool-exynos
dtbTool-exynos: $(OBJ_FILES)
$(CC) $(CFLAGS) -o $@ $^ -lfdt
- strip $@
clean:
rm -f dtbTool-exynos $(OBJ_FILES)
--
2.50.0

View file

@ -0,0 +1,75 @@
From 26e8af6741db48c7add3ac2f8cd2d05827702024 Mon Sep 17 00:00:00 2001
From: Henrik Grimler <henrik@grimler.se>
Date: Mon, 30 Jun 2025 16:05:34 +0200
Subject: [PATCH] dtbtool-exynos: convert all space indentation to tabs
---
dtbtool-exynos.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/dtbtool-exynos.c b/dtbtool-exynos.c
index 30fd8a1c2491..0e40e4036846 100644
--- a/dtbtool-exynos.c
+++ b/dtbtool-exynos.c
@@ -129,16 +129,16 @@ static void *scan_dtb_path(char **dtb_files, const char *dtb_path)
if (files < 0)
error("failed to open '%s': %s", dtb_path, strerror(errno));
-
- printf("%s","List of files:\n############################################");
+
+ printf("%s","List of files:\n############################################");
for (f = 0, i = 0; f < files; f++) {
- printf("%s",de[f]->d_name);
-
+ printf("%s",de[f]->d_name);
+
namlen = strlen(de[f]->d_name);
if (namlen < 4 || strcmp(&de[f]->d_name[namlen - 4], ".dtb")) {
- printf("%s"," : skipped");
+ printf("%s"," : skipped");
goto next_f;
- }
+ }
/* skip over already allocated file names */
for (; dtb_files[i]; i++)
@@ -153,7 +153,7 @@ static void *scan_dtb_path(char **dtb_files, const char *dtb_path)
snprintf(dtb_files[i], namlen, "%s/%s", dtb_path, de[f]->d_name);
next_f:
free(de[f]);
- printf("%s\n","");
+ printf("%s\n","");
}
printf("%s\n","End list of files\n#######################################");
@@ -385,16 +385,16 @@ int main(int argc, char **argv)
read_val;
dt_subtype_code = strtoul(val, 0, 16);
} else if (*arg != '-') {
- /* skip over already allocated file names */
- for (; dtb_files[dt_count]; dt_count++) {
- if (dt_count >= DTB_MAX) {
- fail("reached dtb file limit (%d)", DTB_MAX);
- }
- }
- dtb_files[dt_count] = strdup(arg);
- if (!dtb_files[dt_count]) {
- fail("failed to allocate memory");
- }
+ /* skip over already allocated file names */
+ for (; dtb_files[dt_count]; dt_count++) {
+ if (dt_count >= DTB_MAX) {
+ fail("reached dtb file limit (%d)", DTB_MAX);
+ }
+ }
+ dtb_files[dt_count] = strdup(arg);
+ if (!dtb_files[dt_count]) {
+ fail("failed to allocate memory");
+ }
} else
usage();
}
--
2.50.0

View file

@ -0,0 +1,46 @@
From 129bdc748223beb81a5cc516077909671a86e192 Mon Sep 17 00:00:00 2001
From: Henrik Grimler <henrik@grimler.se>
Date: Mon, 30 Jun 2025 16:33:47 +0200
Subject: [PATCH] scan_dtb_path: be less verbose when scanning directories
And add spaces between each printf arg.
---
dtbtool-exynos.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/dtbtool-exynos.c b/dtbtool-exynos.c
index 0e40e4036846..017f6d3bc408 100644
--- a/dtbtool-exynos.c
+++ b/dtbtool-exynos.c
@@ -129,14 +129,13 @@ static void *scan_dtb_path(char **dtb_files, const char *dtb_path)
if (files < 0)
error("failed to open '%s': %s", dtb_path, strerror(errno));
-
- printf("%s","List of files:\n############################################");
+ printf("Scanning directory %s...\n", dtb_path);
for (f = 0, i = 0; f < files; f++) {
- printf("%s",de[f]->d_name);
+ printf("%s", de[f]->d_name);
namlen = strlen(de[f]->d_name);
if (namlen < 4 || strcmp(&de[f]->d_name[namlen - 4], ".dtb")) {
- printf("%s"," : skipped");
+ printf("%s", " : skipped");
goto next_f;
}
@@ -153,9 +152,8 @@ static void *scan_dtb_path(char **dtb_files, const char *dtb_path)
snprintf(dtb_files[i], namlen, "%s/%s", dtb_path, de[f]->d_name);
next_f:
free(de[f]);
- printf("%s\n","");
+ printf("%s\n", "");
}
- printf("%s\n","End list of files\n#######################################");
return 0;
}
--
2.50.0

View file

@ -0,0 +1,25 @@
From 09df703183035495012a3af494243d37b8f93b31 Mon Sep 17 00:00:00 2001
From: Henrik Grimler <henrik@grimler.se>
Date: Mon, 30 Jun 2025 16:36:08 +0200
Subject: [PATCH] scan_dtb_path: free struct from scandir
To not leak memory.
---
dtbtool-exynos.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dtbtool-exynos.c b/dtbtool-exynos.c
index 017f6d3bc408..9bc10e1ce94b 100644
--- a/dtbtool-exynos.c
+++ b/dtbtool-exynos.c
@@ -154,6 +154,7 @@ next_f:
free(de[f]);
printf("%s\n", "");
}
+ free(de);
return 0;
}
--
2.50.0

View file

@ -0,0 +1,32 @@
From 57cee5fd7352f5db17eab51e7b26054327b7126c Mon Sep 17 00:00:00 2001
From: Henrik Grimler <henrik@grimler.se>
Date: Mon, 30 Jun 2025 16:28:00 +0200
Subject: [PATCH] dtbtool-exynos: zero allocated dtb_files memory
To check if an element of dtb_files is already allocated, we later
use:
if (dtb_files[i]) { ... }
If memory has not been zero'ed then this check might or might not
succeed, as we have no idea what garbage values are inside the memory.
---
dtbtool-exynos.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dtbtool-exynos.c b/dtbtool-exynos.c
index 9bc10e1ce94b..806b00f8f62e 100644
--- a/dtbtool-exynos.c
+++ b/dtbtool-exynos.c
@@ -357,6 +357,8 @@ int main(int argc, char **argv)
dtb_files = malloc(sizeof(char*) * DTB_MAX);
if (!dtb_files)
error("failed to allocate memory");
+ else
+ memset(dtb_files, 0, sizeof(char*) * DTB_MAX);
while (argc > 0) {
argc--;
--
2.50.0

View file

@ -0,0 +1,168 @@
From cc35004fb1b81cf0fe4381d6b83c2e656b00fc47 Mon Sep 17 00:00:00 2001
From: Henrik Grimler <henrik@grimler.se>
Date: Mon, 30 Jun 2025 16:36:04 +0200
Subject: [PATCH] dtbtool-exynos: allocate memory for dtbs as needed
Before, we allocated memory for 100 dtbs and started assigning found
dtbs to the list. We can save some memory if we instead re-allocate
memory on every valid dtb.
---
dtbtool-exynos.c | 79 ++++++++++++++++++++++++++++--------------------
1 file changed, 46 insertions(+), 33 deletions(-)
diff --git a/dtbtool-exynos.c b/dtbtool-exynos.c
index 806b00f8f62e..46437c17c4eb 100644
--- a/dtbtool-exynos.c
+++ b/dtbtool-exynos.c
@@ -119,18 +119,20 @@ oops:
return 0;
}
-static void *scan_dtb_path(char **dtb_files, const char *dtb_path)
+static void scan_dtb_path(char ***dtb_files_ptr, int *dtb_count_ptr, const char *dtb_path)
{
struct dirent **de;
- int i, f, files, namlen;
+ int f, files, namlen;
const int dlen = strlen(dtb_path);
+ char **dtb_files = *dtb_files_ptr;
+ int dtb_count = *dtb_count_ptr;
files = scandir(dtb_path, &de, NULL, alphasort);
if (files < 0)
error("failed to open '%s': %s", dtb_path, strerror(errno));
printf("Scanning directory %s...\n", dtb_path);
- for (f = 0, i = 0; f < files; f++) {
+ for (f = 0; f < files; f++) {
printf("%s", de[f]->d_name);
namlen = strlen(de[f]->d_name);
@@ -139,29 +141,55 @@ static void *scan_dtb_path(char **dtb_files, const char *dtb_path)
goto next_f;
}
- /* skip over already allocated file names */
- for (; dtb_files[i]; i++)
- if (i >= DTB_MAX)
- fail("reached dtb file limit (%d)", DTB_MAX);
+ char **new_files = realloc(dtb_files, sizeof(char*) * (dtb_count + 2));
+ if (!new_files)
+ fail("failed to allocate memory");
+ dtb_files = new_files;
namlen += dlen + 2; /* / and NULL terminator */
- dtb_files[i] = calloc(namlen, sizeof(char));
- if (!dtb_files[i])
+ dtb_files[dtb_count] = calloc(namlen, sizeof(char));
+ if (!dtb_files[dtb_count])
fail("failed to allocate memory");
- snprintf(dtb_files[i], namlen, "%s/%s", dtb_path, de[f]->d_name);
+ snprintf(dtb_files[dtb_count], namlen, "%s/%s", dtb_path, de[f]->d_name);
+ dtb_count++;
+ dtb_files[dtb_count] = NULL;
+
next_f:
free(de[f]);
printf("%s\n", "");
}
free(de);
- return 0;
+ *dtb_files_ptr = dtb_files;
+ *dtb_count_ptr = dtb_count;
+}
+
+void add_dtb_file(char ***dtb_files_ptr, int *dtb_count_ptr, const char *filename) {
+ char **dtb_files = *dtb_files_ptr;
+ int dtb_count = *dtb_count_ptr;
+
+ if (dtb_count >= DTB_MAX) {
+ fail("reached dtb file limit (%d)", DTB_MAX);
+ }
+ char **new_files = realloc(dtb_files, sizeof(char*) * (dtb_count + 2));
+ if (!new_files)
+ fail("failed to allocate memory");
+ dtb_files = new_files;
+
+ dtb_files[dtb_count] = strdup(filename);
+ if (!dtb_files[dtb_count])
+ fail("failed to allocate memory");
+ dtb_count++;
+ dtb_files[dtb_count] = NULL;
+
+ *dtb_files_ptr = dtb_files;
+ *dtb_count_ptr = dtb_count;
}
static void *load_dtbh_block(char **dtb_files, unsigned pagesize,
- uint32_t platform_code, uint32_t subtype_code,
- unsigned *_sz)
+ uint32_t platform_code, uint32_t subtype_code,
+ unsigned *_sz)
{
const unsigned pagemask = pagesize - 1;
struct dt_entry *new_entries;
@@ -347,19 +375,13 @@ int main(int argc, char **argv)
char *arg, *val;
char *dt_img = 0;
void *dt_data = 0;
- char **dtb_files = 0;
+ char **dtb_files = NULL;
int fd, dt_count = 0;
unsigned pagesize = DTBH_PAGE_SIZE_DEF;
uint32_t dt_platform_code = DTBH_PLATFORM_CODE_DEF;
uint32_t dt_subtype_code = DTBH_SUBTYPE_CODE_DEF;
unsigned dt_size;
- dtb_files = malloc(sizeof(char*) * DTB_MAX);
- if (!dtb_files)
- error("failed to allocate memory");
- else
- memset(dtb_files, 0, sizeof(char*) * DTB_MAX);
-
while (argc > 0) {
argc--;
argv++;
@@ -375,7 +397,7 @@ int main(int argc, char **argv)
fail("unsupported page size %d\n", pagesize);
} else if (!strcmp(arg, "--dtb") || !strcmp(arg, "-d")) {
read_val;
- scan_dtb_path(dtb_files, val);
+ scan_dtb_path(&dtb_files, &dt_count, val);
} else if (!strcmp(arg, "--output") || !strcmp(arg, "-o")) {
read_val;
dt_img = val;
@@ -385,17 +407,8 @@ int main(int argc, char **argv)
} else if (!strcmp(arg, "--subtype")) {
read_val;
dt_subtype_code = strtoul(val, 0, 16);
- } else if (*arg != '-') {
- /* skip over already allocated file names */
- for (; dtb_files[dt_count]; dt_count++) {
- if (dt_count >= DTB_MAX) {
- fail("reached dtb file limit (%d)", DTB_MAX);
- }
- }
- dtb_files[dt_count] = strdup(arg);
- if (!dtb_files[dt_count]) {
- fail("failed to allocate memory");
- }
+ } else if (arg[0] != '-') {
+ add_dtb_file(&dtb_files, &dt_count, arg);
} else
usage();
}
@@ -405,7 +418,7 @@ int main(int argc, char **argv)
usage();
}
- if (!dtb_files[0])
+ if (dt_count == 0)
fail("no dtb files found");
dt_data = load_dtbh_block(dtb_files, pagesize, dt_platform_code, dt_subtype_code, &dt_size);
--
2.50.0

View file

@ -0,0 +1,37 @@
From 952fc6a1b5f2781b1077f84e5efdb0fd308cf09d Mon Sep 17 00:00:00 2001
From: Henrik Grimler <henrik@grimler.se>
Date: Mon, 30 Jun 2025 16:46:08 +0200
Subject: [PATCH] dtbtool-exynos: remove fail goto
It is only called in one place, so it is not necessary.
---
dtbtool-exynos.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dtbtool-exynos.c b/dtbtool-exynos.c
index 46437c17c4eb..2164aae18159 100644
--- a/dtbtool-exynos.c
+++ b/dtbtool-exynos.c
@@ -429,14 +429,14 @@ int main(int argc, char **argv)
if (fd < 0)
fail("could not create output file '%s': %s", dt_img, strerror(errno));
- if (write(fd, dt_data, dt_size) != dt_size) goto fail;
+ if (write(fd, dt_data, dt_size) != dt_size) {
+ unlink(dt_img);
+ close(fd);
+ fail("failed writing '%s': %s", dt_img, strerror(errno));
+ }
close(fd);
return 0;
-fail:
- unlink(dt_img);
- close(fd);
- fail("failed writing '%s': %s", dt_img, strerror(errno));
}
--
2.50.0

View file

@ -0,0 +1,73 @@
From 4917606a69a5134863ac27b3b590d323355f9cfb Mon Sep 17 00:00:00 2001
From: Henrik Grimler <henrik@grimler.se>
Date: Mon, 30 Jun 2025 16:59:58 +0200
Subject: [PATCH] dtbtool-exynos: free allocated dtb_files before exit
Otherwise tools like valgrind detects memory leaks.
---
dtbtool-exynos.c | 24 ++++++++++++++++++++----
1 file changed, 20 insertions(+), 4 deletions(-)
diff --git a/dtbtool-exynos.c b/dtbtool-exynos.c
index 2164aae18159..efb6baecc828 100644
--- a/dtbtool-exynos.c
+++ b/dtbtool-exynos.c
@@ -355,6 +355,14 @@ static void *load_dtbh_block(char **dtb_files, unsigned pagesize,
return dtbh;
}
+void free_dtb_files(char **dtb_files) {
+ if (!dtb_files) return;
+ for (int i = 0; dtb_files[i]; i++) {
+ free(dtb_files[i]);
+ }
+ free(dtb_files);
+}
+
static int usage(void)
{
fprintf(stderr, "usage: dtbtool\n"
@@ -415,28 +423,36 @@ int main(int argc, char **argv)
if (!dt_img) {
error("no output filename specified");
+ free_dtb_files(dtb_files);
usage();
}
- if (dt_count == 0)
+ if (dt_count == 0) {
+ free_dtb_files(dtb_files);
fail("no dtb files found");
+ }
dt_data = load_dtbh_block(dtb_files, pagesize, dt_platform_code, dt_subtype_code, &dt_size);
- if (!dt_data)
+ if (!dt_data) {
+ free_dtb_files(dtb_files);
fail("could not load device tree blobs");
+ }
fd = open(dt_img, O_CREAT | O_TRUNC | O_WRONLY, 0644);
- if (fd < 0)
+ if (fd < 0) {
+ free_dtb_files(dtb_files);
fail("could not create output file '%s': %s", dt_img, strerror(errno));
+ }
if (write(fd, dt_data, dt_size) != dt_size) {
unlink(dt_img);
close(fd);
+ free_dtb_files(dtb_files);
fail("failed writing '%s': %s", dt_img, strerror(errno));
}
+ free_dtb_files(dtb_files);
close(fd);
return 0;
-
}
--
2.50.0

View file

@ -0,0 +1,147 @@
From 6c418bf000af76959df27e21fd06ca49847ce65d Mon Sep 17 00:00:00 2001
From: Henrik Grimler <henrik@grimler.se>
Date: Mon, 30 Jun 2025 17:05:44 +0200
Subject: [PATCH] load_dtbh_block: free allocated memory
---
dtbtool-exynos.c | 57 +++++++++++++++++++++++++++++++++++++-----------
1 file changed, 44 insertions(+), 13 deletions(-)
diff --git a/dtbtool-exynos.c b/dtbtool-exynos.c
index efb6baecc828..256ccce4069a 100644
--- a/dtbtool-exynos.c
+++ b/dtbtool-exynos.c
@@ -188,16 +188,17 @@ void add_dtb_file(char ***dtb_files_ptr, int *dtb_count_ptr, const char *filenam
}
static void *load_dtbh_block(char **dtb_files, unsigned pagesize,
- uint32_t platform_code, uint32_t subtype_code,
- unsigned *_sz)
+ uint32_t platform_code, uint32_t subtype_code,
+ unsigned *_sz)
{
const unsigned pagemask = pagesize - 1;
- struct dt_entry *new_entries;
+ struct dt_entry *new_entries = NULL;
struct dt_entry *entries = NULL;
struct dt_entry *entry;
- struct dt_blob *blob;
+ struct dt_blob *blob = NULL;
struct dt_blob *blob_list = NULL;
struct dt_blob *last_blob = NULL;
+ struct dt_blob *tmp_blob = NULL;
unsigned new_count;
unsigned entry_count = 0;
unsigned offset;
@@ -210,15 +211,19 @@ static void *load_dtbh_block(char **dtb_files, unsigned pagesize,
const unsigned *prop_hw_rev_end;
const unsigned *prop_compatible;
int len;
- void *dtb;
- char *dtbh;
+ void *dtb = NULL;
+ char *dtbh = NULL;
char **fname;
unsigned c;
+ bool fail = false;
for (fname = dtb_files; *fname; fname++) {
dtb = load_file(*fname, &dtb_sz);
- if (!dtb || !dtb_sz)
+ if (!dtb || !dtb_sz) {
error("failed to read dtb '%s'", *fname);
+ fail = true;
+ goto cleanup;
+ }
if (fdt_check_header(dtb) != 0) {
warnx("'%s' is not a valid dtb, skipping", *fname);
@@ -262,8 +267,12 @@ static void *load_dtbh_block(char **dtb_files, unsigned pagesize,
ntohl(prop_hw_rev[0]), ntohl(prop_hw_rev_end[0]));
blob = calloc(1, sizeof(struct dt_blob));
- if (!blob)
+ if (!blob) {
error("failed to allocate memory");
+ free(dtb);
+ fail = true;
+ goto cleanup;
+ }
blob->payload = dtb;
blob->size = dtb_sz;
@@ -278,8 +287,11 @@ static void *load_dtbh_block(char **dtb_files, unsigned pagesize,
blob_sz += (blob->size + pagemask) & ~pagemask;
new_count = entry_count + 1;
new_entries = realloc(entries, new_count * sizeof(struct dt_entry));
- if (!new_entries)
+ if (!new_entries) {
error("failed to allocate memory");
+ fail = true;
+ goto cleanup;
+ }
entries = new_entries;
entry = &entries[entry_count];
@@ -299,7 +311,8 @@ static void *load_dtbh_block(char **dtb_files, unsigned pagesize,
if (!entry_count) {
warnx("unable to locate any dtbs in the given path");
- return 0;
+ fail = true;
+ goto cleanup;
}
hdr_sz += sizeof(uint32_t); /* eot marker */
@@ -324,8 +337,11 @@ static void *load_dtbh_block(char **dtb_files, unsigned pagesize,
* All parts are now gathered, so build the dt block
*/
dtbh = calloc(hdr_sz + blob_sz, 1);
- if (!dtbh)
- fail("failed to allocate memory");
+ if (!dtbh) {
+ error("failed to allocate memory");
+ fail = true;
+ goto cleanup;
+ }
offset = 0;
@@ -352,7 +368,20 @@ static void *load_dtbh_block(char **dtb_files, unsigned pagesize,
*_sz = hdr_sz + blob_sz;
- return dtbh;
+cleanup:
+ if (entries)
+ free(entries);
+ tmp_blob = blob_list;
+ while (tmp_blob) {
+ struct dt_blob *next = tmp_blob->next;
+ free(tmp_blob->payload);
+ free(tmp_blob);
+ tmp_blob = next;
+ }
+ if (fail)
+ return NULL;
+ else
+ return dtbh;
}
void free_dtb_files(char **dtb_files) {
@@ -447,10 +476,12 @@ int main(int argc, char **argv)
if (write(fd, dt_data, dt_size) != dt_size) {
unlink(dt_img);
close(fd);
+ free(dt_data);
free_dtb_files(dtb_files);
fail("failed writing '%s': %s", dt_img, strerror(errno));
}
+ free(dt_data);
free_dtb_files(dtb_files);
close(fd);
--
2.50.0

View file

@ -1,6 +1,6 @@
pkgname=dtbtool-exynos pkgname=dtbtool-exynos
pkgver=1.1.0 pkgver=1.1.0
pkgrel=0 pkgrel=1
pkgdesc="Tool for compiling a dtb.img for Exynos SOC" pkgdesc="Tool for compiling a dtb.img for Exynos SOC"
url="https://forum.xda-developers.com/android/development/exynos-compiling-dtb-img-linux-t3700690" url="https://forum.xda-developers.com/android/development/exynos-compiling-dtb-img-linux-t3700690"
arch="all" arch="all"
@ -8,7 +8,19 @@ license="MIT"
depends="libfdt" depends="libfdt"
makedepends="dtc-dev" makedepends="dtc-dev"
options="!check" # There is no testsuite options="!check" # There is no testsuite
source="$pkgname-$pkgver.tar.gz::https://github.com/dsankouski/dtbtool-exynos/archive/$pkgver.tar.gz" source="
$pkgname-$pkgver.tar.gz::https://github.com/dsankouski/dtbtool-exynos/archive/$pkgver.tar.gz
0001-Makefile-do-not-add-libfdt.so-to-OBJ_FILES.patch
0002-Makefile-do-not-strip-the-produced-binary.patch
0003-dtbtool-exynos-convert-all-space-indentation-to-tabs.patch
0004-scan_dtb_path-be-less-verbose-when-scanning-director.patch
0005-scan_dtb_path-free-struct-from-scandir.patch
0006-dtbtool-exynos-zero-allocated-dtb_files-memory.patch
0007-dtbtool-exynos-allocate-memory-for-dtbs-as-needed.patch
0008-dtbtool-exynos-remove-fail-goto.patch
0009-dtbtool-exynos-free-allocated-dtb_files-before-exit.patch
0010-load_dtbh_block-free-allocated-memory.patch
"
build() { build() {
make make
@ -18,4 +30,16 @@ package() {
install -D -m755 "$builddir"/dtbTool-exynos \ install -D -m755 "$builddir"/dtbTool-exynos \
"$pkgdir"/usr/bin/dtbTool-exynos "$pkgdir"/usr/bin/dtbTool-exynos
} }
sha512sums="a870ea1552d58757d4d44d93f3b84a211331eb39871d5c964d314b50e17c7b456a50368c539c58a02557aa4be775e0158c7be237115328d507719d491f65645f dtbtool-exynos-1.1.0.tar.gz" sha512sums="
a870ea1552d58757d4d44d93f3b84a211331eb39871d5c964d314b50e17c7b456a50368c539c58a02557aa4be775e0158c7be237115328d507719d491f65645f dtbtool-exynos-1.1.0.tar.gz
980c419f14aada81c2a07067d4d3c0c0b53a866103623eecc8e893a708b31efd4d9a6bdbd689d922dacd1ece57807197c6892b3462d6f527a3a41133efed7720 0001-Makefile-do-not-add-libfdt.so-to-OBJ_FILES.patch
8f7ad2227950ca28aabd366f4d1305beaa0adb7712b3ee7ddc38a45ccbe7f1075a5a4390bce9617ddf479aac44206127c60811855d0a6aa7dc505fe65ddabc4a 0002-Makefile-do-not-strip-the-produced-binary.patch
fc92871ca1eede3939ad681d14c97ff30f94356c7a68a25d87f956b8ac04aaf1b3661027674cab76fa0420584d470c7ee9a19b0d6f6d571d2dcb2eb383827a34 0003-dtbtool-exynos-convert-all-space-indentation-to-tabs.patch
774009d0f612c9056a2b9508f2fad7c8aa4bd9bbfbec52b077699f119ba895717c4dbf4d679d9af1f7ae623374a145c936cdadd68f4e465c06e11f0fc7e49f57 0004-scan_dtb_path-be-less-verbose-when-scanning-director.patch
928819d1d3f367e5ac2d71011a3215e136da7e0969f1d9afd9e106dd1d0cac49efb3acbfe34cf713e839eabbca47454e32771ad5aaed6770d6a54c91f5f2482c 0005-scan_dtb_path-free-struct-from-scandir.patch
9552c4a3c363fb69b97c2418b23e9aeb9d82cb4587548a75cbc16e87694b91cbec3e9a5a43e4c74108ef7ecd8a6735f0b03967a6195486a9a1291b5cca6226bf 0006-dtbtool-exynos-zero-allocated-dtb_files-memory.patch
5a4d89ac6688b977b96a8bcf4a4b405319d436e1f09277bd12139033d1c7f3b75f097ade7274ec34e4726eb1aa849a72adb41456f9c90a74019851a9e4fc83f9 0007-dtbtool-exynos-allocate-memory-for-dtbs-as-needed.patch
43d073ebe3adaa7103049e63f337d9d701cfb7cc90780ab3bd97c06aa89b280ac448d4008a769c8534b823426763eeca26569a37d6aa972298e146d8c72119af 0008-dtbtool-exynos-remove-fail-goto.patch
9c4a06382c40285bccacabae095d4a12e384f05ee3e601d04c8f58d1da5e88d89ab0d27e7965a6f5bf945d3a1ba21c3c66966da6cd26b9e4f20763e29ac3c491 0009-dtbtool-exynos-free-allocated-dtb_files-before-exit.patch
c38af9be572d9bd3baf20711ec1876214d6fafe60074d420394c64faeaadd2aa7159104baf0acd6cdf18782693a6964b787f18a451649b3f18ed05b485268d2e 0010-load_dtbh_block-free-allocated-memory.patch
"