ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] Q: postinst hook for firmware-*
Date: Wed, 6 Sep 2017 16:37:35 +0300
Message-ID: <20170906133734.GE13205@altlinux.org> (raw)
In-Reply-To: <20170906120909.GA8403@lks.home>

[-- Attachment #1: Type: text/plain, Size: 3152 bytes --]

On Wed, Sep 06, 2017 at 02:09:09PM +0200, Konstantin Lepikhov wrote:
> Hi Dmitry!
> 
> On 09/05/2017, at 12:35:09 AM you wrote:
> 
> <skip>
> > > > Пакеты kernel-image не дёргают make-initrd самостоятельно, полагаясь на
> > > > /usr/lib/rpm/boot_kernel.filetrigger; если эти файлы склонны расползаться
> > > > по пакетам, может быть, лучше подойдёт файлтриггер?
> > > Так если мне нужно перегенерить initrd, то я не против дернуть тот же
> > > boot_kernel.filetrigger. Где это задается? Внутри rpm?
> > 
> > Прямо в boot_kernel.filetrigger; это пакет bootloader-utils.
> Подойдет ли такое изменение?
> 
> -- 
> WBR et al.

> >From c974d0d02c1275c600929b3590e6ef644a4e8159 Mon Sep 17 00:00:00 2001
> From: "Konstantin A. Lepikhov" <lakostis@altlinux.ru>
> Date: Wed, 6 Sep 2017 13:49:26 +0200
> Subject: [PATCH] kernel.filetrigger: ucode support
> 
> We need to rebuild initramfs on CPU ucode changes otherwise everything
> will continue use outdated version till next kernel update.
> ---
>  kernel.filetrigger | 27 ++++++++++++++++++++++++++-
>  1 file changed, 26 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel.filetrigger b/kernel.filetrigger
> index 9cdf01e..38ea249 100755
> --- a/kernel.filetrigger
> +++ b/kernel.filetrigger
> @@ -9,6 +9,7 @@
>  BOOTDIR=/boot
>  VMLINUZ_PREFIX=/boot/vmlinuz
>  MODULES_PREFIX=/lib/modules
> +UCODE_PREFIX=/lib/firmware
>  INITRD_AUTOUPDATE=
>  
>  . /etc/sysconfig/installkernel
> @@ -99,6 +100,27 @@ $VERSION"
>  	last_added="$VERSION"
>  }
>  
> +ucode_handled=
> +handle_ucode()
> +{
> +	local f VENDOR VERSION
> +	f="$1"; shift
> +	# filename format: $UCODE_PREFIX/<vendor>-ucode/*
> +	VENDOR=${f#$UCODE_PREFIX/}
> +	VENDOR=${VENDOR%%-ucode/*}
> +	ucode_handled="$ucode_handled $VENDOR"

содержимое ucode_handled дальше только проверяется на непустоту,
можно записывать туда что-то более простое, например, ucode_handled=1

> +	set +f

set +f дальше не используется и, видимо, не нужен.

> +	f="$(readlink -e /boot/vmlinuz)"
> +	if [ -n "$f" -a -n "$kernel_versions_handled" ]; then
> +		VERSION=${f#$VMLINUZ_PREFIX-}
> +		case "$kernel_version_handled" in
> +			"* $VERSION*")
> +			ucode_handled=
> +			;;
> +		esac
> +	fi

Это лучше делать всего один раз после обработки цикла по файлам.
Хотя почему это исключение сделано именно для /boot/vmlinuz, неочевидно.

> +}
> +
>  while read f; do
>  	case "$f" in
>  		$VMLINUZ_PREFIX-[0-9].*-*-*)
> @@ -107,10 +129,13 @@ while read f; do
>  		$MODULES_PREFIX/*-*-*/*/*.ko*)
>  			handle_module "$f"
>  			;;
> +		$UCODE_PREFIX/*-ucode/*)
> +			handle_ucode "$f"

Получается, что здесь достаточно написать ucode_detected=1,

> +			;;
>  	esac
>  done

А сюда поместить сброс ucode_detected в случае, если он уже был обработан.

> -if [ -n "$kernel_versions_handled" -a "$INITRD_AUTOUPDATE" = all ]; then
> +if [ -n "$kernel_versions_handled" -o -n "$ucode_handled" ] && [ "$INITRD_AUTOUPDATE" = all ]; then
>  	set +f
>  	ls -c $VMLINUZ_PREFIX-[0-9].*-*-* 2> /dev/null | while read f; do
>  		[ "$f" != "$(readlink -e /boot/vmlinuz)" ] ||


-- 
ldv

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2017-09-06 13:37 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-04 11:56 Konstantin Lepikhov
2017-09-04 16:01 ` Dmitry V. Levin
2017-09-04 19:18   ` Konstantin Lepikhov
2017-09-04 21:35     ` Dmitry V. Levin
2017-09-06 12:09       ` Konstantin Lepikhov
2017-09-06 13:37         ` Dmitry V. Levin [this message]
2017-09-06 22:03           ` Konstantin Lepikhov
2017-09-07  6:37             ` Dmitry V. Levin
2017-09-07  7:47           ` Konstantin Lepikhov
2017-09-07  9:28             ` Dmitry V. Levin
2017-09-07 10:17               ` Konstantin Lepikhov
2017-09-08 21:01                 ` Dmitry V. Levin
2017-09-08 22:06                   ` Konstantin Lepikhov
2017-11-22 11:23                     ` Mikhail Efremov
2017-11-23 11:55                       ` Konstantin Lepikhov
2017-11-23 13:53                         ` Sergey Afonin
2017-11-23 13:56                         ` Mikhail Efremov
2017-11-23 14:22                           ` Konstantin Lepikhov
2017-11-23 16:19                             ` Mikhail Efremov
2017-11-23 18:15                               ` Dmitry V. Levin
2017-11-23 18:19                                 ` Michael Shigorin
2017-11-24  8:46                                 ` Sergey Afonin
2017-11-24  9:58                                   ` Alexey Gladkov
2017-11-23 17:10                             ` Sergey Y. Afonin
2017-11-23 18:08                             ` Michael Shigorin
2017-11-23 18:10                               ` Anton Farygin
2017-11-23 18:24                                 ` Sergey Y. Afonin
2017-11-23 23:06                               ` Konstantin Lepikhov
2017-11-23 23:41                                 ` Dmitry V. Levin
2017-11-24  0:43                                   ` Alexey Gladkov
2017-11-24  1:41                                     ` Dmitry V. Levin
2017-12-05 13:48                                       ` Alexey Gladkov
2017-11-24  4:37                                     ` [devel] Q: agp modules in initrd ? Anton Farygin
2017-11-24 10:06                                       ` Alexey Gladkov
2017-11-24 10:32                                         ` Anton Farygin
2017-11-24 11:15                                           ` Alexey Gladkov
2017-11-24 11:25                                             ` Anton Farygin
2017-11-24 12:44                                               ` Alexey Gladkov
2017-11-24 13:10                                                 ` Anton Farygin
2017-11-24 15:04                                                   ` Alexey Gladkov
2017-11-24 15:07                                                     ` Anton Farygin
2017-11-24 15:47                                                       ` Mikhail Efremov
2017-11-24 16:04                                                         ` Anton Farygin
2017-11-24 16:20                                                           ` Mikhail Efremov
2017-11-24 16:21                                                             ` Anton Farygin
2017-11-24 17:38                                                               ` Mikhail Efremov
2017-11-24 11:44                                       ` Konstantin Lepikhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170906133734.GE13205@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git