The Linux kernel minimal building requirements specifies that the calculator bc is required to build kernel v4.10, the minimal version of the tool being 1.06.95.

What use is made of bc in this context, and why isn't the C language directly used instead of bc for these operations?

  • 10
    What do you mean by using C directly? I don't think that using C as a "scripting language" during build is direct or handy.
    – cubuspl42
    Apr 23, 2018 at 19:10
  • 4
    @cubuspl42 you could just write the operations in the source, and let the compiler compute it into constants. In reality, what it's used for is a bit too complicated for that.
    – OrangeDog
    Apr 23, 2018 at 22:03

1 Answer 1


bc is used during the kernel build to generate time constants in header files. You can see it invoked in Kbuild, where it processes kernel/time/timeconst.bc to generate timeconst.h.

This could be implemented as a C program which is built and run during the build, but it’s easier to use bc (which is small and common; in fact it’s part of the set of tools which are mandatory on a POSIX systems — the kernel does expect GNU bc though).

bc is used here instead of Perl. The commit message suggests that bc was used previously, but I can’t find a trace of that; Perl has been used since 2008 (much to some people’s chagrin, although that patch set was never merged).


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .