Kbuild updates for v5.5
- remove unneeded asm headers from hexagon, ia64 - add 'dir-pkg' target, which works like 'tar-pkg' but skips archiving - add 'helpnewconfig' target, which shows help for new CONFIG options - support 'make nsdeps' for external modules - make rebuilds faster by deleting $(wildcard $^) checks - remove compile tests for kernel-space headers - refactor modpost to simplify modversion handling - make single target builds faster - optimize and clean up scripts/kallsyms.c - refactor various Makefiles and scripts -----BEGIN PGP SIGNATURE----- iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAl3lKCUVHG1hc2FoaXJv eUBrZXJuZWwub3JnAAoJED2LAQed4NsGu9sP/iTW/RjDxbAsu0aP8jFqzLK/xKB/ NQn/+dD76TjEmjgew9AXszf2rJL+ixKVymGM08FV59Bbguvi8XmAB/QXK21Sjb5j rVl3N97TWNkvXM+QJyly23G2UtbubRSPo3g+e70BZrw3lcmrsK+sAmTOL5KtIrNX 9BHM803JwqsMJyvBwTBBw3UFeeBqb38Qx6gmigfSihuDf6pvjoVDKskpsDno3wX7 rdiXYxAsKQLQ/P2ym/bV/Oqe90RqRtV/2/WCpLshlwHkiM9huflv6GjgCkkbAx5H N3TSptlS7l/2B/XKHgA5ALjHjUlxTGBzLLoevarCd8loKcQXFlgx+vd3nM/WJlHJ x9UpTklDwGP9eUBsa9W980tEyUVsFGMAC8EcTdW6NN2IRtuCOSA5N2FYYt8/SDd0 2b3PhElTJIp4pTWSYN6JZxB1R8n/YBgxLqOJ6N2U6B9CdKFUCHlwGH23QfN89km/ WEMP85bsaab/dnyxbwelkoYYYyPgUHsC13AbpkHdrDxMbAGO+G1PwpHxC6ErF2en wRGrcUxWTfHRykO5aJIQtCB9b1fv73134mTzB5fTYd6GtjepGBSBCO9xb2Iy4sc9 Y+nHVVDUrihvSOpJgqh677PcLDutOZR8fFCoc1ZMDAbBsDvrb0Qsee6oEidj98xc 5kXp9YZh/tdh/tdo =zUaB -----END PGP SIGNATURE----- Merge tag 'kbuild-v5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild Pull Kbuild updates from Masahiro Yamada: - remove unneeded asm headers from hexagon, ia64 - add 'dir-pkg' target, which works like 'tar-pkg' but skips archiving - add 'helpnewconfig' target, which shows help for new CONFIG options - support 'make nsdeps' for external modules - make rebuilds faster by deleting $(wildcard $^) checks - remove compile tests for kernel-space headers - refactor modpost to simplify modversion handling - make single target builds faster - optimize and clean up scripts/kallsyms.c - refactor various Makefiles and scripts * tag 'kbuild-v5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: (59 commits) MAINTAINERS: update Kbuild/Kconfig maintainer's email address scripts/kallsyms: remove redundant initializers scripts/kallsyms: put check_symbol_range() calls close together scripts/kallsyms: make check_symbol_range() void function scripts/kallsyms: move ignored symbol types to is_ignored_symbol() scripts/kallsyms: move more patterns to the ignored_prefixes array scripts/kallsyms: skip ignored symbols very early scripts/kallsyms: add const qualifiers where possible scripts/kallsyms: make find_token() return (unsigned char *) scripts/kallsyms: replace prefix_underscores_count() with strspn() scripts/kallsyms: add sym_name() to mitigate cast ugliness scripts/kallsyms: remove unneeded length check for prefix matching scripts/kallsyms: remove redundant is_arm_mapping_symbol() scripts/kallsyms: set relative_base more effectively scripts/kallsyms: shrink table before sorting it scripts/kallsyms: fix definitely-lost memory leak scripts/kallsyms: remove unneeded #ifndef ARRAY_SIZE kbuild: make single target builds even faster modpost: respect the previous export when 'exported twice' is warned modpost: do not set ->preloaded for symbols from Module.symvers ...
This commit is contained in:
Коммит
76bb8b0596
|
@ -32,7 +32,6 @@
|
||||||
*.lzo
|
*.lzo
|
||||||
*.mod
|
*.mod
|
||||||
*.mod.c
|
*.mod.c
|
||||||
*.ns_deps
|
|
||||||
*.o
|
*.o
|
||||||
*.o.*
|
*.o.*
|
||||||
*.patch
|
*.patch
|
||||||
|
@ -61,6 +60,7 @@ modules.order
|
||||||
/System.map
|
/System.map
|
||||||
/Module.markers
|
/Module.markers
|
||||||
/modules.builtin.modinfo
|
/modules.builtin.modinfo
|
||||||
|
/modules.nsdeps
|
||||||
|
|
||||||
#
|
#
|
||||||
# RPM spec file (make rpm-pkg)
|
# RPM spec file (make rpm-pkg)
|
||||||
|
|
|
@ -128,8 +128,10 @@ dochelp:
|
||||||
@echo ' pdfdocs - PDF'
|
@echo ' pdfdocs - PDF'
|
||||||
@echo ' epubdocs - EPUB'
|
@echo ' epubdocs - EPUB'
|
||||||
@echo ' xmldocs - XML'
|
@echo ' xmldocs - XML'
|
||||||
@echo ' linkcheckdocs - check for broken external links (will connect to external hosts)'
|
@echo ' linkcheckdocs - check for broken external links'
|
||||||
@echo ' refcheckdocs - check for references to non-existing files under Documentation'
|
@echo ' (will connect to external hosts)'
|
||||||
|
@echo ' refcheckdocs - check for references to non-existing files under'
|
||||||
|
@echo ' Documentation'
|
||||||
@echo ' cleandocs - clean all generated files'
|
@echo ' cleandocs - clean all generated files'
|
||||||
@echo
|
@echo
|
||||||
@echo ' make SPHINXDIRS="s1 s2" [target] Generate only docs of folder s1, s2'
|
@echo ' make SPHINXDIRS="s1 s2" [target] Generate only docs of folder s1, s2'
|
||||||
|
|
|
@ -152,3 +152,6 @@ in-tree modules::
|
||||||
- notice the warning of modpost telling about a missing import
|
- notice the warning of modpost telling about a missing import
|
||||||
- run `make nsdeps` to add the import to the correct code location
|
- run `make nsdeps` to add the import to the correct code location
|
||||||
|
|
||||||
|
You can also run nsdeps for external module builds. A typical usage is::
|
||||||
|
|
||||||
|
$ make -C <path_to_kernel_src> M=$PWD nsdeps
|
||||||
|
|
|
@ -179,6 +179,7 @@ mkutf8data
|
||||||
modpost
|
modpost
|
||||||
modules.builtin
|
modules.builtin
|
||||||
modules.builtin.modinfo
|
modules.builtin.modinfo
|
||||||
|
modules.nsdeps
|
||||||
modules.order
|
modules.order
|
||||||
modversions.h*
|
modversions.h*
|
||||||
nconf
|
nconf
|
||||||
|
|
|
@ -1115,23 +1115,6 @@ When kbuild executes, the following steps are followed (roughly):
|
||||||
In this example, extra-y is used to list object files that
|
In this example, extra-y is used to list object files that
|
||||||
shall be built, but shall not be linked as part of built-in.a.
|
shall be built, but shall not be linked as part of built-in.a.
|
||||||
|
|
||||||
header-test-y
|
|
||||||
|
|
||||||
header-test-y specifies headers (`*.h`) in the current directory that
|
|
||||||
should be compile tested to ensure they are self-contained,
|
|
||||||
i.e. compilable as standalone units. If CONFIG_HEADER_TEST is enabled,
|
|
||||||
this builds them as part of extra-y.
|
|
||||||
|
|
||||||
header-test-pattern-y
|
|
||||||
|
|
||||||
This works as a weaker version of header-test-y, and accepts wildcard
|
|
||||||
patterns. The typical usage is::
|
|
||||||
|
|
||||||
header-test-pattern-y += *.h
|
|
||||||
|
|
||||||
This specifies all the files that matches to `*.h` in the current
|
|
||||||
directory, but the files in 'header-test-' are excluded.
|
|
||||||
|
|
||||||
6.7 Commands useful for building a boot image
|
6.7 Commands useful for building a boot image
|
||||||
---------------------------------------------
|
---------------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -492,11 +492,8 @@ build.
|
||||||
to the symbols from the kernel to check if all external symbols
|
to the symbols from the kernel to check if all external symbols
|
||||||
are defined. This is done in the MODPOST step. modpost obtains
|
are defined. This is done in the MODPOST step. modpost obtains
|
||||||
the symbols by reading Module.symvers from the kernel source
|
the symbols by reading Module.symvers from the kernel source
|
||||||
tree. If a Module.symvers file is present in the directory
|
tree. During the MODPOST step, a new Module.symvers file will be
|
||||||
where the external module is being built, this file will be
|
written containing all exported symbols from that external module.
|
||||||
read too. During the MODPOST step, a new Module.symvers file
|
|
||||||
will be written containing all exported symbols that were not
|
|
||||||
defined in the kernel.
|
|
||||||
|
|
||||||
6.3 Symbols From Another External Module
|
6.3 Symbols From Another External Module
|
||||||
----------------------------------------
|
----------------------------------------
|
||||||
|
@ -504,7 +501,7 @@ build.
|
||||||
Sometimes, an external module uses exported symbols from
|
Sometimes, an external module uses exported symbols from
|
||||||
another external module. Kbuild needs to have full knowledge of
|
another external module. Kbuild needs to have full knowledge of
|
||||||
all symbols to avoid spitting out warnings about undefined
|
all symbols to avoid spitting out warnings about undefined
|
||||||
symbols. Three solutions exist for this situation.
|
symbols. Two solutions exist for this situation.
|
||||||
|
|
||||||
NOTE: The method with a top-level kbuild file is recommended
|
NOTE: The method with a top-level kbuild file is recommended
|
||||||
but may be impractical in certain situations.
|
but may be impractical in certain situations.
|
||||||
|
@ -544,8 +541,8 @@ build.
|
||||||
all symbols defined and not part of the kernel.
|
all symbols defined and not part of the kernel.
|
||||||
|
|
||||||
Use "make" variable KBUILD_EXTRA_SYMBOLS
|
Use "make" variable KBUILD_EXTRA_SYMBOLS
|
||||||
If it is impractical to copy Module.symvers from
|
If it is impractical to add a top-level kbuild file,
|
||||||
another module, you can assign a space separated list
|
you can assign a space separated list
|
||||||
of files to KBUILD_EXTRA_SYMBOLS in your build file.
|
of files to KBUILD_EXTRA_SYMBOLS in your build file.
|
||||||
These files will be loaded by modpost during the
|
These files will be loaded by modpost during the
|
||||||
initialization of its symbol tables.
|
initialization of its symbol tables.
|
||||||
|
|
|
@ -8934,7 +8934,7 @@ F: mm/kasan/
|
||||||
F: scripts/Makefile.kasan
|
F: scripts/Makefile.kasan
|
||||||
|
|
||||||
KCONFIG
|
KCONFIG
|
||||||
M: Masahiro Yamada <yamada.masahiro@socionext.com>
|
M: Masahiro Yamada <masahiroy@kernel.org>
|
||||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kconfig
|
T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git kconfig
|
||||||
L: linux-kbuild@vger.kernel.org
|
L: linux-kbuild@vger.kernel.org
|
||||||
S: Maintained
|
S: Maintained
|
||||||
|
@ -8966,7 +8966,7 @@ S: Maintained
|
||||||
F: fs/autofs/
|
F: fs/autofs/
|
||||||
|
|
||||||
KERNEL BUILD + files below scripts/ (unless maintained elsewhere)
|
KERNEL BUILD + files below scripts/ (unless maintained elsewhere)
|
||||||
M: Masahiro Yamada <yamada.masahiro@socionext.com>
|
M: Masahiro Yamada <masahiroy@kernel.org>
|
||||||
M: Michal Marek <michal.lkml@markovi.net>
|
M: Michal Marek <michal.lkml@markovi.net>
|
||||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
|
T: git git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
|
||||||
L: linux-kbuild@vger.kernel.org
|
L: linux-kbuild@vger.kernel.org
|
||||||
|
|
121
Makefile
121
Makefile
|
@ -618,7 +618,6 @@ ifeq ($(KBUILD_EXTMOD),)
|
||||||
init-y := init/
|
init-y := init/
|
||||||
drivers-y := drivers/ sound/
|
drivers-y := drivers/ sound/
|
||||||
drivers-$(CONFIG_SAMPLES) += samples/
|
drivers-$(CONFIG_SAMPLES) += samples/
|
||||||
drivers-$(CONFIG_KERNEL_HEADER_TEST) += include/
|
|
||||||
net-y := net/
|
net-y := net/
|
||||||
libs-y := lib/
|
libs-y := lib/
|
||||||
core-y := usr/
|
core-y := usr/
|
||||||
|
@ -1011,6 +1010,7 @@ endif
|
||||||
PHONY += prepare0
|
PHONY += prepare0
|
||||||
|
|
||||||
export MODORDER := $(extmod-prefix)modules.order
|
export MODORDER := $(extmod-prefix)modules.order
|
||||||
|
export MODULES_NSDEPS := $(extmod-prefix)modules.nsdeps
|
||||||
|
|
||||||
ifeq ($(KBUILD_EXTMOD),)
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
|
core-y += kernel/ certs/ mm/ fs/ ipc/ security/ crypto/ block/
|
||||||
|
@ -1196,19 +1196,15 @@ headers: $(version_h) scripts_unifdef uapi-asm-generic archheaders archscripts
|
||||||
$(Q)$(MAKE) $(hdr-inst)=include/uapi
|
$(Q)$(MAKE) $(hdr-inst)=include/uapi
|
||||||
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi
|
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi
|
||||||
|
|
||||||
|
# Deprecated. It is no-op now.
|
||||||
PHONY += headers_check
|
PHONY += headers_check
|
||||||
headers_check: headers
|
headers_check:
|
||||||
$(Q)$(MAKE) $(hdr-inst)=include/uapi HDRCHECK=1
|
@:
|
||||||
$(Q)$(MAKE) $(hdr-inst)=arch/$(SRCARCH)/include/uapi HDRCHECK=1
|
|
||||||
|
|
||||||
ifdef CONFIG_HEADERS_INSTALL
|
ifdef CONFIG_HEADERS_INSTALL
|
||||||
prepare: headers
|
prepare: headers
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifdef CONFIG_HEADERS_CHECK
|
|
||||||
all: headers_check
|
|
||||||
endif
|
|
||||||
|
|
||||||
PHONY += scripts_unifdef
|
PHONY += scripts_unifdef
|
||||||
scripts_unifdef: scripts_basic
|
scripts_unifdef: scripts_basic
|
||||||
$(Q)$(MAKE) $(build)=scripts scripts/unifdef
|
$(Q)$(MAKE) $(build)=scripts scripts/unifdef
|
||||||
|
@ -1360,7 +1356,7 @@ endif # CONFIG_MODULES
|
||||||
|
|
||||||
# Directories & files removed with 'make clean'
|
# Directories & files removed with 'make clean'
|
||||||
CLEAN_DIRS += include/ksym
|
CLEAN_DIRS += include/ksym
|
||||||
CLEAN_FILES += modules.builtin.modinfo
|
CLEAN_FILES += modules.builtin.modinfo modules.nsdeps
|
||||||
|
|
||||||
# Directories & files removed with 'make mrproper'
|
# Directories & files removed with 'make mrproper'
|
||||||
MRPROPER_DIRS += include/config include/generated \
|
MRPROPER_DIRS += include/config include/generated \
|
||||||
|
@ -1476,7 +1472,6 @@ help:
|
||||||
@echo ' versioncheck - Sanity check on version.h usage'
|
@echo ' versioncheck - Sanity check on version.h usage'
|
||||||
@echo ' includecheck - Check for duplicate included header files'
|
@echo ' includecheck - Check for duplicate included header files'
|
||||||
@echo ' export_report - List the usages of all exported symbols'
|
@echo ' export_report - List the usages of all exported symbols'
|
||||||
@echo ' headers_check - Sanity check on exported headers'
|
|
||||||
@echo ' headerdep - Detect inclusion cycles in headers'
|
@echo ' headerdep - Detect inclusion cycles in headers'
|
||||||
@echo ' coccicheck - Check with Coccinelle'
|
@echo ' coccicheck - Check with Coccinelle'
|
||||||
@echo ''
|
@echo ''
|
||||||
|
@ -1515,7 +1510,7 @@ help:
|
||||||
@echo ''
|
@echo ''
|
||||||
@$(if $(boards), \
|
@$(if $(boards), \
|
||||||
$(foreach b, $(boards), \
|
$(foreach b, $(boards), \
|
||||||
printf " %-24s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
|
printf " %-27s - Build for %s\\n" $(b) $(subst _defconfig,,$(b));) \
|
||||||
echo '')
|
echo '')
|
||||||
@$(if $(board-dirs), \
|
@$(if $(board-dirs), \
|
||||||
$(foreach b, $(board-dirs), \
|
$(foreach b, $(board-dirs), \
|
||||||
|
@ -1526,7 +1521,8 @@ help:
|
||||||
@echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
|
@echo ' make V=0|1 [targets] 0 => quiet build (default), 1 => verbose build'
|
||||||
@echo ' make V=2 [targets] 2 => give reason for rebuild of target'
|
@echo ' make V=2 [targets] 2 => give reason for rebuild of target'
|
||||||
@echo ' make O=dir [targets] Locate all output files in "dir", including .config'
|
@echo ' make O=dir [targets] Locate all output files in "dir", including .config'
|
||||||
@echo ' make C=1 [targets] Check re-compiled c source with $$CHECK (sparse by default)'
|
@echo ' make C=1 [targets] Check re-compiled c source with $$CHECK'
|
||||||
|
@echo ' (sparse by default)'
|
||||||
@echo ' make C=2 [targets] Force check of all c source with $$CHECK'
|
@echo ' make C=2 [targets] Force check of all c source with $$CHECK'
|
||||||
@echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
|
@echo ' make RECORDMCOUNT_WARN=1 [targets] Warn about ignored mcount sections'
|
||||||
@echo ' make W=n [targets] Enable extra build checks, n=1,2,3 where'
|
@echo ' make W=n [targets] Enable extra build checks, n=1,2,3 where'
|
||||||
|
@ -1622,7 +1618,7 @@ _emodinst_post: _emodinst_
|
||||||
$(call cmd,depmod)
|
$(call cmd,depmod)
|
||||||
|
|
||||||
clean-dirs := $(KBUILD_EXTMOD)
|
clean-dirs := $(KBUILD_EXTMOD)
|
||||||
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers
|
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers $(KBUILD_EXTMOD)/modules.nsdeps
|
||||||
|
|
||||||
PHONY += /
|
PHONY += /
|
||||||
/:
|
/:
|
||||||
|
@ -1641,6 +1637,50 @@ help:
|
||||||
PHONY += prepare
|
PHONY += prepare
|
||||||
endif # KBUILD_EXTMOD
|
endif # KBUILD_EXTMOD
|
||||||
|
|
||||||
|
# Single targets
|
||||||
|
# ---------------------------------------------------------------------------
|
||||||
|
# To build individual files in subdirectories, you can do like this:
|
||||||
|
#
|
||||||
|
# make foo/bar/baz.s
|
||||||
|
#
|
||||||
|
# The supported suffixes for single-target are listed in 'single-targets'
|
||||||
|
#
|
||||||
|
# To build only under specific subdirectories, you can do like this:
|
||||||
|
#
|
||||||
|
# make foo/bar/baz/
|
||||||
|
|
||||||
|
ifdef single-build
|
||||||
|
|
||||||
|
# .ko is special because modpost is needed
|
||||||
|
single-ko := $(sort $(filter %.ko, $(MAKECMDGOALS)))
|
||||||
|
single-no-ko := $(sort $(patsubst %.ko,%.mod, $(MAKECMDGOALS)))
|
||||||
|
|
||||||
|
$(single-ko): single_modpost
|
||||||
|
@:
|
||||||
|
$(single-no-ko): descend
|
||||||
|
@:
|
||||||
|
|
||||||
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
|
# For the single build of in-tree modules, use a temporary file to avoid
|
||||||
|
# the situation of modules_install installing an invalid modules.order.
|
||||||
|
MODORDER := .modules.tmp
|
||||||
|
endif
|
||||||
|
|
||||||
|
PHONY += single_modpost
|
||||||
|
single_modpost: $(single-no-ko)
|
||||||
|
$(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
|
||||||
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
||||||
|
|
||||||
|
KBUILD_MODULES := 1
|
||||||
|
|
||||||
|
export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))
|
||||||
|
|
||||||
|
# trim unrelated directories
|
||||||
|
build-dirs := $(foreach d, $(build-dirs), \
|
||||||
|
$(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
|
||||||
|
|
||||||
|
endif
|
||||||
|
|
||||||
# Handle descending into subdirectories listed in $(build-dirs)
|
# Handle descending into subdirectories listed in $(build-dirs)
|
||||||
# Preset locale variables to speed up the build process. Limit locale
|
# Preset locale variables to speed up the build process. Limit locale
|
||||||
# tweaks to this spot to avoid wrong language settings when running
|
# tweaks to this spot to avoid wrong language settings when running
|
||||||
|
@ -1649,7 +1689,9 @@ endif # KBUILD_EXTMOD
|
||||||
PHONY += descend $(build-dirs)
|
PHONY += descend $(build-dirs)
|
||||||
descend: $(build-dirs)
|
descend: $(build-dirs)
|
||||||
$(build-dirs): prepare
|
$(build-dirs): prepare
|
||||||
$(Q)$(MAKE) $(build)=$@ single-build=$(single-build) need-builtin=1 need-modorder=1
|
$(Q)$(MAKE) $(build)=$@ \
|
||||||
|
single-build=$(if $(filter-out $@/, $(single-no-ko)),1) \
|
||||||
|
need-builtin=1 need-modorder=1
|
||||||
|
|
||||||
clean-dirs := $(addprefix _clean_, $(clean-dirs))
|
clean-dirs := $(addprefix _clean_, $(clean-dirs))
|
||||||
PHONY += $(clean-dirs) clean
|
PHONY += $(clean-dirs) clean
|
||||||
|
@ -1664,7 +1706,7 @@ clean: $(clean-dirs)
|
||||||
-o -name '*.ko.*' \
|
-o -name '*.ko.*' \
|
||||||
-o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
|
-o -name '*.dtb' -o -name '*.dtb.S' -o -name '*.dt.yaml' \
|
||||||
-o -name '*.dwo' -o -name '*.lst' \
|
-o -name '*.dwo' -o -name '*.lst' \
|
||||||
-o -name '*.su' -o -name '*.mod' -o -name '*.ns_deps' \
|
-o -name '*.su' -o -name '*.mod' \
|
||||||
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
|
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
|
||||||
-o -name '*.lex.c' -o -name '*.tab.[ch]' \
|
-o -name '*.lex.c' -o -name '*.tab.[ch]' \
|
||||||
-o -name '*.asn1.[ch]' \
|
-o -name '*.asn1.[ch]' \
|
||||||
|
@ -1686,10 +1728,9 @@ tags TAGS cscope gtags: FORCE
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
PHONY += nsdeps
|
PHONY += nsdeps
|
||||||
|
nsdeps: export KBUILD_NSDEPS=1
|
||||||
nsdeps: modules
|
nsdeps: modules
|
||||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost nsdeps
|
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/nsdeps
|
||||||
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/$@
|
|
||||||
|
|
||||||
# Scripts to check various things for consistency
|
# Scripts to check various things for consistency
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
@ -1753,50 +1794,6 @@ tools/%: FORCE
|
||||||
$(Q)mkdir -p $(objtree)/tools
|
$(Q)mkdir -p $(objtree)/tools
|
||||||
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
|
$(Q)$(MAKE) LDFLAGS= MAKEFLAGS="$(tools_silent) $(filter --j% -j,$(MAKEFLAGS))" O=$(abspath $(objtree)) subdir=tools -C $(srctree)/tools/ $*
|
||||||
|
|
||||||
# Single targets
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# To build individual files in subdirectories, you can do like this:
|
|
||||||
#
|
|
||||||
# make foo/bar/baz.s
|
|
||||||
#
|
|
||||||
# The supported suffixes for single-target are listed in 'single-targets'
|
|
||||||
#
|
|
||||||
# To build only under specific subdirectories, you can do like this:
|
|
||||||
#
|
|
||||||
# make foo/bar/baz/
|
|
||||||
|
|
||||||
ifdef single-build
|
|
||||||
|
|
||||||
single-all := $(filter $(single-targets), $(MAKECMDGOALS))
|
|
||||||
|
|
||||||
# .ko is special because modpost is needed
|
|
||||||
single-ko := $(sort $(filter %.ko, $(single-all)))
|
|
||||||
single-no-ko := $(sort $(patsubst %.ko,%.mod, $(single-all)))
|
|
||||||
|
|
||||||
$(single-ko): single_modpost
|
|
||||||
@:
|
|
||||||
$(single-no-ko): descend
|
|
||||||
@:
|
|
||||||
|
|
||||||
ifeq ($(KBUILD_EXTMOD),)
|
|
||||||
# For the single build of in-tree modules, use a temporary file to avoid
|
|
||||||
# the situation of modules_install installing an invalid modules.order.
|
|
||||||
MODORDER := .modules.tmp
|
|
||||||
endif
|
|
||||||
|
|
||||||
PHONY += single_modpost
|
|
||||||
single_modpost: $(single-no-ko)
|
|
||||||
$(Q){ $(foreach m, $(single-ko), echo $(extmod-prefix)$m;) } > $(MODORDER)
|
|
||||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
|
|
||||||
|
|
||||||
KBUILD_MODULES := 1
|
|
||||||
|
|
||||||
export KBUILD_SINGLE_TARGETS := $(addprefix $(extmod-prefix), $(single-no-ko))
|
|
||||||
|
|
||||||
single-build = $(if $(filter-out $@/, $(single-no-ko)),1)
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
# FIXME Should go into a make.lib or something
|
# FIXME Should go into a make.lib or something
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License version 2 and
|
|
||||||
* only version 2 as published by the Free Software Foundation.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
* 02110-1301, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __ASM_HEXAGON_BITSPERLONG_H
|
|
||||||
#define __ASM_HEXAGON_BITSPERLONG_H
|
|
||||||
|
|
||||||
#define __BITS_PER_LONG 32
|
|
||||||
|
|
||||||
#include <asm-generic/bitsperlong.h>
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
||||||
#include <asm-generic/errno.h>
|
|
|
@ -1,2 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
||||||
#include <asm-generic/ioctl.h>
|
|
|
@ -1,7 +0,0 @@
|
||||||
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
|
|
||||||
#ifndef _ASM_IA64_IOCTLS_H
|
|
||||||
#define _ASM_IA64_IOCTLS_H
|
|
||||||
|
|
||||||
#include <asm-generic/ioctls.h>
|
|
||||||
|
|
||||||
#endif /* _ASM_IA64_IOCTLS_H */
|
|
|
@ -7,7 +7,6 @@ config DRM_I915_WERROR
|
||||||
# We use the dependency on !COMPILE_TEST to not be enabled in
|
# We use the dependency on !COMPILE_TEST to not be enabled in
|
||||||
# allmodconfig or allyesconfig configurations
|
# allmodconfig or allyesconfig configurations
|
||||||
depends on !COMPILE_TEST
|
depends on !COMPILE_TEST
|
||||||
select HEADER_TEST
|
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
Add -Werror to the build flags for (and only for) i915.ko.
|
Add -Werror to the build flags for (and only for) i915.ko.
|
||||||
|
|
|
@ -5,3 +5,4 @@
|
||||||
*_vga16.c
|
*_vga16.c
|
||||||
*_clut224.c
|
*_clut224.c
|
||||||
*_gray256.c
|
*_gray256.c
|
||||||
|
pnmtologo
|
||||||
|
|
|
@ -18,24 +18,19 @@ obj-$(CONFIG_SPU_BASE) += logo_spe_clut224.o
|
||||||
|
|
||||||
# How to generate logo's
|
# How to generate logo's
|
||||||
|
|
||||||
pnmtologo := scripts/pnmtologo
|
hostprogs-y := pnmtologo
|
||||||
|
|
||||||
# Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..."
|
# Create commands like "pnmtologo -t mono -n logo_mac_mono -o ..."
|
||||||
quiet_cmd_logo = LOGO $@
|
quiet_cmd_logo = LOGO $@
|
||||||
cmd_logo = $(pnmtologo) \
|
cmd_logo = $(obj)/pnmtologo -t $(lastword $(subst _, ,$*)) -n $* -o $@ $<
|
||||||
-t $(patsubst $*_%,%,$(notdir $(basename $<))) \
|
|
||||||
-n $(notdir $(basename $<)) -o $@ $<
|
|
||||||
|
|
||||||
$(obj)/%_mono.c: $(src)/%_mono.pbm $(pnmtologo) FORCE
|
$(obj)/%.c: $(src)/%.pbm $(obj)/pnmtologo FORCE
|
||||||
$(call if_changed,logo)
|
$(call if_changed,logo)
|
||||||
|
|
||||||
$(obj)/%_vga16.c: $(src)/%_vga16.ppm $(pnmtologo) FORCE
|
$(obj)/%.c: $(src)/%.ppm $(obj)/pnmtologo FORCE
|
||||||
$(call if_changed,logo)
|
$(call if_changed,logo)
|
||||||
|
|
||||||
$(obj)/%_clut224.c: $(src)/%_clut224.ppm $(pnmtologo) FORCE
|
$(obj)/%.c: $(src)/%.pgm $(obj)/pnmtologo FORCE
|
||||||
$(call if_changed,logo)
|
|
||||||
|
|
||||||
$(obj)/%_gray256.c: $(src)/%_gray256.pgm $(pnmtologo) FORCE
|
|
||||||
$(call if_changed,logo)
|
$(call if_changed,logo)
|
||||||
|
|
||||||
# generated C files
|
# generated C files
|
||||||
|
|
1187
include/Kbuild
1187
include/Kbuild
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -31,7 +31,6 @@
|
||||||
*/
|
*/
|
||||||
.macro ___EXPORT_SYMBOL name,val,sec
|
.macro ___EXPORT_SYMBOL name,val,sec
|
||||||
#ifdef CONFIG_MODULES
|
#ifdef CONFIG_MODULES
|
||||||
.globl __ksymtab_\name
|
|
||||||
.section ___ksymtab\sec+\name,"a"
|
.section ___ksymtab\sec+\name,"a"
|
||||||
.balign KSYM_ALIGN
|
.balign KSYM_ALIGN
|
||||||
__ksymtab_\name:
|
__ksymtab_\name:
|
||||||
|
@ -44,7 +43,6 @@ __kstrtab_\name:
|
||||||
#ifdef CONFIG_MODVERSIONS
|
#ifdef CONFIG_MODVERSIONS
|
||||||
.section ___kcrctab\sec+\name,"a"
|
.section ___kcrctab\sec+\name,"a"
|
||||||
.balign KCRC_ALIGN
|
.balign KCRC_ALIGN
|
||||||
__kcrctab_\name:
|
|
||||||
#if defined(CONFIG_MODULE_REL_CRCS)
|
#if defined(CONFIG_MODULE_REL_CRCS)
|
||||||
.long __crc_\name - .
|
.long __crc_\name - .
|
||||||
#else
|
#else
|
||||||
|
|
22
init/Kconfig
22
init/Kconfig
|
@ -104,29 +104,9 @@ config COMPILE_TEST
|
||||||
here. If you are a user/distributor, say N here to exclude useless
|
here. If you are a user/distributor, say N here to exclude useless
|
||||||
drivers to be distributed.
|
drivers to be distributed.
|
||||||
|
|
||||||
config HEADER_TEST
|
|
||||||
bool "Compile test headers that should be standalone compilable"
|
|
||||||
help
|
|
||||||
Compile test headers listed in header-test-y target to ensure they are
|
|
||||||
self-contained, i.e. compilable as standalone units.
|
|
||||||
|
|
||||||
If you are a developer or tester and want to ensure the requested
|
|
||||||
headers are self-contained, say Y here. Otherwise, choose N.
|
|
||||||
|
|
||||||
config KERNEL_HEADER_TEST
|
|
||||||
bool "Compile test kernel headers"
|
|
||||||
depends on HEADER_TEST
|
|
||||||
help
|
|
||||||
Headers in include/ are used to build external moduls.
|
|
||||||
Compile test them to ensure they are self-contained, i.e.
|
|
||||||
compilable as standalone units.
|
|
||||||
|
|
||||||
If you are a developer or tester and want to ensure the headers
|
|
||||||
in include/ are self-contained, say Y here. Otherwise, choose N.
|
|
||||||
|
|
||||||
config UAPI_HEADER_TEST
|
config UAPI_HEADER_TEST
|
||||||
bool "Compile test UAPI headers"
|
bool "Compile test UAPI headers"
|
||||||
depends on HEADER_TEST && HEADERS_INSTALL && CC_CAN_LINK
|
depends on HEADERS_INSTALL && CC_CAN_LINK
|
||||||
help
|
help
|
||||||
Compile test headers exported to user-space to ensure they are
|
Compile test headers exported to user-space to ensure they are
|
||||||
self-contained, i.e. compilable as standalone units.
|
self-contained, i.e. compilable as standalone units.
|
||||||
|
|
|
@ -130,7 +130,7 @@ $(obj)/config_data.gz: $(KCONFIG_CONFIG) FORCE
|
||||||
$(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz
|
$(obj)/kheaders.o: $(obj)/kheaders_data.tar.xz
|
||||||
|
|
||||||
quiet_cmd_genikh = CHK $(obj)/kheaders_data.tar.xz
|
quiet_cmd_genikh = CHK $(obj)/kheaders_data.tar.xz
|
||||||
cmd_genikh = $(BASH) $(srctree)/kernel/gen_kheaders.sh $@
|
cmd_genikh = $(CONFIG_SHELL) $(srctree)/kernel/gen_kheaders.sh $@
|
||||||
$(obj)/kheaders_data.tar.xz: FORCE
|
$(obj)/kheaders_data.tar.xz: FORCE
|
||||||
$(call cmd,genikh)
|
$(call cmd,genikh)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
# This script generates an archive consisting of kernel headers
|
# This script generates an archive consisting of kernel headers
|
||||||
|
@ -21,30 +21,38 @@ arch/$SRCARCH/include/
|
||||||
# Uncomment it for debugging.
|
# Uncomment it for debugging.
|
||||||
# if [ ! -f /tmp/iter ]; then iter=1; echo 1 > /tmp/iter;
|
# if [ ! -f /tmp/iter ]; then iter=1; echo 1 > /tmp/iter;
|
||||||
# else iter=$(($(cat /tmp/iter) + 1)); echo $iter > /tmp/iter; fi
|
# else iter=$(($(cat /tmp/iter) + 1)); echo $iter > /tmp/iter; fi
|
||||||
# find $src_file_list -name "*.h" | xargs ls -l > /tmp/src-ls-$iter
|
# find $all_dirs -name "*.h" | xargs ls -l > /tmp/ls-$iter
|
||||||
# find $obj_file_list -name "*.h" | xargs ls -l > /tmp/obj-ls-$iter
|
|
||||||
|
all_dirs=
|
||||||
|
if [ "$building_out_of_srctree" ]; then
|
||||||
|
for d in $dir_list; do
|
||||||
|
all_dirs="$all_dirs $srctree/$d"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
all_dirs="$all_dirs $dir_list"
|
||||||
|
|
||||||
# include/generated/compile.h is ignored because it is touched even when none
|
# include/generated/compile.h is ignored because it is touched even when none
|
||||||
# of the source files changed. This causes pointless regeneration, so let us
|
# of the source files changed.
|
||||||
# ignore them for md5 calculation.
|
#
|
||||||
pushd $srctree > /dev/null
|
# When Kconfig regenerates include/generated/autoconf.h, its timestamp is
|
||||||
src_files_md5="$(find $dir_list -name "*.h" |
|
# updated, but the contents might be still the same. When any CONFIG option is
|
||||||
grep -v "include/generated/compile.h" |
|
# changed, Kconfig touches the corresponding timestamp file include/config/*.h.
|
||||||
grep -v "include/generated/autoconf.h" |
|
# Hence, the md5sum detects the configuration change anyway. We do not need to
|
||||||
xargs ls -l | md5sum | cut -d ' ' -f1)"
|
# check include/generated/autoconf.h explicitly.
|
||||||
popd > /dev/null
|
#
|
||||||
obj_files_md5="$(find $dir_list -name "*.h" |
|
# Ignore them for md5 calculation to avoid pointless regeneration.
|
||||||
grep -v "include/generated/compile.h" |
|
headers_md5="$(find $all_dirs -name "*.h" |
|
||||||
grep -v "include/generated/autoconf.h" |
|
grep -v "include/generated/compile.h" |
|
||||||
|
grep -v "include/generated/autoconf.h" |
|
||||||
xargs ls -l | md5sum | cut -d ' ' -f1)"
|
xargs ls -l | md5sum | cut -d ' ' -f1)"
|
||||||
|
|
||||||
# Any changes to this script will also cause a rebuild of the archive.
|
# Any changes to this script will also cause a rebuild of the archive.
|
||||||
this_file_md5="$(ls -l $sfile | md5sum | cut -d ' ' -f1)"
|
this_file_md5="$(ls -l $sfile | md5sum | cut -d ' ' -f1)"
|
||||||
if [ -f $tarfile ]; then tarfile_md5="$(md5sum $tarfile | cut -d ' ' -f1)"; fi
|
if [ -f $tarfile ]; then tarfile_md5="$(md5sum $tarfile | cut -d ' ' -f1)"; fi
|
||||||
if [ -f kernel/kheaders.md5 ] &&
|
if [ -f kernel/kheaders.md5 ] &&
|
||||||
[ "$(cat kernel/kheaders.md5|head -1)" == "$src_files_md5" ] &&
|
[ "$(head -n 1 kernel/kheaders.md5)" = "$headers_md5" ] &&
|
||||||
[ "$(cat kernel/kheaders.md5|head -2|tail -1)" == "$obj_files_md5" ] &&
|
[ "$(head -n 2 kernel/kheaders.md5 | tail -n 1)" = "$this_file_md5" ] &&
|
||||||
[ "$(cat kernel/kheaders.md5|head -3|tail -1)" == "$this_file_md5" ] &&
|
[ "$(tail -n 1 kernel/kheaders.md5)" = "$tarfile_md5" ]; then
|
||||||
[ "$(cat kernel/kheaders.md5|tail -1)" == "$tarfile_md5" ]; then
|
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -55,14 +63,17 @@ fi
|
||||||
rm -rf $cpio_dir
|
rm -rf $cpio_dir
|
||||||
mkdir $cpio_dir
|
mkdir $cpio_dir
|
||||||
|
|
||||||
pushd $srctree > /dev/null
|
if [ "$building_out_of_srctree" ]; then
|
||||||
for f in $dir_list;
|
(
|
||||||
do find "$f" -name "*.h";
|
cd $srctree
|
||||||
done | cpio --quiet -pd $cpio_dir
|
for f in $dir_list
|
||||||
popd > /dev/null
|
do find "$f" -name "*.h";
|
||||||
|
done | cpio --quiet -pd $cpio_dir
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
|
||||||
# The second CPIO can complain if files already exist which can
|
# The second CPIO can complain if files already exist which can happen with out
|
||||||
# happen with out of tree builds. Just silence CPIO for now.
|
# of tree builds having stale headers in srctree. Just silence CPIO for now.
|
||||||
for f in $dir_list;
|
for f in $dir_list;
|
||||||
do find "$f" -name "*.h";
|
do find "$f" -name "*.h";
|
||||||
done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1
|
done | cpio --quiet -pd $cpio_dir >/dev/null 2>&1
|
||||||
|
@ -79,8 +90,7 @@ find $cpio_dir -printf "./%P\n" | LC_ALL=C sort | \
|
||||||
--owner=0 --group=0 --numeric-owner --no-recursion \
|
--owner=0 --group=0 --numeric-owner --no-recursion \
|
||||||
-Jcf $tarfile -C $cpio_dir/ -T - > /dev/null
|
-Jcf $tarfile -C $cpio_dir/ -T - > /dev/null
|
||||||
|
|
||||||
echo "$src_files_md5" > kernel/kheaders.md5
|
echo $headers_md5 > kernel/kheaders.md5
|
||||||
echo "$obj_files_md5" >> kernel/kheaders.md5
|
|
||||||
echo "$this_file_md5" >> kernel/kheaders.md5
|
echo "$this_file_md5" >> kernel/kheaders.md5
|
||||||
echo "$(md5sum $tarfile | cut -d ' ' -f1)" >> kernel/kheaders.md5
|
echo "$(md5sum $tarfile | cut -d ' ' -f1)" >> kernel/kheaders.md5
|
||||||
|
|
||||||
|
|
|
@ -308,17 +308,6 @@ config HEADERS_INSTALL
|
||||||
user-space program samples. It is also needed by some features such
|
user-space program samples. It is also needed by some features such
|
||||||
as uapi header sanity checks.
|
as uapi header sanity checks.
|
||||||
|
|
||||||
config HEADERS_CHECK
|
|
||||||
bool "Run sanity checks on uapi headers when building 'all'"
|
|
||||||
depends on HEADERS_INSTALL
|
|
||||||
help
|
|
||||||
This option will run basic sanity checks on uapi headers when
|
|
||||||
building the 'all' target, for example, ensure that they do not
|
|
||||||
attempt to include files which were not exported, etc.
|
|
||||||
|
|
||||||
If you're making modifications to header files which are
|
|
||||||
relevant for userspace, say 'Y'.
|
|
||||||
|
|
||||||
config OPTIMIZE_INLINING
|
config OPTIMIZE_INLINING
|
||||||
def_bool y
|
def_bool y
|
||||||
help
|
help
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
bin2c
|
bin2c
|
||||||
conmakehash
|
conmakehash
|
||||||
kallsyms
|
kallsyms
|
||||||
pnmtologo
|
|
||||||
unifdef
|
unifdef
|
||||||
recordmcount
|
recordmcount
|
||||||
sortextable
|
sortextable
|
||||||
|
|
|
@ -210,17 +210,20 @@ endif
|
||||||
# (needed for the shell)
|
# (needed for the shell)
|
||||||
make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))))
|
make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1)))))
|
||||||
|
|
||||||
# Find any prerequisites that is newer than target or that does not exist.
|
# Find any prerequisites that are newer than target or that do not exist.
|
||||||
|
# (This is not true for now; $? should contain any non-existent prerequisites,
|
||||||
|
# but it does not work as expected when .SECONDARY is present. This seems a bug
|
||||||
|
# of GNU Make.)
|
||||||
# PHONY targets skipped in both cases.
|
# PHONY targets skipped in both cases.
|
||||||
any-prereq = $(filter-out $(PHONY),$?)$(filter-out $(PHONY) $(wildcard $^),$^)
|
newer-prereqs = $(filter-out $(PHONY),$?)
|
||||||
|
|
||||||
# Execute command if command has changed or prerequisite(s) are updated.
|
# Execute command if command has changed or prerequisite(s) are updated.
|
||||||
if_changed = $(if $(any-prereq)$(cmd-check), \
|
if_changed = $(if $(newer-prereqs)$(cmd-check), \
|
||||||
$(cmd); \
|
$(cmd); \
|
||||||
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
|
printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:)
|
||||||
|
|
||||||
# Execute the command and also postprocess generated .d dependencies file.
|
# Execute the command and also postprocess generated .d dependencies file.
|
||||||
if_changed_dep = $(if $(any-prereq)$(cmd-check),$(cmd_and_fixdep),@:)
|
if_changed_dep = $(if $(newer-prereqs)$(cmd-check),$(cmd_and_fixdep),@:)
|
||||||
|
|
||||||
cmd_and_fixdep = \
|
cmd_and_fixdep = \
|
||||||
$(cmd); \
|
$(cmd); \
|
||||||
|
@ -230,7 +233,7 @@ cmd_and_fixdep = \
|
||||||
# Usage: $(call if_changed_rule,foo)
|
# Usage: $(call if_changed_rule,foo)
|
||||||
# Will check if $(cmd_foo) or any of the prerequisites changed,
|
# Will check if $(cmd_foo) or any of the prerequisites changed,
|
||||||
# and if so will execute $(rule_foo).
|
# and if so will execute $(rule_foo).
|
||||||
if_changed_rule = $(if $(any-prereq)$(cmd-check),$(rule_$(1)),@:)
|
if_changed_rule = $(if $(newer-prereqs)$(cmd-check),$(rule_$(1)),@:)
|
||||||
|
|
||||||
###
|
###
|
||||||
# why - tell why a target got built
|
# why - tell why a target got built
|
||||||
|
@ -255,7 +258,7 @@ ifeq ($(KBUILD_VERBOSE),2)
|
||||||
why = \
|
why = \
|
||||||
$(if $(filter $@, $(PHONY)),- due to target is PHONY, \
|
$(if $(filter $@, $(PHONY)),- due to target is PHONY, \
|
||||||
$(if $(wildcard $@), \
|
$(if $(wildcard $@), \
|
||||||
$(if $(any-prereq),- due to: $(any-prereq), \
|
$(if $(newer-prereqs),- due to: $(newer-prereqs), \
|
||||||
$(if $(cmd-check), \
|
$(if $(cmd-check), \
|
||||||
$(if $(cmd_$@),- due to command line change, \
|
$(if $(cmd_$@),- due to command line change, \
|
||||||
$(if $(filter $@, $(targets)), \
|
$(if $(filter $@, $(targets)), \
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
# the kernel for the build process.
|
# the kernel for the build process.
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# kallsyms: Find all symbols in vmlinux
|
# kallsyms: Find all symbols in vmlinux
|
||||||
# pnmttologo: Convert pnm files to logo files
|
|
||||||
# conmakehash: Create chartable
|
# conmakehash: Create chartable
|
||||||
# conmakehash: Create arrays for initializing the kernel console tables
|
# conmakehash: Create arrays for initializing the kernel console tables
|
||||||
|
|
||||||
|
@ -12,7 +11,6 @@ HOST_EXTRACFLAGS += -I$(srctree)/tools/include
|
||||||
|
|
||||||
hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c
|
hostprogs-$(CONFIG_BUILD_BIN2C) += bin2c
|
||||||
hostprogs-$(CONFIG_KALLSYMS) += kallsyms
|
hostprogs-$(CONFIG_KALLSYMS) += kallsyms
|
||||||
hostprogs-$(CONFIG_LOGO) += pnmtologo
|
|
||||||
hostprogs-$(CONFIG_VT) += conmakehash
|
hostprogs-$(CONFIG_VT) += conmakehash
|
||||||
hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount
|
hostprogs-$(BUILD_C_RECORDMCOUNT) += recordmcount
|
||||||
hostprogs-$(CONFIG_BUILDTIME_EXTABLE_SORT) += sortextable
|
hostprogs-$(CONFIG_BUILDTIME_EXTABLE_SORT) += sortextable
|
||||||
|
|
|
@ -283,15 +283,6 @@ quiet_cmd_cc_lst_c = MKLST $@
|
||||||
$(obj)/%.lst: $(src)/%.c FORCE
|
$(obj)/%.lst: $(src)/%.c FORCE
|
||||||
$(call if_changed_dep,cc_lst_c)
|
$(call if_changed_dep,cc_lst_c)
|
||||||
|
|
||||||
# header test (header-test-y, header-test-m target)
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
quiet_cmd_cc_s_h = CC $@
|
|
||||||
cmd_cc_s_h = $(CC) $(c_flags) -S -o $@ -x c /dev/null -include $<
|
|
||||||
|
|
||||||
$(obj)/%.h.s: $(src)/%.h FORCE
|
|
||||||
$(call if_changed_dep,cc_s_h)
|
|
||||||
|
|
||||||
# Compile assembler sources (.S)
|
# Compile assembler sources (.S)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -469,17 +460,20 @@ targets += $(call intermediate_targets, .asn1.o, .asn1.c .asn1.h) \
|
||||||
|
|
||||||
ifdef single-build
|
ifdef single-build
|
||||||
|
|
||||||
|
KBUILD_SINGLE_TARGETS := $(filter $(obj)/%, $(KBUILD_SINGLE_TARGETS))
|
||||||
|
|
||||||
curdir-single := $(sort $(foreach x, $(KBUILD_SINGLE_TARGETS), \
|
curdir-single := $(sort $(foreach x, $(KBUILD_SINGLE_TARGETS), \
|
||||||
$(if $(filter $(x) $(basename $(x)).o, $(targets)), $(x))))
|
$(if $(filter $(x) $(basename $(x)).o, $(targets)), $(x))))
|
||||||
|
|
||||||
# Handle single targets without any rule: show "Nothing to be done for ..." or
|
# Handle single targets without any rule: show "Nothing to be done for ..." or
|
||||||
# "No rule to make target ..." depending on whether the target exists.
|
# "No rule to make target ..." depending on whether the target exists.
|
||||||
unknown-single := $(filter-out $(addsuffix /%, $(subdir-ym)), \
|
unknown-single := $(filter-out $(addsuffix /%, $(subdir-ym)), \
|
||||||
$(filter $(obj)/%, \
|
$(filter-out $(curdir-single), $(KBUILD_SINGLE_TARGETS)))
|
||||||
$(filter-out $(curdir-single), \
|
|
||||||
$(KBUILD_SINGLE_TARGETS))))
|
|
||||||
|
|
||||||
__build: $(curdir-single) $(subdir-ym)
|
single-subdirs := $(foreach d, $(subdir-ym), \
|
||||||
|
$(if $(filter $(d)/%, $(KBUILD_SINGLE_TARGETS)), $(d)))
|
||||||
|
|
||||||
|
__build: $(curdir-single) $(single-subdirs)
|
||||||
ifneq ($(unknown-single),)
|
ifneq ($(unknown-single),)
|
||||||
$(Q)$(MAKE) -f /dev/null $(unknown-single)
|
$(Q)$(MAKE) -f /dev/null $(unknown-single)
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -56,9 +56,6 @@ new-dirs := $(filter-out $(existing-dirs), $(wanted-dirs))
|
||||||
$(if $(new-dirs), $(shell mkdir -p $(new-dirs)))
|
$(if $(new-dirs), $(shell mkdir -p $(new-dirs)))
|
||||||
|
|
||||||
# Rules
|
# Rules
|
||||||
|
|
||||||
ifndef HDRCHECK
|
|
||||||
|
|
||||||
quiet_cmd_install = HDRINST $@
|
quiet_cmd_install = HDRINST $@
|
||||||
cmd_install = $(CONFIG_SHELL) $(srctree)/scripts/headers_install.sh $< $@
|
cmd_install = $(CONFIG_SHELL) $(srctree)/scripts/headers_install.sh $< $@
|
||||||
|
|
||||||
|
@ -81,21 +78,6 @@ existing-headers := $(filter $(old-headers), $(all-headers))
|
||||||
|
|
||||||
-include $(foreach f,$(existing-headers),$(dir $(f)).$(notdir $(f)).cmd)
|
-include $(foreach f,$(existing-headers),$(dir $(f)).$(notdir $(f)).cmd)
|
||||||
|
|
||||||
else
|
|
||||||
|
|
||||||
quiet_cmd_check = HDRCHK $<
|
|
||||||
cmd_check = $(PERL) $(srctree)/scripts/headers_check.pl $(dst) $(SRCARCH) $<; touch $@
|
|
||||||
|
|
||||||
check-files := $(addsuffix .chk, $(all-headers))
|
|
||||||
|
|
||||||
$(check-files): $(dst)/%.chk : $(dst)/% $(srctree)/scripts/headers_check.pl
|
|
||||||
$(call cmd,check)
|
|
||||||
|
|
||||||
__headers: $(check-files)
|
|
||||||
@:
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
PHONY += FORCE
|
PHONY += FORCE
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
|
|
|
@ -65,20 +65,6 @@ extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
|
||||||
extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
|
extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Test self-contained headers
|
|
||||||
|
|
||||||
# Wildcard searches in $(srctree)/$(src)/, but not in $(objtree)/$(obj)/.
|
|
||||||
# Stale generated headers are often left over, so pattern matching should
|
|
||||||
# be avoided. Please notice $(srctree)/$(src)/ and $(objtree)/$(obj) point
|
|
||||||
# to the same location for in-tree building. So, header-test-pattern-y should
|
|
||||||
# be used with care.
|
|
||||||
header-test-y += $(filter-out $(header-test-), \
|
|
||||||
$(patsubst $(srctree)/$(src)/%, %, \
|
|
||||||
$(wildcard $(addprefix $(srctree)/$(src)/, \
|
|
||||||
$(header-test-pattern-y)))))
|
|
||||||
|
|
||||||
extra-$(CONFIG_HEADER_TEST) += $(addsuffix .s, $(header-test-y) $(header-test-m))
|
|
||||||
|
|
||||||
# Add subdir path
|
# Add subdir path
|
||||||
|
|
||||||
extra-y := $(addprefix $(obj)/,$(extra-y))
|
extra-y := $(addprefix $(obj)/,$(extra-y))
|
||||||
|
|
|
@ -50,12 +50,10 @@ MODPOST = scripts/mod/modpost \
|
||||||
$(if $(CONFIG_MODVERSIONS),-m) \
|
$(if $(CONFIG_MODVERSIONS),-m) \
|
||||||
$(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \
|
$(if $(CONFIG_MODULE_SRCVERSION_ALL),-a) \
|
||||||
$(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
|
$(if $(KBUILD_EXTMOD),-i,-o) $(kernelsymfile) \
|
||||||
$(if $(KBUILD_EXTMOD),-I $(modulesymfile)) \
|
|
||||||
$(if $(KBUILD_EXTMOD),$(addprefix -e ,$(KBUILD_EXTRA_SYMBOLS))) \
|
$(if $(KBUILD_EXTMOD),$(addprefix -e ,$(KBUILD_EXTRA_SYMBOLS))) \
|
||||||
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
|
$(if $(KBUILD_EXTMOD),-o $(modulesymfile)) \
|
||||||
$(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
|
$(if $(CONFIG_SECTION_MISMATCH_WARN_ONLY),,-E) \
|
||||||
$(if $(KBUILD_MODPOST_WARN),-w) \
|
$(if $(KBUILD_MODPOST_WARN),-w)
|
||||||
$(if $(filter nsdeps,$(MAKECMDGOALS)),-d)
|
|
||||||
|
|
||||||
ifdef MODPOST_VMLINUX
|
ifdef MODPOST_VMLINUX
|
||||||
|
|
||||||
|
@ -67,10 +65,14 @@ __modpost:
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
# When building external modules load the Kbuild file to retrieve EXTRA_SYMBOLS info
|
MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T - \
|
||||||
ifneq ($(KBUILD_EXTMOD),)
|
$(if $(KBUILD_NSDEPS),-d $(MODULES_NSDEPS))
|
||||||
|
|
||||||
# set src + obj - they may be used when building the .mod.c file
|
ifeq ($(KBUILD_EXTMOD),)
|
||||||
|
MODPOST += $(wildcard vmlinux)
|
||||||
|
else
|
||||||
|
|
||||||
|
# set src + obj - they may be used in the modules's Makefile
|
||||||
obj := $(KBUILD_EXTMOD)
|
obj := $(KBUILD_EXTMOD)
|
||||||
src := $(obj)
|
src := $(obj)
|
||||||
|
|
||||||
|
@ -79,8 +81,6 @@ include $(if $(wildcard $(KBUILD_EXTMOD)/Kbuild), \
|
||||||
$(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile)
|
$(KBUILD_EXTMOD)/Kbuild, $(KBUILD_EXTMOD)/Makefile)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T - $(wildcard vmlinux)
|
|
||||||
|
|
||||||
# find all modules listed in modules.order
|
# find all modules listed in modules.order
|
||||||
modules := $(sort $(shell cat $(MODORDER)))
|
modules := $(sort $(shell cat $(MODORDER)))
|
||||||
|
|
||||||
|
@ -96,8 +96,6 @@ ifneq ($(KBUILD_MODPOST_NOFINAL),1)
|
||||||
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
|
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modfinal
|
||||||
endif
|
endif
|
||||||
|
|
||||||
nsdeps: __modpost
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: $(PHONY)
|
.PHONY: $(PHONY)
|
||||||
|
|
|
@ -103,7 +103,7 @@ snap-pkg:
|
||||||
|
|
||||||
# tarball targets
|
# tarball targets
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
tar-pkgs := tar-pkg targz-pkg tarbz2-pkg tarxz-pkg
|
tar-pkgs := dir-pkg tar-pkg targz-pkg tarbz2-pkg tarxz-pkg
|
||||||
PHONY += $(tar-pkgs)
|
PHONY += $(tar-pkgs)
|
||||||
$(tar-pkgs):
|
$(tar-pkgs):
|
||||||
$(MAKE) -f $(srctree)/Makefile
|
$(MAKE) -f $(srctree)/Makefile
|
||||||
|
@ -146,7 +146,9 @@ help:
|
||||||
@echo ' binrpm-pkg - Build only the binary kernel RPM package'
|
@echo ' binrpm-pkg - Build only the binary kernel RPM package'
|
||||||
@echo ' deb-pkg - Build both source and binary deb kernel packages'
|
@echo ' deb-pkg - Build both source and binary deb kernel packages'
|
||||||
@echo ' bindeb-pkg - Build only the binary kernel deb package'
|
@echo ' bindeb-pkg - Build only the binary kernel deb package'
|
||||||
@echo ' snap-pkg - Build only the binary kernel snap package (will connect to external hosts)'
|
@echo ' snap-pkg - Build only the binary kernel snap package'
|
||||||
|
@echo ' (will connect to external hosts)'
|
||||||
|
@echo ' dir-pkg - Build the kernel as a plain directory structure'
|
||||||
@echo ' tar-pkg - Build the kernel as an uncompressed tarball'
|
@echo ' tar-pkg - Build the kernel as an uncompressed tarball'
|
||||||
@echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
|
@echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
|
||||||
@echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
|
@echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'
|
||||||
|
|
|
@ -18,15 +18,14 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
#ifndef ARRAY_SIZE
|
|
||||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
|
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
|
||||||
#endif
|
|
||||||
|
|
||||||
#define KSYM_NAME_LEN 128
|
#define KSYM_NAME_LEN 128
|
||||||
|
|
||||||
|
@ -58,9 +57,9 @@ static struct addr_range percpu_range = {
|
||||||
|
|
||||||
static struct sym_entry *table;
|
static struct sym_entry *table;
|
||||||
static unsigned int table_size, table_cnt;
|
static unsigned int table_size, table_cnt;
|
||||||
static int all_symbols = 0;
|
static int all_symbols;
|
||||||
static int absolute_percpu = 0;
|
static int absolute_percpu;
|
||||||
static int base_relative = 0;
|
static int base_relative;
|
||||||
|
|
||||||
static int token_profit[0x10000];
|
static int token_profit[0x10000];
|
||||||
|
|
||||||
|
@ -76,18 +75,88 @@ static void usage(void)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static char *sym_name(const struct sym_entry *s)
|
||||||
* This ignores the intensely annoying "mapping symbols" found
|
|
||||||
* in ARM ELF files: $a, $t and $d.
|
|
||||||
*/
|
|
||||||
static int is_arm_mapping_symbol(const char *str)
|
|
||||||
{
|
{
|
||||||
return str[0] == '$' && strchr("axtd", str[1])
|
return (char *)s->sym + 1;
|
||||||
&& (str[2] == '\0' || str[2] == '.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_symbol_range(const char *sym, unsigned long long addr,
|
static bool is_ignored_symbol(const char *name, char type)
|
||||||
struct addr_range *ranges, int entries)
|
{
|
||||||
|
static const char * const ignored_symbols[] = {
|
||||||
|
/*
|
||||||
|
* Symbols which vary between passes. Passes 1 and 2 must have
|
||||||
|
* identical symbol lists. The kallsyms_* symbols below are
|
||||||
|
* only added after pass 1, they would be included in pass 2
|
||||||
|
* when --all-symbols is specified so exclude them to get a
|
||||||
|
* stable symbol list.
|
||||||
|
*/
|
||||||
|
"kallsyms_addresses",
|
||||||
|
"kallsyms_offsets",
|
||||||
|
"kallsyms_relative_base",
|
||||||
|
"kallsyms_num_syms",
|
||||||
|
"kallsyms_names",
|
||||||
|
"kallsyms_markers",
|
||||||
|
"kallsyms_token_table",
|
||||||
|
"kallsyms_token_index",
|
||||||
|
/* Exclude linker generated symbols which vary between passes */
|
||||||
|
"_SDA_BASE_", /* ppc */
|
||||||
|
"_SDA2_BASE_", /* ppc */
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char * const ignored_prefixes[] = {
|
||||||
|
"$", /* local symbols for ARM, MIPS, etc. */
|
||||||
|
".LASANPC", /* s390 kasan local symbols */
|
||||||
|
"__crc_", /* modversions */
|
||||||
|
"__efistub_", /* arm64 EFI stub namespace */
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char * const ignored_suffixes[] = {
|
||||||
|
"_from_arm", /* arm */
|
||||||
|
"_from_thumb", /* arm */
|
||||||
|
"_veneer", /* arm */
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
const char * const *p;
|
||||||
|
|
||||||
|
/* Exclude symbols which vary between passes. */
|
||||||
|
for (p = ignored_symbols; *p; p++)
|
||||||
|
if (!strcmp(name, *p))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
for (p = ignored_prefixes; *p; p++)
|
||||||
|
if (!strncmp(name, *p, strlen(*p)))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
for (p = ignored_suffixes; *p; p++) {
|
||||||
|
int l = strlen(name) - strlen(*p);
|
||||||
|
|
||||||
|
if (l >= 0 && !strcmp(name + l, *p))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == 'U' || type == 'u')
|
||||||
|
return true;
|
||||||
|
/* exclude debugging symbols */
|
||||||
|
if (type == 'N' || type == 'n')
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (toupper(type) == 'A') {
|
||||||
|
/* Keep these useful absolute symbols */
|
||||||
|
if (strcmp(name, "__kernel_syscall_via_break") &&
|
||||||
|
strcmp(name, "__kernel_syscall_via_epc") &&
|
||||||
|
strcmp(name, "__kernel_sigtramp") &&
|
||||||
|
strcmp(name, "__gp"))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void check_symbol_range(const char *sym, unsigned long long addr,
|
||||||
|
struct addr_range *ranges, int entries)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
struct addr_range *ar;
|
struct addr_range *ar;
|
||||||
|
@ -97,14 +166,12 @@ static int check_symbol_range(const char *sym, unsigned long long addr,
|
||||||
|
|
||||||
if (strcmp(sym, ar->start_sym) == 0) {
|
if (strcmp(sym, ar->start_sym) == 0) {
|
||||||
ar->start = addr;
|
ar->start = addr;
|
||||||
return 0;
|
return;
|
||||||
} else if (strcmp(sym, ar->end_sym) == 0) {
|
} else if (strcmp(sym, ar->end_sym) == 0) {
|
||||||
ar->end = addr;
|
ar->end = addr;
|
||||||
return 0;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int read_symbol(FILE *in, struct sym_entry *s)
|
static int read_symbol(FILE *in, struct sym_entry *s)
|
||||||
|
@ -125,34 +192,15 @@ static int read_symbol(FILE *in, struct sym_entry *s)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_ignored_symbol(sym, stype))
|
||||||
|
return -1;
|
||||||
|
|
||||||
/* Ignore most absolute/undefined (?) symbols. */
|
/* Ignore most absolute/undefined (?) symbols. */
|
||||||
if (strcmp(sym, "_text") == 0)
|
if (strcmp(sym, "_text") == 0)
|
||||||
_text = s->addr;
|
_text = s->addr;
|
||||||
else if (check_symbol_range(sym, s->addr, text_ranges,
|
|
||||||
ARRAY_SIZE(text_ranges)) == 0)
|
|
||||||
/* nothing to do */;
|
|
||||||
else if (toupper(stype) == 'A')
|
|
||||||
{
|
|
||||||
/* Keep these useful absolute symbols */
|
|
||||||
if (strcmp(sym, "__kernel_syscall_via_break") &&
|
|
||||||
strcmp(sym, "__kernel_syscall_via_epc") &&
|
|
||||||
strcmp(sym, "__kernel_sigtramp") &&
|
|
||||||
strcmp(sym, "__gp"))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
}
|
check_symbol_range(sym, s->addr, text_ranges, ARRAY_SIZE(text_ranges));
|
||||||
else if (toupper(stype) == 'U' ||
|
check_symbol_range(sym, s->addr, &percpu_range, 1);
|
||||||
is_arm_mapping_symbol(sym))
|
|
||||||
return -1;
|
|
||||||
/* exclude also MIPS ELF local symbols ($L123 instead of .L123) */
|
|
||||||
else if (sym[0] == '$')
|
|
||||||
return -1;
|
|
||||||
/* exclude debugging symbols */
|
|
||||||
else if (stype == 'N' || stype == 'n')
|
|
||||||
return -1;
|
|
||||||
/* exclude s390 kasan local symbols */
|
|
||||||
else if (!strncmp(sym, ".LASANPC", 8))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* include the type field in the symbol name, so that it gets
|
/* include the type field in the symbol name, so that it gets
|
||||||
* compressed together */
|
* compressed together */
|
||||||
|
@ -163,22 +211,19 @@ static int read_symbol(FILE *in, struct sym_entry *s)
|
||||||
"unable to allocate required amount of memory\n");
|
"unable to allocate required amount of memory\n");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
strcpy((char *)s->sym + 1, sym);
|
strcpy(sym_name(s), sym);
|
||||||
s->sym[0] = stype;
|
s->sym[0] = stype;
|
||||||
|
|
||||||
s->percpu_absolute = 0;
|
s->percpu_absolute = 0;
|
||||||
|
|
||||||
/* Record if we've found __per_cpu_start/end. */
|
|
||||||
check_symbol_range(sym, s->addr, &percpu_range, 1);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int symbol_in_range(struct sym_entry *s, struct addr_range *ranges,
|
static int symbol_in_range(const struct sym_entry *s,
|
||||||
int entries)
|
const struct addr_range *ranges, int entries)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
struct addr_range *ar;
|
const struct addr_range *ar;
|
||||||
|
|
||||||
for (i = 0; i < entries; ++i) {
|
for (i = 0; i < entries; ++i) {
|
||||||
ar = &ranges[i];
|
ar = &ranges[i];
|
||||||
|
@ -190,41 +235,9 @@ static int symbol_in_range(struct sym_entry *s, struct addr_range *ranges,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int symbol_valid(struct sym_entry *s)
|
static int symbol_valid(const struct sym_entry *s)
|
||||||
{
|
{
|
||||||
/* Symbols which vary between passes. Passes 1 and 2 must have
|
const char *name = sym_name(s);
|
||||||
* identical symbol lists. The kallsyms_* symbols below are only added
|
|
||||||
* after pass 1, they would be included in pass 2 when --all-symbols is
|
|
||||||
* specified so exclude them to get a stable symbol list.
|
|
||||||
*/
|
|
||||||
static char *special_symbols[] = {
|
|
||||||
"kallsyms_addresses",
|
|
||||||
"kallsyms_offsets",
|
|
||||||
"kallsyms_relative_base",
|
|
||||||
"kallsyms_num_syms",
|
|
||||||
"kallsyms_names",
|
|
||||||
"kallsyms_markers",
|
|
||||||
"kallsyms_token_table",
|
|
||||||
"kallsyms_token_index",
|
|
||||||
|
|
||||||
/* Exclude linker generated symbols which vary between passes */
|
|
||||||
"_SDA_BASE_", /* ppc */
|
|
||||||
"_SDA2_BASE_", /* ppc */
|
|
||||||
NULL };
|
|
||||||
|
|
||||||
static char *special_prefixes[] = {
|
|
||||||
"__crc_", /* modversions */
|
|
||||||
"__efistub_", /* arm64 EFI stub namespace */
|
|
||||||
NULL };
|
|
||||||
|
|
||||||
static char *special_suffixes[] = {
|
|
||||||
"_veneer", /* arm */
|
|
||||||
"_from_arm", /* arm */
|
|
||||||
"_from_thumb", /* arm */
|
|
||||||
NULL };
|
|
||||||
|
|
||||||
int i;
|
|
||||||
char *sym_name = (char *)s->sym + 1;
|
|
||||||
|
|
||||||
/* if --all-symbols is not specified, then symbols outside the text
|
/* if --all-symbols is not specified, then symbols outside the text
|
||||||
* and inittext sections are discarded */
|
* and inittext sections are discarded */
|
||||||
|
@ -239,37 +252,39 @@ static int symbol_valid(struct sym_entry *s)
|
||||||
* rules.
|
* rules.
|
||||||
*/
|
*/
|
||||||
if ((s->addr == text_range_text->end &&
|
if ((s->addr == text_range_text->end &&
|
||||||
strcmp(sym_name,
|
strcmp(name, text_range_text->end_sym)) ||
|
||||||
text_range_text->end_sym)) ||
|
|
||||||
(s->addr == text_range_inittext->end &&
|
(s->addr == text_range_inittext->end &&
|
||||||
strcmp(sym_name,
|
strcmp(name, text_range_inittext->end_sym)))
|
||||||
text_range_inittext->end_sym)))
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Exclude symbols which vary between passes. */
|
|
||||||
for (i = 0; special_symbols[i]; i++)
|
|
||||||
if (strcmp(sym_name, special_symbols[i]) == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for (i = 0; special_prefixes[i]; i++) {
|
|
||||||
int l = strlen(special_prefixes[i]);
|
|
||||||
|
|
||||||
if (l <= strlen(sym_name) &&
|
|
||||||
strncmp(sym_name, special_prefixes[i], l) == 0)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; special_suffixes[i]; i++) {
|
|
||||||
int l = strlen(sym_name) - strlen(special_suffixes[i]);
|
|
||||||
|
|
||||||
if (l >= 0 && strcmp(sym_name + l, special_suffixes[i]) == 0)
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* remove all the invalid symbols from the table */
|
||||||
|
static void shrink_table(void)
|
||||||
|
{
|
||||||
|
unsigned int i, pos;
|
||||||
|
|
||||||
|
pos = 0;
|
||||||
|
for (i = 0; i < table_cnt; i++) {
|
||||||
|
if (symbol_valid(&table[i])) {
|
||||||
|
if (pos != i)
|
||||||
|
table[pos] = table[i];
|
||||||
|
pos++;
|
||||||
|
} else {
|
||||||
|
free(table[i].sym);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
table_cnt = pos;
|
||||||
|
|
||||||
|
/* When valid symbol is not registered, exit to error */
|
||||||
|
if (!table_cnt) {
|
||||||
|
fprintf(stderr, "No valid symbol.\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void read_map(FILE *in)
|
static void read_map(FILE *in)
|
||||||
{
|
{
|
||||||
while (!feof(in)) {
|
while (!feof(in)) {
|
||||||
|
@ -288,7 +303,7 @@ static void read_map(FILE *in)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void output_label(char *label)
|
static void output_label(const char *label)
|
||||||
{
|
{
|
||||||
printf(".globl %s\n", label);
|
printf(".globl %s\n", label);
|
||||||
printf("\tALGN\n");
|
printf("\tALGN\n");
|
||||||
|
@ -297,7 +312,7 @@ static void output_label(char *label)
|
||||||
|
|
||||||
/* uncompress a compressed symbol. When this function is called, the best table
|
/* uncompress a compressed symbol. When this function is called, the best table
|
||||||
* might still be compressed itself, so the function needs to be recursive */
|
* might still be compressed itself, so the function needs to be recursive */
|
||||||
static int expand_symbol(unsigned char *data, int len, char *result)
|
static int expand_symbol(const unsigned char *data, int len, char *result)
|
||||||
{
|
{
|
||||||
int c, rlen, total=0;
|
int c, rlen, total=0;
|
||||||
|
|
||||||
|
@ -322,7 +337,7 @@ static int expand_symbol(unsigned char *data, int len, char *result)
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int symbol_absolute(struct sym_entry *s)
|
static int symbol_absolute(const struct sym_entry *s)
|
||||||
{
|
{
|
||||||
return s->percpu_absolute;
|
return s->percpu_absolute;
|
||||||
}
|
}
|
||||||
|
@ -460,7 +475,7 @@ static void write_src(void)
|
||||||
/* table lookup compression functions */
|
/* table lookup compression functions */
|
||||||
|
|
||||||
/* count all the possible tokens in a symbol */
|
/* count all the possible tokens in a symbol */
|
||||||
static void learn_symbol(unsigned char *symbol, int len)
|
static void learn_symbol(const unsigned char *symbol, int len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -469,7 +484,7 @@ static void learn_symbol(unsigned char *symbol, int len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* decrease the count for all the possible tokens in a symbol */
|
/* decrease the count for all the possible tokens in a symbol */
|
||||||
static void forget_symbol(unsigned char *symbol, int len)
|
static void forget_symbol(const unsigned char *symbol, int len)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -477,24 +492,17 @@ static void forget_symbol(unsigned char *symbol, int len)
|
||||||
token_profit[ symbol[i] + (symbol[i + 1] << 8) ]--;
|
token_profit[ symbol[i] + (symbol[i + 1] << 8) ]--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remove all the invalid symbols from the table and do the initial token count */
|
/* do the initial token count */
|
||||||
static void build_initial_tok_table(void)
|
static void build_initial_tok_table(void)
|
||||||
{
|
{
|
||||||
unsigned int i, pos;
|
unsigned int i;
|
||||||
|
|
||||||
pos = 0;
|
for (i = 0; i < table_cnt; i++)
|
||||||
for (i = 0; i < table_cnt; i++) {
|
learn_symbol(table[i].sym, table[i].len);
|
||||||
if ( symbol_valid(&table[i]) ) {
|
|
||||||
if (pos != i)
|
|
||||||
table[pos] = table[i];
|
|
||||||
learn_symbol(table[pos].sym, table[pos].len);
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
table_cnt = pos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *find_token(unsigned char *str, int len, unsigned char *token)
|
static unsigned char *find_token(unsigned char *str, int len,
|
||||||
|
const unsigned char *token)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -507,7 +515,7 @@ static void *find_token(unsigned char *str, int len, unsigned char *token)
|
||||||
|
|
||||||
/* replace a given token in all the valid symbols. Use the sampled symbols
|
/* replace a given token in all the valid symbols. Use the sampled symbols
|
||||||
* to update the counts */
|
* to update the counts */
|
||||||
static void compress_symbols(unsigned char *str, int idx)
|
static void compress_symbols(const unsigned char *str, int idx)
|
||||||
{
|
{
|
||||||
unsigned int i, len, size;
|
unsigned int i, len, size;
|
||||||
unsigned char *p1, *p2;
|
unsigned char *p1, *p2;
|
||||||
|
@ -614,19 +622,13 @@ static void optimize_token_table(void)
|
||||||
|
|
||||||
insert_real_symbols_in_table();
|
insert_real_symbols_in_table();
|
||||||
|
|
||||||
/* When valid symbol is not registered, exit to error */
|
|
||||||
if (!table_cnt) {
|
|
||||||
fprintf(stderr, "No valid symbol.\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
optimize_result();
|
optimize_result();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* guess for "linker script provide" symbol */
|
/* guess for "linker script provide" symbol */
|
||||||
static int may_be_linker_script_provide_symbol(const struct sym_entry *se)
|
static int may_be_linker_script_provide_symbol(const struct sym_entry *se)
|
||||||
{
|
{
|
||||||
const char *symbol = (char *)se->sym + 1;
|
const char *symbol = sym_name(se);
|
||||||
int len = se->len - 1;
|
int len = se->len - 1;
|
||||||
|
|
||||||
if (len < 8)
|
if (len < 8)
|
||||||
|
@ -658,16 +660,6 @@ static int may_be_linker_script_provide_symbol(const struct sym_entry *se)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int prefix_underscores_count(const char *str)
|
|
||||||
{
|
|
||||||
const char *tail = str;
|
|
||||||
|
|
||||||
while (*tail == '_')
|
|
||||||
tail++;
|
|
||||||
|
|
||||||
return tail - str;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int compare_symbols(const void *a, const void *b)
|
static int compare_symbols(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
const struct sym_entry *sa;
|
const struct sym_entry *sa;
|
||||||
|
@ -696,8 +688,8 @@ static int compare_symbols(const void *a, const void *b)
|
||||||
return wa - wb;
|
return wa - wb;
|
||||||
|
|
||||||
/* sort by the number of prefix underscores */
|
/* sort by the number of prefix underscores */
|
||||||
wa = prefix_underscores_count((const char *)sa->sym + 1);
|
wa = strspn(sym_name(sa), "_");
|
||||||
wb = prefix_underscores_count((const char *)sb->sym + 1);
|
wb = strspn(sym_name(sb), "_");
|
||||||
if (wa != wb)
|
if (wa != wb)
|
||||||
return wa - wb;
|
return wa - wb;
|
||||||
|
|
||||||
|
@ -731,11 +723,15 @@ static void record_relative_base(void)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
relative_base = -1ULL;
|
|
||||||
for (i = 0; i < table_cnt; i++)
|
for (i = 0; i < table_cnt; i++)
|
||||||
if (!symbol_absolute(&table[i]) &&
|
if (!symbol_absolute(&table[i])) {
|
||||||
table[i].addr < relative_base)
|
/*
|
||||||
|
* The table is sorted by address.
|
||||||
|
* Take the first non-absolute symbol value.
|
||||||
|
*/
|
||||||
relative_base = table[i].addr;
|
relative_base = table[i].addr;
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
|
@ -756,11 +752,12 @@ int main(int argc, char **argv)
|
||||||
usage();
|
usage();
|
||||||
|
|
||||||
read_map(stdin);
|
read_map(stdin);
|
||||||
|
shrink_table();
|
||||||
if (absolute_percpu)
|
if (absolute_percpu)
|
||||||
make_percpus_absolute();
|
make_percpus_absolute();
|
||||||
|
sort_symbols();
|
||||||
if (base_relative)
|
if (base_relative)
|
||||||
record_relative_base();
|
record_relative_base();
|
||||||
sort_symbols();
|
|
||||||
optimize_token_table();
|
optimize_token_table();
|
||||||
write_src();
|
write_src();
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,9 @@ localyesconfig localmodconfig: $(obj)/conf
|
||||||
# syncconfig has become an internal implementation detail and is now
|
# syncconfig has become an internal implementation detail and is now
|
||||||
# deprecated for external use
|
# deprecated for external use
|
||||||
simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
|
simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \
|
||||||
alldefconfig randconfig listnewconfig olddefconfig syncconfig
|
alldefconfig randconfig listnewconfig olddefconfig syncconfig \
|
||||||
|
helpnewconfig
|
||||||
|
|
||||||
PHONY += $(simple-targets)
|
PHONY += $(simple-targets)
|
||||||
|
|
||||||
$(simple-targets): $(obj)/conf
|
$(simple-targets): $(obj)/conf
|
||||||
|
@ -134,17 +136,19 @@ help:
|
||||||
@echo ' alldefconfig - New config with all symbols set to default'
|
@echo ' alldefconfig - New config with all symbols set to default'
|
||||||
@echo ' randconfig - New config with random answer to all options'
|
@echo ' randconfig - New config with random answer to all options'
|
||||||
@echo ' listnewconfig - List new options'
|
@echo ' listnewconfig - List new options'
|
||||||
|
@echo ' helpnewconfig - List new options and help text'
|
||||||
@echo ' olddefconfig - Same as oldconfig but sets new symbols to their'
|
@echo ' olddefconfig - Same as oldconfig but sets new symbols to their'
|
||||||
@echo ' default value without prompting'
|
@echo ' default value without prompting'
|
||||||
@echo ' kvmconfig - Enable additional options for kvm guest kernel support'
|
@echo ' kvmconfig - Enable additional options for kvm guest kernel support'
|
||||||
@echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support'
|
@echo ' xenconfig - Enable additional options for xen dom0 and guest kernel'
|
||||||
|
@echo ' support'
|
||||||
@echo ' tinyconfig - Configure the tiniest possible kernel'
|
@echo ' tinyconfig - Configure the tiniest possible kernel'
|
||||||
@echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)'
|
@echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)'
|
||||||
|
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
# object files used by all kconfig flavours
|
# object files used by all kconfig flavours
|
||||||
common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \
|
common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \
|
||||||
symbol.o
|
symbol.o util.o
|
||||||
|
|
||||||
$(obj)/lexer.lex.o: $(obj)/parser.tab.h
|
$(obj)/lexer.lex.o: $(obj)/parser.tab.h
|
||||||
HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src)
|
HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src)
|
||||||
|
|
|
@ -32,6 +32,7 @@ enum input_mode {
|
||||||
defconfig,
|
defconfig,
|
||||||
savedefconfig,
|
savedefconfig,
|
||||||
listnewconfig,
|
listnewconfig,
|
||||||
|
helpnewconfig,
|
||||||
olddefconfig,
|
olddefconfig,
|
||||||
};
|
};
|
||||||
static enum input_mode input_mode = oldaskconfig;
|
static enum input_mode input_mode = oldaskconfig;
|
||||||
|
@ -434,6 +435,11 @@ static void check_conf(struct menu *menu)
|
||||||
printf("%s%s=%s\n", CONFIG_, sym->name, str);
|
printf("%s%s=%s\n", CONFIG_, sym->name, str);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (input_mode == helpnewconfig) {
|
||||||
|
printf("-----\n");
|
||||||
|
print_help(menu);
|
||||||
|
printf("-----\n");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!conf_cnt++)
|
if (!conf_cnt++)
|
||||||
printf("*\n* Restart config...\n*\n");
|
printf("*\n* Restart config...\n*\n");
|
||||||
|
@ -459,6 +465,7 @@ static struct option long_opts[] = {
|
||||||
{"alldefconfig", no_argument, NULL, alldefconfig},
|
{"alldefconfig", no_argument, NULL, alldefconfig},
|
||||||
{"randconfig", no_argument, NULL, randconfig},
|
{"randconfig", no_argument, NULL, randconfig},
|
||||||
{"listnewconfig", no_argument, NULL, listnewconfig},
|
{"listnewconfig", no_argument, NULL, listnewconfig},
|
||||||
|
{"helpnewconfig", no_argument, NULL, helpnewconfig},
|
||||||
{"olddefconfig", no_argument, NULL, olddefconfig},
|
{"olddefconfig", no_argument, NULL, olddefconfig},
|
||||||
{NULL, 0, NULL, 0}
|
{NULL, 0, NULL, 0}
|
||||||
};
|
};
|
||||||
|
@ -469,6 +476,7 @@ static void conf_usage(const char *progname)
|
||||||
printf("Usage: %s [-s] [option] <kconfig-file>\n", progname);
|
printf("Usage: %s [-s] [option] <kconfig-file>\n", progname);
|
||||||
printf("[option] is _one_ of the following:\n");
|
printf("[option] is _one_ of the following:\n");
|
||||||
printf(" --listnewconfig List new options\n");
|
printf(" --listnewconfig List new options\n");
|
||||||
|
printf(" --helpnewconfig List new options and help text\n");
|
||||||
printf(" --oldaskconfig Start a new configuration using a line-oriented program\n");
|
printf(" --oldaskconfig Start a new configuration using a line-oriented program\n");
|
||||||
printf(" --oldconfig Update a configuration using a provided .config as base\n");
|
printf(" --oldconfig Update a configuration using a provided .config as base\n");
|
||||||
printf(" --syncconfig Similar to oldconfig but generates configuration in\n"
|
printf(" --syncconfig Similar to oldconfig but generates configuration in\n"
|
||||||
|
@ -543,6 +551,7 @@ int main(int ac, char **av)
|
||||||
case allmodconfig:
|
case allmodconfig:
|
||||||
case alldefconfig:
|
case alldefconfig:
|
||||||
case listnewconfig:
|
case listnewconfig:
|
||||||
|
case helpnewconfig:
|
||||||
case olddefconfig:
|
case olddefconfig:
|
||||||
break;
|
break;
|
||||||
case '?':
|
case '?':
|
||||||
|
@ -576,6 +585,7 @@ int main(int ac, char **av)
|
||||||
case oldaskconfig:
|
case oldaskconfig:
|
||||||
case oldconfig:
|
case oldconfig:
|
||||||
case listnewconfig:
|
case listnewconfig:
|
||||||
|
case helpnewconfig:
|
||||||
case olddefconfig:
|
case olddefconfig:
|
||||||
conf_read(NULL);
|
conf_read(NULL);
|
||||||
break;
|
break;
|
||||||
|
@ -657,6 +667,7 @@ int main(int ac, char **av)
|
||||||
/* fall through */
|
/* fall through */
|
||||||
case oldconfig:
|
case oldconfig:
|
||||||
case listnewconfig:
|
case listnewconfig:
|
||||||
|
case helpnewconfig:
|
||||||
case syncconfig:
|
case syncconfig:
|
||||||
/* Update until a loop caused no more changes */
|
/* Update until a loop caused no more changes */
|
||||||
do {
|
do {
|
||||||
|
@ -675,7 +686,7 @@ int main(int ac, char **av)
|
||||||
defconfig_file);
|
defconfig_file);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else if (input_mode != listnewconfig) {
|
} else if (input_mode != listnewconfig && input_mode != helpnewconfig) {
|
||||||
if (!no_conf_write && conf_write(NULL)) {
|
if (!no_conf_write && conf_write(NULL)) {
|
||||||
fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
|
fprintf(stderr, "\n*** Error during writing of the configuration.\n\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
|
@ -44,4 +44,7 @@ echo >&2 "* Unable to find the ncurses package."
|
||||||
echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
|
echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
|
||||||
echo >&2 "* depending on your distribution)."
|
echo >&2 "* depending on your distribution)."
|
||||||
echo >&2 "*"
|
echo >&2 "*"
|
||||||
|
echo >&2 "* You may also need to install pkg-config to find the"
|
||||||
|
echo >&2 "* ncurses installed in a non-default location."
|
||||||
|
echo >&2 "*"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -44,4 +44,7 @@ echo >&2 "* Unable to find the ncurses package."
|
||||||
echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
|
echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev"
|
||||||
echo >&2 "* depending on your distribution)."
|
echo >&2 "* depending on your distribution)."
|
||||||
echo >&2 "*"
|
echo >&2 "*"
|
||||||
|
echo >&2 "* You may also need to install pkg-config to find the"
|
||||||
|
echo >&2 "* ncurses installed in a non-default location."
|
||||||
|
echo >&2 "*"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
@ -727,5 +727,4 @@ void zconfdump(FILE *out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "util.c"
|
|
||||||
#include "menu.c"
|
#include "menu.c"
|
||||||
|
|
|
@ -38,8 +38,6 @@ static int sec_mismatch_count = 0;
|
||||||
static int sec_mismatch_fatal = 0;
|
static int sec_mismatch_fatal = 0;
|
||||||
/* ignore missing files */
|
/* ignore missing files */
|
||||||
static int ignore_missing_files;
|
static int ignore_missing_files;
|
||||||
/* write namespace dependencies */
|
|
||||||
static int write_namespace_deps;
|
|
||||||
|
|
||||||
enum export {
|
enum export {
|
||||||
export_plain, export_unused, export_gpl,
|
export_plain, export_unused, export_gpl,
|
||||||
|
@ -171,7 +169,6 @@ struct symbol {
|
||||||
unsigned int vmlinux:1; /* 1 if symbol is defined in vmlinux */
|
unsigned int vmlinux:1; /* 1 if symbol is defined in vmlinux */
|
||||||
unsigned int kernel:1; /* 1 if symbol is from kernel
|
unsigned int kernel:1; /* 1 if symbol is from kernel
|
||||||
* (only for external modules) **/
|
* (only for external modules) **/
|
||||||
unsigned int preloaded:1; /* 1 if symbol from Module.symvers, or crc */
|
|
||||||
unsigned int is_static:1; /* 1 if symbol is not global */
|
unsigned int is_static:1; /* 1 if symbol is not global */
|
||||||
enum export export; /* Type of export */
|
enum export export; /* Type of export */
|
||||||
char name[0];
|
char name[0];
|
||||||
|
@ -214,13 +211,11 @@ static struct symbol *new_symbol(const char *name, struct module *module,
|
||||||
enum export export)
|
enum export export)
|
||||||
{
|
{
|
||||||
unsigned int hash;
|
unsigned int hash;
|
||||||
struct symbol *new;
|
|
||||||
|
|
||||||
hash = tdb_hash(name) % SYMBOL_HASH_SIZE;
|
hash = tdb_hash(name) % SYMBOL_HASH_SIZE;
|
||||||
new = symbolhash[hash] = alloc_symbol(name, 0, symbolhash[hash]);
|
symbolhash[hash] = alloc_symbol(name, 0, symbolhash[hash]);
|
||||||
new->module = module;
|
|
||||||
new->export = export;
|
return symbolhash[hash];
|
||||||
return new;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct symbol *find_symbol(const char *name)
|
static struct symbol *find_symbol(const char *name)
|
||||||
|
@ -241,10 +236,8 @@ static struct symbol *find_symbol(const char *name)
|
||||||
static bool contains_namespace(struct namespace_list *list,
|
static bool contains_namespace(struct namespace_list *list,
|
||||||
const char *namespace)
|
const char *namespace)
|
||||||
{
|
{
|
||||||
struct namespace_list *ns_entry;
|
for (; list; list = list->next)
|
||||||
|
if (!strcmp(list->namespace, namespace))
|
||||||
for (ns_entry = list; ns_entry != NULL; ns_entry = ns_entry->next)
|
|
||||||
if (strcmp(ns_entry->namespace, namespace) == 0)
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -312,6 +305,18 @@ static const char *sec_name(struct elf_info *elf, int secindex)
|
||||||
return sech_name(elf, &elf->sechdrs[secindex]);
|
return sech_name(elf, &elf->sechdrs[secindex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void *sym_get_data(const struct elf_info *info, const Elf_Sym *sym)
|
||||||
|
{
|
||||||
|
Elf_Shdr *sechdr = &info->sechdrs[sym->st_shndx];
|
||||||
|
unsigned long offset;
|
||||||
|
|
||||||
|
offset = sym->st_value;
|
||||||
|
if (info->hdr->e_type != ET_REL)
|
||||||
|
offset -= sechdr->sh_addr;
|
||||||
|
|
||||||
|
return (void *)info->hdr + sechdr->sh_offset + offset;
|
||||||
|
}
|
||||||
|
|
||||||
#define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0)
|
#define strstarts(str, prefix) (strncmp(str, prefix, strlen(prefix)) == 0)
|
||||||
|
|
||||||
static enum export export_from_secname(struct elf_info *elf, unsigned int sec)
|
static enum export export_from_secname(struct elf_info *elf, unsigned int sec)
|
||||||
|
@ -348,10 +353,10 @@ static enum export export_from_sec(struct elf_info *elf, unsigned int sec)
|
||||||
return export_unknown;
|
return export_unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *namespace_from_kstrtabns(struct elf_info *info,
|
static const char *namespace_from_kstrtabns(const struct elf_info *info,
|
||||||
Elf_Sym *kstrtabns)
|
const Elf_Sym *sym)
|
||||||
{
|
{
|
||||||
char *value = info->ksymtab_strings + kstrtabns->st_value;
|
const char *value = sym_get_data(info, sym);
|
||||||
return value[0] ? value : NULL;
|
return value[0] ? value : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,33 +390,32 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod,
|
||||||
|
|
||||||
if (!s) {
|
if (!s) {
|
||||||
s = new_symbol(name, mod, export);
|
s = new_symbol(name, mod, export);
|
||||||
} else {
|
} else if (!external_module || is_vmlinux(s->module->name) ||
|
||||||
if (!s->preloaded) {
|
s->module == mod) {
|
||||||
warn("%s: '%s' exported twice. Previous export was in %s%s\n",
|
warn("%s: '%s' exported twice. Previous export was in %s%s\n",
|
||||||
mod->name, name, s->module->name,
|
mod->name, name, s->module->name,
|
||||||
is_vmlinux(s->module->name) ? "" : ".ko");
|
is_vmlinux(s->module->name) ? "" : ".ko");
|
||||||
} else {
|
return s;
|
||||||
/* In case Module.symvers was out of date */
|
|
||||||
s->module = mod;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
s->preloaded = 0;
|
|
||||||
|
s->module = mod;
|
||||||
s->vmlinux = is_vmlinux(mod->name);
|
s->vmlinux = is_vmlinux(mod->name);
|
||||||
s->kernel = 0;
|
s->kernel = 0;
|
||||||
s->export = export;
|
s->export = export;
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sym_update_crc(const char *name, struct module *mod,
|
static void sym_set_crc(const char *name, unsigned int crc)
|
||||||
unsigned int crc, enum export export)
|
|
||||||
{
|
{
|
||||||
struct symbol *s = find_symbol(name);
|
struct symbol *s = find_symbol(name);
|
||||||
|
|
||||||
if (!s) {
|
/*
|
||||||
s = new_symbol(name, mod, export);
|
* Ignore stand-alone __crc_*, which might be auto-generated symbols
|
||||||
/* Don't complain when we find it later. */
|
* such as __*_veneer in ARM ELF.
|
||||||
s->preloaded = 1;
|
*/
|
||||||
}
|
if (!s)
|
||||||
|
return;
|
||||||
|
|
||||||
s->crc = crc;
|
s->crc = crc;
|
||||||
s->crc_valid = 1;
|
s->crc_valid = 1;
|
||||||
}
|
}
|
||||||
|
@ -593,10 +597,6 @@ static int parse_elf(struct elf_info *info, const char *filename)
|
||||||
info->export_unused_gpl_sec = i;
|
info->export_unused_gpl_sec = i;
|
||||||
else if (strcmp(secname, "__ksymtab_gpl_future") == 0)
|
else if (strcmp(secname, "__ksymtab_gpl_future") == 0)
|
||||||
info->export_gpl_future_sec = i;
|
info->export_gpl_future_sec = i;
|
||||||
else if (strcmp(secname, "__ksymtab_strings") == 0)
|
|
||||||
info->ksymtab_strings = (void *)hdr +
|
|
||||||
sechdrs[i].sh_offset -
|
|
||||||
sechdrs[i].sh_addr;
|
|
||||||
|
|
||||||
if (sechdrs[i].sh_type == SHT_SYMTAB) {
|
if (sechdrs[i].sh_type == SHT_SYMTAB) {
|
||||||
unsigned int sh_link_idx;
|
unsigned int sh_link_idx;
|
||||||
|
@ -679,12 +679,34 @@ static int ignore_undef_symbol(struct elf_info *info, const char *symname)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handle_modversions(struct module *mod, struct elf_info *info,
|
static void handle_modversion(const struct module *mod,
|
||||||
Elf_Sym *sym, const char *symname)
|
const struct elf_info *info,
|
||||||
|
const Elf_Sym *sym, const char *symname)
|
||||||
{
|
{
|
||||||
unsigned int crc;
|
unsigned int crc;
|
||||||
|
|
||||||
|
if (sym->st_shndx == SHN_UNDEF) {
|
||||||
|
warn("EXPORT symbol \"%s\" [%s%s] version generation failed, symbol will not be versioned.\n",
|
||||||
|
symname, mod->name, is_vmlinux(mod->name) ? "":".ko");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sym->st_shndx == SHN_ABS) {
|
||||||
|
crc = sym->st_value;
|
||||||
|
} else {
|
||||||
|
unsigned int *crcp;
|
||||||
|
|
||||||
|
/* symbol points to the CRC in the ELF object */
|
||||||
|
crcp = sym_get_data(info, sym);
|
||||||
|
crc = TO_NATIVE(*crcp);
|
||||||
|
}
|
||||||
|
sym_set_crc(symname, crc);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void handle_symbol(struct module *mod, struct elf_info *info,
|
||||||
|
const Elf_Sym *sym, const char *symname)
|
||||||
|
{
|
||||||
enum export export;
|
enum export export;
|
||||||
bool is_crc = false;
|
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
if ((!is_vmlinux(mod->name) || mod->is_dot_o) &&
|
if ((!is_vmlinux(mod->name) || mod->is_dot_o) &&
|
||||||
|
@ -693,24 +715,6 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
|
||||||
else
|
else
|
||||||
export = export_from_sec(info, get_secindex(info, sym));
|
export = export_from_sec(info, get_secindex(info, sym));
|
||||||
|
|
||||||
/* CRC'd symbol */
|
|
||||||
if (strstarts(symname, "__crc_")) {
|
|
||||||
is_crc = true;
|
|
||||||
crc = (unsigned int) sym->st_value;
|
|
||||||
if (sym->st_shndx != SHN_UNDEF && sym->st_shndx != SHN_ABS) {
|
|
||||||
unsigned int *crcp;
|
|
||||||
|
|
||||||
/* symbol points to the CRC in the ELF object */
|
|
||||||
crcp = (void *)info->hdr + sym->st_value +
|
|
||||||
info->sechdrs[sym->st_shndx].sh_offset -
|
|
||||||
(info->hdr->e_type != ET_REL ?
|
|
||||||
info->sechdrs[sym->st_shndx].sh_addr : 0);
|
|
||||||
crc = TO_NATIVE(*crcp);
|
|
||||||
}
|
|
||||||
sym_update_crc(symname + strlen("__crc_"), mod, crc,
|
|
||||||
export);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (sym->st_shndx) {
|
switch (sym->st_shndx) {
|
||||||
case SHN_COMMON:
|
case SHN_COMMON:
|
||||||
if (strstarts(symname, "__gnu_lto_")) {
|
if (strstarts(symname, "__gnu_lto_")) {
|
||||||
|
@ -745,11 +749,6 @@ static void handle_modversions(struct module *mod, struct elf_info *info,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (is_crc) {
|
|
||||||
const char *e = is_vmlinux(mod->name) ?"":".ko";
|
|
||||||
warn("EXPORT symbol \"%s\" [%s%s] version generation failed, symbol will not be versioned.\n",
|
|
||||||
symname + strlen("__crc_"), mod->name, e);
|
|
||||||
}
|
|
||||||
mod->unres = alloc_symbol(symname,
|
mod->unres = alloc_symbol(symname,
|
||||||
ELF_ST_BIND(sym->st_info) == STB_WEAK,
|
ELF_ST_BIND(sym->st_info) == STB_WEAK,
|
||||||
mod->unres);
|
mod->unres);
|
||||||
|
@ -2050,18 +2049,22 @@ static void read_symbols(const char *modname)
|
||||||
for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
|
for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
|
||||||
symname = remove_dot(info.strtab + sym->st_name);
|
symname = remove_dot(info.strtab + sym->st_name);
|
||||||
|
|
||||||
handle_modversions(mod, &info, sym, symname);
|
handle_symbol(mod, &info, sym, symname);
|
||||||
handle_moddevtable(mod, &info, sym, symname);
|
handle_moddevtable(mod, &info, sym, symname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Apply symbol namespaces from __kstrtabns_<symbol> entries. */
|
|
||||||
for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
|
for (sym = info.symtab_start; sym < info.symtab_stop; sym++) {
|
||||||
symname = remove_dot(info.strtab + sym->st_name);
|
symname = remove_dot(info.strtab + sym->st_name);
|
||||||
|
|
||||||
|
/* Apply symbol namespaces from __kstrtabns_<symbol> entries. */
|
||||||
if (strstarts(symname, "__kstrtabns_"))
|
if (strstarts(symname, "__kstrtabns_"))
|
||||||
sym_update_namespace(symname + strlen("__kstrtabns_"),
|
sym_update_namespace(symname + strlen("__kstrtabns_"),
|
||||||
namespace_from_kstrtabns(&info,
|
namespace_from_kstrtabns(&info,
|
||||||
sym));
|
sym));
|
||||||
|
|
||||||
|
if (strstarts(symname, "__crc_"))
|
||||||
|
handle_modversion(mod, &info, sym,
|
||||||
|
symname + strlen("__crc_"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for static EXPORT_SYMBOL_* functions && global vars
|
// check for static EXPORT_SYMBOL_* functions && global vars
|
||||||
|
@ -2217,15 +2220,11 @@ static int check_exports(struct module *mod)
|
||||||
else
|
else
|
||||||
basename = mod->name;
|
basename = mod->name;
|
||||||
|
|
||||||
if (exp->namespace) {
|
if (exp->namespace &&
|
||||||
add_namespace(&mod->required_namespaces,
|
!module_imports_namespace(mod, exp->namespace)) {
|
||||||
exp->namespace);
|
warn("module %s uses symbol %s from namespace %s, but does not import it.\n",
|
||||||
|
basename, exp->name, exp->namespace);
|
||||||
if (!write_namespace_deps &&
|
add_namespace(&mod->missing_namespaces, exp->namespace);
|
||||||
!module_imports_namespace(mod, exp->namespace)) {
|
|
||||||
warn("module %s uses symbol %s from namespace %s, but does not import it.\n",
|
|
||||||
basename, exp->name, exp->namespace);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mod->gpl_compatible)
|
if (!mod->gpl_compatible)
|
||||||
|
@ -2477,9 +2476,8 @@ static void read_dump(const char *fname, unsigned int kernel)
|
||||||
}
|
}
|
||||||
s = sym_add_exported(symname, mod, export_no(export));
|
s = sym_add_exported(symname, mod, export_no(export));
|
||||||
s->kernel = kernel;
|
s->kernel = kernel;
|
||||||
s->preloaded = 1;
|
|
||||||
s->is_static = 0;
|
s->is_static = 0;
|
||||||
sym_update_crc(symname, mod, crc, export_no(export));
|
sym_set_crc(symname, crc);
|
||||||
sym_update_namespace(symname, namespace);
|
sym_update_namespace(symname, namespace);
|
||||||
}
|
}
|
||||||
release_file(file, size);
|
release_file(file, size);
|
||||||
|
@ -2527,29 +2525,27 @@ static void write_dump(const char *fname)
|
||||||
free(buf.p);
|
free(buf.p);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_namespace_deps_files(void)
|
static void write_namespace_deps_files(const char *fname)
|
||||||
{
|
{
|
||||||
struct module *mod;
|
struct module *mod;
|
||||||
struct namespace_list *ns;
|
struct namespace_list *ns;
|
||||||
struct buffer ns_deps_buf = {};
|
struct buffer ns_deps_buf = {};
|
||||||
|
|
||||||
for (mod = modules; mod; mod = mod->next) {
|
for (mod = modules; mod; mod = mod->next) {
|
||||||
char fname[PATH_MAX];
|
|
||||||
|
|
||||||
if (mod->skip)
|
if (mod->skip || !mod->missing_namespaces)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ns_deps_buf.pos = 0;
|
buf_printf(&ns_deps_buf, "%s.ko:", mod->name);
|
||||||
|
|
||||||
for (ns = mod->required_namespaces; ns; ns = ns->next)
|
for (ns = mod->missing_namespaces; ns; ns = ns->next)
|
||||||
buf_printf(&ns_deps_buf, "%s\n", ns->namespace);
|
buf_printf(&ns_deps_buf, " %s", ns->namespace);
|
||||||
|
|
||||||
if (ns_deps_buf.pos == 0)
|
buf_printf(&ns_deps_buf, "\n");
|
||||||
continue;
|
|
||||||
|
|
||||||
sprintf(fname, "%s.ns_deps", mod->name);
|
|
||||||
write_if_changed(&ns_deps_buf, fname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
write_if_changed(&ns_deps_buf, fname);
|
||||||
|
free(ns_deps_buf.p);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ext_sym_list {
|
struct ext_sym_list {
|
||||||
|
@ -2561,7 +2557,8 @@ int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct module *mod;
|
struct module *mod;
|
||||||
struct buffer buf = { };
|
struct buffer buf = { };
|
||||||
char *kernel_read = NULL, *module_read = NULL;
|
char *kernel_read = NULL;
|
||||||
|
char *missing_namespace_deps = NULL;
|
||||||
char *dump_write = NULL, *files_source = NULL;
|
char *dump_write = NULL, *files_source = NULL;
|
||||||
int opt;
|
int opt;
|
||||||
int err;
|
int err;
|
||||||
|
@ -2569,13 +2566,10 @@ int main(int argc, char **argv)
|
||||||
struct ext_sym_list *extsym_iter;
|
struct ext_sym_list *extsym_iter;
|
||||||
struct ext_sym_list *extsym_start = NULL;
|
struct ext_sym_list *extsym_start = NULL;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "i:I:e:mnsT:o:awEd")) != -1) {
|
while ((opt = getopt(argc, argv, "i:e:mnsT:o:awEd:")) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'i':
|
case 'i':
|
||||||
kernel_read = optarg;
|
kernel_read = optarg;
|
||||||
break;
|
|
||||||
case 'I':
|
|
||||||
module_read = optarg;
|
|
||||||
external_module = 1;
|
external_module = 1;
|
||||||
break;
|
break;
|
||||||
case 'e':
|
case 'e':
|
||||||
|
@ -2611,7 +2605,7 @@ int main(int argc, char **argv)
|
||||||
sec_mismatch_fatal = 1;
|
sec_mismatch_fatal = 1;
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
write_namespace_deps = 1;
|
missing_namespace_deps = optarg;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@ -2620,8 +2614,6 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
if (kernel_read)
|
if (kernel_read)
|
||||||
read_dump(kernel_read, 1);
|
read_dump(kernel_read, 1);
|
||||||
if (module_read)
|
|
||||||
read_dump(module_read, 0);
|
|
||||||
while (extsym_start) {
|
while (extsym_start) {
|
||||||
read_dump(extsym_start->file, 0);
|
read_dump(extsym_start->file, 0);
|
||||||
extsym_iter = extsym_start->next;
|
extsym_iter = extsym_start->next;
|
||||||
|
@ -2647,8 +2639,6 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
err |= check_modname_len(mod);
|
err |= check_modname_len(mod);
|
||||||
err |= check_exports(mod);
|
err |= check_exports(mod);
|
||||||
if (write_namespace_deps)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
add_header(&buf, mod);
|
add_header(&buf, mod);
|
||||||
add_intree_flag(&buf, !external_module);
|
add_intree_flag(&buf, !external_module);
|
||||||
|
@ -2663,10 +2653,8 @@ int main(int argc, char **argv)
|
||||||
write_if_changed(&buf, fname);
|
write_if_changed(&buf, fname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (write_namespace_deps) {
|
if (missing_namespace_deps)
|
||||||
write_namespace_deps_files();
|
write_namespace_deps_files(missing_namespace_deps);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dump_write)
|
if (dump_write)
|
||||||
write_dump(dump_write);
|
write_dump(dump_write);
|
||||||
|
|
|
@ -126,8 +126,8 @@ struct module {
|
||||||
struct buffer dev_table_buf;
|
struct buffer dev_table_buf;
|
||||||
char srcversion[25];
|
char srcversion[25];
|
||||||
int is_dot_o;
|
int is_dot_o;
|
||||||
// Required namespace dependencies
|
// Missing namespace dependencies
|
||||||
struct namespace_list *required_namespaces;
|
struct namespace_list *missing_namespaces;
|
||||||
// Actual imported namespaces
|
// Actual imported namespaces
|
||||||
struct namespace_list *imported_namespaces;
|
struct namespace_list *imported_namespaces;
|
||||||
};
|
};
|
||||||
|
@ -143,7 +143,6 @@ struct elf_info {
|
||||||
Elf_Section export_gpl_sec;
|
Elf_Section export_gpl_sec;
|
||||||
Elf_Section export_unused_gpl_sec;
|
Elf_Section export_unused_gpl_sec;
|
||||||
Elf_Section export_gpl_future_sec;
|
Elf_Section export_gpl_future_sec;
|
||||||
char *ksymtab_strings;
|
|
||||||
char *strtab;
|
char *strtab;
|
||||||
char *modinfo;
|
char *modinfo;
|
||||||
unsigned int modinfo_len;
|
unsigned int modinfo_len;
|
||||||
|
|
|
@ -21,21 +21,26 @@ if [ "$SPATCH_VERSION_NUM" -lt "$SPATCH_REQ_VERSION_NUM" ] ; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$KBUILD_EXTMOD" ]; then
|
||||||
|
src_prefix=
|
||||||
|
else
|
||||||
|
src_prefix=$srctree/
|
||||||
|
fi
|
||||||
|
|
||||||
generate_deps_for_ns() {
|
generate_deps_for_ns() {
|
||||||
$SPATCH --very-quiet --in-place --sp-file \
|
$SPATCH --very-quiet --in-place --sp-file \
|
||||||
$srctree/scripts/coccinelle/misc/add_namespace.cocci -D ns=$1 $2
|
$srctree/scripts/coccinelle/misc/add_namespace.cocci -D ns=$1 $2
|
||||||
}
|
}
|
||||||
|
|
||||||
generate_deps() {
|
generate_deps() {
|
||||||
local mod_name=`basename $@ .ko`
|
local mod=${1%.ko:}
|
||||||
local mod_file=`echo $@ | sed -e 's/\.ko/\.mod/'`
|
shift
|
||||||
local ns_deps_file=`echo $@ | sed -e 's/\.ko/\.ns_deps/'`
|
local namespaces="$*"
|
||||||
if [ ! -f "$ns_deps_file" ]; then return; fi
|
local mod_source_files="`cat $mod.mod | sed -n 1p \
|
||||||
local mod_source_files="`cat $mod_file | sed -n 1p \
|
|
||||||
| sed -e 's/\.o/\.c/g' \
|
| sed -e 's/\.o/\.c/g' \
|
||||||
| sed "s|[^ ]* *|${srctree}/&|g"`"
|
| sed "s|[^ ]* *|${src_prefix}&|g"`"
|
||||||
for ns in `cat $ns_deps_file`; do
|
for ns in $namespaces; do
|
||||||
echo "Adding namespace $ns to module $mod_name (if needed)."
|
echo "Adding namespace $ns to module $mod.ko."
|
||||||
generate_deps_for_ns $ns "$mod_source_files"
|
generate_deps_for_ns $ns "$mod_source_files"
|
||||||
# sort the imports
|
# sort the imports
|
||||||
for source_file in $mod_source_files; do
|
for source_file in $mod_source_files; do
|
||||||
|
@ -52,7 +57,7 @@ generate_deps() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
for f in `cat $objtree/modules.order`; do
|
while read line
|
||||||
generate_deps $f
|
do
|
||||||
done
|
generate_deps $line
|
||||||
|
done < $MODULES_NSDEPS
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
#
|
#
|
||||||
# buildtar 0.0.4
|
# buildtar 0.0.5
|
||||||
#
|
#
|
||||||
# (C) 2004-2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
|
# (C) 2004-2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
|
||||||
#
|
#
|
||||||
|
@ -24,7 +24,7 @@ tarball="${objtree}/linux-${KERNELRELEASE}-${ARCH}.tar"
|
||||||
# Figure out how to compress, if requested at all
|
# Figure out how to compress, if requested at all
|
||||||
#
|
#
|
||||||
case "${1}" in
|
case "${1}" in
|
||||||
tar-pkg)
|
dir-pkg|tar-pkg)
|
||||||
opts=
|
opts=
|
||||||
;;
|
;;
|
||||||
targz-pkg)
|
targz-pkg)
|
||||||
|
@ -125,6 +125,10 @@ case "${ARCH}" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
if [ "${1}" = dir-pkg ]; then
|
||||||
|
echo "Kernel tree successfully created in $tmpdir"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
#
|
#
|
||||||
# Create the tarball
|
# Create the tarball
|
||||||
|
|
|
@ -45,11 +45,11 @@ scm_version()
|
||||||
|
|
||||||
# Check for git and a git repo.
|
# Check for git and a git repo.
|
||||||
if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
|
if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
|
||||||
head=`git rev-parse --verify --short HEAD 2>/dev/null`; then
|
head=$(git rev-parse --verify --short HEAD 2>/dev/null); then
|
||||||
|
|
||||||
# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
|
# If we are at a tagged commit (like "v2.6.30-rc6"), we ignore
|
||||||
# it, because this version is defined in the top level Makefile.
|
# it, because this version is defined in the top level Makefile.
|
||||||
if [ -z "`git describe --exact-match 2>/dev/null`" ]; then
|
if [ -z "$(git describe --exact-match 2>/dev/null)" ]; then
|
||||||
|
|
||||||
# If only the short version is requested, don't bother
|
# If only the short version is requested, don't bother
|
||||||
# running further git commands
|
# running further git commands
|
||||||
|
@ -59,7 +59,7 @@ scm_version()
|
||||||
fi
|
fi
|
||||||
# If we are past a tagged commit (like
|
# If we are past a tagged commit (like
|
||||||
# "v2.6.30-rc5-302-g72357d5"), we pretty print it.
|
# "v2.6.30-rc5-302-g72357d5"), we pretty print it.
|
||||||
if atag="`git describe 2>/dev/null`"; then
|
if atag="$(git describe 2>/dev/null)"; then
|
||||||
echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
|
echo "$atag" | awk -F- '{printf("-%05d-%s", $(NF-1),$(NF))}'
|
||||||
|
|
||||||
# If we don't have a tag at all we print -g{commitish}.
|
# If we don't have a tag at all we print -g{commitish}.
|
||||||
|
@ -70,7 +70,7 @@ scm_version()
|
||||||
|
|
||||||
# Is this git on svn?
|
# Is this git on svn?
|
||||||
if git config --get svn-remote.svn.url >/dev/null; then
|
if git config --get svn-remote.svn.url >/dev/null; then
|
||||||
printf -- '-svn%s' "`git svn find-rev $head`"
|
printf -- '-svn%s' "$(git svn find-rev $head)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for uncommitted changes.
|
# Check for uncommitted changes.
|
||||||
|
@ -91,15 +91,15 @@ scm_version()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for mercurial and a mercurial repo.
|
# Check for mercurial and a mercurial repo.
|
||||||
if test -d .hg && hgid=`hg id 2>/dev/null`; then
|
if test -d .hg && hgid=$(hg id 2>/dev/null); then
|
||||||
# Do we have an tagged version? If so, latesttagdistance == 1
|
# Do we have an tagged version? If so, latesttagdistance == 1
|
||||||
if [ "`hg log -r . --template '{latesttagdistance}'`" = "1" ]; then
|
if [ "$(hg log -r . --template '{latesttagdistance}')" = "1" ]; then
|
||||||
id=`hg log -r . --template '{latesttag}'`
|
id=$(hg log -r . --template '{latesttag}')
|
||||||
printf '%s%s' -hg "$id"
|
printf '%s%s' -hg "$id"
|
||||||
else
|
else
|
||||||
tag=`printf '%s' "$hgid" | cut -d' ' -f2`
|
tag=$(printf '%s' "$hgid" | cut -d' ' -f2)
|
||||||
if [ -z "$tag" -o "$tag" = tip ]; then
|
if [ -z "$tag" -o "$tag" = tip ]; then
|
||||||
id=`printf '%s' "$hgid" | sed 's/[+ ].*//'`
|
id=$(printf '%s' "$hgid" | sed 's/[+ ].*//')
|
||||||
printf '%s%s' -hg "$id"
|
printf '%s%s' -hg "$id"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -115,8 +115,8 @@ scm_version()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for svn and a svn repo.
|
# Check for svn and a svn repo.
|
||||||
if rev=`LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'`; then
|
if rev=$(LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'); then
|
||||||
rev=`echo $rev | awk '{print $NF}'`
|
rev=$(echo $rev | awk '{print $NF}')
|
||||||
printf -- '-svn%s' "$rev"
|
printf -- '-svn%s' "$rev"
|
||||||
|
|
||||||
# All done with svn
|
# All done with svn
|
||||||
|
|
|
@ -32,6 +32,8 @@ BEGIN {
|
||||||
printversion("PPP", version("pppd --version"))
|
printversion("PPP", version("pppd --version"))
|
||||||
printversion("Isdn4k-utils", version("isdnctrl"))
|
printversion("Isdn4k-utils", version("isdnctrl"))
|
||||||
printversion("Nfs-utils", version("showmount --version"))
|
printversion("Nfs-utils", version("showmount --version"))
|
||||||
|
printversion("Bison", version("bison --version"))
|
||||||
|
printversion("Flex", version("flex --version"))
|
||||||
|
|
||||||
while (getline <"/proc/self/maps" > 0) {
|
while (getline <"/proc/self/maps" > 0) {
|
||||||
if (/libc.*\.so$/) {
|
if (/libc.*\.so$/) {
|
||||||
|
|
|
@ -26,8 +26,6 @@ header-test- += drm/vmwgfx_drm.h
|
||||||
header-test- += linux/am437x-vpfe.h
|
header-test- += linux/am437x-vpfe.h
|
||||||
header-test- += linux/android/binder.h
|
header-test- += linux/android/binder.h
|
||||||
header-test- += linux/android/binderfs.h
|
header-test- += linux/android/binderfs.h
|
||||||
header-test-$(CONFIG_CPU_BIG_ENDIAN) += linux/byteorder/big_endian.h
|
|
||||||
header-test-$(CONFIG_CPU_LITTLE_ENDIAN) += linux/byteorder/little_endian.h
|
|
||||||
header-test- += linux/coda.h
|
header-test- += linux/coda.h
|
||||||
header-test- += linux/elfcore.h
|
header-test- += linux/elfcore.h
|
||||||
header-test- += linux/errqueue.h
|
header-test- += linux/errqueue.h
|
||||||
|
@ -36,8 +34,6 @@ header-test- += linux/hdlc/ioctl.h
|
||||||
header-test- += linux/ivtv.h
|
header-test- += linux/ivtv.h
|
||||||
header-test- += linux/kexec.h
|
header-test- += linux/kexec.h
|
||||||
header-test- += linux/matroxfb.h
|
header-test- += linux/matroxfb.h
|
||||||
header-test- += linux/netfilter_ipv4/ipt_LOG.h
|
|
||||||
header-test- += linux/netfilter_ipv6/ip6t_LOG.h
|
|
||||||
header-test- += linux/nfc.h
|
header-test- += linux/nfc.h
|
||||||
header-test- += linux/omap3isp.h
|
header-test- += linux/omap3isp.h
|
||||||
header-test- += linux/omapfb.h
|
header-test- += linux/omapfb.h
|
||||||
|
@ -99,9 +95,16 @@ endif
|
||||||
# asm-generic/*.h is used by asm/*.h, and should not be included directly
|
# asm-generic/*.h is used by asm/*.h, and should not be included directly
|
||||||
header-test- += asm-generic/%
|
header-test- += asm-generic/%
|
||||||
|
|
||||||
# The rest are compile-tested
|
extra-y := $(patsubst $(obj)/%.h,%.hdrtest, $(shell find $(obj) -name '*.h'))
|
||||||
header-test-y += $(filter-out $(header-test-), \
|
|
||||||
$(patsubst $(obj)/%,%, $(wildcard \
|
quiet_cmd_hdrtest = HDRTEST $<
|
||||||
$(addprefix $(obj)/, *.h */*.h */*/*.h */*/*/*.h))))
|
cmd_hdrtest = \
|
||||||
|
$(CC) $(c_flags) -S -o /dev/null -x c /dev/null \
|
||||||
|
$(if $(filter-out $(header-test-), $*.h), -include $<); \
|
||||||
|
$(PERL) $(srctree)/scripts/headers_check.pl $(obj) $(SRCARCH) $<; \
|
||||||
|
touch $@
|
||||||
|
|
||||||
|
$(obj)/%.hdrtest: $(obj)/%.h FORCE
|
||||||
|
$(call if_changed_dep,hdrtest)
|
||||||
|
|
||||||
clean-files += $(filter-out Makefile, $(notdir $(wildcard $(obj)/*)))
|
clean-files += $(filter-out Makefile, $(notdir $(wildcard $(obj)/*)))
|
||||||
|
|
Загрузка…
Ссылка в новой задаче