linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] kbuild: generate intermediate C files instead of copying _shipped files
@ 2017-08-19  8:49 Masahiro Yamada
  2017-08-19  8:49 ` [RFC PATCH 1/3] kbuild: generate *.hash.c during build Masahiro Yamada
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Masahiro Yamada @ 2017-08-19  8:49 UTC (permalink / raw)
  To: Sam Ravnborg, Michal Marek, Linus Torvalds, linux-kbuild
  Cc: devicetree, Rob Herring, Jonathan Corbet, Richard Purdie,
	Greg Kroah-Hartman, Andrew Morton, Masahiro Yamada,
	Mauro Carvalho Chehab, Nicholas Piggin, linux-doc, Markus Heiser,
	linux-kernel, Frank Rowand, Rob Herring, SeongJae Park,
	Yann E. MORIN

In Linux build system convention, we do not run tools such as
flex, bison, gperf during the kernel building.  Instead, manage
generated C files in the repository with _shipped suffixes.
They are simply shipped (copied) removing the _shipped suffixes
during the kernel building.

Commit 7373f4f83c71 ("kbuild: add implicit rules for parser generation")
added a mechanism to regenerate intermediate C files easily.
The build rules are surrounded with ifdef REGENERATE_PARSERS.
So, we need to pass REGENERATE_PARSERS=1 from the command line
when we want to update them.

Here is one question.  Is it acceptable to use those rules all the time?
That is, generate those C files by flex, bison, gperf during the
kernel building.

This means, the build system depends on more external tools.
>From the users' point of view, they will need to install
flex, bison, gperf in order to build the kernel.
>From the developers' point of view, the advantage is
we do not need to version-control generated files, i.e. _shipped files
will be deleted.

I'd like to know if this is acceptable or not.

For example, currently some files are simply shipped (copied)
when building the kconfig program.

  $ make mrproper; make defconfig
    HOSTCC  scripts/basic/fixdep
    HOSTCC  scripts/kconfig/conf.o
    SHIPPED scripts/kconfig/zconf.tab.c
    SHIPPED scripts/kconfig/zconf.lex.c
    SHIPPED scripts/kconfig/zconf.hash.c
    HOSTCC  scripts/kconfig/zconf.tab.o
    HOSTLD  scripts/kconfig/conf
  *** Default configuration is based on 'x86_64_defconfig'
  #
  # configuration written to .config
  #

With this series, they are created from *real* sources
(*.y, *.l, *.gperf files).

  $ make mrproper; make defconfig
    HOSTCC  scripts/basic/fixdep
    HOSTCC  scripts/kconfig/conf.o
    YACC    scripts/kconfig/zconf.tab.c
    LEX     scripts/kconfig/zconf.lex.c
    GPERF   scripts/kconfig/zconf.hash.c
    HOSTCC  scripts/kconfig/zconf.tab.o
    HOSTLD  scripts/kconfig/conf
  *** Default configuration is based on 'x86_64_defconfig'
  #
  # configuration written to .config
  #

Note:
The tool versions in Documentation/process/changes.rst are just
place-holders for now.  We need to figure out the minimal versions
if we like to switch to this approach.



Masahiro Yamada (3):
  kbuild: generate *.hash.c during build
  kbuild: generate *.lex.c during build
  kbuild: generate *.tab.c and *.tab.h during build

 Documentation/process/changes.rst        |   36 +
 scripts/Makefile.lib                     |   26 +-
 scripts/dtc/Makefile                     |    6 +-
 scripts/dtc/dtc-lexer.lex.c_shipped      | 2259 ---------------------------
 scripts/dtc/dtc-parser.tab.c_shipped     | 2303 ----------------------------
 scripts/dtc/dtc-parser.tab.h_shipped     |  125 --
 scripts/genksyms/Makefile                |    4 +-
 scripts/genksyms/keywords.hash.c_shipped |  230 ---
 scripts/genksyms/lex.lex.c_shipped       | 2291 ---------------------------
 scripts/genksyms/parse.tab.c_shipped     | 2394 -----------------------------
 scripts/genksyms/parse.tab.h_shipped     |  119 --
 scripts/kconfig/Makefile                 |    1 +
 scripts/kconfig/zconf.hash.c_shipped     |  297 ----
 scripts/kconfig/zconf.lex.c_shipped      | 2473 ------------------------------
 scripts/kconfig/zconf.tab.c_shipped      | 2471 -----------------------------
 15 files changed, 53 insertions(+), 14982 deletions(-)
 delete mode 100644 scripts/dtc/dtc-lexer.lex.c_shipped
 delete mode 100644 scripts/dtc/dtc-parser.tab.c_shipped
 delete mode 100644 scripts/dtc/dtc-parser.tab.h_shipped
 delete mode 100644 scripts/genksyms/keywords.hash.c_shipped
 delete mode 100644 scripts/genksyms/lex.lex.c_shipped
 delete mode 100644 scripts/genksyms/parse.tab.c_shipped
 delete mode 100644 scripts/genksyms/parse.tab.h_shipped
 delete mode 100644 scripts/kconfig/zconf.hash.c_shipped
 delete mode 100644 scripts/kconfig/zconf.lex.c_shipped
 delete mode 100644 scripts/kconfig/zconf.tab.c_shipped

-- 
2.7.4

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2017-09-10 16:28 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-19  8:49 [RFC PATCH 0/3] kbuild: generate intermediate C files instead of copying _shipped files Masahiro Yamada
2017-08-19  8:49 ` [RFC PATCH 1/3] kbuild: generate *.hash.c during build Masahiro Yamada
2017-08-19  8:49 ` [RFC PATCH 2/3] kbuild: generate *.lex.c " Masahiro Yamada
2017-08-19  8:49 ` [RFC PATCH 3/3] kbuild: generate *.tab.c and *.tab.h " Masahiro Yamada
2017-08-21 17:12   ` Rob Herring
2017-08-19 11:31 ` [RFC PATCH 0/3] kbuild: generate intermediate C files instead of copying _shipped files Cao jin
2017-08-19 17:03 ` Linus Torvalds
2017-08-19 17:14   ` Linus Torvalds
2017-08-19 18:12     ` Linus Torvalds
2017-09-08  6:18     ` Masahiro Yamada
2017-09-08 17:22       ` Linus Torvalds
2017-09-08 18:01         ` Linus Torvalds
2017-09-08 18:39           ` Linus Torvalds
2017-09-08 21:38             ` Linus Torvalds
2017-09-09  6:39               ` Sam Ravnborg
2017-09-10 13:59                 ` Masahiro Yamada
2017-09-10 13:58               ` Masahiro Yamada
2017-09-10 16:27                 ` Linus Torvalds

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).