Kbuild fixes for v6.3
- Exclude kallsyms_seqs_of_names from kallsyms to fix build error - Fix 'make kernelrelease' for external module builds - Get the Debian source package compilable again - Fix the wrong uname when Debian packages are built with the KDEB_PKGVERSION option - Fix superfluous CROSS_COMPILE when building Debian packages - Fix RPM package build error when KCONFIG_CONFIG is set - Use 'git archive' for creating source tarballs - Remove the scripts/list-gitignored tool -----BEGIN PGP SIGNATURE----- iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAmQV2yAVHG1hc2FoaXJv eUBrZXJuZWwub3JnAAoJED2LAQed4NsGb6oP/iB7JUbZqwKqAFVCJyaey3CTdkvt IZmacDur7hbZY/X1E3fXEfFJsiGxSEIbB6duqB8t/rrKFRM3INO+UKw3ZoQSpMsB sWUWSvGxOSWZaSw46h6temN0LE58QwqdUh1cHM3gD3uLmCSKvTI7XLzYGSi0zIQx 58ym2HB4SQffNp1f2haIJIsqCYCxIkSDT4DpoLyfYUYao/TYeA4XznxJYh1I8MY7 Qy8qVXf2zTr+bXsEgm3/CtnMK9wkli0Me4fAbmvqwi9Ubyt25K06F6dNuAT2jXXz wr885WsjSLFjQYRrVc1z3vDRUaEpr5m1nE9px8Ss1Wzx+jNZ/E6to3WnmMIB+WU+ 25xAHiFOxFsgM4D091QbYY6OeB5lLbfwHmq0+B7xep32rxoIIBM9XmbzE+d040CF D6T76CC6f2xmYlhL5W5a8FKy5wg7jXsdzAiS4+UIvHifRmCYeWYKNy7IJSnXMSn4 fCphPxWoDbY67AFK0jCuNYXwmy7Kb5XzzpKiL0nUv1ongag2a8hZXSTjyMePCrVr t8sq2VLoTYWCDjmLmSRbykXWa8eMlS0WCw8A315G0X6YOW1cJxZWRbAPIL28XRgA Jg48TFTThWPKa5iOS6t9EpSIZGRtohpeSUFmVwwaTJMhOn8o234Iex6Ejt6nVTuk zL8Cf1NlkO3/eLuu =kdAo -----END PGP SIGNATURE----- Merge tag 'kbuild-fixes-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild Pull Kbuild fixes from Masahiro Yamada: - Exclude kallsyms_seqs_of_names from kallsyms to fix build error - Fix 'make kernelrelease' for external module builds - Get the Debian source package compilable again - Fix the wrong uname when Debian packages are built with the KDEB_PKGVERSION option - Fix superfluous CROSS_COMPILE when building Debian packages - Fix RPM package build error when KCONFIG_CONFIG is set - Use 'git archive' for creating source tarballs - Remove the scripts/list-gitignored tool * tag 'kbuild-fixes-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: kbuild: use git-archive for source package creation kbuild: rpm-pkg: move source components to rpmbuild/SOURCES kbuild: deb-pkg: use dh_listpackages to know enabled packages kbuild: deb-pkg: split image and debug objects staging out into functions kbuild: deb-pkg: set CROSS_COMPILE only when undefined kbuild: deb-pkg: do not take KERNELRELEASE from the source version kbuild: deb-pkg: make debian source package working again Makefile: Make kernelrelease target work with M= kconfig: Update config changed flag before calling callback kallsyms: add kallsyms_seqs_of_names to list of special symbols
This commit is contained in:
commit
534293368a
1
.gitignore
vendored
1
.gitignore
vendored
@ -78,6 +78,7 @@ modules.order
|
||||
# RPM spec file (make rpm-pkg)
|
||||
#
|
||||
/*.spec
|
||||
/rpmbuild/
|
||||
|
||||
#
|
||||
# Debian directory (make deb-pkg)
|
||||
|
11
Makefile
11
Makefile
@ -274,8 +274,7 @@ no-dot-config-targets := $(clean-targets) \
|
||||
cscope gtags TAGS tags help% %docs check% coccicheck \
|
||||
$(version_h) headers headers_% archheaders archscripts \
|
||||
%asm-generic kernelversion %src-pkg dt_binding_check \
|
||||
outputmakefile rustavailable rustfmt rustfmtcheck \
|
||||
scripts_package
|
||||
outputmakefile rustavailable rustfmt rustfmtcheck
|
||||
# Installation targets should not require compiler. Unfortunately, vdso_install
|
||||
# is an exception where build artifacts may be updated. This must be fixed.
|
||||
no-compiler-targets := $(no-dot-config-targets) install dtbs_install \
|
||||
@ -1605,7 +1604,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
|
||||
@ -1656,10 +1655,6 @@ distclean: mrproper
|
||||
%pkg: include/config/kernel.release FORCE
|
||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.package $@
|
||||
|
||||
PHONY += scripts_package
|
||||
scripts_package: scripts_basic
|
||||
$(Q)$(MAKE) $(build)=scripts scripts/list-gitignored
|
||||
|
||||
# Brief documentation of the typical targets used
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@ -1886,6 +1881,8 @@ endif
|
||||
|
||||
else # KBUILD_EXTMOD
|
||||
|
||||
filechk_kernel.release = echo $(KERNELRELEASE)
|
||||
|
||||
###
|
||||
# External module support.
|
||||
# When building external modules the kernel used as basis is considered
|
||||
|
1
scripts/.gitignore
vendored
1
scripts/.gitignore
vendored
@ -3,7 +3,6 @@
|
||||
/generate_rust_target
|
||||
/insert-sys-cert
|
||||
/kallsyms
|
||||
/list-gitignored
|
||||
/module.lds
|
||||
/recordmcount
|
||||
/sign-file
|
||||
|
@ -38,7 +38,7 @@ HOSTCFLAGS_sorttable.o += -DMCOUNT_SORT_ENABLED
|
||||
endif
|
||||
|
||||
# The following programs are only built on demand
|
||||
hostprogs += list-gitignored unifdef
|
||||
hostprogs += unifdef
|
||||
|
||||
# The module linker script is preprocessed on demand
|
||||
targets += module.lds
|
||||
|
@ -2,6 +2,7 @@
|
||||
# Makefile for the different targets used to generate full packages of a kernel
|
||||
|
||||
include $(srctree)/scripts/Kbuild.include
|
||||
include $(srctree)/scripts/Makefile.lib
|
||||
|
||||
KERNELPATH := kernel-$(subst -,_,$(KERNELRELEASE))
|
||||
KBUILD_PKG_ROOTCMD ?="fakeroot -u"
|
||||
@ -26,54 +27,46 @@ fi ; \
|
||||
tar -I $(KGZIP) -c $(RCS_TAR_IGNORE) -f $(2).tar.gz \
|
||||
--transform 's:^:$(2)/:S' $(TAR_CONTENT) $(3)
|
||||
|
||||
# .tmp_filelist .tmp_filelist_exclude
|
||||
# tarball compression
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
scripts/list-gitignored: FORCE
|
||||
$(Q)$(MAKE) -f $(srctree)/Makefile scripts_package
|
||||
%.tar.gz: %.tar
|
||||
$(call cmd,gzip)
|
||||
|
||||
# 1f5d3a6b6532e25a5cdf1f311956b2b03d343a48 removed '*.rej' from .gitignore,
|
||||
# but it is definitely a generated file.
|
||||
filechk_filelist = \
|
||||
$< --exclude='*.rej' --output=$@_exclude --prefix=./ --rootdir=$(srctree) --stat=-
|
||||
%.tar.bz2: %.tar
|
||||
$(call cmd,bzip2)
|
||||
|
||||
.tmp_filelist: scripts/list-gitignored FORCE
|
||||
$(call filechk,filelist)
|
||||
%.tar.xz: %.tar
|
||||
$(call cmd,xzmisc)
|
||||
|
||||
# tarball
|
||||
%.tar.zst: %.tar
|
||||
$(call cmd,zstd)
|
||||
|
||||
# Git
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
quiet_cmd_tar = TAR $@
|
||||
cmd_tar = tar -c -f $@ $(tar-compress-opt) $(tar-exclude-opt) \
|
||||
--owner=0 --group=0 --sort=name \
|
||||
--transform 's:^\.:$*:S' -C $(tar-rootdir) .
|
||||
filechk_HEAD = git -C $(srctree) rev-parse --verify HEAD 2>/dev/null
|
||||
|
||||
tar-rootdir := $(srctree)
|
||||
.tmp_HEAD: check-git FORCE
|
||||
$(call filechk,HEAD)
|
||||
|
||||
%.tar:
|
||||
$(call cmd,tar)
|
||||
|
||||
%.tar.gz: private tar-compress-opt := -I $(KGZIP)
|
||||
%.tar.gz:
|
||||
$(call cmd,tar)
|
||||
|
||||
%.tar.bz2: private tar-compress-opt := -I $(KBZIP2)
|
||||
%.tar.bz2:
|
||||
$(call cmd,tar)
|
||||
|
||||
%.tar.xz: private tar-compress-opt := -I $(XZ)
|
||||
%.tar.xz:
|
||||
$(call cmd,tar)
|
||||
|
||||
%.tar.zst: private tar-compress-opt := -I $(ZSTD)
|
||||
%.tar.zst:
|
||||
$(call cmd,tar)
|
||||
PHONY += check-git
|
||||
check-git:
|
||||
@if ! $(srctree)/scripts/check-git; then \
|
||||
echo >&2 "error: creating source package requires git repository"; \
|
||||
false; \
|
||||
fi
|
||||
|
||||
# Linux source tarball
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
linux.tar.gz: tar-exclude-opt = --exclude=./$@ --exclude-from=$<_exclude
|
||||
linux.tar.gz: .tmp_filelist
|
||||
quiet_cmd_archive_linux = ARCHIVE $@
|
||||
cmd_archive_linux = \
|
||||
git -C $(srctree) archive --output=$$(realpath $@) --prefix=$(basename $@)/ $$(cat $<)
|
||||
|
||||
targets += linux.tar
|
||||
linux.tar: .tmp_HEAD FORCE
|
||||
$(call if_changed,archive_linux)
|
||||
|
||||
# rpm-pkg
|
||||
# ---------------------------------------------------------------------------
|
||||
@ -89,7 +82,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
|
||||
# ---------------------------------------------------------------------------
|
||||
@ -148,74 +141,62 @@ snap-pkg:
|
||||
# dir-pkg tar*-pkg - tarball targets
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
tar-pkg-tarball = linux-$(KERNELRELEASE)-$(ARCH).$(1)
|
||||
tar-pkg-phony = $(subst .,,$(1))-pkg
|
||||
|
||||
tar-install: FORCE
|
||||
$(Q)$(MAKE) -f $(srctree)/Makefile
|
||||
+$(Q)$(srctree)/scripts/package/buildtar $@
|
||||
|
||||
quiet_cmd_tar = TAR $@
|
||||
cmd_tar = cd $<; tar cf ../$@ --owner=root --group=root --sort=name *
|
||||
|
||||
linux-$(KERNELRELEASE)-$(ARCH).tar: tar-install
|
||||
$(call cmd,tar)
|
||||
|
||||
PHONY += dir-pkg
|
||||
dir-pkg: tar-install
|
||||
@echo "Kernel tree successfully created in $<"
|
||||
|
||||
define tar-pkg-rule
|
||||
PHONY += $(tar-pkg-phony)
|
||||
$(tar-pkg-phony): $(tar-pkg-tarball)
|
||||
PHONY += tar-pkg
|
||||
tar-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar
|
||||
@:
|
||||
|
||||
$(tar-pkg-tarball): private tar-rootdir := tar-install
|
||||
$(tar-pkg-tarball): tar-install
|
||||
endef
|
||||
|
||||
$(foreach x, tar tar.gz tar.bz2 tar.xz tar.zst, $(eval $(call tar-pkg-rule,$(x))))
|
||||
tar%-pkg: linux-$(KERNELRELEASE)-$(ARCH).tar.% FORCE
|
||||
@:
|
||||
|
||||
# perf-tar*-src-pkg - generate a source tarball with perf source
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
perf-tar-src-pkg-tarball = perf-$(KERNELVERSION).$(1)
|
||||
perf-tar-src-pkg-phony = perf-$(subst .,,$(1))-src-pkg
|
||||
.tmp_perf:
|
||||
$(Q)mkdir .tmp_perf
|
||||
|
||||
quiet_cmd_stage_perf_src = STAGE $@
|
||||
cmd_stage_perf_src = \
|
||||
rm -rf $@; \
|
||||
mkdir -p $@; \
|
||||
tar -c -f - --exclude-from=$<_exclude -C $(srctree) --files-from=$(srctree)/tools/perf/MANIFEST | \
|
||||
tar -x -f - -C $@
|
||||
|
||||
.tmp_perf: .tmp_filelist
|
||||
$(call cmd,stage_perf_src)
|
||||
|
||||
filechk_perf_head = \
|
||||
if test -z "$(git -C $(srctree) rev-parse --show-cdup 2>/dev/null)" && \
|
||||
head=$$(git -C $(srctree) rev-parse --verify HEAD 2>/dev/null); then \
|
||||
echo $$head; \
|
||||
else \
|
||||
echo "not a git tree"; \
|
||||
fi
|
||||
|
||||
.tmp_perf/HEAD: .tmp_perf FORCE
|
||||
$(call filechk,perf_head)
|
||||
.tmp_perf/HEAD: .tmp_HEAD | .tmp_perf
|
||||
$(call cmd,copy)
|
||||
|
||||
quiet_cmd_perf_version_file = GEN $@
|
||||
cmd_perf_version_file = cd $(srctree)/tools/perf; util/PERF-VERSION-GEN $(dir $(abspath $@))
|
||||
|
||||
# PERF-VERSION-FILE and HEAD are independent, but this avoids updating the
|
||||
# PERF-VERSION-FILE and .tmp_HEAD are independent, but this avoids updating the
|
||||
# timestamp of PERF-VERSION-FILE.
|
||||
# The best is to fix tools/perf/util/PERF-VERSION-GEN.
|
||||
.tmp_perf/PERF-VERSION-FILE: .tmp_perf/HEAD $(srctree)/tools/perf/util/PERF-VERSION-GEN
|
||||
.tmp_perf/PERF-VERSION-FILE: .tmp_HEAD $(srctree)/tools/perf/util/PERF-VERSION-GEN | .tmp_perf
|
||||
$(call cmd,perf_version_file)
|
||||
|
||||
define perf-tar-src-pkg-rule
|
||||
PHONY += $(perf-tar-src-pkg-phony)
|
||||
$(perf-tar-src-pkg-phony): $(perf-tar-src-pkg-tarball)
|
||||
quiet_cmd_archive_perf = ARCHIVE $@
|
||||
cmd_archive_perf = \
|
||||
git -C $(srctree) archive --output=$$(realpath $@) --prefix=$(basename $@)/ \
|
||||
--add-file=$$(realpath $(word 2, $^)) \
|
||||
--add-file=$$(realpath $(word 3, $^)) \
|
||||
$$(cat $(word 2, $^))^{tree} $$(cat $<)
|
||||
|
||||
targets += perf-$(KERNELVERSION).tar
|
||||
perf-$(KERNELVERSION).tar: tools/perf/MANIFEST .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE FORCE
|
||||
$(call if_changed,archive_perf)
|
||||
|
||||
PHONY += perf-tar-src-pkg
|
||||
perf-tar-src-pkg: perf-$(KERNELVERSION).tar
|
||||
@:
|
||||
|
||||
$(perf-tar-src-pkg-tarball): private tar-rootdir := .tmp_perf
|
||||
$(perf-tar-src-pkg-tarball): .tmp_filelist .tmp_perf/HEAD .tmp_perf/PERF-VERSION-FILE
|
||||
endef
|
||||
|
||||
$(foreach x, tar tar.gz tar.bz2 tar.xz tar.zst, $(eval $(call perf-tar-src-pkg-rule,$(x))))
|
||||
perf-tar%-src-pkg: perf-$(KERNELVERSION).tar.% FORCE
|
||||
@:
|
||||
|
||||
# Help text displayed when executing 'make help'
|
||||
# ---------------------------------------------------------------------------
|
||||
@ -243,4 +224,13 @@ help:
|
||||
PHONY += FORCE
|
||||
FORCE:
|
||||
|
||||
# Read all saved command lines and dependencies for the $(targets) we
|
||||
# may be building above, using $(if_changed{,_dep}). As an
|
||||
# optimization, we don't need to read them if the target does not
|
||||
# exist, we will rebuild anyway in that case.
|
||||
|
||||
existing-targets := $(wildcard $(sort $(targets)))
|
||||
|
||||
-include $(foreach f,$(existing-targets),$(dir $(f)).$(notdir $(f)).cmd)
|
||||
|
||||
.PHONY: $(PHONY)
|
||||
|
14
scripts/check-git
Executable file
14
scripts/check-git
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# succeed if we are in a git repository
|
||||
|
||||
srctree="$(dirname $0)/.."
|
||||
|
||||
if ! git -C "${srctree}" rev-parse --verify HEAD >/dev/null 2>/dev/null; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! test -z $(git -C "${srctree}" rev-parse --show-cdup 2>/dev/null); then
|
||||
exit 1
|
||||
fi
|
@ -119,6 +119,7 @@ static bool is_ignored_symbol(const char *name, char type)
|
||||
"kallsyms_markers",
|
||||
"kallsyms_token_table",
|
||||
"kallsyms_token_index",
|
||||
"kallsyms_seqs_of_names",
|
||||
/* Exclude linker generated symbols which vary between passes */
|
||||
"_SDA_BASE_", /* ppc */
|
||||
"_SDA2_BASE_", /* ppc */
|
||||
|
@ -1226,10 +1226,12 @@ static void (*conf_changed_callback)(void);
|
||||
|
||||
void conf_set_changed(bool val)
|
||||
{
|
||||
if (conf_changed_callback && conf_changed != val)
|
||||
conf_changed_callback();
|
||||
bool changed = conf_changed != val;
|
||||
|
||||
conf_changed = val;
|
||||
|
||||
if (conf_changed_callback && changed)
|
||||
conf_changed_callback();
|
||||
}
|
||||
|
||||
bool conf_get_changed(void)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -51,7 +51,116 @@ create_package() {
|
||||
dpkg-deb $dpkg_deb_opts ${KDEB_COMPRESS:+-Z$KDEB_COMPRESS} --build "$pdir" ..
|
||||
}
|
||||
|
||||
deploy_kernel_headers () {
|
||||
install_linux_image () {
|
||||
pdir=$1
|
||||
pname=$2
|
||||
|
||||
rm -rf ${pdir}
|
||||
|
||||
# Only some architectures with OF support have this target
|
||||
if is_enabled CONFIG_OF_EARLY_FLATTREE && [ -d "${srctree}/arch/${SRCARCH}/boot/dts" ]; then
|
||||
${MAKE} -f ${srctree}/Makefile INSTALL_DTBS_PATH="${pdir}/usr/lib/linux-image-${KERNELRELEASE}" dtbs_install
|
||||
fi
|
||||
|
||||
if is_enabled CONFIG_MODULES; then
|
||||
${MAKE} -f ${srctree}/Makefile INSTALL_MOD_PATH="${pdir}" modules_install
|
||||
rm -f "${pdir}/lib/modules/${KERNELRELEASE}/build"
|
||||
rm -f "${pdir}/lib/modules/${KERNELRELEASE}/source"
|
||||
if [ "${SRCARCH}" = um ] ; then
|
||||
mkdir -p "${pdir}/usr/lib/uml/modules"
|
||||
mv "${pdir}/lib/modules/${KERNELRELEASE}" "${pdir}/usr/lib/uml/modules/${KERNELRELEASE}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install the kernel
|
||||
if [ "${ARCH}" = um ] ; then
|
||||
mkdir -p "${pdir}/usr/bin" "${pdir}/usr/share/doc/${pname}"
|
||||
cp System.map "${pdir}/usr/lib/uml/modules/${KERNELRELEASE}/System.map"
|
||||
cp ${KCONFIG_CONFIG} "${pdir}/usr/share/doc/${pname}/config"
|
||||
gzip "${pdir}/usr/share/doc/${pname}/config"
|
||||
else
|
||||
mkdir -p "${pdir}/boot"
|
||||
cp System.map "${pdir}/boot/System.map-${KERNELRELEASE}"
|
||||
cp ${KCONFIG_CONFIG} "${pdir}/boot/config-${KERNELRELEASE}"
|
||||
fi
|
||||
|
||||
# Not all arches have the same installed path in debian
|
||||
# XXX: have each arch Makefile export a variable of the canonical image install
|
||||
# path instead
|
||||
case "${SRCARCH}" in
|
||||
um)
|
||||
installed_image_path="usr/bin/linux-${KERNELRELEASE}";;
|
||||
parisc|mips|powerpc)
|
||||
installed_image_path="boot/vmlinux-${KERNELRELEASE}";;
|
||||
*)
|
||||
installed_image_path="boot/vmlinuz-${KERNELRELEASE}";;
|
||||
esac
|
||||
cp "$(${MAKE} -s -f ${srctree}/Makefile image_name)" "${pdir}/${installed_image_path}"
|
||||
|
||||
# Install the maintainer scripts
|
||||
# Note: hook scripts under /etc/kernel are also executed by official Debian
|
||||
# kernel packages, as well as kernel packages built using make-kpkg.
|
||||
# make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and
|
||||
# so do we; recent versions of dracut and initramfs-tools will obey this.
|
||||
debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
|
||||
for script in postinst postrm preinst prerm; do
|
||||
mkdir -p "${pdir}${debhookdir}/${script}.d"
|
||||
|
||||
mkdir -p "${pdir}/DEBIAN"
|
||||
cat <<-EOF > "${pdir}/DEBIAN/${script}"
|
||||
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Pass maintainer script parameters to hook scripts
|
||||
export DEB_MAINT_PARAMS="\$*"
|
||||
|
||||
# Tell initramfs builder whether it's wanted
|
||||
export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No)
|
||||
|
||||
test -d ${debhookdir}/${script}.d && run-parts --arg="${KERNELRELEASE}" --arg="/${installed_image_path}" ${debhookdir}/${script}.d
|
||||
exit 0
|
||||
EOF
|
||||
chmod 755 "${pdir}/DEBIAN/${script}"
|
||||
done
|
||||
}
|
||||
|
||||
install_linux_image_dbg () {
|
||||
pdir=$1
|
||||
image_pdir=$2
|
||||
|
||||
rm -rf ${pdir}
|
||||
|
||||
for module in $(find ${image_pdir}/lib/modules/ -name *.ko -printf '%P\n'); do
|
||||
module=lib/modules/${module}
|
||||
mkdir -p $(dirname ${pdir}/usr/lib/debug/${module})
|
||||
# only keep debug symbols in the debug file
|
||||
${OBJCOPY} --only-keep-debug ${image_pdir}/${module} ${pdir}/usr/lib/debug/${module}
|
||||
# strip original module from debug symbols
|
||||
${OBJCOPY} --strip-debug ${image_pdir}/${module}
|
||||
# then add a link to those
|
||||
${OBJCOPY} --add-gnu-debuglink=${pdir}/usr/lib/debug/${module} ${image_pdir}/${module}
|
||||
done
|
||||
|
||||
# re-sign stripped modules
|
||||
if is_enabled CONFIG_MODULE_SIG_ALL; then
|
||||
${MAKE} -f ${srctree}/Makefile INSTALL_MOD_PATH="${image_pdir}" modules_sign
|
||||
fi
|
||||
|
||||
# Build debug package
|
||||
# Different tools want the image in different locations
|
||||
# perf
|
||||
mkdir -p ${pdir}/usr/lib/debug/lib/modules/${KERNELRELEASE}/
|
||||
cp vmlinux ${pdir}/usr/lib/debug/lib/modules/${KERNELRELEASE}/
|
||||
# systemtap
|
||||
mkdir -p ${pdir}/usr/lib/debug/boot/
|
||||
ln -s ../lib/modules/${KERNELRELEASE}/vmlinux ${pdir}/usr/lib/debug/boot/vmlinux-${KERNELRELEASE}
|
||||
# kdump-tools
|
||||
ln -s lib/modules/${KERNELRELEASE}/vmlinux ${pdir}/usr/lib/debug/vmlinux-${KERNELRELEASE}
|
||||
}
|
||||
|
||||
install_kernel_headers () {
|
||||
pdir=$1
|
||||
|
||||
rm -rf $pdir
|
||||
@ -89,7 +198,7 @@ deploy_kernel_headers () {
|
||||
ln -s /usr/src/linux-headers-$version $pdir/lib/modules/$version/build
|
||||
}
|
||||
|
||||
deploy_libc_headers () {
|
||||
install_libc_headers () {
|
||||
pdir=$1
|
||||
|
||||
rm -rf $pdir
|
||||
@ -104,132 +213,38 @@ deploy_libc_headers () {
|
||||
mv $pdir/usr/include/asm $pdir/usr/include/$host_arch/
|
||||
}
|
||||
|
||||
version=$KERNELRELEASE
|
||||
tmpdir=debian/linux-image
|
||||
dbg_dir=debian/linux-image-dbg
|
||||
packagename=linux-image-$version
|
||||
dbg_packagename=$packagename-dbg
|
||||
rm -f debian/files
|
||||
|
||||
if [ "$ARCH" = "um" ] ; then
|
||||
packagename=user-mode-linux-$version
|
||||
fi
|
||||
packages_enabled=$(dh_listpackages)
|
||||
|
||||
# Not all arches have the same installed path in debian
|
||||
# XXX: have each arch Makefile export a variable of the canonical image install
|
||||
# path instead
|
||||
case $ARCH in
|
||||
um)
|
||||
installed_image_path="usr/bin/linux-$version"
|
||||
;;
|
||||
parisc|mips|powerpc)
|
||||
installed_image_path="boot/vmlinux-$version"
|
||||
;;
|
||||
*)
|
||||
installed_image_path="boot/vmlinuz-$version"
|
||||
esac
|
||||
|
||||
BUILD_DEBUG=$(if_enabled_echo CONFIG_DEBUG_INFO Yes)
|
||||
|
||||
# Setup the directory structure
|
||||
rm -rf "$tmpdir" "$dbg_dir" debian/files
|
||||
mkdir -m 755 -p "$tmpdir/DEBIAN"
|
||||
mkdir -p "$tmpdir/lib" "$tmpdir/boot"
|
||||
|
||||
# Install the kernel
|
||||
if [ "$ARCH" = "um" ] ; then
|
||||
mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" "$tmpdir/usr/share/doc/$packagename"
|
||||
cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map"
|
||||
cp $KCONFIG_CONFIG "$tmpdir/usr/share/doc/$packagename/config"
|
||||
gzip "$tmpdir/usr/share/doc/$packagename/config"
|
||||
else
|
||||
cp System.map "$tmpdir/boot/System.map-$version"
|
||||
cp $KCONFIG_CONFIG "$tmpdir/boot/config-$version"
|
||||
fi
|
||||
cp "$($MAKE -s -f $srctree/Makefile image_name)" "$tmpdir/$installed_image_path"
|
||||
|
||||
if is_enabled CONFIG_OF_EARLY_FLATTREE; then
|
||||
# Only some architectures with OF support have this target
|
||||
if [ -d "${srctree}/arch/$SRCARCH/boot/dts" ]; then
|
||||
$MAKE -f $srctree/Makefile INSTALL_DTBS_PATH="$tmpdir/usr/lib/$packagename" dtbs_install
|
||||
fi
|
||||
fi
|
||||
|
||||
if is_enabled CONFIG_MODULES; then
|
||||
INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_install
|
||||
rm -f "$tmpdir/lib/modules/$version/build"
|
||||
rm -f "$tmpdir/lib/modules/$version/source"
|
||||
if [ "$ARCH" = "um" ] ; then
|
||||
mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/"
|
||||
rmdir "$tmpdir/lib/modules/$version"
|
||||
fi
|
||||
if [ -n "$BUILD_DEBUG" ] ; then
|
||||
for module in $(find $tmpdir/lib/modules/ -name *.ko -printf '%P\n'); do
|
||||
module=lib/modules/$module
|
||||
mkdir -p $(dirname $dbg_dir/usr/lib/debug/$module)
|
||||
# only keep debug symbols in the debug file
|
||||
$OBJCOPY --only-keep-debug $tmpdir/$module $dbg_dir/usr/lib/debug/$module
|
||||
# strip original module from debug symbols
|
||||
$OBJCOPY --strip-debug $tmpdir/$module
|
||||
# then add a link to those
|
||||
$OBJCOPY --add-gnu-debuglink=$dbg_dir/usr/lib/debug/$module $tmpdir/$module
|
||||
done
|
||||
|
||||
# resign stripped modules
|
||||
if is_enabled CONFIG_MODULE_SIG_ALL; then
|
||||
INSTALL_MOD_PATH="$tmpdir" $MAKE -f $srctree/Makefile modules_sign
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install the maintainer scripts
|
||||
# Note: hook scripts under /etc/kernel are also executed by official Debian
|
||||
# kernel packages, as well as kernel packages built using make-kpkg.
|
||||
# make-kpkg sets $INITRD to indicate whether an initramfs is wanted, and
|
||||
# so do we; recent versions of dracut and initramfs-tools will obey this.
|
||||
debhookdir=${KDEB_HOOKDIR:-/etc/kernel}
|
||||
for script in postinst postrm preinst prerm ; do
|
||||
mkdir -p "$tmpdir$debhookdir/$script.d"
|
||||
cat <<EOF > "$tmpdir/DEBIAN/$script"
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Pass maintainer script parameters to hook scripts
|
||||
export DEB_MAINT_PARAMS="\$*"
|
||||
|
||||
# Tell initramfs builder whether it's wanted
|
||||
export INITRD=$(if_enabled_echo CONFIG_BLK_DEV_INITRD Yes No)
|
||||
|
||||
test -d $debhookdir/$script.d && run-parts --arg="$version" --arg="/$installed_image_path" $debhookdir/$script.d
|
||||
exit 0
|
||||
EOF
|
||||
chmod 755 "$tmpdir/DEBIAN/$script"
|
||||
for package in ${packages_enabled}
|
||||
do
|
||||
case ${package} in
|
||||
*-dbg)
|
||||
# This must be done after linux-image, that is, we expect the
|
||||
# debug package appears after linux-image in debian/control.
|
||||
install_linux_image_dbg debian/linux-image-dbg debian/linux-image;;
|
||||
linux-image-*|user-mode-linux-*)
|
||||
install_linux_image debian/linux-image ${package};;
|
||||
linux-libc-dev)
|
||||
install_libc_headers debian/linux-libc-dev;;
|
||||
linux-headers-*)
|
||||
install_kernel_headers debian/linux-headers;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ "$ARCH" != "um" ]; then
|
||||
if is_enabled CONFIG_MODULES; then
|
||||
deploy_kernel_headers debian/linux-headers
|
||||
create_package linux-headers-$version debian/linux-headers
|
||||
fi
|
||||
|
||||
deploy_libc_headers debian/linux-libc-dev
|
||||
create_package linux-libc-dev debian/linux-libc-dev
|
||||
fi
|
||||
|
||||
create_package "$packagename" "$tmpdir"
|
||||
|
||||
if [ -n "$BUILD_DEBUG" ] ; then
|
||||
# Build debug package
|
||||
# Different tools want the image in different locations
|
||||
# perf
|
||||
mkdir -p $dbg_dir/usr/lib/debug/lib/modules/$version/
|
||||
cp vmlinux $dbg_dir/usr/lib/debug/lib/modules/$version/
|
||||
# systemtap
|
||||
mkdir -p $dbg_dir/usr/lib/debug/boot/
|
||||
ln -s ../lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/boot/vmlinux-$version
|
||||
# kdump-tools
|
||||
ln -s lib/modules/$version/vmlinux $dbg_dir/usr/lib/debug/vmlinux-$version
|
||||
create_package "$dbg_packagename" "$dbg_dir"
|
||||
fi
|
||||
for package in ${packages_enabled}
|
||||
do
|
||||
case ${package} in
|
||||
*-dbg)
|
||||
create_package ${package} debian/linux-image-dbg;;
|
||||
linux-image-*|user-mode-linux-*)
|
||||
create_package ${package} debian/linux-image;;
|
||||
linux-libc-dev)
|
||||
create_package ${package} debian/linux-libc-dev;;
|
||||
linux-headers-*)
|
||||
create_package ${package} debian/linux-headers;;
|
||||
esac
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
@ -1,16 +1,14 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
# Set up CROSS_COMPILE if we are cross-compiling, but not called from the
|
||||
# kernel toplevel Makefile
|
||||
if [ -z "${CROSS_COMPILE}${cross_compiling}" -a "${DEB_HOST_ARCH}" != "${DEB_BUILD_ARCH}" ]; then
|
||||
# Set up CROSS_COMPILE if not defined yet
|
||||
if [ "${CROSS_COMPILE+set}" != "set" -a "${DEB_HOST_ARCH}" != "${DEB_BUILD_ARCH}" ]; then
|
||||
echo CROSS_COMPILE=${DEB_HOST_GNU_TYPE}-
|
||||
fi
|
||||
|
||||
version=$(dpkg-parsechangelog -S Version)
|
||||
version_upstream="${version%-*}"
|
||||
debian_revision="${version#${version_upstream}}"
|
||||
debian_revision="${debian_revision#*-}"
|
||||
debian_revision="${version##*-}"
|
||||
|
||||
echo KERNELRELEASE=${version_upstream}
|
||||
echo KBUILD_BUILD_VERSION=${debian_revision}
|
||||
if [ "${version}" != "${debian_revision}" ]; then
|
||||
echo KBUILD_BUILD_VERSION=${debian_revision}
|
||||
fi
|
||||
|
44
scripts/package/gen-diff-patch
Executable file
44
scripts/package/gen-diff-patch
Executable file
@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
diff_patch="${1}"
|
||||
untracked_patch="${2}"
|
||||
srctree=$(dirname $0)/../..
|
||||
|
||||
rm -f ${diff_patch} ${untracked_patch}
|
||||
|
||||
if ! ${srctree}/scripts/check-git; then
|
||||
exit
|
||||
fi
|
||||
|
||||
mkdir -p "$(dirname ${diff_patch})" "$(dirname ${untracked_patch})"
|
||||
|
||||
git -C "${srctree}" diff HEAD > "${diff_patch}"
|
||||
|
||||
if [ ! -s "${diff_patch}" ]; then
|
||||
rm -f "${diff_patch}"
|
||||
exit
|
||||
fi
|
||||
|
||||
git -C ${srctree} status --porcelain --untracked-files=all |
|
||||
while read stat path
|
||||
do
|
||||
if [ "${stat}" = '??' ]; then
|
||||
|
||||
if ! diff -u /dev/null "${srctree}/${path}" > .tmp_diff &&
|
||||
! head -n1 .tmp_diff | grep -q "Binary files"; then
|
||||
{
|
||||
echo "--- /dev/null"
|
||||
echo "+++ linux/$path"
|
||||
cat .tmp_diff | tail -n +3
|
||||
} >> ${untracked_patch}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
rm -f .tmp_diff
|
||||
|
||||
if [ ! -s "${diff_patch}" ]; then
|
||||
rm -f "${diff_patch}"
|
||||
exit
|
||||
fi
|
@ -91,7 +91,7 @@ version=$KERNELRELEASE
|
||||
if [ -n "$KDEB_PKGVERSION" ]; then
|
||||
packageversion=$KDEB_PKGVERSION
|
||||
else
|
||||
packageversion=$version-$($srctree/init/build-version)
|
||||
packageversion=$(${srctree}/scripts/setlocalversion --no-local ${srctree})-$($srctree/init/build-version)
|
||||
fi
|
||||
sourcename=${KDEB_SOURCENAME:-linux-upstream}
|
||||
|
||||
@ -152,6 +152,14 @@ mkdir -p debian/patches
|
||||
} > debian/patches/config
|
||||
echo config > debian/patches/series
|
||||
|
||||
$(dirname $0)/gen-diff-patch debian/patches/diff.patch debian/patches/untracked.patch
|
||||
if [ -f debian/patches/diff.patch ]; then
|
||||
echo diff.patch >> debian/patches/series
|
||||
fi
|
||||
if [ -f debian/patches/untracked.patch ]; then
|
||||
echo untracked.patch >> debian/patches/series
|
||||
fi
|
||||
|
||||
echo $debarch > debian/arch
|
||||
extra_build_depends=", $(if_enabled_echo CONFIG_UNWINDER_ORC libelf-dev:native)"
|
||||
extra_build_depends="$extra_build_depends, $(if_enabled_echo CONFIG_SYSTEM_TRUSTED_KEYRING libssl-dev:native)"
|
||||
@ -192,7 +200,7 @@ Section: kernel
|
||||
Priority: optional
|
||||
Maintainer: $maintainer
|
||||
Rules-Requires-Root: no
|
||||
Build-Depends: bc, rsync, kmod, cpio, bison, flex $extra_build_depends
|
||||
Build-Depends: bc, debhelper, rsync, kmod, cpio, bison, flex $extra_build_depends
|
||||
Homepage: https://www.kernel.org/
|
||||
|
||||
Package: $packagename-$version
|
||||
@ -200,6 +208,10 @@ Architecture: $debarch
|
||||
Description: Linux kernel, version $version
|
||||
This package contains the Linux kernel, modules and corresponding other
|
||||
files, version: $version.
|
||||
EOF
|
||||
|
||||
if [ "${SRCARCH}" != um ]; then
|
||||
cat <<EOF >> debian/control
|
||||
|
||||
Package: linux-libc-dev
|
||||
Section: devel
|
||||
@ -222,6 +234,7 @@ Description: Linux kernel headers for $version on $debarch
|
||||
This is useful for people who need to build external modules
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
if is_enabled CONFIG_DEBUG_INFO; then
|
||||
cat <<EOF >> debian/control
|
||||
@ -239,10 +252,12 @@ cat <<EOF > debian/rules
|
||||
#!$(command -v $MAKE) -f
|
||||
|
||||
srctree ?= .
|
||||
KERNELRELEASE = ${KERNELRELEASE}
|
||||
|
||||
build-indep:
|
||||
build-arch:
|
||||
\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \
|
||||
KERNELRELEASE=\$(KERNELRELEASE) \
|
||||
\$(shell \$(srctree)/scripts/package/deb-build-option) \
|
||||
olddefconfig all
|
||||
|
||||
@ -250,7 +265,9 @@ build: build-arch
|
||||
|
||||
binary-indep:
|
||||
binary-arch: build-arch
|
||||
\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} intdeb-pkg
|
||||
\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} \
|
||||
KERNELRELEASE=\$(KERNELRELEASE) intdeb-pkg
|
||||
|
||||
clean:
|
||||
rm -rf debian/files debian/linux-*
|
||||
\$(MAKE) -f \$(srctree)/Makefile ARCH=${ARCH} clean
|
||||
|
@ -15,15 +15,21 @@ 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
|
||||
$(dirname $0)/gen-diff-patch rpmbuild/SOURCES/diff.patch rpmbuild/SOURCES/untracked.patch
|
||||
touch rpmbuild/SOURCES/diff.patch rpmbuild/SOURCES/untracked.patch
|
||||
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
|
||||
|
||||
@ -48,7 +54,9 @@ 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
|
||||
$S Source2: diff.patch
|
||||
$S Source3: untracked.patch
|
||||
Provides: $PROVIDES
|
||||
$S BuildRequires: bc binutils bison dwarves
|
||||
$S BuildRequires: (elfutils-libelf-devel or libelf-devel) flex
|
||||
@ -85,7 +93,13 @@ $S$M against the $__KERNELRELEASE kernel package.
|
||||
$S$M
|
||||
$S %prep
|
||||
$S %setup -q -n linux
|
||||
$S cp %{SOURCE1} .
|
||||
$S cp %{SOURCE1} .config
|
||||
$S if [ -s %{SOURCE2} ]; then
|
||||
$S patch -p1 < %{SOURCE2}
|
||||
$S fi
|
||||
$S if [ -s %{SOURCE3} ]; then
|
||||
$S patch -p1 < %{SOURCE3}
|
||||
$S fi
|
||||
$S
|
||||
$S %build
|
||||
$S $MAKE %{?_smp_mflags} KERNELRELEASE=$KERNELRELEASE KBUILD_BUILD_VERSION=%{release}
|
||||
|
@ -11,10 +11,16 @@
|
||||
#
|
||||
|
||||
usage() {
|
||||
echo "Usage: $0 [srctree]" >&2
|
||||
echo "Usage: $0 [--no-local] [srctree]" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
no_local=false
|
||||
if test "$1" = "--no-local"; then
|
||||
no_local=true
|
||||
shift
|
||||
fi
|
||||
|
||||
srctree=.
|
||||
if test $# -gt 0; then
|
||||
srctree=$1
|
||||
@ -26,14 +32,22 @@ fi
|
||||
|
||||
scm_version()
|
||||
{
|
||||
local short
|
||||
local short=false
|
||||
local no_dirty=false
|
||||
local tag
|
||||
short=false
|
||||
|
||||
while [ $# -gt 0 ];
|
||||
do
|
||||
case "$1" in
|
||||
--short)
|
||||
short=true;;
|
||||
--no-dirty)
|
||||
no_dirty=true;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
cd "$srctree"
|
||||
if test "$1" = "--short"; then
|
||||
short=true
|
||||
fi
|
||||
|
||||
if test -n "$(git rev-parse --show-cdup 2>/dev/null)"; then
|
||||
return
|
||||
@ -75,6 +89,10 @@ scm_version()
|
||||
printf '%s%s' -g "$(echo $head | cut -c1-12)"
|
||||
fi
|
||||
|
||||
if ${no_dirty}; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Check for uncommitted changes.
|
||||
# This script must avoid any write attempt to the source tree, which
|
||||
# might be read-only.
|
||||
@ -110,11 +128,6 @@ collect_files()
|
||||
echo "$res"
|
||||
}
|
||||
|
||||
if ! test -e include/config/auto.conf; then
|
||||
echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "${KERNELVERSION}" ]; then
|
||||
echo "KERNELVERSION is not set" >&2
|
||||
exit 1
|
||||
@ -126,6 +139,16 @@ if test ! "$srctree" -ef .; then
|
||||
file_localversion="${file_localversion}$(collect_files "$srctree"/localversion*)"
|
||||
fi
|
||||
|
||||
if ${no_local}; then
|
||||
echo "${KERNELVERSION}$(scm_version --no-dirty)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! test -e include/config/auto.conf; then
|
||||
echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# version string from CONFIG_LOCALVERSION
|
||||
config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user