Re: [PATCH v2] kbuild: rpm-pkg: fix build error with CONFIG_MODULES=n

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 18, 2024 at 08:08:43PM +0900, Masahiro Yamada wrote:
> When CONFIG_MODULES is disabled, 'make (bin)rpm-pkg' fails:
> 
>   $ make allnoconfig binrpm-pkg
>     [ snip ]
>   error: File not found: .../linux/rpmbuild/BUILDROOT/kernel-6.10.0_rc3-1.i386/lib/modules/6.10.0-rc3/kernel
>   error: File not found: .../linux/rpmbuild/BUILDROOT/kernel-6.10.0_rc3-1.i386/lib/modules/6.10.0-rc3/modules.order
> 
> Specify the directory path, /lib/modules/%{KERNELRELEASE}, instead of
> individual files to make it work irrespective of CONFIG_MODULES.
> 
> However, doing so would cause new warnings:
> 
>   warning: File listed twice: /lib/modules/6.10.0-rc3-dirty/modules.alias
>   warning: File listed twice: /lib/modules/6.10.0-rc3-dirty/modules.alias.bin
>   warning: File listed twice: /lib/modules/6.10.0-rc3-dirty/modules.builtin.alias.bin
>   warning: File listed twice: /lib/modules/6.10.0-rc3-dirty/modules.builtin.bin
>   warning: File listed twice: /lib/modules/6.10.0-rc3-dirty/modules.dep
>   warning: File listed twice: /lib/modules/6.10.0-rc3-dirty/modules.dep.bin
>   warning: File listed twice: /lib/modules/6.10.0-rc3-dirty/modules.devname
>   warning: File listed twice: /lib/modules/6.10.0-rc3-dirty/modules.softdep
>   warning: File listed twice: /lib/modules/6.10.0-rc3-dirty/modules.symbols
>   warning: File listed twice: /lib/modules/6.10.0-rc3-dirty/modules.symbols.bin
> 
> These files exist in /lib/modules/%{KERNELRELEASE} and are also explicitly
> marked as %ghost.
> 
> Suppress depmod because depmod-generated files are not packaged.
> 
> Fixes: 615b3a3d2d41 ("kbuild: rpm-pkg: do not include depmod-generated files")
> Signed-off-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>

Reviewed-by: Nathan Chancellor <nathan@xxxxxxxxxx>

> ---
> 
> Changes in v2:
>   - Do not run depmod
> 
>  scripts/package/kernel.spec | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec
> index e095eb1e290e..fffc8af8deb1 100644
> --- a/scripts/package/kernel.spec
> +++ b/scripts/package/kernel.spec
> @@ -57,7 +57,8 @@ patch -p1 < %{SOURCE2}
>  %install
>  mkdir -p %{buildroot}/lib/modules/%{KERNELRELEASE}
>  cp $(%{make} %{makeflags} -s image_name) %{buildroot}/lib/modules/%{KERNELRELEASE}/vmlinuz
> -%{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install
> +# DEPMOD=true makes depmod no-op. We do not package depmod-generated files.
> +%{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} DEPMOD=true modules_install
>  %{make} %{makeflags} INSTALL_HDR_PATH=%{buildroot}/usr headers_install
>  cp System.map %{buildroot}/lib/modules/%{KERNELRELEASE}
>  cp .config %{buildroot}/lib/modules/%{KERNELRELEASE}/config
> @@ -70,10 +71,7 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA
>  %endif
>  
>  {
> -	for x in System.map config kernel modules.builtin \
> -			modules.builtin.modinfo modules.order vmlinuz; do
> -		echo "/lib/modules/%{KERNELRELEASE}/${x}"
> -	done
> +	echo "/lib/modules/%{KERNELRELEASE}"
>  
>  	for x in alias alias.bin builtin.alias.bin builtin.bin dep dep.bin \
>  					devname softdep symbols symbols.bin; do
> -- 
> 2.43.0
> 




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux