Re: [PATCH 3/3] kbuild: add generation of kernel-devel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 24.6.2013 16:38, Mike Marciniszyn wrote:
> Change the spec file to generate a kernel-devel module
> allowing for compilation of external kernel modules.
> 
> Signed-off-by: Mike Marciniszyn <mike.marciniszyn@xxxxxxxxx>
> ---
>  scripts/package/mkspec |   26 ++++++++++++++++++++++++++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/scripts/package/mkspec b/scripts/package/mkspec
> index 514aeb2..65131df 100755
> --- a/scripts/package/mkspec
> +++ b/scripts/package/mkspec
> @@ -59,6 +59,14 @@ echo "header files define structures and constants that are needed for"
>  echo "building most standard programs and are also needed for rebuilding the"
>  echo "glibc package."
>  echo ""
> +echo "%package devel"
> +echo "Summary: Development package for building kernel modules to match the $__KERNELRELEASE kernel"
> +echo "Group: System Environment/Kernel"
> +echo "AutoReqProv: no"
> +echo "%description -n kernel-devel"
> +echo "This package provides kernel headers and makefiles sufficient to build modules"
> +echo "against the $__KERNELRELEASE kernel package."
> +echo ""
>  
>  if ! $PREBUILT; then
>  echo "%prep"
> @@ -109,6 +117,11 @@ echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
>  echo 'mv vmlinux.orig vmlinux'
>  echo "%endif"
>  
> +echo 'rm -rf $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE/{build,source}"
> +echo "mkdir -p "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE"
> +echo "EXCLUDES=\"--exclude-vcs --exclude .tmp_versions --exclude=*vmlinux* --exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation --exclude=firmware --exclude .config.old --exclude .missing-syscalls.d\""
> +echo "tar "'$EXCLUDES'" -cf- . | (cd "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE;tar xvf -)"

For consistency and compatibility with older tar versions, please use
$RCS_TAR_EXCLUDE instead of --exclude-vcs. Also, you only need .config,
scripts/, include/ and the Makefiles to build external modules. But
that's an optimization that can be done in a later patch.

> +echo "%post devel"
> +echo "cd /lib/modules/$KERNELRELEASE"
> +echo "ln -sf /usr/src/kernels/$KERNELRELEASE build"
> +echo "ln -sf /usr/src/kernels/$KERNELRELEASE source"
> +echo ""
> +echo "%postun devel"
> +echo "cd /lib/modules/$KERNELRELEASE"
> +echo "rm -f build source"

These symlinks should be part of the RPM payload.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux