# RELENG_9 New style kernel compiling not working.



## MaxDev (Nov 26, 2012)

I used the regular way this time:

`make buildkernel KERNCONF=MYCONF` (enabled hwpmc)


```
cc -c -x assembler-with-cpp -DLOCORE -O2 -frename-registers -pipe -fno-strict-aliasing -march=nocona
 -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/src/sys
 -I/usr/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 -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float
  -fno-asynchronous-unwind-tables -ffreestanding -fstack-protector  -Werror /usr/src/sys/amd64/acpica/acpi_switch.S
/usr/src/sys/amd64/acpica/acpi_switch.S: Assembler messages:
/usr/src/sys/amd64/acpica/acpi_switch.S:146: Error: no such instruction: `xsetbv'
/usr/src/sys/amd64/acpica/acpi_switch.S:147: Error: no such instruction: `xrstor (%rbx)'
*** Error code 1

Stop in /usr/obj/usr/src/sys/CUSTOMKERNEL.
*** Error code 1

Stop in /usr/src.
*** Error code 1

Stop in /usr/src.
```

And this is what happens :\


----------



## expl (Nov 26, 2012)

You are probably building kernel source that is of a different version than what you are running on the system. In this case you need to 'buildworld' first before 'buildkernel'. You should fallow the official guide to building FreeBSD from source.


----------



## MaxDev (Nov 27, 2012)

expl said:
			
		

> You are probably building kernel source that is of a different version than what you are running on the system. In this case you need to 'buildworld' first before 'buildkernel'. You should fallow the official guide to building FreeBSD from source.



It only happens, trying to compile 'hwpmc' support.


----------



## expl (Nov 27, 2012)

You have to fetch source for both kernel and world. Build world first this will build up new version of compiler kit. Kernel should always be compiled after building (NOT installing, just building) same revision of world first because it depends on correct versions of compilers and would explain your error. The flow of make order can be found here.


----------



## MaxDev (Nov 27, 2012)

I had saw this observation on the documentation, but i had tought it was not necessary when building only the kernel, altough i'll test it and let you know, thank you.


----------



## expl (Nov 27, 2012)

MaxDev said:
			
		

> I had saw this observation on the documentation, but i had tought it was not necessary when building only the kernel, altough i'll test it and let you know, thank you.



That is only true when you are building kernel of same revision as your current kernel/world. Its a bad idea to only build/install kernel on a different revision of world. Usually you could get away like that if revisions are close together but you need to inspect UPDATING file if there were critical changes that would require a full rebuild.


----------



## MaxDev (Nov 27, 2012)

expl said:
			
		

> That is only true when you are building kernel of same revision as your current kernel/world. Its a bad idea to only build/install kernel on a different revision of world. Usually you could get away like that if revisions are close together but you need to inspect UPDATING file if there were critical changes that would require a full rebuild.



Yeah, i generally take a look on this


----------



## MaxDev (Nov 27, 2012)

Your tip worked, it was just another "RTFM" issue, case closed


----------

