Subject: -current kernel on a SPARC
To: None <current-users@sun-lamp.cs.berkeley.edu,>
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
List: current-users
Date: 07/13/1994 16:36:25
I took a freshly supped source tree (as of last night) and tried to
build a SPARC kernel.  The user level I'm working from is somewhat old;
it corresponds to the binary snapshot before the most recent one.

Starting with the freshly supped source tree, I rebuilt config.new
(well, first I did a false start that ended with ufs_mountroot
undefined, and I discovered that config.new was the reason, so I
carefully threw it away and started over with a config.new from the
same sup run as the kernel source I was using).  Then I did

	cd /sys/arch/sparc/conf
	config.new TDR2
	cd ../compile/TDR2
	( std ; make depend && make -k )

where "std" is an alias that removes all the customizations from my
path and environment.  The output is of course large (the file is
105067 bytes), but the relevant portions are fairly small:

....
	cc  -c -I. -I../../../../arch -I../../../.. -I../../../../sys -DSUN4C -DTIMEZONE="0x1e0" -DDST="1" -DSWAPPAGER -DVNODEPAGER -DDEVPAGER -DKTRACE -DGDB -DKGDBDEV="0xc01" -DKGDBRATE="0x9600" -DRCONSOLE -DSYSVMSG -DSYSVSEM -DCOMPAT_09 -DFFS -DNFSSERVER -DNFSCLIENT -DINET -DTCP_COMPAT_42 -DCOMPAT_43 -DLKM -DCOMPAT_SUNOS -DKERNEL  -DMAXUSERS=8 ../../../../arch/sparc/sparc/pmap.c
	../../../../arch/sparc/sparc/pmap.c: In function `PMPID':
	../../../../arch/sparc/sparc/pmap.c:781: warning: assignment discards `volatile' from pointer target type
....
	making sure the kern library is up to date...
....
	echo 'building rem.S from divrem.m4'
	building rem.S from divrem.m4
	(echo "define(NAME,\`.rem')define(OP,\`rem')define(S,\`true')";  cat divrem.m4) | m4 > rem.S
	cat: divrem.m4: No such file or directory
	chmod 444 rem.S
	cpp -E -I/sources/working-usr-src/sys/lib/libkern -Imachine/.. -I. -I/sources/working-usr-src/sys/lib/libkern/../.. -I/sources/working-usr-src/sys/lib/libkern/arch/sparc -I/sources/working-usr-src/sys/lib/libkern/../../../lib/libc/arch/sparc rem.S |  as -o rem.o
	ld: bad string table size in rem.o
	*** Error code 1 (continuing)
	echo 'building sdiv.S from divrem.m4'
	building sdiv.S from divrem.m4
	(echo "define(NAME,\`.div')define(OP,\`div')define(S,\`true')";  cat divrem.m4) | m4 > sdiv.S
	cat: divrem.m4: No such file or directory
	chmod 444 sdiv.S
	cpp -E -I/sources/working-usr-src/sys/lib/libkern -Imachine/.. -I. -I/sources/working-usr-src/sys/lib/libkern/../.. -I/sources/working-usr-src/sys/lib/libkern/arch/sparc -I/sources/working-usr-src/sys/lib/libkern/../../../lib/libc/arch/sparc sdiv.S |  as -o sdiv.o
	ld: bad string table size in sdiv.o
	building udiv.S from divrem.m4
	cat: divrem.m4: No such file or directory
	*** Error code 1 (continuing)
	cpp -E -I/sources/working-usr-src/sys/lib/libkern -Imachine/.. -I. -I/sources/working-usr-src/sys/lib/libkern/../.. -I/sources/working-usr-src/sys/lib/libkern/arch/sparc -I/sources/working-usr-src/sys/lib/libkern/../../../lib/libc/arch/sparc udiv.S |  as -o udiv.o
	ld: bad string table size in udiv.o
	building urem.S from divrem.m4
	cat: divrem.m4: No such file or directory
	*** Error code 1 (continuing)
	cpp -E -I/sources/working-usr-src/sys/lib/libkern -Imachine/.. -I. -I/sources/working-usr-src/sys/lib/libkern/../.. -I/sources/working-usr-src/sys/lib/libkern/arch/sparc -I/sources/working-usr-src/sys/lib/libkern/../../../lib/libc/arch/sparc urem.S |  as -o urem.o
	ld: bad string table size in urem.o
	*** Error code 1 (continuing)
....
	cpp -E -DPROF -I/sources/working-usr-src/sys/lib/libkern -Imachine/.. -I. -I/sources/working-usr-src/sys/lib/libkern/../.. -I/sources/working-usr-src/sys/lib/libkern/arch/sparc -I/sources/working-usr-src/sys/lib/libkern/../../../lib/libc/arch/sparc rem.S |  as -o rem.po
	ld: bad string table size in rem.po
	*** Error code 1 (continuing)
	cpp -E -DPROF -I/sources/working-usr-src/sys/lib/libkern -Imachine/.. -I. -I/sources/working-usr-src/sys/lib/libkern/../.. -I/sources/working-usr-src/sys/lib/libkern/arch/sparc -I/sources/working-usr-src/sys/lib/libkern/../../../lib/libc/arch/sparc sdiv.S |  as -o sdiv.po
	ld: bad string table size in sdiv.po
	*** Error code 1 (continuing)
	cpp -E -DPROF -I/sources/working-usr-src/sys/lib/libkern -Imachine/.. -I. -I/sources/working-usr-src/sys/lib/libkern/../.. -I/sources/working-usr-src/sys/lib/libkern/arch/sparc -I/sources/working-usr-src/sys/lib/libkern/../../../lib/libc/arch/sparc udiv.S |  as -o udiv.po
	ld: bad string table size in udiv.po
	*** Error code 1 (continuing)
	cpp -E -DPROF -I/sources/working-usr-src/sys/lib/libkern -Imachine/.. -I. -I/sources/working-usr-src/sys/lib/libkern/../.. -I/sources/working-usr-src/sys/lib/libkern/arch/sparc -I/sources/working-usr-src/sys/lib/libkern/../../../lib/libc/arch/sparc urem.S |  as -o urem.po
	ld: bad string table size in urem.po
	*** Error code 1 (continuing)
....
	cp mcount.o mcount.po
	`all' not remade because of errors.
....
	loading netbsd
	ld: No such file or directory for /sources/working-usr-src/sys/lib/libkern/libkern.a
	*** Error code 1 (continuing)
	`all' not remade because of errors.

So I went poking around, and found divrem.m4 in
sys/lib/libkern/arch/sparc.  So I then did:

	cd /sys/lib/libkern
	ln -s arch/sparc/divrem.m4 .
	rm {rem,sdiv,urem,udiv}.{S,o,po}
	cd /sys/arch/sparc/compile/TDR2
	make -k

and this time I got a kernel.  It appears to work fine, except that
it's not compatible with a few user-level programs like route(8); I'm
now doing a full make in /usr/src to get user-level binaries from the
same source tree.  I'll report on any problems I encounter.  In the
meantime, someone who knows the philosophy behind the make setup might
want to figure out what lib/libkern should do about divrem.m4.  It
might also be good to fix arch/sparc/sparc/pmap.c so the compiler
doesn't whine about volatile.

					der Mouse

			    mouse@collatz.mcrcim.mcgill.edu

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