Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Jose Ignacio Tornos Martinez and committed by
Masahiro Yamada
097f1200 b27a9138

+13
+13
scripts/package/kernel.spec
··· 61 61 %{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install 62 62 cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE} 63 63 cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config 64 + if %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='test -d ${srctree}/arch/${SRCARCH}/boot/dts' 2>/dev/null; then 65 + %{make} %{makeflags} INSTALL_DTBS_PATH=%{buildroot}/lib/modules/%{KERNELRELEASE}/dtb dtbs_install 66 + fi 64 67 ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEASE}/build 65 68 %if %{with_devel} 66 69 %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}' ··· 84 81 echo "%ghost /boot/${x}-%{KERNELRELEASE}" 85 82 done 86 83 84 + if [ -d "%{buildroot}/lib/modules/%{KERNELRELEASE}/dtb" ];then 85 + echo "/lib/modules/%{KERNELRELEASE}/dtb" 86 + find "%{buildroot}/lib/modules/%{KERNELRELEASE}/dtb" -printf "%%%ghost /boot/dtb-%{KERNELRELEASE}/%%P\n" 87 + fi 88 + 87 89 echo "%exclude /lib/modules/%{KERNELRELEASE}/build" 88 90 } > %{buildroot}/kernel.list 89 91 ··· 104 96 cp "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}" 105 97 fi 106 98 done 99 + if [ -d "/lib/modules/%{KERNELRELEASE}/dtb" ] && \ 100 + ! diff -rq "/lib/modules/%{KERNELRELEASE}/dtb" "/boot/dtb-%{KERNELRELEASE}" >/dev/null 2>&1; then 101 + rm -rf "/boot/dtb-%{KERNELRELEASE}" 102 + cp -r "/lib/modules/%{KERNELRELEASE}/dtb" "/boot/dtb-%{KERNELRELEASE}" 103 + fi 107 104 if [ ! -e "/lib/modules/%{KERNELRELEASE}/modules.dep" ]; then 108 105 /usr/sbin/depmod %{KERNELRELEASE} 109 106 fi