diff mbox

[1/6] kbuild: Integrate with new-kernel-pkg

Message ID 1305653779-3445-1-git-send-email-asharma@fb.com (mailing list archive)
State New, archived
Headers show

Commit Message

Arun Sharma May 17, 2011, 5:36 p.m. UTC
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(-)

Comments

Michal Marek May 17, 2011, 7:46 p.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arun Sharma May 17, 2011, 8:45 p.m. UTC | #2
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Michal Marek May 17, 2011, 9:34 p.m. UTC | #3
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arun Sharma May 17, 2011, 9:48 p.m. UTC | #4
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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'