Re: [kbuild-devel] [rfe] easier customization of kconfig for non-Linux projects

2007-05-24 Thread Sam Ravnborg
Hi Mike.

Forwarding this to Roman Zippel which is the kconfig maintainer.

The intent with this is clear but the solution you suggest albeit simple
does not really match where we could end up with kconfig.
Recently Roman added support for options in the kconfig language
and I would assume we could deal with most of this just using options.

One example could be to support options for the mainmenu entrye like this:

mainmenu Busybow config system
option project=Busybox
option version=$VERSION   = Where '$' signify an environment variable

etc etc.

In this way we could later distribute kconfig as a binary instead
of building it into the source as today.

Sam

On Thu, May 24, 2007 at 01:17:39AM -0400, Mike Frysinger wrote:
 since kconfig is such a nice build system, more projects other than the Linux
 kernel have started to integrate it (like uClibc and busybox) ... it'd be nice
 if it were easier to customize for each project so that when we pull down the
 latest version, we dont have to go through and tweak all of the strings again.
 what do you think of something like the attached patch ?  i doubt i caught all
 the places that'd need to be changed, but this should give a pretty good
 picture of what we'd like to have.
 
 Signed-off-by: Mike Frysinger [EMAIL PROTECTED]
 ---
 --- a/scripts/kconfig/lkc_local.h
 +++ b/scripts/kconfig/lkc_local.h
 @@ -0,0 +1,15 @@
 +/*
 + * Customize kconfig to your project.
 + *
 + * Released under the terms of the GNU GPL v2.0.
 + */
 +
 +#ifndef LKC_LOCAL_H
 +#define LKC_LOCAL_H
 +
 +#define PROJECT   Linux Kernel
 +#define PROJECT_INFORMAL  kernel
 +#define VERSION_SYMBOLKERNELVERSION
 +#define AUTOCONF_DEFINE   AUTOCONF_INCLUDED
 +
 +#endif
 diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
 index 1199baf..a5f5102 100644
 --- a/scripts/kconfig/conf.c
 +++ b/scripts/kconfig/conf.c
 @@ -557,8 +557,8 @@ int main(int ac, char **av)
   case ask_silent:
   if (stat(.config, tmpstat)) {
   printf(_(***\n
 - *** You have not yet configured your kernel!\n
 - *** (missing kernel .config file)\n
 + *** You have not yet configured your  
 PROJECT_INFORMAL !\n
 + *** (missing  PROJECT_INFORMAL  .config 
 file)\n
   ***\n
   *** Please run some configurator (e.g. \make 
 oldconfig\ or\n
   *** \make menuconfig\ or \make 
 xconfig\).\n
 @@ -604,7 +604,7 @@ int main(int ac, char **av)
   } else if (conf_get_changed()) {
   name = getenv(KCONFIG_NOSILENTUPDATE);
   if (name  *name) {
 - fprintf(stderr, _(\n*** Kernel configuration requires 
 explicit update.\n\n));
 + fprintf(stderr, _(\n***  PROJECT  configuration 
 requires explicit update.\n\n));
   return 1;
   }
   } else
 @@ -615,12 +615,12 @@ int main(int ac, char **av)
   check_conf(rootmenu);
   } while (conf_cnt);
   if (conf_write(NULL)) {
 - fprintf(stderr, _(\n*** Error during writing of the kernel 
 configuration.\n\n));
 + fprintf(stderr, _(\n*** Error during writing of the  
 PROJECT_INFORMAL  configuration.\n\n));
   return 1;
   }
  skip_check:
   if (input_mode == ask_silent  conf_write_autoconf()) {
 - fprintf(stderr, _(\n*** Error during writing of the kernel 
 configuration.\n\n));
 + fprintf(stderr, _(\n*** Error during writing of the  
 PROJECT_INFORMAL  configuration.\n\n));
   return 1;
   }
  
 diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
 index 664fe29..06366ed 100644
 --- a/scripts/kconfig/confdata.c
 +++ b/scripts/kconfig/confdata.c
 @@ -416,7 +416,7 @@ int conf_write(const char *name)
   if (!out)
   return 1;
  
 - sym = sym_lookup(KERNELVERSION, 0);
 + sym = sym_lookup(VERSION_SYMBOL, 0);
   sym_calc_value(sym);
   time(now);
   env = getenv(KCONFIG_NOTIMESTAMP);
 @@ -425,7 +425,7 @@ int conf_write(const char *name)
  
   fprintf(out, _(#\n
  # Automatically generated make config: don't edit\n
 -# Linux kernel version: %s\n
 +#  PROJECT  version: %s\n
  %s%s
  #\n),
sym_get_string_value(sym),
 @@ -672,21 +672,21 @@ int conf_write_autoconf(void)
   return 1;
   }
  
 - sym = sym_lookup(KERNELVERSION, 0);
 + sym = sym_lookup(VERSION_SYMBOL, 0);
   sym_calc_value(sym);
   time(now);
   fprintf(out, #\n
# Automatically generated make config: don't edit\n
 -  # Linux kernel version: %s\n
 +  #  PROJECT  version: %s\n
# %s

Re: [kbuild-devel] [rfe] easier customization of kconfig for non-Linux projects

2007-05-24 Thread Mike Frysinger
On Thursday 24 May 2007, Sam Ravnborg wrote:
 The intent with this is clear but the solution you suggest albeit simple
 does not really match where we could end up with kconfig.
 Recently Roman added support for options in the kconfig language
 and I would assume we could deal with most of this just using options.

that certainly sounds nicer :)

 One example could be to support options for the mainmenu entrye like this:

 mainmenu Busybow config system
   option project=Busybox
   option version=$VERSION   = Where '$' signify an environment variable

this is doable now ?  if so, i'll test it out in uClibc ...

 In this way we could later distribute kconfig as a binary instead
 of building it into the source as today.

not entirely sure how useful that'd be unless you mean as a completely sep 
package that distributions would include ...
-mike


signature.asc
Description: This is a digitally signed message part.
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
kbuild-devel mailing list
kbuild-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kbuild-devel


Re: [kbuild-devel] [rfe] easier customization of kconfig for non-Linux projects

2007-05-24 Thread Sam Ravnborg
On Thu, May 24, 2007 at 09:23:40AM -0400, Mike Frysinger wrote:
 On Thursday 24 May 2007, Sam Ravnborg wrote:
  The intent with this is clear but the solution you suggest albeit simple
  does not really match where we could end up with kconfig.
  Recently Roman added support for options in the kconfig language
  and I would assume we could deal with most of this just using options.
 
 that certainly sounds nicer :)
 
  One example could be to support options for the mainmenu entrye like this:
 
  mainmenu Busybow config system
  option project=Busybox
  option version=$VERSION   = Where '$' signify an environment variable
 
 this is doable now ?  if so, i'll test it out in uClibc ...
No - it was just a proposal.
Would like to have a word from Roman before looking deeper into it.

Sam

-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
kbuild-devel mailing list
kbuild-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kbuild-devel


Re: [kbuild-devel] [rfe] easier customization of kconfig for non-Linux projects

2007-05-24 Thread Yann E. MORIN
Hello all!

Sorry to jump into the discussion, but...

On Thursday 24 May 2007 08:40, Sam Ravnborg wrote:
 The intent with this is clear but the solution you suggest albeit simple
 does not really match where we could end up with kconfig.
 Recently Roman added support for options in the kconfig language
 and I would assume we could deal with most of this just using options.
 
 One example could be to support options for the mainmenu entrye like this:
 
 mainmenu Busybow config system
   option project=Busybox
   option version=$VERSION   = Where '$' signify an environment variable

I would rather suggest a kind of 'namespace' thing. This way, one could use
the kconfig language for a project (eg. buildroot) and include sub-Kconfig
files from other sub-projects (eg. kernel), thus making all configurable
from the same menu.

Something like (syntax proposal):

8
mainmenu Buildroot config system
option prefix== prefix to config options

config foo  = foo=y/   # foo is not set
blah blah blah...

namespace Buildroot options
option project=Buildroot
option version=${VERSION} = To avoid $VERSION_test ambiguity
option prefix=BR2_= prefix to config options

config bar  = BR2_bar=y   /   # BR2_bar is not set
blah blah blah...

endnamespace

namespace Linux Kernel options
option project=Linux
option version=...
option prefix=CONFIG_

include ${BR2_KERNEL_DIR}/arch/${BR2_ARCH]/Kconfig

endnamespace
8

Then with a simple grep -E '^CONFIG_' one can easily extract the kernel
options from the others.

We _may_ need to support nested namespaces also, concatenating the prefixes.

I once tried to do such thing, but I'm lacking good lex/yacc fu, and I
miserably failed... :-(

Comments?

Regards,
Yann E. MORIN.

-- 
.-..--..
|  Yann E. MORIN  | Real-Time Embedded | /\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN |   ^|
| --== °_° ==-- °.---:  X  AGAINST  |  /e\  There is no  |
| http://ymorin.is-a-geek.org/ | (*_*) | / \ HTML MAIL|conspiracy.  |
°--°---°--°°


-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
___
kbuild-devel mailing list
kbuild-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kbuild-devel


Re: [kbuild-devel] vmlinux.lds not marked for update when building on OS X and changing config options

2007-05-24 Thread Mike Frysinger

lovely ... looks like Darwin fails at life when it comes to respecting
POSIX and open() with O_TRUNC and a 0 byte file ... in particular,
this statement:

http://www.opengroup.org/onlinepubs/009695399/functions/open.html
If O_TRUNC is set and the file did previously exist, upon successful
completion, open() shall mark for update the st_ctime and st_mtime
fields of the file.

on OS X, if the file is 0 bytes and the file is opened with O_TRUNC,
it only updates st_ctime ... if the file is more than 0 bytes, then it
will correctly updated st_ctime and st_mtime ... ive attached my test
case if anyone is interested

the machine i'm testing on:
$ uname -a
Darwin Blackfin-Linux-Mac-Mini.local 8.9.0 Darwin Kernel Version
8.9.0: Thu Feb 22 20:54:07 PST 2007; root:xnu-792.17.14~1/RELEASE_PPC
Power Macintosh powerpc

the filesystem is default OS X HFS+ with case sensitivity enabled

i hate to ask this, but would you consider adding an unlink() or a
write() to conf_split_config() in scripts/kconfig/confdata.c ?  if you
want to tell me to blow it out my ass, that's OK :)

Signed-off-by: Mike Frysinger [EMAIL PROTECTED]
---
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -607,6 +607,7 @@ int conf_split_config(void)
strcpy(d, .h);

/* Assume directory path already exists. */
+   unlink(path); /* hack for non-POSIX compliant systems (Darwin) 
*/
fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd == -1) {
if (errno != ENOENT) {
#include sys/types.h
#include sys/stat.h
#include fcntl.h
#include stdio.h
#include stdlib.h
#include unistd.h
#include assert.h

void timestest(size_t num_bytes)
{
	const char *tempfile = MOO_MOO;
	struct stat st1, st2;
	int fd, ret;

	/* punt the file and then create a 0 byte file and get its times */
	printf(getting first times ...\n);
	unlink(tempfile);

	fd = open(tempfile, O_WRONLY | O_CREAT | O_TRUNC, 0644);
	assert(fd = 0);
	if (num_bytes)
		write(fd, tempfile, num_bytes);
	close(fd);

	ret = stat(tempfile, st1);
	assert(ret == 0);

	/* sleep a little to make there is a difference in the times */
	printf(sleeping for three seconds ...\n);
	sleep(3);

	/* open the file again and grab the new file times */
	printf(getting second times ...\n);
	fd = open(tempfile, O_WRONLY | O_CREAT | O_TRUNC, 0644);
	assert(fd = 0);
	close(fd);

	ret = stat(tempfile, st2);
	assert(ret == 0);

	unlink(tempfile);

	/* each of these should be different (except for atime if you
	 * mount your filesystem with atime turned off)
	 */
#define comp(member) (st1.member == st2.member ? same : diff)
	printf(the following times should all be different\n(atime can be the same if you have filesystem mounted noatime)\n);
	printf(atime: %lu vs %lu (%s)\n
	   mtime: %lu vs %lu (%s)\n
	   ctime: %lu vs %lu (%s)\n,
	   st1.st_atime, st2.st_atime, comp(st_atime),
	   st1.st_mtime, st2.st_mtime, comp(st_mtime),
	   st1.st_ctime, st2.st_ctime, comp(st_ctime));

	printf(\n);
}

int main(int argc, char *argv[])
{
	printf(testing truncation with a 0 byte file\n);
	timestest(0);

	printf(testing truncation with a 4 byte file\n);
	timestest(4);

	return 0;
}
-
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/___
kbuild-devel mailing list
kbuild-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kbuild-devel