Re: [kbuild-devel] vmlinux.lds not marked for update when building on OS X and changing config options
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
Re: [kbuild-devel] vmlinux.lds not marked for update when building on OS X and changing config options
On Mon, May 21, 2007 at 05:08:23PM -0400, Mike Frysinger wrote: i'm not terribly familiar with the kconfig/kbuild system so i'm looking for some pointers so i can track down the root cause here ... some people like to cross-compile the Blackfin kernel on OS X hosts and we noticed that in some cases the vmlinux.lds linker script is not properly regenerated when changing some options in the kernel config menu ... it works just fine on all our Linux hosts :) linux/arch/blackfin/kernel/vmlinux.lds.S has this: MEMORY { ram : ORIGIN = CONFIG_BOOT_LOAD, ... and in linux/arch/blackfin/Kconfig, we have: config BOOT_LOAD hex Kernel load address default 0x1000 if vmlinux.lds does not exist yet, running `make` generates the proper file. but if we do `make menuconfig` and update just BOOT_LOAD to say 0x4000 and then run `make`, vmlinux.lds is not regenerated. doing `rm -f` on vmlinux.lds and re-running `make` once again produces the correct file any pointers on where to dig ? :) The file arch/blackfin/kernel/.vmlinux.lds.cmd should look like this: cmd_arch/i386/kernel/vmlinux.lds := i686-unknown-linux-gnu-gcc -m32 -E -Wp,-MD,arch/i386/kernel/.vmlinux.lds.d -nostdinc -isystem /opt/crosstool/gcc-4.1.0-glibc-2.3.6/i686-unknown-linux-gnu/lib/gcc/i686-unknown-linux-gnu/4.1.0/include -D__KERNEL__ -I/home/sam/kernel/kbuild-fix.git/include -Iinclude -I/home/sam/kernel/kbuild-fix.git/include2 -Iinclude2 -I/home/sam/kernel/kbuild-fix.git/include -include include/linux/autoconf.h -P -C -Ui386 -D__ASSEMBLY__ -o arch/i386/kernel/vmlinux.lds /home/sam/kernel/kbuild-fix.git/arch/i386/kernel/vmlinux.lds.S deps_arch/i386/kernel/vmlinux.lds := \ /home/sam/kernel/kbuild-fix.git/arch/i386/kernel/vmlinux.lds.S \ $(wildcard include/config/blk/dev/initrd.h) \ /home/sam/kernel/kbuild-fix.git/include/asm-generic/vmlinux.lds.h \ include2/asm/thread_info.h \ $(wildcard include/config/4kstacks.h) \ $(wildcard include/config/debug/stack/usage.h) \ /home/sam/kernel/kbuild-fix.git/include/linux/compiler.h \ Could you please check this. The line that says: deps_arch/blackfin/kernel/vmlinux.lds := \ list all the files that the .lds file is dependent on (the prerequisites). For the config option BOOT_LOAD look for include/config/boot/load Check that this file gets properly update on OS X. 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
[kbuild-devel] vmlinux.lds not marked for update when building on OS X and changing config options
i'm not terribly familiar with the kconfig/kbuild system so i'm looking for some pointers so i can track down the root cause here ... some people like to cross-compile the Blackfin kernel on OS X hosts and we noticed that in some cases the vmlinux.lds linker script is not properly regenerated when changing some options in the kernel config menu ... it works just fine on all our Linux hosts :) linux/arch/blackfin/kernel/vmlinux.lds.S has this: MEMORY { ram : ORIGIN = CONFIG_BOOT_LOAD, ... and in linux/arch/blackfin/Kconfig, we have: config BOOT_LOAD hex Kernel load address default 0x1000 if vmlinux.lds does not exist yet, running `make` generates the proper file. but if we do `make menuconfig` and update just BOOT_LOAD to say 0x4000 and then run `make`, vmlinux.lds is not regenerated. doing `rm -f` on vmlinux.lds and re-running `make` once again produces the correct file any pointers on where to dig ? :) -mike - 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