You are not logged in.

#1 2011-04-25 08:27:29

Ben9250
Member
From: Bath - England
Registered: 2010-06-10
Posts: 208
Website

Manual Kernel Compilation

Hi, I'm trying to patch and compile my own kernel, in the hope that I will be able to then transfer the process to makepkg, but I keep getting an error during "make" or "make bzImage". The last few lines that give the errors seem to be to do with bfs, with some unused variables.

 VDSOSYM arch/x86/vdso/vdso32-int80-syms.lds
  VDSOSYM arch/x86/vdso/vdso32-sysenter-syms.lds
  VDSOSYM arch/x86/vdso/vdso32-syms.lds
  LD      arch/x86/vdso/built-in.o
  LD      arch/x86/built-in.o
  CC      kernel/sched.o
In file included from include/trace/ftrace.h:343:0,
                 from include/trace/define_trace.h:96,
                 from include/trace/events/sched.h:397,
                 from kernel/sched_bfs.c:80,
                 from kernel/sched.c:2:
include/trace/events/sched.h: In function ‘ftrace_define_fields_sched_stat_template’:
include/trace/events/sched.h:305:1: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
include/trace/events/sched.h: In function ‘ftrace_define_fields_sched_stat_runtime’:
include/trace/events/sched.h:363:1: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
include/trace/events/sched.h:363:1: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
In file included from kernel/sched.c:2:0:
kernel/sched_bfs.c: At top level:
kernel/sched_bfs.c:3094:5: error: conflicting types for ‘mutex_spin_on_owner’
include/linux/sched.h:368:12: note: previous declaration of ‘mutex_spin_on_owner’ was here
kernel/sched_bfs.c: In function ‘mutex_spin_on_owner’:
kernel/sched_bfs.c:3131:19: warning: comparison of distinct pointer types lacks a cast [enabled by default]
kernel/sched_bfs.c: In function ‘sched_getaffinity’:
kernel/sched_bfs.c:4271:13: warning: variable ‘rq’ set but not used [-Wunused-but-set-variable]
kernel/sched_bfs.c: In function ‘sys_sched_rr_get_interval’:
kernel/sched_bfs.c:4545:13: warning: variable ‘rq’ set but not used [-Wunused-but-set-variable]
make[1]: *** [kernel/sched.o] Error 1
make: *** [kernel] Error 2

My process is below:

wget -c http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.3.tar.bz2
wget -c ftp://ftp.kernel.org/pub/linux/kernel/v2.6/patch-2.6.38.3.bz2
wget -c ftp://ftp.archlinux.org/other/kernel26/patch-2.6.38.3-1-ARCH.bz2
wget -c http://grsecurity.net/test/grsecurity-2.2.2-2.6.38.4-201104231406.patch
wget -c http://kernel.org/pub/linux/kernel/people/ck/patches/2.6/2.6.38/2.6.38-ck3/patch-2.6.38-ck3.bz2

cp linux-2.6.38.3.tar.bz2 ~/kernelbuild/
cp patch-2.6.38.3.bz2 ~/kernelbuild/
cp patch-2.6.38.3-1-ARCH.bz2 ~/kernelbuild/
cp grsecurity-2.2.2-2.6.38.3-201104231406.patch ~/kernelbuild/
cp patch-2.6.38-ck3.bz2 ~/kernelbuild/

# Extracted everything with gnome's file manager.

cd ~/kernelbuild/linux-2.6.38.3
patch -Np1 -i ~/kernelbuild/patch-2.6.38.3
patch -Np1 -i ~/kernelbuild/patch-2.6.38.3-1-ARCH
patch -Np1 -i ~/kernelbuild/grsecurity-2.2.2-2.6.38.4-201104231406.patch
patch -Np1 -i ~/kernelbuild/patch-2.6.38-ck3

sudo mount -o remount,exec /home  # Because my home directory is mounted noexec.
make menuconfig  #
make mrproper
make or make bzImage

My main reason for doing this is for the testing grsecurity patchset, I don't really fancy being a kernel version behind, after having drilled into myself that I must keep everything updated.
Thanks,
Ben.


"In England we have come to rely upon a comfortable time-lag of fifty years or a century intervening between the perception that something ought to be done and a serious attempt to do it."
  - H. G. Wells

Offline

#2 2011-04-25 11:05:05

byte
Member
From: Düsseldorf (DE)
Registered: 2006-05-01
Posts: 2,046

Re: Manual Kernel Compilation

First, when you get linux-2.6.38.3.tar.bz2 then there's no point in fetching patch-2.6.38.3.bz2 - it's redundant.
grsecurity-2.2.2-2.6.38.4-201104231406.patch is for .38.4, not .38.3, does it apply cleanly?
Same for -ck?

Perhaps I'd first try compiling with just one patchset, -grsec and -ck by itself.
When that works, then it's possibly the combination of both where it fails.


1000

Offline

#3 2011-04-25 13:48:08

JokerBoy
Member
From: România
Registered: 2009-09-24
Posts: 641

Re: Manual Kernel Compilation

and use

make mrproper
make prepare
make menuconfig
make bzImage modules

also, you should consider using kernel26-ck's PKGBUILD from AUR, and add the grsecurity patch to it.

Offline

#4 2011-04-25 17:03:35

Ben9250
Member
From: Bath - England
Registered: 2010-06-10
Posts: 208
Website

Re: Manual Kernel Compilation

Thanks, I didn't notice the mismatch. I see, I thought, patch-2.6.38.3.bz2, was a patch for linux-2.6.38.3.tar.bz2, but I see now that's to patch the previous version up to 2.6.38.3. I was looking at the testing page and can't find a patch for 2.6.38.3 - which was the latest kernel when I started this, it may have updated now. In which case I can use the 2.6.38.4 one. I'll try one patch at a time and come back, I'm trying to do it without the AUR first because the first time I had a go at it and didn't do very well, so if I can do it right manually I can try and then apply that in terms of makepkg and the AUR.


"In England we have come to rely upon a comfortable time-lag of fifty years or a century intervening between the perception that something ought to be done and a serious attempt to do it."
  - H. G. Wells

Offline

#5 2011-04-25 18:42:34

Ranguvar
Member
Registered: 2008-08-12
Posts: 2,549

Re: Manual Kernel Compilation

The best route is definitely making your own PKGBUILD once you feel comfortable trying that.
I've made one for my own personal kernel package (being very pedantic about such things), if you'd like to take a look and mod it to your liking.  It's a bit cleaner than the `kernel26' PKGBUILD.
Be sure to track http://projects.archlinux.org/linux-2.6-ARCH.git/ and http://projects.archlinux.org/svntogit/ … l26/trunk/ for new Arch patches and config file changes.

I don't remember why I commented out the firmware packaging and don't want to look into it right now wink
So yeah, in case it helps you.
http://ompldr.org/vOGYyNQ

Offline

#6 2011-04-25 23:28:50

Ben9250
Member
From: Bath - England
Registered: 2010-06-10
Posts: 208
Website

Re: Manual Kernel Compilation

Thanks, I just corrected the mismatch and tried with only grsecurity, it seemed to work, I did get quite a lot of warning messages about comparrisons of unsigned expressions, and a few about thread ids or variables set but not used. I'm wondering if this is probably where I've stuck with some default option or chosen an option because I don't know my hardware that intimately beyond makes and model numbers. The final message was:

Setup is 14924 bytes (padded to 15360 bytes).
System is 3985 kB
CRC ade1fd57
Kernel: arch/x86/boot/bzImage is ready  (#1)
  Building modules, stage 2.
  MODPOST 3 modules
WARNING: modpost: Found 4 section mismatch(es).
To see full details build your kernel with:
'make CONFIG_DEBUG_SECTION_MISMATCH=y'

I'll see if it works with the ck patch as well as grsecurity next.


"In England we have come to rely upon a comfortable time-lag of fifty years or a century intervening between the perception that something ought to be done and a serious attempt to do it."
  - H. G. Wells

Offline

Board footer

Powered by FluxBB