Subject: re: Probs compiling kernel
To: None <Pasi.Pirhonen@helsinki.fi>
From: Terry R. Friedrichsen <terry@venus.sunquest.com>
List: port-pmax
Date: 12/01/1994 09:00:10
I have appended my step-by-step instructions for compiling NetBSD from
the sources under Ultrix.  You'll find the answer to your specific
question in step 18, I believe.

The resulting kernel boots on my Personal DECstation 5000/25, and ap-
parently finds /sbin/init and /bin/sh, but then hangs (I haven't had
time to work much on figuring out why).

Terry R. Friedrichsen

terry@venus.sunquest.com  (Internet)
uunet!sunquest!terry      (Usenet)
terry@sdsc.edu            (alternate address; I live in Tucson)


---------------------------------------------------------------------------

	Building NetBSD from sources under Ultrix

0)  create a directory somewhere called pmax to old all this stuff
	(we'll call that directory $(TOP) from now on)

1)  cd $(TOP)

2)  get config.tar.gz, sys.tar.gz, and include.tar.gz from sun-lamp
	(don't forget to use binary mode)

3)  gzcat config.tar.gz | tar -xvf -
	(this creates src/usr.sbin/config/...)

4)  cd src/usr.sbin/config
    pmake (new Berkeley make)  

5)  cd $(TOP)
    gzcat sys.tar.gz | tar -xvf -
	(this creates src/sys/... and eats up 21 MB of disk space)

6)  cd src/sys/arch
    rm -rf amiga da30 hp300 i386 m68k mac68k pc532 sparc sun3 vax
	(optional - buys back 12.5 MB of disk)
    
7)  cd $(TOP)
    gzcat include.tar.gz | tar -xvf -
	(this creates src/include/... - we'll need this in step 14)

8)  cd src

9)  apply Jonathan Stone patches
	patch < whereever/stone-patches

9.1)  problem:
	Patching file sys/arch/pmax/dev/if_le.c using Plan A...
	Reversed (or previously applied) patch detected!  Assume -R? [y]
      fix:  answer 'n' and do not apply this patch

9.2)  problem:
	Patching file sys/arch/pmax/pmax/autoconf.c using Plan A...
	Hunk #1 failed at 38.
      fix:  just ignore this

10)  apply Ted Lemon clock patch
	patch < whereever/lemon-clock-patch

11)  cd sys/lib/libkern

12)  edit the Makefile
	add "-G 0" to CFLAGS
		(avoids R_GPREL loader errors)
	change "-I/machine/.." to "-Imachine/." in CFLAGS definition
		(so limits.h can be found by quad.h)

13)  cd arch
     mkdir pmax
     cp mips/Makefile.inc pmax
	(do this so as to reserve "arch/mips" for MIPSco boxes, keeping
	 them separate from the DEC pmax-style boxes)
     cd ..

14)  cp ../../../include/string.h .
	(I don't know where this is supposed to live, but it isn't anywhere
	 the Makefile tells gcc to look)

15)  pmake CC="gcc -nostdinc" MACHINE=pmax MACHINE_ARCH=pmax NOPROFILE=1

	this should build libkern.a successfully

16)  cp libkern.a ../../arch/pmax/compile

17)  edit src/sys/kern/vnode_if.sh
	comment out "awk=${AWK:-awk}"
	add "awk=nawk" after the commented-out line
	(yes, you could do this in other ways; the point is that we need
	 to run nawk to avoid "bad substitution" errors in make depend)

18)  cd src/sys/compat/ultrix
     chmod 755 makesyscalls.sh
     makesyscalls.sh syscalls.master
	(avoids sun_mount undefined symbol when loading kernel)

19)  cd src/sys/arch/pmax/conf

20)  create MAXINE (e. g.) from GENERIC

21)  config MAXINE (this is the config program built in step 0)

22)  cd ../compile/MAXINE

23)  pmake depend

23.1)  problem:  _POSIX_VDISABLE redefined in unistd.h and termios.h
       fix:  no action taken

	dependencies should build successfully

24)  pmake

24.1)  problem:
	as1: Warning: ../../pmax/locore.s, line 2257: nop required
			0x40851000      mtc0    $5,tlblo
			0x04400000      bltz    $2,0
       fix:  no action taken

24.2)  problem:
	../../../../kern/kern_exit.c: In function `exit':
	../../../../kern/kern_exit.c:90: warning: `volatile' function does return
       fix:  no action taken

24.3)  problem:
	../../../../kern/sys_process.c: In function `ptrace':
	../../../../kern/sys_process.c:198: warning: cast from pointer to integer of different size
       fix:  no action taken, but it sounds rather serious

24.4)  problem:  millions of
	../../../../arch/pmax/pmax/conf.c:101: warning: initialization from incompatible pointer type
       fix:  no action taken

	this successfully builds the kernel (whether it works or not is
	another story)

On my Personal DECstation 5000/25, running headless with no graphics adapter,
the resulting kernel boots and runs until a "no init" panic.