[arch-projects] [mkinitcpio][PATCH] kernel-install: add hook
This will allow systemd's kernel-install script to generate and install an initrd as per the freedesktop boot loader specs. See kernel-install(8) for details. Notice that 'profiles' are not used. This will eventually be hooked up so that calling "make install" from a kernel build will do the right thing. Signed-off-by: Tom Gundersen <teg@jklm.no> --- 50-mkinitcpio.install | 12 ++++++++++++ Makefile | 3 +++ 2 files changed, 15 insertions(+) create mode 100755 50-mkinitcpio.install diff --git a/50-mkinitcpio.install b/50-mkinitcpio.install new file mode 100755 index 0000000..7cd195e --- /dev/null +++ b/50-mkinitcpio.install @@ -0,0 +1,12 @@ +#!/bin/sh + +case "$1" in + add) + mkinitcpio -k "$2" -g "$3"/initrd + ;; + remove) + rm -f -- "$3"/initrd + ;; +esac + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/Makefile b/Makefile index 633dd63..1b933c9 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ DIRS = \ /usr/lib/initcpio/hooks \ /usr/lib/initcpio/install \ /usr/lib/initcpio/udev \ + /usr/lib/kernel/install.d \ /usr/share/man/man8 \ /usr/share/man/man5 \ /usr/share/man/man1 \ @@ -48,6 +49,8 @@ install: all cp -at $(DESTDIR)/usr/lib/initcpio hooks install install -m644 -t $(DESTDIR)/usr/share/mkinitcpio mkinitcpio.d/* + install -m755 50-mkinitcpio.install $(DESTDIR)/usr/lib/kernel/install.d/50-mkinitcpio.install + install -m644 man/mkinitcpio.8 $(DESTDIR)/usr/share/man/man8/mkinitcpio.8 install -m644 man/mkinitcpio.conf.5 $(DESTDIR)/usr/share/man/man5/mkinitcpio.conf.5 install -m644 man/lsinitcpio.1 $(DESTDIR)/usr/share/man/man1/lsinitcpio.1 -- 1.8.4
On Wed, Sep 25, 2013 at 08:39:41PM +0200, Tom Gundersen wrote:
This will allow systemd's kernel-install script to generate and install an initrd as per the freedesktop boot loader specs.
What bootloaders implement this?
See kernel-install(8) for details.
Notice that 'profiles' are not used.
This will eventually be hooked up so that calling "make install" from a kernel build will do the right thing.
Is there a pending patch set you can point me to?
Signed-off-by: Tom Gundersen <teg@jklm.no> --- 50-mkinitcpio.install | 12 ++++++++++++ Makefile | 3 +++ 2 files changed, 15 insertions(+) create mode 100755 50-mkinitcpio.install
Probably best to commit this as 644. The Makefile takes care of the permissions.
diff --git a/50-mkinitcpio.install b/50-mkinitcpio.install new file mode 100755 index 0000000..7cd195e --- /dev/null +++ b/50-mkinitcpio.install @@ -0,0 +1,12 @@ +#!/bin/sh + +case "$1" in + add) + mkinitcpio -k "$2" -g "$3"/initrd + ;; + remove) + rm -f -- "$3"/initrd + ;;
Mixing tabs and spces here.
+esac + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/Makefile b/Makefile index 633dd63..1b933c9 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ DIRS = \ /usr/lib/initcpio/hooks \ /usr/lib/initcpio/install \ /usr/lib/initcpio/udev \ + /usr/lib/kernel/install.d \ /usr/share/man/man8 \ /usr/share/man/man5 \ /usr/share/man/man1 \ @@ -48,6 +49,8 @@ install: all cp -at $(DESTDIR)/usr/lib/initcpio hooks install install -m644 -t $(DESTDIR)/usr/share/mkinitcpio mkinitcpio.d/*
+ install -m755 50-mkinitcpio.install $(DESTDIR)/usr/lib/kernel/install.d/50-mkinitcpio.install + install -m644 man/mkinitcpio.8 $(DESTDIR)/usr/share/man/man8/mkinitcpio.8 install -m644 man/mkinitcpio.conf.5 $(DESTDIR)/usr/share/man/man5/mkinitcpio.conf.5 install -m644 man/lsinitcpio.1 $(DESTDIR)/usr/share/man/man1/lsinitcpio.1 -- 1.8.4
On Thu, Sep 26, 2013 at 12:36 AM, Dave Reisner <d@falconindy.com> wrote:
On Wed, Sep 25, 2013 at 08:39:41PM +0200, Tom Gundersen wrote:
This will allow systemd's kernel-install script to generate and install an initrd as per the freedesktop boot loader specs.
What bootloaders implement this?
gummiboot does and there are patches for grub (but I don't think they are upstreamed yet), I don't think anyone else do yet. That said, other bootloaders could also add kernel-install hooks of their own to update their configs to point at the correct kernel/initramfs images, so they don't necessarily need to implement the spec to take advantage of this. I know Sébastien was looking at refind, did you find a simple way to integrate this with refind without it implementing the boot spec?
See kernel-install(8) for details.
Notice that 'profiles' are not used.
This will eventually be hooked up so that calling "make install" from a kernel build will do the right thing.
Is there a pending patch set you can point me to?
At least one systemd patch is needed [0], and you need to symlink /bin/installkernel or ~/bin/installkernel to /bin/kernel-install. I'll resend after addressing your comments. -t [0]: <http://www.mail-archive.com/systemd-devel@lists.freedesktop.org/msg13165.html>
On 26/09/2013 14:55, Tom Gundersen wrote:
On Thu, Sep 26, 2013 at 12:36 AM, Dave Reisner <d@falconindy.com> wrote:
On Wed, Sep 25, 2013 at 08:39:41PM +0200, Tom Gundersen wrote:
This will allow systemd's kernel-install script to generate and install an initrd as per the freedesktop boot loader specs.
What bootloaders implement this?
gummiboot does and there are patches for grub (but I don't think they are upstreamed yet), I don't think anyone else do yet. That said, other bootloaders could also add kernel-install hooks of their own to update their configs to point at the correct kernel/initramfs images, so they don't necessarily need to implement the spec to take advantage of this.
I know Sébastien was looking at refind, did you find a simple way to integrate this with refind without it implementing the boot spec?
Sadly, that doesn't work. Refind scan for linux kernel in the efi partition, but if the kernel is not suffixed by .efi, it looks only for files beginning by vmlinuz or bzimage. The boot spec names kernel files linux. I sent a patch[1] proposal to refind forum[2]. I switched all my custom kernel to use kernel-install for 2 months, and I use a custom 90-loaderentry.install[3], which create kernel in the right directory (for grub) and with the right naming (for refind). Letting the directory created by kernel-install empty (two copies are too expensive). Cheers, [1] https://horus.seblu.net/~seblu/refind/0001-Add-Freedesktop-bootspec-support.... [2] https://sourceforge.net/p/refind/discussion/general/thread/b1062250/ [3] https://horus.seblu.net/~seblu/refind/90-loaderentry.install -- Sébastien "Seblu" Luttringer https://www.seblu.net GPG: 0x2072D77A
This will allow systemd's kernel-install script to generate and install an initrd as per the freedesktop boot loader specs. See kernel-install(8) for details. Notice that 'profiles' are not used. This will eventually be hooked up so that calling "make install" from a kernel build will do the right thing. Signed-off-by: Tom Gundersen <teg@jklm.no> --- 50-mkinitcpio.install | 12 ++++++++++++ Makefile | 3 +++ 2 files changed, 15 insertions(+) create mode 100644 50-mkinitcpio.install diff --git a/50-mkinitcpio.install b/50-mkinitcpio.install new file mode 100644 index 0000000..40f589a --- /dev/null +++ b/50-mkinitcpio.install @@ -0,0 +1,12 @@ +#!/bin/sh + +case "$1" in + add) + mkinitcpio -k "$2" -g "$3"/initrd + ;; + remove) + rm -f -- "$3"/initrd + ;; +esac + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/Makefile b/Makefile index 633dd63..1b933c9 100644 --- a/Makefile +++ b/Makefile @@ -10,6 +10,7 @@ DIRS = \ /usr/lib/initcpio/hooks \ /usr/lib/initcpio/install \ /usr/lib/initcpio/udev \ + /usr/lib/kernel/install.d \ /usr/share/man/man8 \ /usr/share/man/man5 \ /usr/share/man/man1 \ @@ -48,6 +49,8 @@ install: all cp -at $(DESTDIR)/usr/lib/initcpio hooks install install -m644 -t $(DESTDIR)/usr/share/mkinitcpio mkinitcpio.d/* + install -m755 50-mkinitcpio.install $(DESTDIR)/usr/lib/kernel/install.d/50-mkinitcpio.install + install -m644 man/mkinitcpio.8 $(DESTDIR)/usr/share/man/man8/mkinitcpio.8 install -m644 man/mkinitcpio.conf.5 $(DESTDIR)/usr/share/man/man5/mkinitcpio.conf.5 install -m644 man/lsinitcpio.1 $(DESTDIR)/usr/share/man/man1/lsinitcpio.1 -- 1.8.4
participants (3)
-
Dave Reisner
-
Sébastien Luttringer
-
Tom Gundersen