* [RFC][PATCH] deb target
@ 2003-10-11 8:22 Wichert Akkerman
2003-10-11 11:10 ` Sam Ravnborg
2003-10-18 11:50 ` Wichert Akkerman
0 siblings, 2 replies; 4+ messages in thread
From: Wichert Akkerman @ 2003-10-11 8:22 UTC (permalink / raw)
To: linux-kernel
I sent this to the listed contact for kbuild first, but Michael
Elizabeth Chastain tells me he is no longer active in kernel development
and the kbuild-devel list seems both inactive and defunct (my post
never made it to any of the list archives), so I'm reposting this
here.
For a while now I've been missing a deb target in kbuild, especially
since there is a simple rpm target. While Debian does have a tool
to create kernel packages (make-kpkg from the kernel-package package)
I felt there was a need for a simpler method build into kbuild.
The patch is imperfect and could use some changes from someone who is
more familiar with kbuild, but It Works For Me(tm). I would appreciate
any feedback people have on it.
Wichert.
diff -wurN linux-2.6.0-test7/Makefile linux-2.5/Makefile
--- linux-2.6.0-test7/Makefile 2003-10-08 21:24:17.000000000 +0200
+++ linux-2.5/Makefile 2003-10-09 18:08:17.000000000 +0200
@@ -780,7 +780,7 @@
quiet_cmd_rmclean = RM $$(CLEAN_FILES)
cmd_rmclean = rm -f $(CLEAN_FILES)
-clean: archclean $(clean-dirs)
+clean: archclean debclean $(clean-dirs)
$(call cmd,rmclean)
@find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
@@ -843,6 +843,19 @@
tags: FORCE
$(call cmd,tags)
+# DEB target
+# ---------------------------------------------------------------------------
+
+.PHONY: deb debclean
+
+debclean:
+ rm -rf debian/tmp
+ rm -f debian/changelog debian/control debian/files
+ rmdir debian
+
+deb:
+ $(srctree)/scripts/builddeb
+
# RPM target
# ---------------------------------------------------------------------------
diff -wurN linux-2.6.0-test7/scripts/builddeb linux-2.5/scripts/builddeb
--- linux-2.6.0-test7/scripts/builddeb 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.5/scripts/builddeb 2003-10-09 18:13:44.000000000 +0200
@@ -0,0 +1,74 @@
+#!/bin/sh
+#
+# builddep 0.1
+# Copyright 2003 Wichert Akkerman <wichert@deephackmode.org>
+#
+# Simple script to generate a deb package for a Linux kernel. All the
+# complexity of what to do with a kernel after it is installer or removed
+# is left to other scripts and packages: they can install scripts in the
+# /etc/linux/postinst/ and /etc/linux/prerm/ directories that will be called
+# on package install and removal.
+
+set -e
+
+# Some variables and settings used throughout the script
+version="$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
+tmpdir="$(pwd)/debian/tmp"
+
+# Setup the directory structure
+rm -rf "$tmpdir"
+mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boo"t
+
+# Build and install the kernel
+INSTALL_PATH="$tmpdir/boot" make install
+INSTALL_MOD_PATH="$tmpdir" make modules_install
+
+# Remove the generated symbolic links, those should not be in the package but
+# generated after installation
+rm $(find "$tmpdir/boot" -type l -print)
+
+# Install the maintainer scripts
+for script in postinst postrm preinst prerm ; do
+ mkdir -p "$tmpdir/etc/linux/$script.d"
+ cat <<EOF > "$tmpdir/DEBIAN/$script"
+#!/bin/sh
+
+set -e
+
+test -d /etc/linux/$script.d && run-parts --arg="$version" /etc/linux/$script.d
+exit 0
+EOF
+ chmod 755 "$tmpdir/DEBIAN/$script"
+done
+
+# Generate a simple changelog template
+cat <<EOF > debian/changelog
+linux ($version) unstable; urgency=low
+
+ * A standard release
+
+ -- Linus Torvalds <torvalds@osdl.org> $(date -R)
+EOF
+
+# Generate a control file
+cat <<EOF > debian/control
+Source: linux
+Section: base
+Priority: optional
+Maintainer: Linus Torvalds <torvalds@osdl.org>
+Standards-Version: 3.6.1
+
+Package: linux
+Architecture: any
+Description: Linux kernel, version $version
+ This package contains the Linux kernel, modules and corresponding other
+ files version $version.
+EOF
+
+# Fix some ownership and permissions
+chown -R root:root "$tmpdir"
+chmod -R go-w "$tmpdir"
+
+# Perform the final magic
+dpkg-gencontrol -isp
+dpkg --build "$tmpdir" ..
--
Wichert Akkerman <wichert@wiggy.net> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
----- End forwarded message -----
--
Wichert Akkerman <wichert@wiggy.net> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC][PATCH] deb target
2003-10-11 8:22 [RFC][PATCH] deb target Wichert Akkerman
@ 2003-10-11 11:10 ` Sam Ravnborg
2003-10-18 11:50 ` Wichert Akkerman
1 sibling, 0 replies; 4+ messages in thread
From: Sam Ravnborg @ 2003-10-11 11:10 UTC (permalink / raw)
To: linux-kernel
On Sat, Oct 11, 2003 at 10:22:53AM +0200, Wichert Akkerman wrote:
>
> For a while now I've been missing a deb target in kbuild, especially
> since there is a simple rpm target. While Debian does have a tool
> to create kernel packages (make-kpkg from the kernel-package package)
> I felt there was a need for a simpler method build into kbuild.
Thanks.
I will save the patch until later.
For now we are in bug-fix mode, and this is clearly new functionality.
Sam
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC][PATCH] deb target
2003-10-11 8:22 [RFC][PATCH] deb target Wichert Akkerman
2003-10-11 11:10 ` Sam Ravnborg
@ 2003-10-18 11:50 ` Wichert Akkerman
2003-10-19 15:12 ` Wichert Akkerman
1 sibling, 1 reply; 4+ messages in thread
From: Wichert Akkerman @ 2003-10-18 11:50 UTC (permalink / raw)
To: linux-kernel; +Cc: Sam Ravnborg
Here is a new versino of my make deb patch. There are a few changes
since the previous version:
* no longer use make install, since that will call installkernel which
should not happen on package creation. Instead manually install the
kernel image, config and system.map using a trick taken from
scripts/mkspec to guess the filename of the kernel image.
* no longer use Linus' name and email address but generate a name and
email address based on the currently logged in user. This to prevent
possible unwanted email to Linus.
* use /etc/kernel/ for install/removal handling scripts. This will also
be supported by the next version of Debian's kernel-package.
* obligatory typo fixes.
As always, any comments, bugreports and other forms of feedback are
welcome.
Wichert.
diff -wurN linux-2.6.0-test8/Makefile linux-2.5/Makefile
--- linux-2.6.0-test8/Makefile 2003-10-17 23:43:20.000000000 +0200
+++ linux-2.5/Makefile 2003-10-18 13:30:37.000000000 +0200
@@ -780,7 +780,7 @@
quiet_cmd_rmclean = RM $$(CLEAN_FILES)
cmd_rmclean = rm -f $(CLEAN_FILES)
-clean: archclean $(clean-dirs)
+clean: archclean debclean $(clean-dirs)
$(call cmd,rmclean)
@find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
@@ -843,6 +843,20 @@
tags: FORCE
$(call cmd,tags)
+# DEB target
+# ---------------------------------------------------------------------------
+
+.PHONY: deb debclean
+
+debclean:
+ rm -rf debian/tmp
+ rm -f debian/changelog debian/control debian/files
+ -rmdir debian
+
+deb: boot
+ @echo ' Creating kernel deb package'
+ @$(srctree)/scripts/builddeb
+
# RPM target
# ---------------------------------------------------------------------------
diff -wurN linux-2.6.0-test8/scripts/builddeb linux-2.5/scripts/builddeb
--- linux-2.6.0-test8/scripts/builddeb 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.5/scripts/builddeb 2003-10-18 13:15:39.000000000 +0200
@@ -0,0 +1,77 @@
+#!/bin/sh
+#
+# builddeb 1.0
+# Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
+#
+# Simple script to generate a deb package for a Linux kernel. All the
+# complexity of what to do with a kernel after it is installer or removed
+# is left to other scripts and packages: they can install scripts in the
+# /etc/linux/postinst/ and /etc/linux/prerm/ directories that will be called
+# on package install and removal.
+
+set -e
+
+# Some variables and settings used throughout the script
+version="$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
+tmpdir="$(pwd)/debian/tmp"
+
+# Setup the directory structure
+rm -rf "$tmpdir"
+mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot"
+
+# Build and install the kernel
+cp System.map "$tmpdir/boot/System.map-$version"
+cp .config "$tmpdir/boot/config-$version"
+if [ $(arch | grep -q i.86) 2>/dev/null ] ; then
+ cp arch/i386/boot/bzImage "$tmpdir/boot/vmlinuz-$version"
+else
+ cp vmlinux "$tmpdir/boot/vmlinuz-$version"
+fi
+INSTALL_MOD_PATH="$tmpdir" make modules_install
+
+# Install the maintainer scripts
+for script in postinst postrm preinst prerm ; do
+ mkdir -p "$tmpdir/etc/kernel/$script.d"
+ cat <<EOF > "$tmpdir/DEBIAN/$script"
+#!/bin/sh
+
+set -e
+
+test -d /etc/kernel/$script.d && run-parts --arg="$version" /etc/kernel/$script.d
+exit 0
+EOF
+ chmod 755 "$tmpdir/DEBIAN/$script"
+done
+
+name="Kernel Compiler <$(id -nu)@$(hostname -f)>"
+# Generate a simple changelog template
+cat <<EOF > debian/changelog
+linux ($version) unstable; urgency=low
+
+ * A standard release
+
+ -- $name $(date -R)
+EOF
+
+# Generate a control file
+cat <<EOF > debian/control
+Source: linux
+Section: base
+Priority: optional
+Maintainer: $name
+Standards-Version: 3.6.1
+
+Package: linux
+Architecture: any
+Description: Linux kernel, version $version
+ This package contains the Linux kernel, modules and corresponding other
+ files version $version.
+EOF
+
+# Fix some ownership and permissions
+chown -R root:root "$tmpdir"
+chmod -R go-w "$tmpdir"
+
+# Perform the final magic
+dpkg-gencontrol -isp
+dpkg --build "$tmpdir" ..
--
Wichert Akkerman <wichert@wiggy.net> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [RFC][PATCH] deb target
2003-10-18 11:50 ` Wichert Akkerman
@ 2003-10-19 15:12 ` Wichert Akkerman
0 siblings, 0 replies; 4+ messages in thread
From: Wichert Akkerman @ 2003-10-19 15:12 UTC (permalink / raw)
To: linux-kernel
A third version of this patch. A few important changes:
* make boot does not exist, use make all (oops)
* do not try to install modules if they are not enabled
* update the comments in the scripts/builddeb script to reflect the
new naming for pre- and postinstall scripts.
* do not abort when running make debclean when there is nothing to clean
Wichert.
diff -wurN linux-2.6.0-test8/Makefile linux-2.5/Makefile
--- linux-2.6.0-test8/Makefile 2003-10-17 23:43:20.000000000 +0200
+++ linux-2.5/Makefile 2003-10-18 13:30:37.000000000 +0200
@@ -780,7 +780,7 @@
quiet_cmd_rmclean = RM $$(CLEAN_FILES)
cmd_rmclean = rm -f $(CLEAN_FILES)
-clean: archclean $(clean-dirs)
+clean: archclean debclean $(clean-dirs)
$(call cmd,rmclean)
@find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
@@ -843,6 +843,20 @@
tags: FORCE
$(call cmd,tags)
+# DEB target
+# ---------------------------------------------------------------------------
+
+.PHONY: deb debclean
+
+debclean:
+ rm -rf debian/tmp
+ rm -f debian/changelog debian/control debian/files
+ -rmdir debian
+
+deb: all
+ @echo ' Creating kernel deb package'
+ @$(srctree)/scripts/builddeb
+
# RPM target
# ---------------------------------------------------------------------------
diff -wurN linux-2.6.0-test8/scripts/builddeb linux-2.5/scripts/builddeb
--- linux-2.6.0-test8/scripts/builddeb 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.5/scripts/builddeb 2003-10-18 13:15:39.000000000 +0200
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# builddeb 1.1
+# Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
+#
+# Simple script to generate a deb package for a Linux kernel. All the
+# complexity of what to do with a kernel after it is installer or removed
+# is left to other scripts and packages: they can install scripts in the
+# /etc/kernel/{pre,post}{inst,rm}.d/ directories that will be called on
+# package install and removal.
+
+set -e
+
+# Some variables and settings used throughout the script
+version="$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
+tmpdir="$(pwd)/debian/tmp"
+
+# Setup the directory structure
+rm -rf "$tmpdir"
+mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot"
+
+# Build and install the kernel
+cp System.map "$tmpdir/boot/System.map-$version"
+cp .config "$tmpdir/boot/config-$version"
+if $(arch | grep -q i.86) ; then
+ cp arch/i386/boot/bzImage "$tmpdir/boot/vmlinuz-$version"
+else
+ cp vmlinux "$tmpdir/boot/vmlinuz-$version"
+fi
+if grep -q '^CONFIG_MODULES=y' .config ; then
+ INSTALL_MOD_PATH="$tmpdir" make modules_install
+fi
+
+# Install the maintainer scripts
+for script in postinst postrm preinst prerm ; do
+ mkdir -p "$tmpdir/etc/kernel/$script.d"
+ cat <<EOF > "$tmpdir/DEBIAN/$script"
+#!/bin/sh
+
+set -e
+
+test -d /etc/kernel/$script.d && run-parts --arg="$version" /etc/kernel/$script.d
+exit 0
+EOF
+ chmod 755 "$tmpdir/DEBIAN/$script"
+done
+
+name="Kernel Compiler <$(id -nu)@$(hostname -f)>"
+# Generate a simple changelog template
+cat <<EOF > debian/changelog
+linux ($version) unstable; urgency=low
+
+ * A standard release
+
+ -- $name $(date -R)
+EOF
+
+# Generate a control file
+cat <<EOF > debian/control
+Source: linux
+Section: base
+Priority: optional
+Maintainer: $name
+Standards-Version: 3.6.1
+
+Package: linux
+Architecture: any
+Description: Linux kernel, version $version
+ This package contains the Linux kernel, modules and corresponding other
+ files version $version.
+EOF
+
+# Fix some ownership and permissions
+chown -R root:root "$tmpdir"
+chmod -R go-w "$tmpdir"
+
+# Perform the final magic
+dpkg-gencontrol -isp
+dpkg --build "$tmpdir" ..
+
+exit 0
+
--
Wichert Akkerman <wichert@wiggy.net> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-10-19 15:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-11 8:22 [RFC][PATCH] deb target Wichert Akkerman
2003-10-11 11:10 ` Sam Ravnborg
2003-10-18 11:50 ` Wichert Akkerman
2003-10-19 15:12 ` Wichert Akkerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.