* [PATCH 0/2] fixdep: fix a bug for TPL, and re-sync with Linux
@ 2020-04-16 5:01 Masahiro Yamada
2020-04-16 5:01 ` [PATCH 1/2] fixdep: handle CONFIG_IS_ENABLE() and friends for TPL Masahiro Yamada
2020-04-16 5:01 ` [PATCH 2/2] fixdep: Re-sync with Linux 5.7-rc1 Masahiro Yamada
0 siblings, 2 replies; 5+ messages in thread
From: Masahiro Yamada @ 2020-04-16 5:01 UTC (permalink / raw
To: u-boot
Masahiro Yamada (2):
fixdep: handle CONFIG_IS_ENABLE() and friends for TPL
fixdep: Re-sync with Linux 5.7-rc1
scripts/basic/fixdep.c | 104 +++++++++++++++++++++--------------------
1 file changed, 54 insertions(+), 50 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] fixdep: handle CONFIG_IS_ENABLE() and friends for TPL
2020-04-16 5:01 [PATCH 0/2] fixdep: fix a bug for TPL, and re-sync with Linux Masahiro Yamada
@ 2020-04-16 5:01 ` Masahiro Yamada
2020-04-24 17:12 ` Tom Rini
2020-04-16 5:01 ` [PATCH 2/2] fixdep: Re-sync with Linux 5.7-rc1 Masahiro Yamada
1 sibling, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2020-04-16 5:01 UTC (permalink / raw
To: u-boot
Since commit f1c6e1922eb5 ("spl: dm: use CONFIG_IS_ENABLED to test for
the DM option"), CONFIG_IS_ENABLED() handles CONFIG_TPL_* options, but
fixdep still cannot because it hard-codes the "SPL_" prefix as follows:
char tmp_buf[256] = "SPL_"; /* hack for U-Boot */
Take care of the "TPL_" prefix too.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/basic/fixdep.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index c9277d782c..555dada47a 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -103,7 +103,7 @@
#include <stdio.h>
#include <ctype.h>
-int is_spl_build = 0; /* hack for U-Boot */
+char tmp_buf[256]; /* hack for U-Boot */
static void usage(void)
{
@@ -230,7 +230,6 @@ static void parse_config_file(const char *p)
{
const char *q, *r;
const char *start = p;
- char tmp_buf[256] = "SPL_"; /* hack for U-Boot */
while ((p = strstr(p, "CONFIG_"))) {
if (p > start && (isalnum(p[-1]) || p[-1] == '_')) {
@@ -260,7 +259,7 @@ static void parse_config_file(const char *p)
while (isalnum(*q) || *q == '_')
q++;
r = q;
- if (r > p && is_spl_build) {
+ if (r > p && tmp_buf[0]) {
memcpy(tmp_buf + 4, p, r - p);
r = tmp_buf + 4 + (r - p);
p = tmp_buf;
@@ -419,8 +418,11 @@ int main(int argc, char *argv[])
cmdline = argv[3];
/* hack for U-Boot */
- if (!strncmp(target, "spl/", 4) || !strncmp(target, "tpl/", 4))
- is_spl_build = 1;
+ if (!strncmp(target, "spl/", 4))
+ strcpy(tmp_buf, "SPL_");
+ else if (!strncmp(target, "tpl/", 4))
+ strcpy(tmp_buf, "TPL_");
+ /* end U-Boot hack */
printf("cmd_%s := %s\n\n", target, cmdline);
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] fixdep: Re-sync with Linux 5.7-rc1
2020-04-16 5:01 [PATCH 0/2] fixdep: fix a bug for TPL, and re-sync with Linux Masahiro Yamada
2020-04-16 5:01 ` [PATCH 1/2] fixdep: handle CONFIG_IS_ENABLE() and friends for TPL Masahiro Yamada
@ 2020-04-16 5:01 ` Masahiro Yamada
2020-04-24 17:12 ` Tom Rini
1 sibling, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2020-04-16 5:01 UTC (permalink / raw
To: u-boot
fixdep is a standalone host program, so we can just re-sync it with
the latest Linux in one commit.
I kept the U-Boot own code block surrounded by
/* hack for U-Boot */ ... /* U-boot hack end */.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---
scripts/basic/fixdep.c | 92 +++++++++++++++++++++---------------------
1 file changed, 47 insertions(+), 45 deletions(-)
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c
index 555dada47a..24be244d5e 100644
--- a/scripts/basic/fixdep.c
+++ b/scripts/basic/fixdep.c
@@ -77,11 +77,6 @@
* dependencies on include/config/my/option.h for every
* CONFIG_MY_OPTION encountered in any of the prerequisites.
*
- * It will also filter out all the dependencies on *.ver. We need
- * to make sure that the generated version checksum are globally up
- * to date before even starting the recursive build, so it's too late
- * at this point anyway.
- *
* We don't even try to really parse the header files, but
* merely grep, i.e. if CONFIG_FOO is mentioned in a comment, it will
* be picked up as well. It's not a problem with respect to
@@ -99,6 +94,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
+#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
@@ -107,11 +103,40 @@ char tmp_buf[256]; /* hack for U-Boot */
static void usage(void)
{
- fprintf(stderr, "Usage: fixdep [-e] <depfile> <target> <cmdline>\n");
- fprintf(stderr, " -e insert extra dependencies given on stdin\n");
+ fprintf(stderr, "Usage: fixdep <depfile> <target> <cmdline>\n");
exit(1);
}
+/*
+ * In the intended usage of this program, the stdout is redirected to .*.cmd
+ * files. The return value of printf() and putchar() must be checked to catch
+ * any error, e.g. "No space left on device".
+ */
+static void xprintf(const char *format, ...)
+{
+ va_list ap;
+ int ret;
+
+ va_start(ap, format);
+ ret = vprintf(format, ap);
+ if (ret < 0) {
+ perror("fixdep");
+ exit(1);
+ }
+ va_end(ap);
+}
+
+static void xputchar(int c)
+{
+ int ret;
+
+ ret = putchar(c);
+ if (ret == EOF) {
+ perror("fixdep");
+ exit(1);
+ }
+}
+
/*
* Print out a dependency path from a symbol name
*/
@@ -119,7 +144,7 @@ static void print_dep(const char *m, int slen, const char *dir)
{
int c, prev_c = '/', i;
- printf(" $(wildcard %s/", dir);
+ xprintf(" $(wildcard %s/", dir);
for (i = 0; i < slen; i++) {
c = m[i];
if (c == '_')
@@ -127,25 +152,10 @@ static void print_dep(const char *m, int slen, const char *dir)
else
c = tolower(c);
if (c != '/' || prev_c != '/')
- putchar(c);
+ xputchar(c);
prev_c = c;
}
- printf(".h) \\\n");
-}
-
-static void do_extra_deps(void)
-{
- char buf[80];
-
- while (fgets(buf, sizeof(buf), stdin)) {
- int len = strlen(buf);
-
- if (len < 2 || buf[len - 1] != '\n') {
- fprintf(stderr, "fixdep: bad data on stdin\n");
- exit(1);
- }
- print_dep(buf, len - 1, "include/ksym");
- }
+ xprintf(".h) \\\n");
}
struct item {
@@ -238,7 +248,7 @@ static void parse_config_file(const char *p)
}
p += 7;
q = p;
- while (*q && (isalnum(*q) || *q == '_'))
+ while (isalnum(*q) || *q == '_')
q++;
if (str_ends_with(p, q - p, "_MODULE"))
r = q - 7;
@@ -309,8 +319,7 @@ static void *read_file(const char *filename)
static int is_ignored_file(const char *s, int len)
{
return str_ends_with(s, len, "include/generated/autoconf.h") ||
- str_ends_with(s, len, "include/generated/autoksyms.h") ||
- str_ends_with(s, len, ".ver");
+ str_ends_with(s, len, "include/generated/autoksyms.h");
}
/*
@@ -318,7 +327,7 @@ static int is_ignored_file(const char *s, int len)
* assignments are parsed not only by make, but also by the rather simple
* parser in scripts/mod/sumversion.c.
*/
-static void parse_dep_file(char *m, const char *target, int insert_extra_deps)
+static void parse_dep_file(char *m, const char *target)
{
char *p;
int is_last, is_target;
@@ -365,13 +374,13 @@ static void parse_dep_file(char *m, const char *target, int insert_extra_deps)
*/
if (!saw_any_target) {
saw_any_target = 1;
- printf("source_%s := %s\n\n",
- target, m);
- printf("deps_%s := \\\n", target);
+ xprintf("source_%s := %s\n\n",
+ target, m);
+ xprintf("deps_%s := \\\n", target);
}
is_first_dep = 0;
} else {
- printf(" %s \\\n", m);
+ xprintf(" %s \\\n", m);
}
buf = read_file(m);
@@ -394,23 +403,16 @@ static void parse_dep_file(char *m, const char *target, int insert_extra_deps)
exit(1);
}
- if (insert_extra_deps)
- do_extra_deps();
-
- printf("\n%s: $(deps_%s)\n\n", target, target);
- printf("$(deps_%s):\n", target);
+ xprintf("\n%s: $(deps_%s)\n\n", target, target);
+ xprintf("$(deps_%s):\n", target);
}
int main(int argc, char *argv[])
{
const char *depfile, *target, *cmdline;
- int insert_extra_deps = 0;
void *buf;
- if (argc == 5 && !strcmp(argv[1], "-e")) {
- insert_extra_deps = 1;
- argv++;
- } else if (argc != 4)
+ if (argc != 4)
usage();
depfile = argv[1];
@@ -424,10 +426,10 @@ int main(int argc, char *argv[])
strcpy(tmp_buf, "TPL_");
/* end U-Boot hack */
- printf("cmd_%s := %s\n\n", target, cmdline);
+ xprintf("cmd_%s := %s\n\n", target, cmdline);
buf = read_file(depfile);
- parse_dep_file(buf, target, insert_extra_deps);
+ parse_dep_file(buf, target);
free(buf);
return 0;
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 1/2] fixdep: handle CONFIG_IS_ENABLE() and friends for TPL
2020-04-16 5:01 ` [PATCH 1/2] fixdep: handle CONFIG_IS_ENABLE() and friends for TPL Masahiro Yamada
@ 2020-04-24 17:12 ` Tom Rini
0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2020-04-24 17:12 UTC (permalink / raw
To: u-boot
On Thu, Apr 16, 2020 at 02:01:44PM +0900, Masahiro Yamada wrote:
> Since commit f1c6e1922eb5 ("spl: dm: use CONFIG_IS_ENABLED to test for
> the DM option"), CONFIG_IS_ENABLED() handles CONFIG_TPL_* options, but
> fixdep still cannot because it hard-codes the "SPL_" prefix as follows:
>
> char tmp_buf[256] = "SPL_"; /* hack for U-Boot */
>
> Take care of the "TPL_" prefix too.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200424/5842cad4/attachment.sig>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] fixdep: Re-sync with Linux 5.7-rc1
2020-04-16 5:01 ` [PATCH 2/2] fixdep: Re-sync with Linux 5.7-rc1 Masahiro Yamada
@ 2020-04-24 17:12 ` Tom Rini
0 siblings, 0 replies; 5+ messages in thread
From: Tom Rini @ 2020-04-24 17:12 UTC (permalink / raw
To: u-boot
On Thu, Apr 16, 2020 at 02:01:45PM +0900, Masahiro Yamada wrote:
> fixdep is a standalone host program, so we can just re-sync it with
> the latest Linux in one commit.
>
> I kept the U-Boot own code block surrounded by
> /* hack for U-Boot */ ... /* U-boot hack end */.
>
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Applied to u-boot/master, thanks!
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200424/4092dab5/attachment.sig>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-04-24 17:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-16 5:01 [PATCH 0/2] fixdep: fix a bug for TPL, and re-sync with Linux Masahiro Yamada
2020-04-16 5:01 ` [PATCH 1/2] fixdep: handle CONFIG_IS_ENABLE() and friends for TPL Masahiro Yamada
2020-04-24 17:12 ` Tom Rini
2020-04-16 5:01 ` [PATCH 2/2] fixdep: Re-sync with Linux 5.7-rc1 Masahiro Yamada
2020-04-24 17:12 ` Tom Rini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.