On Sun, Nov 18, 2018 at 7:09 PM geraldo netto <[email protected]> wrote:
> Just in case, document -j option on make / scripts/build > Once someone might be unaware of this option > I committed your patch, thanks, although as I'm sure you know, since all modern machines are multi-core, but "make" never adapted to this fact (many Linux tools haven't), users already need to use "-j.." on every make invocation or set MAKEFLAGS (I did that, by the way), so it's not at all special to OSv's Makefile. However, since we do need to explain that "-j" can also be passed to scripts/build, I think there is value in your explanation so I'm committing it. > Also, document that nproc is a built-in command from bash/core-utils [1] > Nitpick: the "nproc" command has nothing to do with bash, it is indeed a tool from the GNU coreutils package. > That counts the number of available processors > > In my case, using compilation without -j takes ~5 minutes against 1.5 > minutes with -j$(nproc) > By the way, these numbers are just for a complete recompilation. Unlike some other projects I'm involved in, OSv is pretty good in separating its source files so that changing one file and recompiling, only recompiles a small subset of the source files. Another reason one often needs to recompile everything is when you do "make clean". However, I wholeheartedly recommend that you install ccache (installing it is all you need to do to use it!), and then recompilation after a "make clean" is super quick. > Before, I used to overcommit the cpu/thread number on make / scripts/build > but the saturation can actually slow things down... > > [1] > http://www.gnu.org/software/coreutils/manual/coreutils.html#nproc-invocation > > Signed-off-by: geraldo netto <[email protected]> > --- > README.md | 13 +++++++++++-- > 1 file changed, 11 insertions(+), 2 deletions(-) > > diff --git a/README.md b/README.md > index f68bee57..d9e2d9d6 100644 > --- a/README.md > +++ b/README.md > @@ -98,17 +98,26 @@ git submodule update --init --recursive > Finally, build everything at once: > > ``` > -make > +make -j$(nproc) > ``` > > to build only the OSv kernel, or more usefully, > > ``` > -scripts/build > +scripts/build -j$(nproc) > ``` > > to build an image of the OSv kernel and the default application. > > +Command nproc (embedded in bash/core-utils) will calculte the number of > jobs/threads for make and scripts/build automatically. > +Alternatively, the environment variable MAKEFLAGS can be exported as > follows: > + > +``` > +export MAKEFLAGS=-j$(nproc) > +``` > + > +In that case, make and scripts/build do not need the parameter -j. > + > scripts/build creates the image ```build/last/usr.img``` in qcow2 format. > To convert this image to other formats, use the ```scripts/convert``` > tool, which can create an image in the vmdk, vdi, raw, or qcow2-old > formats > -- > 2.17.1 > > -- > You received this message because you are subscribed to the Google Groups > "OSv Development" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "OSv Development" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
