*BSD News Article 6000


Return to BSD News archive

Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!spool.mu.edu!darwin.sura.net!convex!bcm!rice!news.Rice.edu!rich
From: rich@Rice.edu (Richard Murphey)
Subject: Bare minimum steps for recompiling the 386BSD kernel for XFree86
Message-ID: <RICH.92Oct3175851@kappa.Rice.edu>
Sender: news@rice.edu (News)
Reply-To: Rich@rice.edu
Organization: Department of Electrical and Computer Engineering, Rice
	University
Date: Sat, 3 Oct 1992 23:58:51 GMT
Lines: 272


Here is a step-by-step example of the bare minimum needed to configure
a 386bsd kernel with XFree86 support.  If you plan to go any farther,
take a look at Terry Lambert's patch kit instead.  Terry's kit
includes all of the patches used here.  For more info on configuring
kernels, look at chapter 2 of the system maintainers manual
(in /usr/othersrc/share/doc/smm/02.config).

Create a copy of the /sys/compile/GENERICISA directory where the
kernel with be built.

        cd /sys/compile
        mkdir XGENERICISA
        cd XGENERICISA

cp will complain about 'machine'.  Recreate it using ln:

        ln -s ../../i386/include machine

Next copy over the files that need to be modified.
                                                                  
        cp /usr/src/sys.386bsd/i386/isa/com.c .
        cp /usr/src/sys.386bsd/i386/i386/cons.c .
        cp /usr/src/sys.386bsd/kern/kern_execve.c .
        cp /usr/src/sys.386bsd/i386/i386/locore.s .
        cp /usr/src/sys.386bsd/i386/i386/machdep.c .
        cp /usr/src/sys.386bsd/i386/isa/pccons.c .

Patches for each of these files is included with the binary
distribution for XFree86 1.1.  If XFree86 has already been installed
in /usr/X386 then they should be in /usr/X386/lib/X11/etc/386bsd.patch.
Extract the patches.

        sh /usr/X386/lib/X11/etc/386bsd.patch

This will create the file README and  files *.diff, one for each
source file that is modified.   README describes the patches.
Patch each of the source files:

        patch -p <com.diff
        patch -p <cons.diff
        patch -p <kern_execve.diff
        patch -p <locore.diff
        patch -p <machdep.diff
        patch -p <pccons.diff

Skip init.diff.  It's a patch for the init program, not the kernel,
and is handled later.  Cut out the patch below for the makefile and
apply it.  It changes the Makefile so that the modified files are
compiled in rather than the distribution files.  It also includes
Chris Demetriou's fixes for the order of loading and creating vers.o.

        make depend
        make

Then install the new kernel:

        mv /386bsd /386bsd.alt
        cp 386bsd /386bsd


/sbin/init also needs to be patched:

        cd /usr/src/sbin/init
        patch -p </sys/compile/XGENERICISA/init.diff
        make
        mv /sbin/init /sbin/init~
        make install

Assuming you have already run /usr/X386/lib/X11/etc/x386install.  You
should already have created /dev/vga and changed `console' to `vga' in
/etc/ttys so that the X server will interact properly with the console
login session.

/usr/X386/lib/X11/etc/README and README.386BSD have more details
and pointers to information on configuring and installing XFree86.

Rich


----------------------------------------------------------------
*** Makefile.dist	Tue Aug 11 15:15:48 1992
--- Makefile	Sat Oct  3 15:42:41 1992
***************
*** 1,4 ****
! IDENT=-DGENERICISA -Di386 -DTCP_COMPAT_42 -DCOMPAT_43 -DNFS -DISOFS -DINET
  PARAM=-DTIMEZONE=480 -DDST=1 -DMAXUSERS=10
  # Copyright 1990 W. Jolitz
  # @(#)Makefile.i386	7.1 5/10/91
--- 1,4 ----
! IDENT=-DXGENERICISA -Di386 -DTCP_COMPAT_42 -DCOMPAT_43 -DNFS -DISOFS -DINET -DXSERVER -DUCONSOLE
  PARAM=-DTIMEZONE=480 -DDST=1 -DMAXUSERS=10
  # Copyright 1990 W. Jolitz
  # @(#)Makefile.i386	7.1 5/10/91
***************
*** 22,34 ****
  #
  TOUCH=	touch -f -c
  LD=	/usr/bin/ld
! CC=	cc 
  CPP=	cpp
  
  S=	../..
  I386=	../../i386
  
! INCLUDES= -I. -I$S -I$S/sys
  COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
  ASFLAGS=
  CFLAGS=	-O ${COPTS}
--- 22,34 ----
  #
  TOUCH=	touch -f -c
  LD=	/usr/bin/ld
! CC=	/bin/cc 
  CPP=	cpp
  
  S=	../..
  I386=	../../i386
  
! INCLUDES= -I. -I$S -I$S/sys -I$S/i386/i386
  COPTS=	${INCLUDES} ${IDENT} -DKERNEL -Di386 -DNPX
  ASFLAGS=
  CFLAGS=	-O ${COPTS}
***************
*** 37,47 ****
  NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
  DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
  DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
! SYSTEM_OBJS=locore.o ${OBJS} param.o ioconf.o conf.o vers.o
! SYSTEM_DEP=Makefile symbols.sort ${SYSTEM_OBJS}
! SYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@ ; /sys/conf/newvers.sh ; cc -c vers.c
! SYSTEM_LD= @${LD} -z -T FE000000 -o $@ -X ${SYSTEM_OBJS}
! SYSTEM_LD_TAIL= @echo rearranging symbols; cp $@ orig.$@ ;symorder -t symbols.sort $@; size $@; chmod 755 $@
  
  OBJS=init_main.o init_sysent.o kern_acct.o kern_clock.o kern_descrip.o \
  	kern_execve.o kern_exit.o kern_fork.o kern_kinfo.o kern_ktrace.o \
--- 37,47 ----
  NORMAL_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
  DRIVER_C= ${CC} -c ${CFLAGS} ${PROF} $<
  DRIVER_C_C= ${CC} -c ${CFLAGS} ${PROF} ${PARAM} $<
! SYSTEM_OBJS=locore.o ${OBJS} param.o ioconf.o conf.o
! SYSTEM_DEP=Makefile newvers symbols.sort ${SYSTEM_OBJS}
! SYSTEM_LD_HEAD= 	@echo loading $@; rm -f $@
! SYSTEM_LD= @${LD} -z -T FE000000 -o $@ -X vers.o ${SYSTEM_OBJS}
! SYSTEM_LD_TAIL= @echo rearranging symbols; symorder symbols.sort $@; size $@; chmod 755 $@
  
  OBJS=init_main.o init_sysent.o kern_acct.o kern_clock.o kern_descrip.o \
  	kern_execve.o kern_exit.o kern_fork.o kern_kinfo.o kern_ktrace.o \
***************
*** 114,127 ****
  	$S/isofs/isofs_lookup.c $S/isofs/isofs_node.c \
  	$S/isofs/isofs_util.c $S/isofs/isofs_vfsops.c \
  	$S/isofs/isofs_vnops.c $S/i386/i386/autoconf.c \
! 	$S/i386/i386/cons.c $S/i386/isa/pccons.c $S/i386/isa/clock.c \
! 	$S/i386/i386/in_cksum.c $S/i386/i386/machdep.c \
  	$S/i386/i386/math_emulate.c $S/i386/i386/mem.c \
  	$S/i386/i386/pmap.c $S/i386/i386/sys_machdep.c \
  	$S/i386/i386/trap.c $S/i386/i386/vm_machdep.c \
  	$S/i386/isa/if_ne.c $S/i386/isa/if_we.c $S/i386/isa/if_ec.c \
  	$S/i386/isa/if_is.c $S/i386/isa/wd.c $S/i386/isa/fd.c \
! 	$S/i386/isa/wt.c $S/i386/isa/isa.c $S/i386/isa/com.c \
  	$S/i386/isa/npx.c $S/i386/isa/as.c swap386bsd.c 
  
  386bsd: ${SYSTEM_DEP} swap386bsd.o
--- 114,127 ----
  	$S/isofs/isofs_lookup.c $S/isofs/isofs_node.c \
  	$S/isofs/isofs_util.c $S/isofs/isofs_vfsops.c \
  	$S/isofs/isofs_vnops.c $S/i386/i386/autoconf.c \
! 	./cons.c ./pccons.c $S/i386/isa/clock.c \
! 	$S/i386/i386/in_cksum.c ./machdep.c \
  	$S/i386/i386/math_emulate.c $S/i386/i386/mem.c \
  	$S/i386/i386/pmap.c $S/i386/i386/sys_machdep.c \
  	$S/i386/i386/trap.c $S/i386/i386/vm_machdep.c \
  	$S/i386/isa/if_ne.c $S/i386/isa/if_we.c $S/i386/isa/if_ec.c \
  	$S/i386/isa/if_is.c $S/i386/isa/wd.c $S/i386/isa/fd.c \
! 	$S/i386/isa/wt.c $S/i386/isa/isa.c ./com.c \
  	$S/i386/isa/npx.c $S/i386/isa/as.c swap386bsd.c 
  
  386bsd: ${SYSTEM_DEP} swap386bsd.o
***************
*** 148,157 ****
  	grep -v '^#' ${I386}/i386/symbols.raw \
  	    | sed 's/^	//' | sort -u > symbols.sort
  
! locore.o: assym.s ${I386}/i386/locore.s machine/trap.h machine/psl.h \
  	machine/pte.h vector.s ${I386}/isa/icu.s ${I386}/isa/isa.h \
  	${I386}/isa/icu.h
! 	${CPP} -I. -DLOCORE ${COPTS} ${I386}/i386/locore.s | \
  		${AS} ${ASFLAGS} -o locore.o
  
  # the following is necessary because autoconf.o depends on #if GENERIC
--- 148,157 ----
  	grep -v '^#' ${I386}/i386/symbols.raw \
  	    | sed 's/^	//' | sort -u > symbols.sort
  
! locore.o: assym.s ./locore.s machine/trap.h machine/psl.h \
  	machine/pte.h vector.s ${I386}/isa/icu.s ${I386}/isa/isa.h \
  	${I386}/isa/icu.h
! 	${CPP} -I. -DLOCORE ${COPTS} ./locore.s | \
  		${AS} ${ASFLAGS} -o locore.o
  
  # the following is necessary because autoconf.o depends on #if GENERIC
***************
*** 207,212 ****
--- 207,216 ----
  param.o: param.c Makefile
  	${CC} -c ${CFLAGS} ${PARAM} param.c
  
+ newvers:
+ 	sh $S/conf/newvers.sh ${KERN_IDENT} ${IDENT}
+ 	cc ${CFLAGS} -c vers.c
+ 
  init_main.o: $S/kern/init_main.c
  	${NORMAL_C}
  
***************
*** 564,573 ****
  autoconf.o: $S/i386/i386/autoconf.c
  	${DRIVER_C}
  
! cons.o: $S/i386/i386/cons.c
  	${NORMAL_C}
  
! pccons.o: $S/i386/isa/pccons.c
  	${DRIVER_C}
  
  clock.o: $S/i386/isa/clock.c
--- 568,577 ----
  autoconf.o: $S/i386/i386/autoconf.c
  	${DRIVER_C}
  
! cons.o: ./cons.c
  	${NORMAL_C}
  
! pccons.o: ./pccons.c
  	${DRIVER_C}
  
  clock.o: $S/i386/isa/clock.c
***************
*** 576,582 ****
  in_cksum.o: $S/i386/i386/in_cksum.c
  	${NORMAL_C}
  
! machdep.o: $S/i386/i386/machdep.c
  	${NORMAL_C_C}
  
  math_emulate.o: $S/i386/i386/math_emulate.c
--- 580,586 ----
  in_cksum.o: $S/i386/i386/in_cksum.c
  	${NORMAL_C}
  
! machdep.o: ./machdep.c
  	${NORMAL_C_C}
  
  math_emulate.o: $S/i386/i386/math_emulate.c
***************
*** 621,627 ****
  isa.o: $S/i386/isa/isa.c
  	${DRIVER_C}
  
! com.o: $S/i386/isa/com.c
  	${DRIVER_C}
  
  npx.o: $S/i386/isa/npx.c
--- 625,631 ----
  isa.o: $S/i386/isa/isa.c
  	${DRIVER_C}
  
! com.o: ./com.c
  	${DRIVER_C}
  
  npx.o: $S/i386/isa/npx.c