Possible to build 9-stable kernel on 8.2?

Jeremy Chadwick freebsd at jdc.parodius.com
Wed Nov 16 01:32:15 UTC 2011


On Tue, Nov 15, 2011 at 07:29:44PM -0500, Glen Barber wrote:
> Hi,
> 
> On Tue, Nov 15, 2011 at 11:45:02AM -0800, Chuck Tuffli wrote:
> > Is it possible to do a buildkernel of 9-stable (r227536) on a stock
> > 8.2 system? Most of it seems to work, but the linker fails towards the
> > end with
> > 
> > ...
> > MAKE=make sh /usr/home/ctuffli/dev/releng_9/src/sys/conf/newvers.sh GENERIC
> > /usr/local/bin/svnversion
> > cc -c -O2 -frename-registers -pipe -fno-strict-aliasing  -std=c99 -g
> > -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes
> > -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef
> > -Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs
> > -fdiagnostics-show-option -nostdinc  -I.
> > -I/usr/home/ctuffli/dev/releng_9/src/sys
> > -I/usr/home/ctuffli/dev/releng_9/src/sys/contrib/altq -D_KERNEL
> > -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h -fno-common
> > -finline-limit=8000 --param inline-unit-growth=100 --param
> > large-function-growth=1000  -fno-omit-frame-pointer -mno-sse
> > -mcmodel=kernel -mno-red-zone -mno-mmx -msoft-float
> > -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector
> > -Werror  vers.c
> > linking kernel.debug
> > ld:/usr/home/ctuffli/dev/releng_9/src/sys/conf/ldscript.amd64:9: syntax error
> > *** Error code 1
> > 
> > Stop in /usr/home/ctuffli/dev/releng_9/obj/usr/home/ctuffli/dev/releng_9/src/sys/GENERIC.
> > *** Error code 1
> > 
> > Stop in /usr/home/ctuffli/dev/releng_9/src.
> > *** Error code 1
> > 
> > Stop in /usr/home/ctuffli/dev/releng_9/src.
> 
> You'll need to do 'buildworld' first.

Not to mention, one should always do buildworld first.  The absolute
correct procedure is outlined in /usr/src/Makefile:

#  1.  `cd /usr/src'       (or to the directory containing your source tree).
#  2.  `make buildworld'
#  3.  `make buildkernel KERNCONF=YOUR_KERNEL_HERE'     (default is GENERIC).
#  4.  `make installkernel KERNCONF=YOUR_KERNEL_HERE'   (default is GENERIC).
#       [steps 3. & 4. can be combined by using the "kernel" target]
#  5.  `reboot'        (in single user mode: boot -s from the loader prompt).
#  6.  `mergemaster -p'
#  7.  `make installworld'
#  8.  `make delete-old'
#  9.  `mergemaster'            (you may wish to use -i, along with -U or -F).
# 10.  `reboot'
# 11.  `make delete-old-libs' (in case no 3rd party program uses them anymore)

People (not you Glen :-) ) need to realise that doing buildworld
actually builds the necessary "build toolchain" used for the buildkernel
portion (the results are in /usr/obj).  Failure to do that results in
the buildkernel bits using the already-installed-on-the-system
compiler/build toolchain (e.g. the stuff in /usr), which may not be
compatible with the version of the kernel source you're trying to build.
Hope this makes sense to readers.

Two "extra steps" which I do:

- Before step 1, I do rm -fr /usr/obj/*
- Before step 7, I do rm -fr /usr/share/man/*

Step 1 is a precaution, and step 7 ensures that no old/leftover
compressed man pages (from old versions of software) are retained.
If needed/asked, Doug Barton can talk a bit more about the latter.

-- 
| Jeremy Chadwick                                jdc at parodius.com |
| Parodius Networking                       http://www.parodius.com/ |
| UNIX Systems Administrator                   Mountain View, CA, US |
| Making life hard for others since 1977.               PGP 4BD6C0CB |



More information about the freebsd-stable mailing list