[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Avoiding make-kpkg clean, redux



%% "Roberto C. Sanchez" <roberto@familiasanchez.net> writes:

  >> What do I need to do to use make-kpkg to build my kernel packages, but
  >> avoid having to run "make-kpkg clean" between every build?  I'm
  >> upgrading to a 2.6 kernel and I'm tweaking and poking at my config.
  >> Running a build after a clean takes too long.  Even with ccache.

  rcs> Add 'do_clean := NO' to /etc/kernel-pkg.conf.

Ah!  Another one from the previous thread.  The discussion around this
was confusing to be sure, and Manoj generated a bit of it himself :-).
Contrary to what I understood him to say, if this variable (do_clean) is
set to YES then the kernel WILL be cleaned automatically after EVERY
invocation of "make-kpkg kernel_image".  I verified this both by looking
at the man page (which is correct) and at the implementation itself.

Obviously, this is bad.  This is not exactly what I'm talking about
though: having this variable set to something other than YES is a
necessary, but not sufficient, step.

In fact, if you go look at the actual content of the rules file you'll
see that the default value of this variable is actually _already_ NO (at
least in my versions of kernel-package -- 8.135).  So, the above change
has exactly no effect.


Further, this is not really what I'm talking about.  Assume that this is
done, and the kernel source is not cleaned up after the kernel_image.

Now, I want to make a change to the configuration and rebuild.  I can't
do this using make-kpkg, without either (a) knowing some undocumented
magic steps, or (b) running make-kpkg clean first.  I don't want to do
option (b), so I'm asking someone to document (and, preferably, SUPPORT
so it's not magic anymore) option (a).  I'm fine of the docs list it as
"for experts only", etc.  I just don't want to have to learn the entire
implementation of make-kpkg to find out what it is.

As I said, the simple-minded approach of just re-running make-kpkg
kernel_image without doing a make-kpkg clean DOES NOT WORK: it doesn't
invoke the kernel makefile at all (at least it didn't when I tried it).
There is more that must be done: some make-kpkg-generated stamp files or
something need to be removed, probably.  But nowhere in the
kernel-package documentation (that I could find) does it tell you what
you need to do... and ideally there would be some target to make-kpkg
that would do it for you.

  rcs> As far as using ccache, you are able to specify your C compiler on the
  rcs> command line.  From the make-kpkg(1) man page:

  rcs>  You may control
  rcs>        which version of gcc used in kernel compilation by setting
  rcs>        the Makefile variables CC and HOSTCC in the top level
  rcs>        kernel Makefile. You can do this simply by
 
  rcs>          % MAKEFLAGS="CC=gcc-2.95" make-kpkg ...
 
  rcs>        (please see the top level kernel Makefile for variables
  rcs>        that can be set).

Your example here is too simple: to use ccache you need to assign a
value containing whitespace to the CC variable: CC="ccache gcc".  Doing
that via MAKEFLAGS is much more complex than the above example.
MAKEFLAGS is technically not designed for this type of argument passing:
MAKEFLAGS is really designed for parent makes to pass flags to
sub-makes.  It's also available for users to set SIMPLE command line
options, like -k etc. in their environment if they want to.

Using MAKEFLAGS like this is a hack and it's difficult to use correctly
with ccache, due to the quoting issues.  You'd need to do something
like:

    MAKEFLAGS='CC=ccache\ cc' make-kpkg ...

And this relies on knowing some internal implementation details about
how GNU make works when it invokes recursive makes: it's not guaranteed
to work in future versions as it's undocumented.  Finally, note that it
is probably much harder to do this in csh where quoting is very bizarre.
Of course csh sucks anyway but...

Why can't we do something like:

    make-kpkg ... CC="ccache gcc"

and have make-kpkg pass any argument which is a variable assignment down
to the kernel build system?  That's simple enough.


I actually did figure out a way around this; you can add this to your
~/.kernel-pkg.conf file (or /etc/kernel-pkg.conf if you prefer):

    override CC = ccache $(CROSS_COMPILE)gcc

By adding the "override" keyword this setting will take precedence over
the one that comes later, in the kernel's makefile.  It will also
override any command-line settings, but as above make-kpkg doesn't allow
them anyway.  But, if you wanted, you could do something like this:

    ifneq (command line,$(origin CC))
      override CC = ccache $(CROSS_COMPILE)gcc
    endif

Now, it won't override a command-line setting of CC.

I'd still prefer make-kpkg to support this directly.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <psmith@nortel.com>           HASMAT--HA Software Mthds & Tools
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist
-------------------------------------------------------------------------------
   These are my opinions---Nortel Networks takes no responsibility for them.



Reply to: