Skip to content

Commit

Permalink
kbuild: rpm-pkg: move source components to rpmbuild/SOURCES
Browse files Browse the repository at this point in the history
Prepare to add more files to the source RPM.

Also, fix the build error when KCONFIG_CONFIG is set:
  error: Bad file: ./.config: No such file or directory

Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
masahir0y committed Mar 16, 2023
1 parent 36862e1 commit 81f59a2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ modules.order
# RPM spec file (make rpm-pkg)
#
/*.spec
/rpmbuild/

#
# Debian directory (make deb-pkg)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1605,7 +1605,7 @@ MRPROPER_FILES += include/config include/generated \
certs/signing_key.pem \
certs/x509.genkey \
vmlinux-gdb.py \
*.spec \
*.spec rpmbuild \
rust/libmacros.so

# clean - Delete most, but leave enough to build external modules
Expand Down
2 changes: 1 addition & 1 deletion scripts/Makefile.package
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ PHONY += srcrpm-pkg
srcrpm-pkg: linux.tar.gz
$(CONFIG_SHELL) $(MKSPEC) >$(objtree)/kernel.spec
+rpmbuild $(RPMOPTS) --target $(UTS_MACHINE)-linux -bs kernel.spec \
--define='_smp_mflags %{nil}' --define='_sourcedir .' --define='_srcrpmdir .'
--define='_smp_mflags %{nil}' --define='_sourcedir rpmbuild/SOURCES' --define='_srcrpmdir .'

# binrpm-pkg
# ---------------------------------------------------------------------------
Expand Down
12 changes: 8 additions & 4 deletions scripts/package/mkspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@ if [ "$1" = prebuilt ]; then
MAKE="$MAKE -f $srctree/Makefile"
else
S=

mkdir -p rpmbuild/SOURCES
cp linux.tar.gz rpmbuild/SOURCES
cp "${KCONFIG_CONFIG}" rpmbuild/SOURCES/config
fi

if grep -q CONFIG_MODULES=y .config; then
if grep -q CONFIG_MODULES=y include/config/auto.conf; then
M=
else
M=DEL
fi

if grep -q CONFIG_DRM=y .config; then
if grep -q CONFIG_DRM=y include/config/auto.conf; then
PROVIDES=kernel-drm
fi

Expand All @@ -48,7 +52,7 @@ sed -e '/^DEL/d' -e 's/^\t*//' <<EOF
Vendor: The Linux Community
URL: https://www.kernel.org
$S Source0: linux.tar.gz
$S Source1: .config
$S Source1: config
Provides: $PROVIDES
$S BuildRequires: bc binutils bison dwarves
$S BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
Expand Down Expand Up @@ -85,7 +89,7 @@ $S$M against the $__KERNELRELEASE kernel package.
$S$M
$S %prep
$S %setup -q -n linux
$S cp %{SOURCE1} .
$S cp %{SOURCE1} .config
$S
$S %build
$S $MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE KBUILD_BUILD_VERSION=%{release}
Expand Down

0 comments on commit 81f59a2

Please sign in to comment.