[linux-dvb] User compile of Hg version broken

Mauro Carvalho Chehab mchehab at infradead.org
Thu Apr 27 15:03:01 CEST 2006

Em Qua, 2006-04-26 às 18:41 -0700, Trent Piepho escreveu:
> On Wed, 26 Apr 2006, Mauro Carvalho Chehab wrote:
> > Em Qua, 2006-04-26 s 14:31 -0700, Trent Piepho escreveu:
> > > So now you download a second copy of the kernel source, install that,
> > > and figure out how to get the Hg version to look at it instead of the
> > > system source it finds automatically?
> > Huh??? NO! You don't need this!
> Since the makefile used to always rebuild *conf, you needed to do this.
Makefile will build *conf only if not found:

xconfig:: links .version
        -if [ ! -f $(KDIR)/scripts/kconfig/qconf ]; then \
                $(MAKE) -C $(KDIR) $(build)=scripts/kconfig
qconf-target=1 scripts/kconfig/qconf; \

So, if *conf were already generated at kernel tree, it won't rebuild
> > > Kernel 2.6.12.  Even if I'm root, it tries to compile without needing
> > > to, and when it does, it doesn't work:
> > >
> > > [root at t2 v4l-dvb]# make xconfig
> > > scripts/kconfig/mconf.c:1045: error: 'LC_ALL' undeclared (first use in this function)
> > > scripts/kconfig/mconf.c:1045: error: (Each undeclared identifier is reported only once
> > > scripts/kconfig/mconf.c:1045: error: for each function it appears in.)
> >
> > LC_ALL is an environment var about your current language. All distros I
> > know have this defined (also an entire bunch of LC_foo stuff), like:
> >
> > It seems to be something weird on your environment... Maybe kernel
> > Makefile do some trick for this one. probably, if we do LC_ALL=C at the
> > building line will make it work on 2.6.12.
> Tried that, still the same problem.  The top level kernel makefile exports all
> sorts of variables that aren't getting defined by the v4l-dvb makefile.
We don't need to fill all those vars. Only those required by scripts
makefiles. Anyway, the V4L/DVB makefile calls kernel main Makefile, that
may redefine some vars.
> HOSTCC is a different value, HOSTCFLAGS and HOSTCXXFLAGS aren't set, and so
> on.  Is interfacing into the middle of the kernel build system like this
> supported? 
No. Out of tree calls to Kconfig is also not supported. If you take a
look at our Makefile, it have to do some checks, because thare are some
variations between kernel versions (for example, for version <2.6.15,
lxconfig is under script, for >=2.6.16, it is under scripts/kconfig).
>  It seems like the command you're using just doesn't work on
> 2.6.12.
So, we can try to fix it :)
>   Is there any reason to believe it will continue to work on 2.6.17 or
> 2.6.18 and so on?  Having the v4l-dvb makefile automatically build *conf
> *when needed* could be convenient, but it looks like it's very hard to get it
> to work correctly.
Having support for Kconfig will be kernel version dependent, anyway. We
might copy those "scripts" to our tree, but it would be even worse,
since we would need to re-copy from time to time. I think we should try
to make it work from 2.6.12 and above.

You should notice that the interface that should work always is "make
all" (and allyesconfig/allmodconfig). 

The newer building process is important for V4L/DVB for several reasons:

1) To help tree development (this were the motivation, in fact for this
movement), since it allows testing Kconfig/Makefile stuff.

In the past, we had several troubles when sending patches to mainstream,
since people just forgot to patch the real makefiles (those under linux
dir). So, we were sending broken patches to kernel. Now, developers
should patch only linux dir, and may test newer Kconfig/Makefile stuff
without needing to export to kernel tree.

2) Sometimes, you need to stress some part of the tree. It is just too
painful to recompile all stuff because you are touching on a header file
that is used all over the tree. Now, you can just select one driver,
change everything at the header file, then, after having this work, to
compile with allyesconfig;

3) There are some situations where people use a non-standard kernel,
where some patches from newer kernel were introduced on an older one.
This breaks the compatibility checks at our tree, and may break some
drivers. Hopefully the one you want were not broken. So, you may use
make *config to compile just the required driver;

4) Our tree is now very complex and require lots of time to compile on
older system. Make *config makes life easier.

The big trouble is that, for make *config to work, we need those 4
"scripts" from kernel, depending on what mode you want: lxconfig, mconf,
qconf, gconf. So, for example, without qconf, make xconfig don't work.
So, V4L/DVB makefile should check if qconf is present before calling it.
It might just fail if the script were not found, but this makes life
more complicated to newbies. So, it go further by calling kernel's main
Makefile, asking for compilation of the required script. IMHO, this is
better than just fail.

Some people complained about root permissions required for make *config.
In fact, the need here is just write to kernel dir, since kernel's
Makefile will require, if the *conf script were not yet compiled in
kernel. This is just the same permission you need if you change to
kernel dir and do make *config [1]. 

You should also notice that root permission *is required* for you to
handle with kernel modules. Most of make methods require root access
(like make install, make rmmod, make insmod, make kernel-links). In
fact, only a few building methods don't require root access (all,
default, clean, distclean).


[1] Btw, from security POV, your kernel tree shouldn't be owned by root,
but by a normal trusted user, for it to compile the kernel. So, a good
practice is to have it owned by a non-root user, that will compile it.
Only to install, root is required. Most experienced Unix admins compile
kernel as a normal user, and install it with something like:
	sudo make modules_install install

More information about the linux-dvb mailing list