LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 10-13-2014, 03:10 PM   #1
duffman
LQ Newbie
 
Registered: Oct 2014
Location: Canada
Distribution: Slackware 14.1
Posts: 13

Rep: Reputation: Disabled
Make errors when building from kernel source 3.10.7 in seperate output directory


Hello,
I'm on Slackware 14.1

What I'm trying to do: 'make O=/my/build/folder' from /usr/src/linux-3.10.17, as a normal user.
I'm using a slightly modified config-generic-smp as .config

First error I get is about the source directory no being clean and that I need to 'make mrproper', but of course I can only do that as root. I figure there must be a good reason the kernel-source package ships in an unclean state.

If I run 'make mrproper' as root, then running 'make O=/my/build/folder' afterwards(as non-root) works for a while but then fails because of a missing header 'hz.h'
Turns out that 'make mrproper' deletes a bunch of headers in ./include/config so I had to reinstall the kernel-source package.

I also tried from a copied source directory (cp -s -r ...) so I could run 'make mrproper' as non-root and then recopied those headers in ./include/config but it still complains that mrproper should be run.

At this point, I'm stumped.

Last edited by duffman; 10-13-2014 at 03:14 PM.
 
Old 10-13-2014, 03:23 PM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Why not make life easier and copy /usr/src/linux-3.10.17 content in your /my/build/folder, then change permissions and compile from here

Last edited by keefaz; 10-13-2014 at 03:25 PM.
 
Old 10-13-2014, 03:46 PM   #3
duffman
LQ Newbie
 
Registered: Oct 2014
Location: Canada
Distribution: Slackware 14.1
Posts: 13

Original Poster
Rep: Reputation: Disabled
I did, the problem is those missing headers in include/config, the ones that get deleted by 'make mrproper'. Are they supposed to be regenerated? Because they are not.
 
Old 10-13-2014, 04:19 PM   #4
duffman
LQ Newbie
 
Registered: Oct 2014
Location: Canada
Distribution: Slackware 14.1
Posts: 13

Original Poster
Rep: Reputation: Disabled
Here is make's output tail I get:
...
CC kernel/fork.o
CC kernel/exec_domain.o
CC kernel/panic.o
CC kernel/printk.o
CC kernel/cpu.o
CC kernel/exit.o
CC kernel/itimer.o
make[2]: *** No rule to make target `/tmp/build/kernel/include/config/hz.h', needed by `kernel/hz.bc'. Stop.
make[1]: *** [kernel] Error 2
make: *** [sub-make] Error 2
 
Old 10-13-2014, 04:50 PM   #5
duffman
LQ Newbie
 
Registered: Oct 2014
Location: Canada
Distribution: Slackware 14.1
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by keefaz View Post
Why not make life easier and copy /usr/src/linux-3.10.17 content in your /my/build/folder, then change permissions and compile from here
Ok so I did a real copy of the source (cp -r instead of cp -s -r) and it's compiling fine now.
Thanks.
Still irks me that I have to do a whole copy when it's already installed once.
 
Old 10-13-2014, 04:57 PM   #6
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Quote:
Originally Posted by duffman View Post
Still irks me that I have to do a whole copy when it's already installed once.
You don't have to. Why not just customize the LOCALVERSION in "General setup"?
 
Old 10-13-2014, 05:28 PM   #7
duffman
LQ Newbie
 
Registered: Oct 2014
Location: Canada
Distribution: Slackware 14.1
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Didier Spaier View Post
You don't have to. Why not just customize the LOCALVERSION in "General setup"?
I always do that. I added '-custom-'. If I didn't, 'make modules_install' would overwrite the modules installed by the 'kernel-modules-smp' package, which is a bad. I learned that the hard way years ago.
Not sure what you're getting at. That setting doesn't affect where Make looks for headers.
 
Old 10-13-2014, 05:33 PM   #8
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-15.0
Posts: 11,057

Rep: Reputation: Disabled
Quote:
Originally Posted by duffman View Post
Not sure what you're getting at. That setting doesn't affect where Make looks for headers.
Actually I don't understand why you need to use "make O=". Why not build the kernel and modules in place?
 
Old 10-13-2014, 05:54 PM   #9
duffman
LQ Newbie
 
Registered: Oct 2014
Location: Canada
Distribution: Slackware 14.1
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Didier Spaier View Post
Actually I don't understand why you need to use "make O=". Why not build the kernel and modules in place?
The whole point of the 'O=' functionality is to allow making kernels builds with different .config, which allows minimal rebuild times when you tweak each.
For example I could do
'make O=/my/build/folder1' where LOCALVERSION is set to 'custom1'
'make O=/my/build/folder2' where LOCALVERSION is set to 'custom2'

Because of the errors I get with 'make O=', instead I have to make a whole source copy for each config and build in place.
Follow me? I don't know how to explain it better.
 
Old 10-13-2014, 06:31 PM   #10
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
I never used O option, but personally I prefer don't touch /usr/src/linux* dir, as I consider it like system dir (distribution kernel source). I used to always compile custom kernels as user in separate directory (I think I read somewhere a suggestion by Linus Torvalds to not compile kernels in /usr/src)

Now if I read the Makefile about O option:
Code:
# kbuild supports saving output files in a separate directory.
# To locate output files in a separate directory two syntaxes are supported.
# In both cases the working directory must be the root of the kernel src.
# 1) O=
# Use "make O=dir/to/store/output/files/"
#
# 2) Set KBUILD_OUTPUT
# Set the environment variable KBUILD_OUTPUT to point to the directory
# where the output files shall be placed.
# export KBUILD_OUTPUT=dir/to/store/output/files/
# make
#
# The O= assignment takes precedence over the KBUILD_OUTPUT environment
# variable.
At this point, I don't know how mrproper would deal with this, no experience on that

Last edited by keefaz; 10-13-2014 at 06:32 PM.
 
Old 10-14-2014, 06:18 AM   #11
GazL
LQ Veteran
 
Registered: May 2008
Posts: 6,897

Rep: Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019Reputation: 5019
If you've done an in-tree build (one without 'O=/somewhere') then you can't use that source tree to build another kernel. You have to do a 'make mrproper' on it first, but once you've done that 'make mrproper' you can use the tree for any number of builds if they all use 'O=/somewhere-unique'.

The reason Pat ships /usr/src/linux in an unclean state is that its contents are required if you ever need to build out-of-tree kernel modules for use with the stock kernel. If he shipped pristine sources, then you wouldn't be able to do that. Unless that is Pat himself started building the stock kernels with O=/somewhere in order to preserve /usr/src/linux.

O= is very useful if you're building from kernel sources under the control of git. Without it a 'git checkout -f' would delete the results of your last build. If you've used O= you can switch back and forth at will, without having to give each build its own copy of the kernel sources.

I use /usr/obj/$VERSION$LOCALVERSION for my O= build directories. Once built, I do a 'make O=... clean && make O=... prepare' on the builddir to reclaim a little disk space.

I use a build script that does the build and nicely packages all this up for me. I end up
with a single package that looks something like this:
Code:
PACKAGE NAME:     kernel-3.14.y-custom-3.14.20-x86_64-1_local
COMPRESSED PACKAGE SIZE:     5.4M
UNCOMPRESSED PACKAGE SIZE:     12M
PACKAGE LOCATION: kernel-3.14.y-custom-3.14.20-x86_64-1_local.txz
PACKAGE DESCRIPTION:
kernel-3.14.y-custom: Kernel 3.14.20-custom
kernel-3.14.y-custom:
kernel-3.14.y-custom: This is an all-in-one package that contains
kernel-3.14.y-custom: a linux kernel, its modules and its build directory.
kernel-3.14.y-custom:
kernel-3.14.y-custom: Package includes:
kernel-3.14.y-custom:   /boot/vmlinuz-3.14.20-custom
kernel-3.14.y-custom:   /boot/System.map-3.14.20-custom
kernel-3.14.y-custom:   /lib/modules/3.14.20-custom/...
kernel-3.14.y-custom:   /usr/obj/3.14.20-custom/...
kernel-3.14.y-custom:
May seem over-engineered to some, but I've been using this for around 4 years now and it works well for me, but we each have our own ways of doing things.

Last edited by GazL; 10-14-2014 at 06:21 AM.
 
Old 10-14-2014, 09:45 PM   #12
duffman
LQ Newbie
 
Registered: Oct 2014
Location: Canada
Distribution: Slackware 14.1
Posts: 13

Original Poster
Rep: Reputation: Disabled
Good to know, thanks.
 
Old 10-14-2014, 09:50 PM   #13
duffman
LQ Newbie
 
Registered: Oct 2014
Location: Canada
Distribution: Slackware 14.1
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by GazL View Post
May seem over-engineered to some, but I've been using this for around 4 years now and it works well for me, but we each have our own ways of doing things.
You can never automate too much, time is so precious
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Building an out-of-tree module without building the kernel source lijodevasia Linux - General 2 08-01-2013 12:45 AM
Make errors building aircrack-ng-1.2-beta1 funky445o Linux - Software 14 06-10-2013 07:05 AM
building from source and installing to a specified directory gvp87 Linux - Software 1 03-31-2008 12:10 AM
Errors building WINE 0.9.53 from source on CentOS x64 Micro420 Linux - Software 4 01-14-2008 12:15 PM
Errors Trying to "make menuconfig" kernel-source-2.6.10 Royle Debian 2 02-14-2005 06:53 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 11:18 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration