# kernel compile: syntax error



## cbrace (Sep 22, 2012)

Hi all,

I thought I would recompile the kernel on my VPS using the kernel configuration file that SirDice kindly shared with us in an earlier thread.

Something is going wrong here. It appears to be in line #1, which is nothing more than

```
cpu             HAMMER
```
. I don't see any other problems with the file. My installation would appear to be adequate as I can compile GENERIC. 

Here is SirDice's config file: http://pastebin.com/41uUHpKj

Any thoughts what might be going wrong here?



> $ time sudo make buildkernel KERNCONF=VPS
> 
> --------------------------------------------------------------
> >>> Kernel build for VPS started on Sat Sep 22 21:08:28 CEST 2012
> ...




$ uname -rps
FreeBSD 9.0-RELEASE i386


----------



## wblock@ (Sep 22, 2012)

Please show the output of
`% hd VPS | head -n2`


----------



## cbrace (Sep 23, 2012)

```
$ hd VPS | head -n2
00000000  63 70 75 20 20 20 20 20  20 20 20 20 20 20 20 20  |cpu             |
00000010  48 41 4d 4d 45 52 0d 0a  69 64 65 6e 74 20 20 20  |HAMMER..ident   |
```


----------



## phoenix (Sep 23, 2012)

You're using an amd64 (64-bit) CPU type inside the i386 (32-bit) kernel source directory.


----------



## cbrace (Sep 23, 2012)

If I understand your answer correctly, how then to I force make to build an AMD64 kernel, if that is what is required?


----------



## kpa (Sep 23, 2012)

The option is not valid for an i386 kernel, replace it with for example:

```
cpu             I486_CPU
cpu             I586_CPU
cpu             I686_CPU
```

Read the i386 /usr/src/sys/i386/conf/GENERIC configuration file for more information.


----------



## wblock@ (Sep 23, 2012)

cbrace said:
			
		

> ```
> $ hd VPS | head -n2
> 00000000  63 70 75 20 20 20 20 20  20 20 20 20 20 20 20 20  |cpu             |
> 00000010  48 41 4d 4d 45 52 0d 0a  69 64 65 6e 74 20 20 20  |HAMMER..ident   |
> ```



In addition to the amd64/i386 problem, cut and paste of that file has added MS-DOS line endings (0d 0a) and changed tabs to spaces.  I don't know for a fact that either is a problem, but would suspect the carriage returns.


----------



## cbrace (Sep 23, 2012)

Fixed! Thanks. I pasted it into Gedit and saved it anew. FWIW, here is what it looks like now:

```
00000000  63 70 75 20 20 20 20 20  20 20 20 20 20 20 20 20  |cpu             |
00000010  49 36 38 36 5f 43 50 55  0a 69 64 65 6e 74 20 20  |I686_CPU.ident  |
```

In case you anyone else uses the same config file, make returned another error message about a minute into the process:


> /usr/src/sys/i386/i386/mp_machdep.c:42:2: error: #error The apic device is required for SMP, add "device apic" to your config file.


So I added this line from GENERIC:

```
device		apic			# I/O APIC
```
Perhaps SirDice was compiling a kernel for a single-core VPS or maybe this isn't required for the AMD64 architecture.


----------



## wblock@ (Sep 23, 2012)

This might be useful: Simplifying FreeBSD Kernel Config Files.


----------



## cbrace (Sep 23, 2012)

Thanks WB, great tip.

I can now confirm that "apic" is not needed under AMD64 kernel compiles.


----------



## cbrace (Sep 23, 2012)

I compiled a new kernel on my AMD64 server  with SirDice's config file and it wouldn't boot. Back to GENERIC. 

igb and bce returned errors, so I commented them out. However, I don't know what module is failing here:


> /usr/src/sys/modules/netgraph/atm/uni/../../../../contrib/ngatm/netnatm/sig/sig_party.c: In function 'uni_sig_party':
> /usr/src/sys/modules/netgraph/atm/uni/../../../../contrib/ngatm/netnatm/sig/sig_party.c:916: internal compiler error: in symbol_marked_for_renaming, at tree-into-ssa.c:548
> Please submit a full bug report,
> with preprocessed source if appropriate.
> ...


I can't find (netnatm | netgraph | atm | ngatmin) in GENERIC.

Thanks.


----------

