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

Re: [DRAFT] Policy for Linux kernel, initramfs, boot loader update process



On Mon, 28 Jun 2010 12:45:10 -0400 (EDT), maximilian attems wrote:
> On Mon, 28 Jun 2010 03:02:35 +0100 Ben Hutchings wrote:
>> The arguments given to all kernel hook scripts are the kernel ABI
>> version (the string that uname -r reports) and the absolute path to the
>> kernel image.
> On Mon, Jun 28, 2010 at 11:16:58AM -0400, Stephen Powell wrote:
>> Currently, hook scripts invoked by a stock kernel maintainer script
>> or a maintainer script from a kernel image package created by make-kpkg
>> pass these exact same arguments.
> 
> no.

>From a Squeeze system running a custom kernel created by make-kpkg:

-----

debian3:~# dpkg-reconfigure linux-image-2.6.32-custom5b-s390x
Running depmod.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/S30initramfs 2.6.32-custom5b-s390x /boot/vmlinuz-2.6.32-custom5b-s390x
                                                         ^                     ^
                                                         +-- 1st argument      +-- 2nd argument
  
-----

>From a Squeeze system running a stock kernel image:

-----

root@testdebian:~# dpkg-reconfigure linux-image-2.6.32-3-686
Running depmod.
Running update-initramfs: Generating /boot/initrd.img-2.6.32-3-686
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/S30initramfs 2.6.32-3-686 /boot/vmlinuz-2.6.32-3-686
                                                         ^            ^
                                                         |            +-- 2nd argument
                                                         +-- 1st argument

-----

Q.E.D.

> On Mon, Jun 28, 2010 at 11:16:58AM -0400, Stephen Powell wrote:
>> But a maintainer script for a kernel
>> image package created by "make deb-pkg" passes only the first argument.
> 
> no.

The actual text of /etc/kernel/postinst.d/initramfs-tools:

-----

#!/bin/sh

version="$1"
bootopt=""

# passing the kernel version is required
[ -z "${version}" ] && exit 0

# kernel-package passes an extra arg
if [ -n "$2" ]; then
        if [ -n "${KERNEL_PACKAGE_VERSION}" ]; then
                bootdir=$(dirname "$2")
                bootopt="-b ${bootdir}"
        else
                # official Debian linux-images take care themself
                exit 0
        fi
fi

# avoid running multiple times
if [ -n "$DEB_MAINT_PARAMS" ]; then
        eval set -- "$DEB_MAINT_PARAMS"
        if [ -z "$1" ] || [ "$1" != "configure" ]; then
                exit 0
        fi
fi

# we're good - create initramfs.  update runs do_bootloader
update-initramfs -c -t -k "${version}" ${bootopt}

-----

I admit that I have never personally used "make deb-pkg", but
clearly the source code speaks for itself.  This hook script is
expecting only one argument when invoked by "make deb-pkg".

Q.E.D.

> On Mon, Jun 28, 2010 at 11:16:58AM -0400, Stephen Powell wrote: 
>> Existing hook scripts rely on that difference to determine whether or
>> not to take action.  For example, the initramfs hook script provided by
>> the initramfs-tools package tests the number of arguments and exits
>> without doing anything if more than one argument is supplied.  In other
>> words, this hook script is designed to create the initial RAM file system
>> for a kernel image created by "make deb-pkg", and only for a kernel
>> image created by "make deb-pkg".  It does nothing otherwise.  Are you
>> proposing to change this behavior?
> 
> please get your facts right before spamming the world.

OK, you're partly right on this one.  Execution tracing shows that it
does nothing when invoked by a stock kernel maintainer script but
does create an initial RAM file system when invoked by a maintainer
script from a kernel image package created by make-kpkg.  (By the way,
since this script is running under debconf, output from update-initramfs
should be redirected to standard error via ">&2".)  I don't remember the
kernel-package logic being present in this script the last time I looked
at it.

(1) As far as I am able to determine, my original statements are correct,
    with the exception of the correction made in the above paragraph.
    If you can prove me wrong, please do so.
(2) This was not spam.  Spam is unsolicited advertising.
    This was a response to an RFC, to which I was explicitly
    included as an adressee.
(3) All the addressees of my e-mail were legitimate stake-holders
    in this process.  This is not "the world".

-- 
  .''`.     Stephen Powell    
 : :'  :
 `. `'`
   `-


Reply to: