Commit Graph

9 Commits

Author SHA1 Message Date
Jose Ignacio Tornos Martinez 097f1200bf kbuild: rpm-pkg: add dtb files in kernel rpm
Some architectures, like aarch64 ones, need a dtb file to configure the
hardware. The default dtb file can be preloaded from u-boot, but the final
and/or more complete dtb file needs to be able to be loaded later from
rootfs.

Add the possible dtb files to the kernel rpm and mimic Fedora shipping
process, storing the dtb files in the module directory. These dtb files
will be copied to /boot directory by the install scripts, but add fallback
just in case, checking if the content in /boot directory is correct.

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

Tested with Fedora Rawhide (x86_64 and aarch64) with dnf and rpm tools.
In addition, fallback was also tested after modifying the install scripts.

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-03-19 02:30:51 +09:00
Masahiro Yamada fee9b6d14a Revert "kbuild/mkspec: clean boot loader configuration on rpm removal"
This reverts commit 6ef41e22a3.

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>
2024-02-19 18:20:40 +09:00
Masahiro Yamada 435e86998e Revert "kbuild/mkspec: support 'update-bootloader'-based systems"
This reverts commit 27c3bffd23.

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>
2024-02-19 18:20:40 +09:00
Masahiro Yamada bca17edb24 kbuild: rpm-pkg: mark installed files in /boot as %ghost
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>
2024-02-19 18:20:40 +09:00
Masahiro Yamada 615b3a3d2d kbuild: rpm-pkg: do not include depmod-generated files
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>
2024-02-19 18:20:40 +09:00
Jose Ignacio Tornos Martinez 358de8b4f2 kbuild: rpm-pkg: simplify installkernel %post
The new installkernel application that is now included in systemd-udev
package allows installation although destination files are already present
in the boot directory of the kernel package, but is failing with the
implemented workaround for the old installkernel application from grubby
package.

For the new installkernel application, as Davide says:
<<The %post currently does a shuffling dance before calling installkernel.
This isn't actually necessary afaict, and the current implementation
ends up triggering downstream issues such as
https://github.com/systemd/systemd/issues/29568
This commit simplifies the logic to remove the shuffling. For reference,
the original logic was added in commit 3c9c7a14b627("rpm-pkg: add %post
section to create initramfs and grub hooks").>>

But we need to keep the old behavior as well, because the old installkernel
application from grubby package, does not allow this simplification and
we need to be backward compatible to avoid issues with the different
packages.

Mimic Fedora shipping process and store vmlinuz, config amd System.map
in the module directory instead of the boot directory. In this way, we will
avoid the commented problem for all the cases, because the new destination
files are not going to exist in the boot directory of the kernel package.

Replace installkernel tool with kernel-install tool, because the latter is
more complete.

Besides, after installkernel tool execution, check to complete if the
correct package files vmlinuz, System.map and config files are present
in /boot directory, and if necessary, copy manually for install operation.
In this way, take into account if  files were not previously copied from
/usr/lib/kernel/install.d/* scripts and if the suitable files for the
requested package are present (it could be others if the rpm files were
replace with a new pacakge with the same release and a different build).

Tested with Fedora 38, Fedora 39, RHEL 9, Oracle Linux 9.3,
openSUSE Tumbleweed and openMandrive ROME, using dnf/zypper and rpm tools.

cc: stable@vger.kernel.org
Co-Developed-by: Davide Cavalca <dcavalca@meta.com>
Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2024-01-31 23:24:27 +09:00
Masahiro Yamada 0df8e97085 scripts: clean up IA-64 code
A little more janitorial work after commit cf8e865810 ("arch: Remove
Itanium (IA-64) architecture").

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
2023-12-03 18:51:48 +09:00
Masahiro Yamada 2d7d1bc119 kbuild: remove stale code for 'source' symlink in packaging scripts
Since commit d8131c2965 ("kbuild: remove $(MODLIB)/source symlink"),
modules_install does not create the 'source' symlink.

Remove the stale code from builddeb and kernel.spec.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-10-01 23:06:06 +09:00
Masahiro Yamada 49c803cd91 kbuild: rpm-pkg: split out the body of spec file
Most of the lines in the spec file are independent of any build
condition.

Split the body of the spec file into scripts/package/kernel.spec.
scripts/package/mkspec will prepend some env-dependent variables.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2023-07-25 00:59:33 +09:00