linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] kbuild: Integrate with new-kernel-pkg
@ 2011-05-17 17:36 Arun Sharma
  2011-05-17 17:36 ` [PATCH 2/6] kbuild: Add a kernel-devel package Arun Sharma
                   ` (5 more replies)
  0 siblings, 6 replies; 20+ messages in thread
From: Arun Sharma @ 2011-05-17 17:36 UTC (permalink / raw)
  To: Michal Marek, linux-kbuild, linux-kernel; +Cc: Arun Sharma

Handles mkinitrd, updating the bootloader among other things.

Signed-off-by: Arun Sharma <asharma@fb.com>
---
 scripts/package/mkspec |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index ed8b6a8..b820677 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -94,6 +94,19 @@ 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 "rsync -avz --exclude '.git/' --exclude '*vmlinux*' --exclude '.*' --exclude '*.o' --exclude '*.so' --exclude '*.ko' . "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE/"
+echo 'pushd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE"' && ln -s build source && ln -s '"/usr/src/kernels/$KERNELRELEASE"' build && popd'
+
+echo ""
+echo "%preun"
+echo '/sbin/new-kernel-pkg --rminitrd --rmmoddep --remove '"$KERNELRELEASE"' || exit $?'
+
+echo ""
+echo "%post"
+echo '/sbin/new-kernel-pkg --mkinitrd --depmod --install --make-default '"$KERNELRELEASE"' || exit $?'
+
 echo ""
 echo "%clean"
 echo 'rm -rf $RPM_BUILD_ROOT'
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/6] kbuild: Add a kernel-devel package
  2011-05-17 17:36 [PATCH 1/6] kbuild: Integrate with new-kernel-pkg Arun Sharma
@ 2011-05-17 17:36 ` Arun Sharma
  2011-05-25 20:34   ` Arun Sharma
  2011-05-17 17:36 ` [PATCH 3/6] kbuild: Create a kernel-headers RPM Arun Sharma
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Arun Sharma @ 2011-05-17 17:36 UTC (permalink / raw)
  To: Michal Marek, linux-kbuild, linux-kernel; +Cc: Arun Sharma

Useful for building modules without having kernel sources

Signed-off-by: Arun Sharma <asharma@fb.com>
---
 scripts/package/mkspec |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index b820677..81b6057 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -47,6 +47,14 @@ echo ""
 echo "%description"
 echo "The Linux Kernel, the operating system core itself"
 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"
@@ -118,3 +126,7 @@ echo "/lib/modules/$KERNELRELEASE"
 echo "/lib/firmware"
 echo "/boot/*"
 echo ""
+echo "%files devel"
+echo '%defattr (-, root, root)'
+echo "/usr/src/kernels/$KERNELRELEASE"
+echo ""
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/6] kbuild: Create a kernel-headers RPM
  2011-05-17 17:36 [PATCH 1/6] kbuild: Integrate with new-kernel-pkg Arun Sharma
  2011-05-17 17:36 ` [PATCH 2/6] kbuild: Add a kernel-devel package Arun Sharma
@ 2011-05-17 17:36 ` Arun Sharma
  2011-05-24 16:38   ` Michal Marek
  2011-05-17 17:36 ` [PATCH 4/6] kbuild: Move firmware images to a separate RPM Arun Sharma
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Arun Sharma @ 2011-05-17 17:36 UTC (permalink / raw)
  To: Michal Marek, linux-kbuild, linux-kernel; +Cc: Arun Sharma

To compile binaries which depend on new kernel interfaces, we need a
kernel-headers RPM

Signed-off-by: Arun Sharma <asharma@fb.com>
---
 scripts/package/mkspec |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 81b6057..c38e950 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -55,6 +55,17 @@ echo "%description -n kernel-devel"
 echo "This package provides kernel headers and makefiles sufficient to build modules"
 echo "against the $__KERNELRELEASE kernel package."
 echo ""
+echo "%package headers"
+echo "Summary: Header files for the Linux kernel for use by glibc"
+echo "Group: Development/System"
+echo "Obsoletes: kernel-headers"
+echo "Provides: kernel-headers = %{version}"
+echo "%description headers"
+echo "Kernel-headers includes the C header files that specify the interface"
+echo "between the Linux kernel and userspace libraries and programs.  The"
+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."
 
 if ! $PREBUILT; then
 echo "%prep"
@@ -91,6 +102,7 @@ echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
 echo "%endif"
 echo "%endif"
 
+echo 'make %{?_smp_mflags} INSTALL_HDR_PATH=$RPM_BUILD_ROOT/usr headers_install'
 echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
 
 echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE"
@@ -130,3 +142,7 @@ echo "%files devel"
 echo '%defattr (-, root, root)'
 echo "/usr/src/kernels/$KERNELRELEASE"
 echo ""
+echo "%files headers"
+echo '%defattr (-, root, root)'
+echo "/usr/include"
+echo ""
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/6] kbuild: Move firmware images to a separate RPM
  2011-05-17 17:36 [PATCH 1/6] kbuild: Integrate with new-kernel-pkg Arun Sharma
  2011-05-17 17:36 ` [PATCH 2/6] kbuild: Add a kernel-devel package Arun Sharma
  2011-05-17 17:36 ` [PATCH 3/6] kbuild: Create a kernel-headers RPM Arun Sharma
@ 2011-05-17 17:36 ` Arun Sharma
  2011-05-25 13:53   ` Michal Marek
  2011-05-17 17:36 ` [PATCH 5/6] kbuild: Append RPM release to $KERNELRELEASE Arun Sharma
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 20+ messages in thread
From: Arun Sharma @ 2011-05-17 17:36 UTC (permalink / raw)
  To: Michal Marek, linux-kbuild, linux-kernel; +Cc: Arun Sharma

This allows multiple kernel RPMs to be installed without
namespace conflicts.

Signed-off-by: Arun Sharma <asharma@fb.com>
---
 scripts/package/mkspec |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index c38e950..bf215c5 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -66,6 +66,13 @@ echo "between the Linux kernel and userspace libraries and programs.  The"
 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 firmware"
+echo "Summary: Set of firmware images in the kernel tree"
+echo "Group: Development/System"
+echo "%description firmware"
+echo "Firmware images in the kernel tree provided for backward compability"
+echo ""
 
 if ! $PREBUILT; then
 echo "%prep"
@@ -90,6 +97,7 @@ echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
 echo "%endif"
 
 echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{?_smp_mflags} KBUILD_SRC= modules_install'
+echo 'make %{?_smp_mflags} INSTALL_FW_PATH=$RPM_BUILD_ROOT/lib/firmware KBUILD_SRC= firmware_install'
 echo "%ifarch ia64"
 echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE"
 echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/"
@@ -135,7 +143,6 @@ echo "%files"
 echo '%defattr (-, root, root)'
 echo "%dir /lib/modules"
 echo "/lib/modules/$KERNELRELEASE"
-echo "/lib/firmware"
 echo "/boot/*"
 echo ""
 echo "%files devel"
@@ -146,3 +153,7 @@ echo "%files headers"
 echo '%defattr (-, root, root)'
 echo "/usr/include"
 echo ""
+echo "%files firmware"
+echo '%defattr (-, root, root)'
+echo "/lib/firmware"
+echo ""
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 5/6] kbuild: Append RPM release to $KERNELRELEASE
  2011-05-17 17:36 [PATCH 1/6] kbuild: Integrate with new-kernel-pkg Arun Sharma
                   ` (2 preceding siblings ...)
  2011-05-17 17:36 ` [PATCH 4/6] kbuild: Move firmware images to a separate RPM Arun Sharma
@ 2011-05-17 17:36 ` Arun Sharma
  2011-05-17 17:46   ` Arun Sharma
  2011-05-17 20:13   ` Michal Marek
  2011-05-17 17:36 ` [PATCH 6/6] kbuild: cleanup the rpm buildroot Arun Sharma
  2011-05-17 19:46 ` [PATCH 1/6] kbuild: Integrate with new-kernel-pkg Michal Marek
  5 siblings, 2 replies; 20+ messages in thread
From: Arun Sharma @ 2011-05-17 17:36 UTC (permalink / raw)
  To: Michal Marek, linux-kbuild, linux-kernel; +Cc: Arun Sharma

Provide the same consistency as distributor kernels.
uname -r matches RPM name (includes the release)

Glossary:

KERNELRELEASE = what users see
___KERNELRELEASE = KERNELRELEASE without RPM release
__KERNELRELEASE = ___KERNELRELEASE with s/-/_/g

Signed-off-by: Arun Sharma <asharma@fb.com>
---
 Makefile                 |    9 ++++++---
 scripts/package/Makefile |    2 +-
 scripts/package/mkspec   |    2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index 28820f7..90d45f4 100644
--- a/Makefile
+++ b/Makefile
@@ -367,11 +367,14 @@ KBUILD_AFLAGS_MODULE  := -DMODULE
 KBUILD_CFLAGS_MODULE  := -DMODULE
 KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
 
-# Read KERNELRELEASE from include/config/kernel.release (if it exists)
-KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
+# Read ___KERNELRELEASE from include/config/kernel.release (if it exists)
+___KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
+# Append the release version only once. 
+# Note: .version could change during the build.
+KERNELRELEASE ?= $(___KERNELRELEASE)-$(shell /bin/sh scripts/mkversion)
 KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
-export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
+export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION ___KERNELRELEASE
 export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
 export CPP AR NM STRIP OBJCOPY OBJDUMP
 export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index 1b7eaea..0ec687b 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -26,7 +26,7 @@ RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
 	           else echo rpm; fi)
 
 # Remove hyphens since they have special meaning in RPM filenames
-KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
+KERNELPATH := kernel-$(subst -,_,$(___KERNELRELEASE))
 MKSPEC     := $(srctree)/scripts/package/mkspec
 PREV       := set -e; cd ..;
 
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index bf215c5..9a8c2fa 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -22,7 +22,7 @@ if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then
 fi
 
 PROVIDES="$PROVIDES kernel-$KERNELRELEASE"
-__KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"`
+__KERNELRELEASE=`echo $___KERNELRELEASE | sed -e "s/-/_/g"`
 
 echo "Name: kernel"
 echo "Summary: The Linux Kernel"
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 6/6] kbuild: cleanup the rpm buildroot
  2011-05-17 17:36 [PATCH 1/6] kbuild: Integrate with new-kernel-pkg Arun Sharma
                   ` (3 preceding siblings ...)
  2011-05-17 17:36 ` [PATCH 5/6] kbuild: Append RPM release to $KERNELRELEASE Arun Sharma
@ 2011-05-17 17:36 ` Arun Sharma
  2011-05-25 13:54   ` Michal Marek
  2011-05-17 19:46 ` [PATCH 1/6] kbuild: Integrate with new-kernel-pkg Michal Marek
  5 siblings, 1 reply; 20+ messages in thread
From: Arun Sharma @ 2011-05-17 17:36 UTC (permalink / raw)
  To: Michal Marek, linux-kbuild, linux-kernel; +Cc: Arun Sharma

Signed-off-by: Arun Sharma <asharma@fb.com>
---
 scripts/package/mkspec |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 9a8c2fa..79dbe5c 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -81,6 +81,7 @@ echo ""
 fi
 
 echo "%build"
+echo 'rm -rf $RPM_BUILD_ROOT'
 
 if ! $PREBUILT; then
 echo "make clean && make %{?_smp_mflags}"
-- 
1.7.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 5/6] kbuild: Append RPM release to $KERNELRELEASE
  2011-05-17 17:36 ` [PATCH 5/6] kbuild: Append RPM release to $KERNELRELEASE Arun Sharma
@ 2011-05-17 17:46   ` Arun Sharma
  2011-05-17 20:13   ` Michal Marek
  1 sibling, 0 replies; 20+ messages in thread
From: Arun Sharma @ 2011-05-17 17:46 UTC (permalink / raw)
  To: Michal Marek, linux-kbuild, linux-kernel

On Tue, May 17, 2011 at 10:36:18AM -0700, Arun Sharma wrote:
> Provide the same consistency as distributor kernels.
> uname -r matches RPM name (includes the release)

Not all of the patches in this series may be appropriate for
inclusion into kbuild. But I wanted to send them out anyway
to get feedback on how things can be improved.

This patch in particular changes the rpm name and might need
to be an opt-in feature.

 -Arun

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] kbuild: Integrate with new-kernel-pkg
  2011-05-17 17:36 [PATCH 1/6] kbuild: Integrate with new-kernel-pkg Arun Sharma
                   ` (4 preceding siblings ...)
  2011-05-17 17:36 ` [PATCH 6/6] kbuild: cleanup the rpm buildroot Arun Sharma
@ 2011-05-17 19:46 ` Michal Marek
  2011-05-17 20:45   ` Arun Sharma
  5 siblings, 1 reply; 20+ messages in thread
From: Michal Marek @ 2011-05-17 19:46 UTC (permalink / raw)
  To: Arun Sharma; +Cc: linux-kbuild, linux-kernel

On 17.5.2011 19:36, Arun Sharma wrote:
> Handles mkinitrd, updating the bootloader among other things.

This is a Fedora/RHEL specific script, please keep the mkspec script
work on any rpm distribution.

Michal

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 5/6] kbuild: Append RPM release to $KERNELRELEASE
  2011-05-17 17:36 ` [PATCH 5/6] kbuild: Append RPM release to $KERNELRELEASE Arun Sharma
  2011-05-17 17:46   ` Arun Sharma
@ 2011-05-17 20:13   ` Michal Marek
  2011-05-20 20:59     ` Arun Sharma
  2011-05-25 20:46     ` Arun Sharma
  1 sibling, 2 replies; 20+ messages in thread
From: Michal Marek @ 2011-05-17 20:13 UTC (permalink / raw)
  To: Arun Sharma; +Cc: linux-kbuild, linux-kernel

On 17.5.2011 19:36, Arun Sharma wrote:
> Provide the same consistency as distributor kernels.
> uname -r matches RPM name (includes the release)
> 
> Glossary:
> 
> KERNELRELEASE = what users see
> ___KERNELRELEASE = KERNELRELEASE without RPM release
> __KERNELRELEASE = ___KERNELRELEASE with s/-/_/g
> 
> Signed-off-by: Arun Sharma <asharma@fb.com>
> ---
>  Makefile                 |    9 ++++++---
>  scripts/package/Makefile |    2 +-
>  scripts/package/mkspec   |    2 +-
>  3 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 28820f7..90d45f4 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -367,11 +367,14 @@ KBUILD_AFLAGS_MODULE  := -DMODULE
>  KBUILD_CFLAGS_MODULE  := -DMODULE
>  KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
>  
> -# Read KERNELRELEASE from include/config/kernel.release (if it exists)
> -KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
> +# Read ___KERNELRELEASE from include/config/kernel.release (if it exists)
> +___KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
> +# Append the release version only once. 
> +# Note: .version could change during the build.
> +KERNELRELEASE ?= $(___KERNELRELEASE)-$(shell /bin/sh scripts/mkversion)

Please stop decorating the kernel release string for the sake of make
rpm, thanks. If you really want the kernel release string match rpm's
%{version}-%{release}, how about this: Let the user set
CONFIG_LOCALVERSION=-<number> and check in make rpm if $KERNELRELEASE
ends with -<number>. If so, use <number> in the Release: field and the
rest in Version:, otherwise use the same scheme as before. That way, you
won't force a new kernel release numbering scheme on anyone.

Michal

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] kbuild: Integrate with new-kernel-pkg
  2011-05-17 19:46 ` [PATCH 1/6] kbuild: Integrate with new-kernel-pkg Michal Marek
@ 2011-05-17 20:45   ` Arun Sharma
  2011-05-17 21:34     ` Michal Marek
  0 siblings, 1 reply; 20+ messages in thread
From: Arun Sharma @ 2011-05-17 20:45 UTC (permalink / raw)
  To: Michal Marek; +Cc: Arun Sharma, linux-kbuild, linux-kernel

On Tue, May 17, 2011 at 09:46:59PM +0200, Michal Marek wrote:
> On 17.5.2011 19:36, Arun Sharma wrote:
> > Handles mkinitrd, updating the bootloader among other things.
> 
> This is a Fedora/RHEL specific script, please keep the mkspec script
> work on any rpm distribution.

One alternative is to surround it with:

if [ -x /sbin/new-kernel-pkg ]; then
 ...
fi

and have similar stanzas for other popular rpm based distros.

 -Arun

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] kbuild: Integrate with new-kernel-pkg
  2011-05-17 20:45   ` Arun Sharma
@ 2011-05-17 21:34     ` Michal Marek
  2011-05-17 21:48       ` Arun Sharma
  2011-05-25 20:31       ` Arun Sharma
  0 siblings, 2 replies; 20+ messages in thread
From: Michal Marek @ 2011-05-17 21:34 UTC (permalink / raw)
  To: Arun Sharma; +Cc: linux-kbuild, linux-kernel

On 17.5.2011 22:45, Arun Sharma wrote:
> On Tue, May 17, 2011 at 09:46:59PM +0200, Michal Marek wrote:
>> On 17.5.2011 19:36, Arun Sharma wrote:
>>> Handles mkinitrd, updating the bootloader among other things.
>>
>> This is a Fedora/RHEL specific script, please keep the mkspec script
>> work on any rpm distribution.
> 
> One alternative is to surround it with:
> 
> if [ -x /sbin/new-kernel-pkg ]; then
>  ...
> fi
> 
> and have similar stanzas for other popular rpm based distros.

Or use /sbin/installkernel and let distros handle it.

Michal

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] kbuild: Integrate with new-kernel-pkg
  2011-05-17 21:34     ` Michal Marek
@ 2011-05-17 21:48       ` Arun Sharma
  2011-05-25 20:31       ` Arun Sharma
  1 sibling, 0 replies; 20+ messages in thread
From: Arun Sharma @ 2011-05-17 21:48 UTC (permalink / raw)
  To: Michal Marek; +Cc: Arun Sharma, linux-kbuild, linux-kernel

On Tue, May 17, 2011 at 11:34:17PM +0200, Michal Marek wrote:
> > and have similar stanzas for other popular rpm based distros.
> 
> Or use /sbin/installkernel and let distros handle it.

There is no /sbin/uninstallkernel though :)

Also installkernel doesn't seem to have a way of making the 
newly installed rpm the default kernel.

I'm ok with either approach (go with the least common denominator
or have parallel distro specific code).

 -Arun

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 5/6] kbuild: Append RPM release to $KERNELRELEASE
  2011-05-17 20:13   ` Michal Marek
@ 2011-05-20 20:59     ` Arun Sharma
  2011-05-25 20:46     ` Arun Sharma
  1 sibling, 0 replies; 20+ messages in thread
From: Arun Sharma @ 2011-05-20 20:59 UTC (permalink / raw)
  To: Michal Marek; +Cc: Arun Sharma, linux-kbuild, linux-kernel

On Tue, May 17, 2011 at 10:13:55PM +0200, Michal Marek wrote:
> 
> Please stop decorating the kernel release string for the sake of make
> rpm, thanks. If you really want the kernel release string match rpm's
> %{version}-%{release}, how about this: Let the user set
> CONFIG_LOCALVERSION=-<number> and check in make rpm if $KERNELRELEASE
> ends with -<number>. If so, use <number> in the Release: field and the
> rest in Version:, otherwise use the same scheme as before. That way, you
> won't force a new kernel release numbering scheme on anyone.

Turns out that even this patch isn't sufficient for what we were trying to
do. Let's drop this patch for now. The other patches are independent
and should still apply.

 -Arun


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 3/6] kbuild: Create a kernel-headers RPM
  2011-05-17 17:36 ` [PATCH 3/6] kbuild: Create a kernel-headers RPM Arun Sharma
@ 2011-05-24 16:38   ` Michal Marek
  0 siblings, 0 replies; 20+ messages in thread
From: Michal Marek @ 2011-05-24 16:38 UTC (permalink / raw)
  To: Arun Sharma; +Cc: linux-kbuild, linux-kernel

On Tue, May 17, 2011 at 10:36:16AM -0700, Arun Sharma wrote:
> To compile binaries which depend on new kernel interfaces, we need a
> kernel-headers RPM
> 
> Signed-off-by: Arun Sharma <asharma@fb.com>
> ---
>  scripts/package/mkspec |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)

Pushed to kbuild-2.6.git#packaging.

Thanks,
Michal

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 4/6] kbuild: Move firmware images to a separate RPM
  2011-05-17 17:36 ` [PATCH 4/6] kbuild: Move firmware images to a separate RPM Arun Sharma
@ 2011-05-25 13:53   ` Michal Marek
  0 siblings, 0 replies; 20+ messages in thread
From: Michal Marek @ 2011-05-25 13:53 UTC (permalink / raw)
  To: Arun Sharma; +Cc: linux-kbuild, linux-kernel

On Tue, May 17, 2011 at 10:36:17AM -0700, Arun Sharma wrote:
> +echo 'make %{?_smp_mflags} INSTALL_FW_PATH=$RPM_BUILD_ROOT/lib/firmware KBUILD_SRC= firmware_install'

I don't think we need firmware_install, just package the firmware
installed by modules_install.

Michal

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/6] kbuild: cleanup the rpm buildroot
  2011-05-17 17:36 ` [PATCH 6/6] kbuild: cleanup the rpm buildroot Arun Sharma
@ 2011-05-25 13:54   ` Michal Marek
  2011-05-25 19:39     ` Arun Sharma
  0 siblings, 1 reply; 20+ messages in thread
From: Michal Marek @ 2011-05-25 13:54 UTC (permalink / raw)
  To: Arun Sharma; +Cc: linux-kbuild, linux-kernel

On Tue, May 17, 2011 at 10:36:19AM -0700, Arun Sharma wrote:
>  echo "%build"
> +echo 'rm -rf $RPM_BUILD_ROOT'

Don't do it, this allows another user to create their or $RPM_BUILD_ROOT
and let you package it.

Michal

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 6/6] kbuild: cleanup the rpm buildroot
  2011-05-25 13:54   ` Michal Marek
@ 2011-05-25 19:39     ` Arun Sharma
  0 siblings, 0 replies; 20+ messages in thread
From: Arun Sharma @ 2011-05-25 19:39 UTC (permalink / raw)
  To: Michal Marek; +Cc: Arun Sharma, linux-kbuild, linux-kernel

On Wed, May 25, 2011 at 03:54:58PM +0200, Michal Marek wrote:
> On Tue, May 17, 2011 at 10:36:19AM -0700, Arun Sharma wrote:
> >  echo "%build"
> > +echo 'rm -rf $RPM_BUILD_ROOT'
> 
> Don't do it, this allows another user to create their or $RPM_BUILD_ROOT
> and let you package it.

Here's the motivation for the change:

mkspec has a BuildRoot that is deterministic (i.e. the next time I
rebuild I get the same buildroot)

> echo "BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root"

So if I were to restart a broken build, the build root could have old files
that break the build even after the breakage is fixed.

 -Arun

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH 1/6] kbuild: Integrate with new-kernel-pkg
  2011-05-17 21:34     ` Michal Marek
  2011-05-17 21:48       ` Arun Sharma
@ 2011-05-25 20:31       ` Arun Sharma
  1 sibling, 0 replies; 20+ messages in thread
From: Arun Sharma @ 2011-05-25 20:31 UTC (permalink / raw)
  To: Michal Marek; +Cc: Arun Sharma, linux-kbuild, linux-kernel

On Tue, May 17, 2011 at 11:34:17PM +0200, Michal Marek wrote:
> 
> Or use /sbin/installkernel and let distros handle it.

Updated distro specific patch (not expecting you to apply it).
The earlier version was mixed up with kernel-devel patch.

 -Arun

commit cb73fb35a588922344763c075b2fce159df41fc7
Author: Arun Sharma <asharma@fb.com>
Date:   Sun Mar 6 08:08:53 2011 -0800

    kbuild: Integrate with new-kernel-pkg
    
    Handles mkinitrd, updating the bootloader among other things.
    
    Signed-off-by: Arun Sharma <asharma@fb.com>

diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index ed8b6a8..f5f0cb5 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -40,6 +40,8 @@ echo "Source: kernel-$__KERNELRELEASE.tar.gz"
 fi
 
 echo "BuildRoot: %{_tmppath}/%{name}-%{PACKAGE_VERSION}-root"
+echo "Requires(post): /sbin/new-kernel-pkg"
+echo "Requires(preun): /sbin/new-kernel-pkg"
 echo "Provides: $PROVIDES"
 echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
 echo "%define debug_package %{nil}"
@@ -95,6 +97,14 @@ echo 'mv vmlinux.orig vmlinux'
 echo "%endif"
 
 echo ""
+echo "%preun"
+echo '/sbin/new-kernel-pkg --rminitrd --rmmoddep --remove '"$KERNELRELEASE"' || exit $?'
+
+echo ""
+echo "%post"
+echo '/sbin/new-kernel-pkg --mkinitrd --depmod --install --make-default '"$KERNELRELEASE"' || exit $?'
+
+echo ""
 echo "%clean"
 echo 'rm -rf $RPM_BUILD_ROOT'
 echo ""

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 2/6] kbuild: Add a kernel-devel package
  2011-05-17 17:36 ` [PATCH 2/6] kbuild: Add a kernel-devel package Arun Sharma
@ 2011-05-25 20:34   ` Arun Sharma
  0 siblings, 0 replies; 20+ messages in thread
From: Arun Sharma @ 2011-05-25 20:34 UTC (permalink / raw)
  To: Arun Sharma; +Cc: Michal Marek, linux-kbuild, linux-kernel

[ Updated version of this patch. ]

    kbuild: Add a kernel-devel package
    
    Useful for building modules without having kernel sources
    
    Signed-off-by: Arun Sharma <asharma@fb.com>

diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index f5f0cb5..c79b777 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -49,6 +49,14 @@ echo ""
 echo "%description"
 echo "The Linux Kernel, the operating system core itself"
 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"
@@ -96,6 +104,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 "rsync -avz --exclude '.git/' --exclude '*vmlinux*' --exclude '.*' --exclude '*.o' --exclude '*.so' --exclude '*.ko' . "'$RPM_BUILD_ROOT'"/usr/src/kernels/$KERNELRELEASE/"
+echo 'pushd $RPM_BUILD_ROOT'"/lib/modules/$KERNELRELEASE"' && ln -s build source && ln -s '"/usr/src/kernels/$KERNELRELEASE"' build && popd'
+
 echo ""
 echo "%preun"
 echo '/sbin/new-kernel-pkg --rminitrd --rmmoddep --remove '"$KERNELRELEASE"' || exit $?'
@@ -115,3 +128,7 @@ echo "/lib/modules/$KERNELRELEASE"
 echo "/lib/firmware"
 echo "/boot/*"
 echo ""
+echo "%files devel"
+echo '%defattr (-, root, root)'
+echo "/usr/src/kernels/$KERNELRELEASE"
+echo ""

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH 5/6] kbuild: Append RPM release to $KERNELRELEASE
  2011-05-17 20:13   ` Michal Marek
  2011-05-20 20:59     ` Arun Sharma
@ 2011-05-25 20:46     ` Arun Sharma
  1 sibling, 0 replies; 20+ messages in thread
From: Arun Sharma @ 2011-05-25 20:46 UTC (permalink / raw)
  To: Michal Marek; +Cc: Arun Sharma, linux-kbuild, linux-kernel

On Tue, May 17, 2011 at 10:13:55PM +0200, Michal Marek wrote:
> 
> Please stop decorating the kernel release string for the sake of make
> rpm, thanks. If you really want the kernel release string match rpm's
> %{version}-%{release}, how about this: Let the user set
> CONFIG_LOCALVERSION=-<number> and check in make rpm if $KERNELRELEASE
> ends with -<number>. If so, use <number> in the Release: field and the
> rest in Version:, otherwise use the same scheme as before. That way, you
> won't force a new kernel release numbering scheme on anyone.

This patch has been working better than the previous one for us and it
has a similar property that it is a nop for developers who don't use
rpm for packaging.

commit 29cbbfa5d840ac1ecd80a2045f05f6440d2c4c04
Author: Arun Sharma <asharma@fb.com>
Date:   Fri May 20 14:48:01 2011 -0700

    kbuild: Use KERNELRELEASE from packaging scripts
    
    This adds two changes to the kernel Makefile:
    
    * Honor KERNELRELEASE if it's already set
    * Allow external scripts to append $LOCAL_VERSION to
      $EXTRA_VERSION

diff --git a/Makefile b/Makefile
index 123d858..01c51e4 100644
--- a/Makefile
+++ b/Makefile
@@ -368,7 +368,11 @@ KBUILD_CFLAGS_MODULE  := -DMODULE
 KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
 
 # Read KERNELRELEASE from include/config/kernel.release (if it exists)
-KERNELRELEASE = $(shell cat include/config/kernel.release 2> /dev/null)
+# and if it's not already defined
+KERNELRELEASE ?= $(shell cat include/config/kernel.release 2> /dev/null)
+ifdef LOCAL_VERSION
+EXTRAVERSION := $(EXTRAVERSION)_$(LOCAL_VERSION)
+endif
 KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
 export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
index 001814e..c496bd5 100755
--- a/scripts/package/mkspec
+++ b/scripts/package/mkspec
@@ -23,13 +23,16 @@ fi
 
 PROVIDES="$PROVIDES kernel-$KERNELRELEASE"
 __KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-/_/g"`
+LOCAL_VERSION=`. $srctree/scripts/mkversion``$srctree/scripts/setlocalversion | sed 's/-/_/g'`
+KERNELRELEASE=${__KERNELRELEASE}-${LOCAL_VERSION}
+
 
 echo "Name: kernel"
 echo "Summary: The Linux Kernel"
 echo "Version: $__KERNELRELEASE"
 # we need to determine the NEXT version number so that uname and
 # rpm -q will agree
-echo "Release: `. $srctree/scripts/mkversion`"
+echo "Release: $LOCAL_VERSION"
 echo "License: GPL"
 echo "Group: System Environment/Kernel"
 echo "Vendor: The Linux Community"
@@ -84,6 +87,8 @@ fi
 
 echo "%build"
 echo 'rm -rf $RPM_BUILD_ROOT'
+echo "export KERNELRELEASE=%{version}-%{release}"
+echo "export LOCAL_VERSION=%{release}"
 
 if ! $PREBUILT; then
 echo "make clean && make %{?_smp_mflags}"
@@ -91,6 +96,8 @@ echo ""
 fi
 
 echo "%install"
+echo "export KERNELRELEASE=%{version}-%{release}"
+echo "export LOCAL_VERSION=%{release}"
 echo "%ifarch ia64"
 echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
 echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2011-05-25 20:46 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-17 17:36 [PATCH 1/6] kbuild: Integrate with new-kernel-pkg Arun Sharma
2011-05-17 17:36 ` [PATCH 2/6] kbuild: Add a kernel-devel package Arun Sharma
2011-05-25 20:34   ` Arun Sharma
2011-05-17 17:36 ` [PATCH 3/6] kbuild: Create a kernel-headers RPM Arun Sharma
2011-05-24 16:38   ` Michal Marek
2011-05-17 17:36 ` [PATCH 4/6] kbuild: Move firmware images to a separate RPM Arun Sharma
2011-05-25 13:53   ` Michal Marek
2011-05-17 17:36 ` [PATCH 5/6] kbuild: Append RPM release to $KERNELRELEASE Arun Sharma
2011-05-17 17:46   ` Arun Sharma
2011-05-17 20:13   ` Michal Marek
2011-05-20 20:59     ` Arun Sharma
2011-05-25 20:46     ` Arun Sharma
2011-05-17 17:36 ` [PATCH 6/6] kbuild: cleanup the rpm buildroot Arun Sharma
2011-05-25 13:54   ` Michal Marek
2011-05-25 19:39     ` Arun Sharma
2011-05-17 19:46 ` [PATCH 1/6] kbuild: Integrate with new-kernel-pkg Michal Marek
2011-05-17 20:45   ` Arun Sharma
2011-05-17 21:34     ` Michal Marek
2011-05-17 21:48       ` Arun Sharma
2011-05-25 20:31       ` Arun Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).