mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-30 23:54:04 +08:00
kbuild: refactor kernel-devel RPM package and linux-headers Deb package
The kernel-devel RPM package and the linux-headers Debian package provide headers and scripts needed for building external modules. They copy the necessary files in slightly different ways - the RPM copies almost everything except some exclude patterns, while the Debian copies less number of files. There is no need to maintain different code to do the same thing. Split the Debian code out to scripts/package/install-extmod-build, which is called from both of the packages. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
This commit is contained in:
parent
76a48b8ffb
commit
fe66b5d2ae
@ -162,34 +162,7 @@ install_kernel_headers () {
|
|||||||
|
|
||||||
rm -rf $pdir
|
rm -rf $pdir
|
||||||
|
|
||||||
(
|
"${srctree}/scripts/package/install-extmod-build" "${pdir}/usr/src/linux-headers-${version}"
|
||||||
cd $srctree
|
|
||||||
find . arch/$SRCARCH -maxdepth 1 -name Makefile\*
|
|
||||||
find include scripts -type f -o -type l
|
|
||||||
find arch/$SRCARCH -name Kbuild.platforms -o -name Platform
|
|
||||||
find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f
|
|
||||||
) > debian/hdrsrcfiles
|
|
||||||
|
|
||||||
{
|
|
||||||
if is_enabled CONFIG_OBJTOOL; then
|
|
||||||
echo tools/objtool/objtool
|
|
||||||
fi
|
|
||||||
|
|
||||||
find arch/$SRCARCH/include Module.symvers include scripts -type f
|
|
||||||
|
|
||||||
if is_enabled CONFIG_GCC_PLUGINS; then
|
|
||||||
find scripts/gcc-plugins -name \*.so
|
|
||||||
fi
|
|
||||||
} > debian/hdrobjfiles
|
|
||||||
|
|
||||||
destdir=$pdir/usr/src/linux-headers-$version
|
|
||||||
mkdir -p $destdir
|
|
||||||
tar -c -f - -C $srctree -T debian/hdrsrcfiles | tar -xf - -C $destdir
|
|
||||||
tar -c -f - -T debian/hdrobjfiles | tar -xf - -C $destdir
|
|
||||||
rm -f debian/hdrsrcfiles debian/hdrobjfiles
|
|
||||||
|
|
||||||
# copy .config manually to be where it's expected to be
|
|
||||||
cp $KCONFIG_CONFIG $destdir/.config
|
|
||||||
|
|
||||||
mkdir -p $pdir/lib/modules/$version/
|
mkdir -p $pdir/lib/modules/$version/
|
||||||
ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
|
ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
|
||||||
|
39
scripts/package/install-extmod-build
Executable file
39
scripts/package/install-extmod-build
Executable file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
destdir=${1}
|
||||||
|
|
||||||
|
test -n "${srctree}"
|
||||||
|
test -n "${SRCARCH}"
|
||||||
|
|
||||||
|
is_enabled() {
|
||||||
|
grep -q "^$1=y" include/config/auto.conf
|
||||||
|
}
|
||||||
|
|
||||||
|
mkdir -p "${destdir}"
|
||||||
|
|
||||||
|
(
|
||||||
|
cd "${srctree}"
|
||||||
|
echo Makefile
|
||||||
|
find "arch/${SRCARCH}" -maxdepth 1 -name 'Makefile*'
|
||||||
|
find include scripts -type f -o -type l
|
||||||
|
find "arch/${SRCARCH}" -name Kbuild.platforms -o -name Platform
|
||||||
|
find "$(find "arch/${SRCARCH}" -name include -o -name scripts -type d)" -type f
|
||||||
|
) | tar -c -f - -C "${srctree}" -T - | tar -xf - -C "${destdir}"
|
||||||
|
|
||||||
|
{
|
||||||
|
if is_enabled CONFIG_OBJTOOL; then
|
||||||
|
echo tools/objtool/objtool
|
||||||
|
fi
|
||||||
|
|
||||||
|
find "arch/${SRCARCH}/include" Module.symvers include scripts -type f
|
||||||
|
|
||||||
|
if is_enabled CONFIG_GCC_PLUGINS; then
|
||||||
|
find scripts/gcc-plugins -name '*.so'
|
||||||
|
fi
|
||||||
|
} | tar -c -f - -T - | tar -xf - -C "${destdir}"
|
||||||
|
|
||||||
|
# copy .config manually to be where it's expected to be
|
||||||
|
cp "${KCONFIG_CONFIG}" "${destdir}/.config"
|
@ -28,9 +28,6 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
__KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g")
|
__KERNELRELEASE=$(echo $KERNELRELEASE | sed -e "s/-/_/g")
|
||||||
EXCLUDES="$RCS_TAR_IGNORE --exclude=*vmlinux* --exclude=*.mod \
|
|
||||||
--exclude=*.o --exclude=*.ko --exclude=*.cmd --exclude=Documentation \
|
|
||||||
--exclude=.config.old --exclude=.missing-syscalls.d --exclude=*.s"
|
|
||||||
|
|
||||||
# We can label the here-doc lines for conditional output to the spec file
|
# We can label the here-doc lines for conditional output to the spec file
|
||||||
#
|
#
|
||||||
@ -112,8 +109,7 @@ $M %{make} %{makeflags} INSTALL_MOD_PATH=%{buildroot} modules_install
|
|||||||
cp .config %{buildroot}/boot/config-%{KERNELRELEASE}
|
cp .config %{buildroot}/boot/config-%{KERNELRELEASE}
|
||||||
$S$M rm -f %{buildroot}/lib/modules/%{KERNELRELEASE}/build
|
$S$M rm -f %{buildroot}/lib/modules/%{KERNELRELEASE}/build
|
||||||
$S$M rm -f %{buildroot}/lib/modules/%{KERNELRELEASE}/source
|
$S$M rm -f %{buildroot}/lib/modules/%{KERNELRELEASE}/source
|
||||||
$S$M mkdir -p %{buildroot}/usr/src/kernels/%{KERNELRELEASE}
|
$S$M %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='\${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}'
|
||||||
$S$M tar cf - $EXCLUDES . | tar xf - -C %{buildroot}/usr/src/kernels/%{KERNELRELEASE}
|
|
||||||
$S$M cd %{buildroot}/lib/modules/%{KERNELRELEASE}
|
$S$M cd %{buildroot}/lib/modules/%{KERNELRELEASE}
|
||||||
$S$M ln -sf /usr/src/kernels/%{KERNELRELEASE} build
|
$S$M ln -sf /usr/src/kernels/%{KERNELRELEASE} build
|
||||||
$S$M ln -sf /usr/src/kernels/%{KERNELRELEASE} source
|
$S$M ln -sf /usr/src/kernels/%{KERNELRELEASE} source
|
||||||
|
Loading…
Reference in New Issue
Block a user