Mail archive
alpine-devel

[alpine-devel] RFC: special kernel source packages

From: Natanael Copa <ncopa_at_alpinelinux.org>
Date: Thu, 30 Oct 2008 13:28:55 +0100

Hi,

So in the long run I hope we can build everything with abuild rather
than gentoo.

I would like som feedback on how to deal with kernels and kernelmodules.
Now the kernel modules are in the modloop loopback file, and i'd like to
continue with that. But to be able to better support native harddisk
installs i'd like to build the modloop from kernel/module packages.

We have different kernels and I'd like to be able to support same kernel
with different configurations, package flavors (i.e one kernel with
smp/highmem and one without). Even if we only have a grsecurity kernel
and a vsgersec kernel at the moment, I'd like to be able to scale.

For example, lets say we have linux-grsec and linux-grsec-smp
we have to APKBUILDS: core/linux-grsec/APKBUILD and
core/linux-grsec-smp/APKBUILD. They are almost identical, but they have
their own kernelconfig file.

We have those alternatives:

A) reuse the tmp srcdir from kernel build

during build the entire kernel source is extracted to src/, the
kernelconfig file is copied over and then: 'cd $srcdir/linux-2.6.26 &&
make'. The object files ends up in same tree as the sources, just like
any other package do.

The external module zaptel-grsec will reuse the temp build dir for the
kernel, telling make that it will find kernel sources and configs in
$startdir/../linux-grsec/src/linux-2.6.26. This requires that the kernel
is actually built before the modules can be built. (so if you just want
to build the module you get truoble unless you build the entire kernel
first)

abuild have no chance to trace the makedepends (unless we hack it to
ugliness)

pros: simple. no non-standard source package
cons: bad usage of resources (disk space, cpu etc) on build host, abuild
cannot trace build dependecies properly.

B) create a special linux-sources{,-grsec,-vsgrsec} package as a
makedepends
The linux-sources-grsec is a make dependency for linux-grsec and
linux-grsec-smp. The sources package only installs the (patched) kernel
source into /usr/src, and thats it. The linux-grsec build() function
will look something like this:

build() {
        mkdir -p $srcdir/kout
        cd $srcdir/kout
        cp ../kernelconfig .config
        make -C /usr/src/linux-2.6.26-grsec O="$PWD" oldconfig
        make
        ...
}

The point is, all different flavours of the same kernel sources (i.e
linux-grsec and linux-grsec-smp) will reuse the kernel sources
in /usr/src and only object files ends up in the packages ends up in
packages temp area.

The external module package, lets say openiscsi, will use the same
source package as makedepends + the binary package (where the kernel
config is found). The build() will look something like:

build() {
        mkdir -p $srcdir/kout
        cd $srcdir/kout
        cp $_kernelconfig .config
        make -C /usr/src/linux-2.6.26-grsec O="$PWD" oldconfig mkproper
        
        # openiscsi now finds the kernel output in $srcdir/kout
        ...
}

pros: effecive use of diskspace. you dont need compile kernel to build
external modules. proper makedepends handling in abuild script.
cons: slightly more complex. needs non-standard kernel source package.

I guess I have made up my mind already. I think I'll go for B unless
someone comes with really good arguments for A.

Other ideas?

-nc



---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Thu Oct 30 2008 - 13:28:55 UTC