Unable to compile the kernel

Hi community,

These days I'm trying to modify my kernel /root/kernels/MYKERNEL, and this I obtained through the GENERIC: cp GENERIC /root/kernels/MYKERNEL, but when I do these commands to compile it:
make buildkernel KERNCONF=MYKERNEL
make installkernel KERNCONF=MYKERNEL
FreeBSD gives me errors respectively:
Code:
 make: don't know how to make buildkernel. Stop
make: don't know how to make installkernel. Stop

I installed SYS from the sysinstall (Configure->Distribution-> Src -> Sys) but as I have described, it does not work.

Does anyone know how to solve this problem? I have read that it is advisable to install it using csup, but I do not know.

Kind regards.
 
[cmd=]csup [/cmd] has been obsoleted for the most part. One would be advised to use devel/subversion from the ports tree. Also, the commands you've shown are only part of a much larger sequence of commands: see /usr/src/UPDATING near the bottom for various methods. Other missing factors may also apply.
 
TheCompass said:
These days I'm trying to modify my kernel /root/kernels/MYKERNEL, and this I obtained through the Generic cp GENERIC /root/kernels/MYKERNEL, but when I do these commands to compile it:
make buildkernel KERNCONF=MYKERNEL
make installkernel KERNCONF=MYKERNEL

FreeBSD gives me errors respectively:
Code:
 make: don't know how to make buildkernel. Stop
make: don't know how to make installkernel. Stop

make(1) looks for a Makefile in the current directory, so the first step is to change to the source directory:
Code:
# cd /usr/src
# make buildkernel KERNCONF=MYKERNEL
 
TheCompass said:
These days I'm trying to modify my kernel /root/kernels/MYKERNEL, and this I obtained through the Generic cp GENERIC /root/kernels/MYKERNEL, but when I do these commands to compile it:
make buildkernel KERNCONF=MYKERNEL
make installkernel KERNCONF=MYKERNEL

FreeBSD gives me errors respectively
Apart from the current directory, as mentioned by @wblock@, I'm also wondering where your new configuration file ended up. Because it looks to me as if you merely copied GENERIC to a completely different directory (/root/kernels) and then tried to compile the kernel.

But if your configuration file sits outside the source tree then there's no way that make can ever know about it. So try doing this instead:

Code:
# cp GENERIC /root/kernels/MYKERNEL
# ln -s /root/kernels/MYKERNEL
# cd ../../..    # (or optionally use cd /usr/src)
# make buildkernel KERNCONF=MYKERNEL
And so on...
 
Last edited by a moderator:
It seems that you are compiling the kernel in a wrong directory. You have to change your current directory to /usr/src. In order to use your own kernel, you can copy your modified kernel to the /usr/src/sys/amd64/conf or /usr/src/sys/i386/conf directory depending on your machine architecture and then do the compiling process.

cp /root/kernels/MYKERNEL /usr/src/sys/amd64/conf
cd /usr/src
make buildkernel KERNCONF=MYKERNEL
make installkernel KERNCONF=MYKERNEL
 
jb_fvwm2 said:
[cmd=]csup [/cmd] has been obsoleted for the most part. One would be advised to use devel/subversion from the ports tree. Also, the commands you've shown are only part of a much larger sequence of commands: see /usr/src/UPDATING near the bottom for various methods. Other missing factors may also apply.
Hi, I don't know how to do this, if you can explain it some more, or give me a link to a topic of this theme.

j4ck said:
It seems that you are compiling the kernel in a wrong directory. You have to change your current directory to /usr/src. In order to use your own kernel, you can copy your modified kernel to the /usr/src/sys/amd64/conf or /usr/src/sys/i386/conf directory depending on your machine architecture and then do the compiling process.

cp /root/kernels/MYKERNEL /usr/src/sys/amd64/conf
cd /usr/src
make buildkernel KERNCONF=MYKERNEL
make installkernel KERNCONF=MYKERNEL
Thanks but it doesn't run, gives the same errors, thanks for your time, and thanks to others too. I'm testing your tips but I still can't compile the kernel, I do this:

cd /usr/src/sys/amd64/conf
cp GENERIC MYKERNEL

I edit the file MYKERNEL, and when I go to compile it, the problems persists:

cd /usr/src
make buildkernel KERNCONF=kerneladrian
make installkernel KERNCONF=kerneladrian

Gives the same errors:
Code:
make: don't know how to make buildkernel. Stop
make: don't know how to make installkernel. Stop

Any more solutions? Thanks for everything and your time, I appreciate it very much.
 
Could you run head -15 /usr/src/Makefile and paste the results here (don't forget to use the
Code:
 tags)?

I'm beginning to suspect that your source tree could be either wrong or incomplete.

Another point of interest: which version of FreeBSD are you using by the way?
 
TheCompass said:
Hi, I don't know how to do this, if you can explain it some more, or give me a link to a topic of this theme.
Handbook: A.5. Using Subversion

I edit the file MYKERNEL, and when I go to compile it, the problems persists:

cd /usr/src
make buildkernel KERNCONF=kerneladrian
make installkernel KERNCONF=kerneladrian

Gives the same errors:
Code:
make: don't know how to make buildkernel. Stop
make: don't know how to make installkernel. Stop
That sounds to me like you don't have a source tree, or at the very least an incomplete one.
 
I'm happy to learn that our comments seem to have helped you out.

Still; I'd also like to request that you share your experiences with us, because that could also help other users as well. Don't worry too much about it; you can always blame me ;)
 
ShelLuser said:
I'm happy to learn that our comments seem to have helped you out.

Still; I'd also like to request that you share your experiences with us, because that could also help other users as well. Don't worry too much about it; you can always blame me ;)

Certainly I still have not managed to solve the problem, I'm trying to install all of the source tree but I do not get it.

If anyone has a link of a post to install all of the source tree that would be appreciated, I'm trying to install the devel/subversion but it does not work or maybe I do not do it completely well.

Big greetings to all.
 
ShelLuser said:
Could you run head -15 /usr/src/Makefile and paste the results here (don't forget to use the
Code:
 tags)?

I'm beginning to suspect that your source tree could be either wrong or incomplete.

Another point of interest: which version of FreeBSD are you using by the way?[/QUOTE]
Hi, I'm using FreeBSD 8.4, and when I do this: [CMD]head -15 /usr/src/Makefile[/CMD] gives that error: [CODE]head: /usr/src/Makefile: No such file or directory
But if I do this: head -15 /usr/ports/net/cvsup/Makefile, gives that:
Code:
PORTNAME=       cvsup
PORTVERSION=    16.1h
PORTREVISION=   4
CATEGORIES=     net devel
MASTER_SITES=   ${MASTER_SITE_FREEBSD_ORG}
MASTER_SITE_SUBDIR=development/CVSup/snapshots
DISTNAME=       cvsup-snap-${PORTVERSION}

MAINTAINER=     ports@FreeBSD.org
COMMENT=        File distribution system optimized for CVS

ONLY_FOR_ARCHS= amd64 i386 sparc64
Or if I do this head -15 /usr/src/sys/amd64/Makefile gives that:

Code:
# $FreeBSD: release/8.4.0/sys/amd64/Makefile 199583 2009-11-20 15:27:52Z jhb $
#       @(#)Makefile    8.1 (Berkeley) 6/11/93

# Makefile for amd64 links, tags file

# SYS is normally set in Make.tags.inc
SYS=/sys

TAGDIR= amd64

.include "../kern/Make.tags.inc"

all:
        @echo "make links or tags only"
SirDice said:
To get the source you will need to have subversion installed. What are the problems you are having with the port?
To install the suberversion I do this:
cd /usr/ports/devel/subversion
make install clean

I select OK in all windows with the predefined options, I think it is installed correctly but I don't know how to continue.

Kind regards!
 
Following this link, this is how I rebuilt mine yesterday.
First, moved everything in /usr/ports/ including hidden files and folders, like so:

# mkdir /root/ports-bkup && mv /usr/ports/* /root/ports-bkup
NOTE: the above command will not move the hidden files, you need to do it manually.

Second, checkout the source using subversion:
# svn checkout [url=https://svn0.us-west.FreeBSD.org/ports/head]https://svn0.us-west.FreeBSD.org/ports/head[/url] /usr/ports/
NOTE: accept the certificate permanently if you don't want to be prompted each time you checkout.

Third, update /usr/ports/:
# svn update /usr/ports/
Or
# cd /usr/src/
# make update SVN_UPDATE=yes

Now, let's deal with the kernel:
# mkdir /root/custom-kernel && cp /usr/src/sys/amd64/conf/GENERIC /root/custom-kernel/DATBSD
NOTE: there (/root/custom-kernel/) you can edit your new kernel (mine named DATBSD).

When you are done, copy the new edited kernel as follow:
# cp /root/custom-kernel/DATBSD /usr/src/sys/amd64/conf/
Then
# cd /usr/src
# make buildkernel KERNCONF=DATBSD
# make installkernel KERNCONF=DATBSD

Good luck!
 
youngunix said:
Following this link, this is how I rebuilt mine yesterday.
First, moved everything in /usr/ports/ including hidden files and folders, like so:

# mkdir /root/ports-bkup && mv /usr/ports/* /root/ports-bkup
NOTE: the above command will not move the hidden files, you need to do it manually.

Just rename the directory: mv /usr/ports /usr/ports.bak. Most people will not have made local modifications, /usr/ports can just be deleted.

Now, let's deal with the kernel:
# mkdir /root/custom-kernel && cp /usr/src/sys/amd64/conf/GENERIC /root/custom-kernel/DATBSD
NOTE: there (/root/custom-kernel/) you can edit your new kernel (mine named DATBSD).

When you are done, copy the new edited kernel as follow:
# cp /root/custom-kernel/DATBSD /usr/src/sys/amd64/conf/

It is not necessary to copy the whole kernel configuration file: Simplifying FreeBSD Kernel Configuration Files. If you put the new configuration file in some other directory for safety, like /root, creating a link in the conf directory means it does not have to be copied back after changes: ln -s /root/DATBSD /usr/src/sys/amd64/conf/
 
wblock@ said:
Just rename the directory: mv /usr/ports /usr/ports.bak. Most people will not have made local modifications, /usr/ports can just be deleted.



It is not necessary to copy the whole kernel configuration file: Simplifying FreeBSD Kernel Configuration Files. If you put the new configuration file in some other directory for safety, like /root, creating a link in the conf directory means it does not have to be copied back after changes: ln -s /root/DATBSD /usr/src/sys/amd64/conf/

I know I didn't follow the documentation to the letter, yet, the way I proceeded was quick, painless, and less confusing (for me). Thus, ending with the same result. :)
 
youngunix said:
Following this link, this is how I rebuilt mine yesterday.
First, moved everything in /usr/ports/ including hidden files and folders, like so:

# mkdir /root/ports-bkup && mv /usr/ports/* /root/ports-bkup
NOTE: the above command will not move the hidden files, you need to do it manually.

Second, checkout the source using subversion:
# svn checkout [url=https://svn0.us-west.FreeBSD.org/ports/head]https://svn0.us-west.FreeBSD.org/ports/head[/url] /usr/ports/
NOTE: accept the certificate permanently if you don't want to be prompted each time you checkout.

Third, update /usr/ports/:
# svn update /usr/ports/
Or
# cd /usr/src/
# make update SVN_UPDATE=yes

Now, let's deal with the kernel:
# mkdir /root/custom-kernel && cp /usr/src/sys/amd64/conf/GENERIC /root/custom-kernel/DATBSD
NOTE: there (/root/custom-kernel/) you can edit your new kernel (mine named DATBSD).

When you are done, copy the new edited kernel as follow:
# cp /root/custom-kernel/DATBSD /usr/src/sys/amd64/conf/
Then
# cd /usr/src
# make buildkernel KERNCONF=DATBSD
# make installkernel KERNCONF=DATBSD

Good luck!

Hi, good night, thanks to all who are helping me.

First I move the /usr/ports to other folder and I do without problem that
# svn checkout [url=https://svn0.us-west.FreeBSD.org/ports/head]https://svn0.us-west.FreeBSD.org/ports/head[/url] /usr/ports/

Second, I can update the /usr/ports
# svn update /usr/ports/
But the /usr/src is empty, then I do
# cd /usr/src
# make update SVN_UPDATE=yes
And that gives the same problem
# make: don't know how to make update. Stop :r

Consequently I can't do
# mkdir /root/custom-kernel && cp /usr/src/sys/amd64/conf/GENERIC /root/custom-kernel/DATBSD
Note: I've tried to update the SYS from the sysinstall but neither works the buildkernel

Thanks for all and your time, I appreciated very much.
 
TheCompass said:
But the /usr/src is empty, then I do
# cd /usr/src
# make update SVN_UPDATE=yes
And that gives the same problem
# make: don't know how to make update. Stop :r

Yes, that is acting as expected. See post #3.

Let's start over. Forget all the previous posts. In the following, it is assumed that you want FreeBSD 9.1-RELEASE (you have not actually specified what version). If not, you will have to change the URL used for the checkout.

Code:
# rm -rf /usr/src
# svn checkout https://svn0.us-west.FreeBSD.org/base/releng/9.1/ /usr/src
 
Back
Top