linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/4] kbuild: rpm-pkg: do not include depmod-generated files
@ 2024-02-02 13:35 Masahiro Yamada
  2024-02-02 13:35 ` [PATCH 2/4] kbuild: rpm-pkg: mark installed files in /boot as %ghost Masahiro Yamada
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Masahiro Yamada @ 2024-02-02 13:35 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier, linux-kernel

Installing the kernel package is fine, but when uninstalling it, the
following warnings are shown:

  warning: file modules.symbols.bin: remove failed: No such file or directory
  warning: file modules.symbols: remove failed: No such file or directory
  warning: file modules.softdep: remove failed: No such file or directory
  warning: file modules.devname: remove failed: No such file or directory
  warning: file modules.dep.bin: remove failed: No such file or directory
  warning: file modules.dep: remove failed: No such file or directory
  warning: file modules.builtin.bin: remove failed: No such file or directory
  warning: file modules.builtin.alias.bin: remove failed: No such file or directory
  warning: file modules.alias.bin: remove failed: No such file or directory
  warning: file modules.alias: remove failed: No such file or directory

The %preun scriptlet runs 'kernel-install remove', which in turn invokes
/usr/lib/kernel/install.d/50-depmod.install to remove those files before
the actual package removal.

RPM-based distributions do not ship files generated by depmod. Mark them
as %ghost in order to exclude them from the package, but still claim the
ownership on them.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/package/kernel.spec | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index f58726671fb3..aaedb6d1b26f 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -66,6 +66,20 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
 %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}'
 %endif
 
+{
+	for x in System.map config kernel modules.builtin \
+			modules.builtin.modinfo modules.order vmlinuz; do
+		echo "/lib/modules/%{KERNELRELEASE}/${x}"
+	done
+
+	for x in alias alias.bin builtin.alias.bin builtin.bin dep dep.bin \
+					devname softdep symbols symbols.bin; do
+		echo "%ghost /lib/modules/%{KERNELRELEASE}/modules.${x}"
+	done
+
+	echo "%exclude /lib/modules/%{KERNELRELEASE}/build"
+} > %{buildroot}/kernel.list
+
 %clean
 rm -rf %{buildroot}
 
@@ -78,6 +92,9 @@ for file in vmlinuz System.map config; do
 		cp "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"
 	fi
 done
+if [ ! -e "/lib/modules/%{KERNELRELEASE}/modules.dep" ]; then
+	/usr/sbin/depmod %{KERNELRELEASE}
+fi
 
 %preun
 if [ -x /sbin/new-kernel-pkg ]; then
@@ -91,10 +108,9 @@ if [ -x /sbin/update-bootloader ]; then
 /sbin/update-bootloader --remove %{KERNELRELEASE}
 fi
 
-%files
+%files -f %{buildroot}/kernel.list
 %defattr (-, root, root)
-/lib/modules/%{KERNELRELEASE}
-%exclude /lib/modules/%{KERNELRELEASE}/build
+%exclude /kernel.list
 
 %files headers
 %defattr (-, root, root)
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] kbuild: rpm-pkg: mark installed files in /boot as %ghost
  2024-02-02 13:35 [PATCH 1/4] kbuild: rpm-pkg: do not include depmod-generated files Masahiro Yamada
@ 2024-02-02 13:35 ` Masahiro Yamada
  2024-02-06  1:35   ` Nathan Chancellor
  2024-02-02 13:35 ` [PATCH 3/4] Revert "kbuild/mkspec: support 'update-bootloader'-based systems" Masahiro Yamada
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Masahiro Yamada @ 2024-02-02 13:35 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier, linux-kernel

Mark the files installed to /boot as %ghost to make sure they will be
removed when the package is uninstalled.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/package/kernel.spec | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index aaedb6d1b26f..ecedcfc11e73 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -77,6 +77,10 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
 		echo "%ghost /lib/modules/%{KERNELRELEASE}/modules.${x}"
 	done
 
+	for x in System.map config vmlinuz; do
+		echo "%ghost /boot/${x}-%{KERNELRELEASE}"
+	done
+
 	echo "%exclude /lib/modules/%{KERNELRELEASE}/build"
 } > %{buildroot}/kernel.list
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] Revert "kbuild/mkspec: support 'update-bootloader'-based systems"
  2024-02-02 13:35 [PATCH 1/4] kbuild: rpm-pkg: do not include depmod-generated files Masahiro Yamada
  2024-02-02 13:35 ` [PATCH 2/4] kbuild: rpm-pkg: mark installed files in /boot as %ghost Masahiro Yamada
@ 2024-02-02 13:35 ` Masahiro Yamada
  2024-02-02 13:35 ` [PATCH 4/4] Revert "kbuild/mkspec: clean boot loader configuration on rpm removal" Masahiro Yamada
  2024-02-06  1:35 ` [PATCH 1/4] kbuild: rpm-pkg: do not include depmod-generated files Nathan Chancellor
  3 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2024-02-02 13:35 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier, linux-kernel

This reverts commit 27c3bffd230abd0a598586aed0fe0ba7b61e0e2e.

If this is still needed, we can bring it back.

However, I'd like to understand why 'update-bootloader --remove' is
needed for uninstallation, while 'update-bootloader --add' was not
called during the installation.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/package/kernel.spec | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index ecedcfc11e73..c1b745967f64 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -107,11 +107,6 @@ elif [ -x /usr/bin/kernel-install ]; then
 kernel-install remove %{KERNELRELEASE}
 fi
 
-%postun
-if [ -x /sbin/update-bootloader ]; then
-/sbin/update-bootloader --remove %{KERNELRELEASE}
-fi
-
 %files -f %{buildroot}/kernel.list
 %defattr (-, root, root)
 %exclude /kernel.list
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] Revert "kbuild/mkspec: clean boot loader configuration on rpm removal"
  2024-02-02 13:35 [PATCH 1/4] kbuild: rpm-pkg: do not include depmod-generated files Masahiro Yamada
  2024-02-02 13:35 ` [PATCH 2/4] kbuild: rpm-pkg: mark installed files in /boot as %ghost Masahiro Yamada
  2024-02-02 13:35 ` [PATCH 3/4] Revert "kbuild/mkspec: support 'update-bootloader'-based systems" Masahiro Yamada
@ 2024-02-02 13:35 ` Masahiro Yamada
  2024-02-06  1:35 ` [PATCH 1/4] kbuild: rpm-pkg: do not include depmod-generated files Nathan Chancellor
  3 siblings, 0 replies; 6+ messages in thread
From: Masahiro Yamada @ 2024-02-02 13:35 UTC (permalink / raw)
  To: linux-kbuild
  Cc: Masahiro Yamada, Nathan Chancellor, Nicolas Schier, linux-kernel

This reverts commit 6ef41e22a320d95a246d45b673aa7247cc1bbf7b.

If this is still needed, we can bring it back.

However, I'd like to understand why 'new-kernel-pkg --remove' is
needed for uninstallation, while 'new-kernel-pkg --install' was not
called during the installation.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/package/kernel.spec | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
index c1b745967f64..c256b73cca3e 100644
--- a/scripts/package/kernel.spec
+++ b/scripts/package/kernel.spec
@@ -101,9 +101,7 @@ if [ ! -e "/lib/modules/%{KERNELRELEASE}/modules.dep" ]; then
 fi
 
 %preun
-if [ -x /sbin/new-kernel-pkg ]; then
-new-kernel-pkg --remove %{KERNELRELEASE} --rminitrd --initrdfile=/boot/initramfs-%{KERNELRELEASE}.img
-elif [ -x /usr/bin/kernel-install ]; then
+if [ -x /usr/bin/kernel-install ]; then
 kernel-install remove %{KERNELRELEASE}
 fi
 
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/4] kbuild: rpm-pkg: do not include depmod-generated files
  2024-02-02 13:35 [PATCH 1/4] kbuild: rpm-pkg: do not include depmod-generated files Masahiro Yamada
                   ` (2 preceding siblings ...)
  2024-02-02 13:35 ` [PATCH 4/4] Revert "kbuild/mkspec: clean boot loader configuration on rpm removal" Masahiro Yamada
@ 2024-02-06  1:35 ` Nathan Chancellor
  3 siblings, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2024-02-06  1:35 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, Nicolas Schier, linux-kernel

On Fri, Feb 02, 2024 at 10:35:17PM +0900, Masahiro Yamada wrote:
> Installing the kernel package is fine, but when uninstalling it, the
> following warnings are shown:
> 
>   warning: file modules.symbols.bin: remove failed: No such file or directory
>   warning: file modules.symbols: remove failed: No such file or directory
>   warning: file modules.softdep: remove failed: No such file or directory
>   warning: file modules.devname: remove failed: No such file or directory
>   warning: file modules.dep.bin: remove failed: No such file or directory
>   warning: file modules.dep: remove failed: No such file or directory
>   warning: file modules.builtin.bin: remove failed: No such file or directory
>   warning: file modules.builtin.alias.bin: remove failed: No such file or directory
>   warning: file modules.alias.bin: remove failed: No such file or directory
>   warning: file modules.alias: remove failed: No such file or directory
> 
> The %preun scriptlet runs 'kernel-install remove', which in turn invokes
> /usr/lib/kernel/install.d/50-depmod.install to remove those files before
> the actual package removal.
> 
> RPM-based distributions do not ship files generated by depmod. Mark them
> as %ghost in order to exclude them from the package, but still claim the
> ownership on them.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Tested-by: Nathan Chancellor <nathan@kernel.org>

> ---
> 
>  scripts/package/kernel.spec | 22 +++++++++++++++++++---
>  1 file changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
> index f58726671fb3..aaedb6d1b26f 100644
> --- a/scripts/package/kernel.spec
> +++ b/scripts/package/kernel.spec
> @@ -66,6 +66,20 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
>  %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}'
>  %endif
>  
> +{
> +	for x in System.map config kernel modules.builtin \
> +			modules.builtin.modinfo modules.order vmlinuz; do
> +		echo "/lib/modules/%{KERNELRELEASE}/${x}"
> +	done
> +
> +	for x in alias alias.bin builtin.alias.bin builtin.bin dep dep.bin \
> +					devname softdep symbols symbols.bin; do
> +		echo "%ghost /lib/modules/%{KERNELRELEASE}/modules.${x}"
> +	done
> +
> +	echo "%exclude /lib/modules/%{KERNELRELEASE}/build"
> +} > %{buildroot}/kernel.list
> +
>  %clean
>  rm -rf %{buildroot}
>  
> @@ -78,6 +92,9 @@ for file in vmlinuz System.map config; do
>  		cp "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}"
>  	fi
>  done
> +if [ ! -e "/lib/modules/%{KERNELRELEASE}/modules.dep" ]; then
> +	/usr/sbin/depmod %{KERNELRELEASE}
> +fi
>  
>  %preun
>  if [ -x /sbin/new-kernel-pkg ]; then
> @@ -91,10 +108,9 @@ if [ -x /sbin/update-bootloader ]; then
>  /sbin/update-bootloader --remove %{KERNELRELEASE}
>  fi
>  
> -%files
> +%files -f %{buildroot}/kernel.list
>  %defattr (-, root, root)
> -/lib/modules/%{KERNELRELEASE}
> -%exclude /lib/modules/%{KERNELRELEASE}/build
> +%exclude /kernel.list
>  
>  %files headers
>  %defattr (-, root, root)
> -- 
> 2.40.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/4] kbuild: rpm-pkg: mark installed files in /boot as %ghost
  2024-02-02 13:35 ` [PATCH 2/4] kbuild: rpm-pkg: mark installed files in /boot as %ghost Masahiro Yamada
@ 2024-02-06  1:35   ` Nathan Chancellor
  0 siblings, 0 replies; 6+ messages in thread
From: Nathan Chancellor @ 2024-02-06  1:35 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, Nicolas Schier, linux-kernel

On Fri, Feb 02, 2024 at 10:35:18PM +0900, Masahiro Yamada wrote:
> Mark the files installed to /boot as %ghost to make sure they will be
> removed when the package is uninstalled.
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

Tested-by: Nathan Chancellor <nathan@kernel.org>

> ---
> 
>  scripts/package/kernel.spec | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
> index aaedb6d1b26f..ecedcfc11e73 100644
> --- a/scripts/package/kernel.spec
> +++ b/scripts/package/kernel.spec
> @@ -77,6 +77,10 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
>  		echo "%ghost /lib/modules/%{KERNELRELEASE}/modules.${x}"
>  	done
>  
> +	for x in System.map config vmlinuz; do
> +		echo "%ghost /boot/${x}-%{KERNELRELEASE}"
> +	done
> +
>  	echo "%exclude /lib/modules/%{KERNELRELEASE}/build"
>  } > %{buildroot}/kernel.list
>  
> -- 
> 2.40.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-02-06  1:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-02 13:35 [PATCH 1/4] kbuild: rpm-pkg: do not include depmod-generated files Masahiro Yamada
2024-02-02 13:35 ` [PATCH 2/4] kbuild: rpm-pkg: mark installed files in /boot as %ghost Masahiro Yamada
2024-02-06  1:35   ` Nathan Chancellor
2024-02-02 13:35 ` [PATCH 3/4] Revert "kbuild/mkspec: support 'update-bootloader'-based systems" Masahiro Yamada
2024-02-02 13:35 ` [PATCH 4/4] Revert "kbuild/mkspec: clean boot loader configuration on rpm removal" Masahiro Yamada
2024-02-06  1:35 ` [PATCH 1/4] kbuild: rpm-pkg: do not include depmod-generated files Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).