Subject: Re: kernel compiles using objdir?
To: None <tech-toolchain@netbsd.org>
From: Simon J. Gerraty <sjg@quick.com.au>
List: tech-toolchain
Date: 04/29/2000 01:28:31
> "Simon J. Gerraty" <sjg@zen.quick.com.au> writes:
> Well after 15 hours, my make release died:
> ...
> `test.o' is up to date.
> (cd /u3/NetBSD/current/src/distrib/miniroot/../../bin/pwd; make pwd.o)
> `pwd.o' is up to date.
> cc -O2 -Werror   -nostdinc -idirafter /NetBSD/install/usr/include -c instbin.c
> echo "int _crunched_sysinst_stub(int argc, char **argv, char **envp){return main(argc,argv,envp);}" >sysinst_stub.c
> cc -O2 -Werror   -nostdinc -idirafter /NetBSD/install/usr/include -c sysinst_stub.c
> make: don't know how to make /u3/NetBSD/current/src/distrib/miniroot/../../distrib/utils/sysinst/arch/sparc/menu_defs.o. Stop
> *** Error code 2
> ...
> Stop.
> 55820.86s real 30588.39s user 7360.67s system 

This turns out to be a problem with crunchgen needing to grok
MAKEOBJDIRPREFIX (just as it already groks obj.${MACHINE} and obj).
The patch below, gets us past that issue, and a make in miniroot then
gets as far as:

SYMLINK /tmp/fstab.shadow               etc/fstab
SYMLINK /tmp/resolv.conf.shadow         etc/resolv.conf
SYMLINK /tmp/hosts                      etc/hosts
LINK    instbin                         sysinst
COPY    ${ARCHDIR}/dot.profile          .profile
COPY    ${ARCHDIR}/../install.md        install.md
COPY    ${DESTDIR}/usr/mdec/boot        boot
SPECIAL sync; ${DESTDIR}/usr/mdec/binstall -m${DESTDIR}/usr/mdec -v ffs ${TARGDIR}
This script has to be run when the kernel is in 'insecure' mode.
The best way is to run this script in single-user mode.
*** Error code 1


Now I can't believe that we are all supposed to run "make release" on
machines in 'insecure' mode or in single-user, so I'll assume this is
a bug?

Anyway here's the patch for crunchgen.
If anyone sees anything evil please scream.

--sjg


Index: crunchgen/crunchgen.c
===================================================================
RCS file: /cvsroot/basesrc/usr.bin/crunch/crunchgen/crunchgen.c,v
retrieving revision 1.15
diff -u -p -r1.15 crunchgen.c
--- crunchgen.c	2000/04/14 06:11:07	1.15
+++ crunchgen.c	2000/04/28 15:23:15
@@ -498,6 +498,7 @@ void fillin_program(prog_t *p)
 {
     char path[MAXPATHLEN];
     char *srcparent;
+    char *cp;
     strlst_t *s;
 
     (void)snprintf(line, sizeof(line), "filling in parms for %s", p->name);
@@ -514,16 +515,23 @@ void fillin_program(prog_t *p)
 	}
     }
     if(!p->objdir && p->srcdir) {
-	(void)snprintf(path, sizeof(path), "%s/obj.%s", p->srcdir, machine);
-	if(is_dir(path))
-	    p->objdir = strdup(path);
-	else {
-	    (void)snprintf(path, sizeof(path), "%s/obj", p->srcdir);
+	if ((cp = getenv("MAKEOBJDIRPREFIX"))) {
+	    (void)snprintf(path, sizeof(path), "%s/%s", cp, p->srcdir);
 	    if(is_dir(path))
 		p->objdir = strdup(path);
-	    else
-	        p->objdir = p->srcdir;
-        }
+	}
+	if (!p->objdir) {
+	    (void)snprintf(path, sizeof(path), "%s/obj.%s", p->srcdir, machine);
+	    if(is_dir(path))
+		p->objdir = strdup(path);
+	    else {
+		(void)snprintf(path, sizeof(path), "%s/obj", p->srcdir);
+		if(is_dir(path))
+		    p->objdir = strdup(path);
+		else
+		    p->objdir = p->srcdir;
+	    }
+	}
     }
 
     if(p->srcdir)