backports: add kernel integration support
Subsystems (2)
cover backports: add kernel integration support
From: "Luis R. Rodriguez" <[email protected]>
This is a cleaned up respin of kernel integration support. It splits up all the patches as much as possible and while doing so noted a few adjustments that could be made that could help simplify sharing paths / code between packaging and integration. The biggest change here is I've dropped the CONFIG_BACKPORT idea for packaging and kept the CPTCFG_ for that, we will only use CONFIG_BACKPORT for kernel integration given that some folks are already heavily relying on CPTCFG_ stuff and doing a major change will cause pain.
To test, reset a linux git tree to tag v3.15 and linux-next to next-20141023 then do:
time ./gentree.py --gitdebug --clean --integrate /home/mcgrof/linux-next/ /home/mcgrof/linux/
real 0m58.616s
user 1m36.273s
sys 0m10.415s
So it takes ~1 minute on my laptop to integrate next-20141023 device divers into v3.15 right now.
At first you will probably have a hard time trying to enable any driver on the backports menu, the reason is you must first disable the respective drivers that you would otherwise get from your kernel. Look at the last patch for example of what options you need for example for cfg80211 and mac80211.
This goes run time tested with kernel integration on v3.15, and ckmake compile tested for packaging across all supported kernels. I suppose we'll need a beefier machine if we want to do testing on integration all the time for all supported kernels as well. Since integration is new integration goes without much testing but with the hopes others will find it useful, start testing it and expand on it.
Luis R. Rodriguez (11):
backports: move legacy and SmPL patch application into helper
backports: extend module_init() module_exit() for built-in
backports: allow for different backport prefix
backports: replace BACKPORT_PWD with BACKPORT_DIR
backports: use BACKPORT_DIR prefix on kconfig sources
backports: update dependencies map file
backports: split Kconfig into Kconfig.package and Kconfig.sources
backports: move version file generation to run earlier
backports: use Kconfig for backport version information
backports: prefix c-file / h-file auto backport with BPAUTO
backports: add full kernel integration support
backport/Kconfig | 47 -- backport/Kconfig.integrate | 36 ++ backport/Kconfig.package | 49 +++ backport/Kconfig.sources | 23 + backport/Makefile | 6 +- backport/Makefile.build | 4 +- backport/Makefile.kernel | 17 +- backport/Makefile.real | 12 +- backport/backport-include/asm/dma-mapping.h | 4 +- backport/backport-include/backport/backport.h | 5 + backport/backport-include/backport/leds-disabled.h | 2 +- backport/backport-include/linux/module.h | 31 +- backport/compat/Kconfig | 80 ++-- backport/compat/Makefile | 8 +- backport/compat/backports.h | 4 +- backport/compat/main.c | 50 ++- backport/scripts/uninstall.sh | 4 +- dependencies | 31 +- devel/ckmake | 2 + devel/doc/kconfig-operation | 7 +- gentree.py | 489 +++++++++++++-------- .../0001-enable-backports-built-in.patch | 40 ++ lib/bpversion.py | 48 ++ lib/kconfig.py | 159 ++++++- patches/backport-adjustments/devcoredump.patch | 4 +- 25 files changed, 821 insertions(+), 341 deletions(-) delete mode 100644 backport/Kconfig create mode 100644 backport/Kconfig.integrate create mode 100644 backport/Kconfig.package create mode 100644 backport/Kconfig.sources create mode 100644 integration-patches/0001-enable-backports/0001-enable-backports-built-in.patch create mode 100644 lib/bpversion.py
Signature · 1 line
2.1.1
PATCH 1/11 backports: move legacy and SmPL patch application into helper
From: "Luis R. Rodriguez" <[email protected]>
This allows us to extend how backports uses patches for different types of applications. This will later be used for kernel integration support, for example.
This should have no functional change.
--- gentree.py | 279 +++++++++++++++++++++++++++++++------------------------------ 1 file changed, 144 insertions(+), 135 deletions(-)
gentree.py +144 -135
@@ -438,6 +438,149 @@ def upload_release(args, rel_prep, logwrite=lambda x:None): kup_cmd = "kup put /\n\t\t%s /\n\t\t%s /\n\t\t%s" % (gzip_name, tar_name + '.asc', korg_path) logwrite("kup-test: skipping cmd: %s" % kup_cmd) +def apply_patches(args, desc, source_dir, patch_src, target_dir, logwrite=lambda x:None): + """ + Given a path of a directories of patches and SmPL patches apply + them on the target directory. If requested refresh patches, or test + a specific SmPL patch. + """ + logwrite('Applying patches from %s to %s ...' % (patch_src, target_dir)) + test_cocci = args.test_cocci or args.profile_cocci + test_cocci_found = False + patches = [] + sempatches = [] + for root, dirs, files in os.walk(os.path.join(source_dir, patch_src)): + for f in files: + if not test_cocci and f.endswith('.patch'): + patches.append(os.path.join(root, f)) + if f.endswith('.cocci'): + if test_cocci: + if f not in test_cocci: + continue + test_cocci_found = True + if args.test_cocci: + logwrite("Testing Coccinelle SmPL patch: %s" % test_cocci) + elif args.profile_cocci: + logwrite("Profiling Coccinelle SmPL patch: %s" % test_cocci) + sempatches.append(os.path.join(root, f)) + patches.sort() + prefix_len = len(os.path.join(source_dir, patch_src)) + 1 + for pfile in patches: + print_name = pfile[prefix_len:] + # read the patch file + p = patch.fromfile(pfile) + # complain if it's not a patch + if not p: + raise Exception('No patch content found in %s' % print_name) + # leading / seems to be stripped? + if 'dev/null' in p.items[0].source: + raise Exception('Patches creating files are not supported (in %s)' % print_name) + # check if the first file the patch touches exists, if so + # assume the patch needs to be applied -- otherwise continue + patched_file = '/'.join(p.items[0].source.split('/')[1:]) + fullfn = os.path.join(target_dir, patched_file) + if not os.path.exists(fullfn): + if args.verbose: + logwrite("Not applying %s, not needed" % print_name) + continue + if args.verbose: + logwrite("Applying patch %s" % print_name) + + if args.refresh: + # but for refresh, of course look at all files the patch touches + for patchitem in p.items: + patched_file = '/'.join(patchitem.source.split('/')[1:]) + fullfn = os.path.join(target_dir, patched_file) + shutil.copyfile(fullfn, fullfn + '.orig_file') + + process = subprocess.Popen(['patch', '-p1'], stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, stdin=subprocess.PIPE, + close_fds=True, universal_newlines=True, + cwd=target_dir) + output = process.communicate(input=open(pfile, 'r').read())[0] + output = output.split('\n') + if output[-1] == '': + output = output[:-1] + if args.verbose: + for line in output: + logwrite('> %s' % line) + if process.returncode != 0: + if not args.verbose: + logwrite("Failed to apply changes from %s" % print_name) + for line in output: + logwrite('> %s' % line) + raise Exception('Patch failed') + + if args.refresh: + pfilef = open(pfile + '.tmp', 'a') + pfilef.write(p.top_header) + pfilef.flush() + for patchitem in p.items: + patched_file = '/'.join(patchitem.source.split('/')[1:]) + fullfn = os.path.join(target_dir, patched_file) + process = subprocess.Popen(['diff', '-p', '-u', patched_file + '.orig_file', patched_file, + '--label', 'a/' + patched_file, + '--label', 'b/' + patched_file], + stdout=pfilef, close_fds=True, + universal_newlines=True, cwd=target_dir) + process.wait() + os.unlink(fullfn + '.orig_file') + if not process.returncode in (0, 1): + logwrite("Failed to diff to refresh %s" % print_name) + pfilef.close() + os.unlink(pfile + '.tmp') + raise Exception('Refresh failed') + pfilef.close() + os.rename(pfile + '.tmp', pfile) + + # remove orig/rej files that patch sometimes creates + for root, dirs, files in os.walk(target_dir): + for f in files: + if f[-5:] == '.orig' or f[-4:] == '.rej': + os.unlink(os.path.join(root, f)) + git_debug_snapshot(args, "apply %s patch %s" % (desc, print_name)) + + sempatches.sort() + prefix_len = len(os.path.join(source_dir, patch_src)) + 1 + + for cocci_file in sempatches: + # Until Coccinelle picks this up + pycocci = os.path.join(source_dir, 'devel/pycocci') + cmd = [pycocci, cocci_file] + extra_spatch_args = [] + if args.profile_cocci: + cmd.append('--profile-cocci') + cmd.append(os.path.abspath(target_dir)) + print_name = cocci_file[prefix_len:] + if args.verbose: + logwrite("Applying SmPL patch %s" % print_name) + sprocess = subprocess.Popen(cmd, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + close_fds=True, universal_newlines=True, + cwd=target_dir) + output = sprocess.communicate()[0] + sprocess.wait() + if sprocess.returncode != 0: + logwrite("Failed to process SmPL patch %s" % print_name) + raise Exception('SmPL patch failed') + output = output.split('\n') + if output[-1] == '': + output = output[:-1] + if args.verbose: + for line in output: + logwrite('> %s' % line) + + # remove cocci_backup files + for root, dirs, files in os.walk(target_dir): + for f in files: + if f.endswith('.cocci_backup'): + os.unlink(os.path.join(root, f)) + git_debug_snapshot(args, "apply %s SmPL patch %s" % (desc, print_name)) + + if test_cocci and test_cocci_found: + logwrite('Done!') + sys.exit(0) + def _main(): # Our binary requirements go here req = reqs.Req()
@@ -620,141 +763,7 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None, bpcfg.disable_symbols(disable_list) git_debug_snapshot(args, 'Add automatic backports') - test_cocci = args.test_cocci or args.profile_cocci - - logwrite('Apply patches ...') - patches = [] - sempatches = [] - for root, dirs, files in os.walk(os.path.join(source_dir, 'patches')): - for f in files: - if not test_cocci and f.endswith('.patch'): - patches.append(os.path.join(root, f)) - if f.endswith('.cocci'): - if test_cocci: - if f not in test_cocci: - continue - if args.test_cocci: - logwrite("Testing Coccinelle SmPL patch: %s" % test_cocci) - elif args.profile_cocci: - logwrite("Profiling Coccinelle SmPL patch: %s" % test_cocci) - sempatches.append(os.path.join(root, f)) - patches.sort() - prefix_len = len(os.path.join(source_dir, 'patches')) + 1 - for pfile in patches: - print_name = pfile[prefix_len:] - # read the patch file - p = patch.fromfile(pfile) - # complain if it's not a patch - if not p: - raise Exception('No patch content found in %s' % print_name) - # leading / seems to be stripped? - if 'dev/null' in p.items[0].source: - raise Exception('Patches creating files are not supported (in %s)' % print_name) - # check if the first file the patch touches exists, if so - # assume the patch needs to be applied -- otherwise continue - patched_file = '/'.join(p.items[0].source.split('/')[1:]) - fullfn = os.path.join(args.outdir, patched_file) - if not os.path.exists(fullfn): - if args.verbose: - logwrite("Not applying %s, not needed" % print_name) - continue - if args.verbose: - logwrite("Applying patch %s" % print_name) - - if args.refresh: - # but for refresh, of course look at all files the patch touches - for patchitem in p.items: - patched_file = '/'.join(patchitem.source.split('/')[1:]) - fullfn = os.path.join(args.outdir, patched_file) - shutil.copyfile(fullfn, fullfn + '.orig_file') - - process = subprocess.Popen(['patch', '-p1'], stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, stdin=subprocess.PIPE, - close_fds=True, universal_newlines=True, - cwd=args.outdir) - output = process.communicate(input=open(pfile, 'r').read())[0] - output = output.split('\n') - if output[-1] == '': - output = output[:-1] - if args.verbose: - for line in output: - logwrite('> %s' % line) - if process.returncode != 0: - if not args.verbose: - logwrite("Failed to apply changes from %s" % print_name) - for line in output: - logwrite('> %s' % line) - return 2 - - if args.refresh: - pfilef = open(pfile + '.tmp', 'a') - pfilef.write(p.top_header) - pfilef.flush() - for patchitem in p.items: - patched_file = '/'.join(patchitem.source.split('/')[1:]) - fullfn = os.path.join(args.outdir, patched_file) - process = subprocess.Popen(['diff', '-p', '-u', patched_file + '.orig_file', patched_file, - '--label', 'a/' + patched_file, - '--label', 'b/' + patched_file], - stdout=pfilef, close_fds=True, - universal_newlines=True, cwd=args.outdir) - process.wait() - os.unlink(fullfn + '.orig_file') - if not process.returncode in (0, 1): - logwrite("Failed to diff to refresh %s" % print_name) - pfilef.close() - os.unlink(pfile + '.tmp') - return 3 - pfilef.close() - os.rename(pfile + '.tmp', pfile) - - # remove orig/rej files that patch sometimes creates - for root, dirs, files in os.walk(args.outdir): - for f in files: - if f[-5:] == '.orig' or f[-4:] == '.rej': - os.unlink(os.path.join(root, f)) - git_debug_snapshot(args, "apply backport patch %s" % print_name) - - sempatches.sort() - prefix_len = len(os.path.join(source_dir, 'patches')) + 1 - - for cocci_file in sempatches: - # Until Coccinelle picks this up - pycocci = os.path.join(source_dir, 'devel/pycocci') - cmd = [pycocci, cocci_file] - extra_spatch_args = [] - if args.profile_cocci: - cmd.append('--profile-cocci') - cmd.append(os.path.abspath(args.outdir)) - print_name = cocci_file[prefix_len:] - if args.verbose: - logwrite("Applying SmPL patch %s" % print_name) - sprocess = subprocess.Popen(cmd, - stdout=subprocess.PIPE, stderr=subprocess.STDOUT, - close_fds=True, universal_newlines=True, - cwd=args.outdir) - output = sprocess.communicate()[0] - sprocess.wait() - if sprocess.returncode != 0: - logwrite("Failed to process SmPL patch %s" % print_name) - return 3 - output = output.split('\n') - if output[-1] == '': - output = output[:-1] - if args.verbose: - for line in output: - logwrite('> %s' % line) - - # remove cocci_backup files - for root, dirs, files in os.walk(args.outdir): - for f in files: - if f.endswith('.cocci_backup'): - os.unlink(os.path.join(root, f)) - git_debug_snapshot(args, "apply backport SmPL patch %s" % print_name) - - if test_cocci: - logwrite('Done!') - return 0 + apply_patches(args, "backport", source_dir, 'patches', args.outdir, logwrite) # some post-processing is required configtree = kconfig.ConfigTree(os.path.join(args.outdir, 'Kconfig'))
Signature · 1 line
2.1.1
PATCH 2/11 backports: extend module_init() module_exit() for built-in
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
When backports is used we want to identify the provenance of the code used to generate the backport. We do this by simply requiring all used drivers to at leats check in with the backports module which identifies the backport.
We had this in place for modules but not for built-in, add the respective set of helpers for it.
--- backport/backport-include/linux/module.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
backport/backport-include/linux/module.h +25 -0
@@ -25,6 +25,30 @@ extern void backport_dependency_symbol(void); " using backports " BACKPORTS_VERSION);#endif +#ifndef MODULE +/* +* Forcing the backports module to load allows us to easily +* identify the backport. +*/ +#undef module_init +#define module_init (fn) \ + static int __init __init_backport_##fn(void) \ + { \ + backport_dependency_symbol(); \ + return fn(); \ + } \ + __initcall(__init_backport_##fn); + +#undef module_exit +#define module_exit (fn) \ + static void __exit __exit_backport_##fn(void) \ + { \ + fn(); \ + rcu_barrier(); \ + } \ + __exitcall(__exit_backport_##fn); + +#else #undef module_init#define module_init (initfn) \ static int __init __init_backport(void) \
@@ -58,6 +82,7 @@ extern void backport_dependency_symbol(void); rcu_barrier(); \ } \void cleanup_module (void ) __attribute__((alias ("__exit_compat" ))); +#endif #if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,3 ,0 )#undef param_check_bool
Signature · 1 line
2.1.1
Re: [PATCH v1 02/11] backports: extend module_init() module_exit() for built-in
backport/backport-include/linux/module.h extern void backport_dependency_symbol(void); · line 32
Quoted 5 lines · Luis R. Rodriguez
backport/backport-include/linux/module.h +5
-0+#ifndef MODULE +/* +* Forcing the backports module to load allows us to easily +* identify the backport. +*/
That comment is wrong really, making the dependency on the symbol forced the backport module to load but if it's built-in that makes no sense.
backport/backport-include/linux/module.h extern void backport_dependency_symbol(void); · line 37
Quoted 5 lines
backport/backport-include/linux/module.h +5
-0+#undef module_init +#define module_init (fn) \ + static int __init __init_backport_##fn(void) \ + { \ + backport_dependency_symbol(); \
That won't do anything at all after all.
backport/backport-include/linux/module.h extern void backport_dependency_symbol(void); · line 49
Quoted 12 lines
backport/backport-include/linux/module.h +12
-0+return fn (); \ + } \ + __initcall(__init_backport_##fn); + +#undef module_exit +#define module_exit (fn) \ + static void __exit __exit_backport_##fn(void) \ + { \ + fn(); \ + rcu_barrier(); \ + } \ + __exitcall(__exit_backport_##fn);
This is also pointless if it's built-in.
I don't think this patch makes sense, you just want to add the "#ifdef MODULE" I guess.
johannes
PATCH 3/11 backports: allow for different backport prefix
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
The way we backport when packaging is to minimize the amount of changes required by taking advantage of the fact that Kconfig will treat can read CONFIG_ an environment variable with getenv() when parsing menu entries. When doing integration we don't want to do this so instead we'll rely on the CONFIG_BACKPORT prefix. This requires a bit of work on our current parsers.
This adds some initial code for integration, this doesn't run yet. Although adjust_backported_configs() runs when packaging right now this just removes some comments out the top level Kconfig, but leaves the code in place should it later want to consider using CONFIG_BACKPORT prefix and the gains of now allowing to build when a respective symbols is already built in.
As a small enhancement add to each backported local symbol a dependency to require the user's kernel to not have built-in the backported symbols when packaging, this allows to get rid of the checks in checks.h, we make this more generic for all drivers and subsystems we backport now.
--- backport/Kconfig | 6 ++- devel/ckmake | 2 + devel/doc/kconfig-operation | 4 +- gentree.py | 53 ++++++++++++++++++------- lib/kconfig.py | 94 ++++++++++++++++++++++++++++++++++++++++++++- 5 files changed, 140 insertions(+), 19 deletions(-)
backport/Kconfig +5 -1
@@ -14,11 +14,15 @@ config BACKPORTED_KERNEL_NAME source Kconfig.kernel source Kconfig.versions -# some hacks ... +# some hacks for when we use backports to generate a package +# to build modules out of tree. +#ignore-parser-package config WIRELESS def_bool y +#ignore-parser-package config NET_CORE def_bool y +#ignore-parser-package config EXPERT def_bool y
devel/ckmake +2 -0
@@ -165,6 +165,7 @@ def process_kernel(num, kset, cmdline_args): all_config_name = os.path.join(work_dir, 'all.config') all_config = open(all_config_name, 'w') all_config.write("CPTCFG_CFG80211_INTERNAL_REGDB=n\n") + all_config.write("CONFIG_BACKPORT_CFG80211_INTERNAL_REGDB=n\n") config_name = 'allnoconfig' if cmdline_args.allyesconfig: config_name = 'allyesconfig'
@@ -173,6 +174,7 @@ def process_kernel(num, kset, cmdline_args): open(os.path.join(work_dir, 'defconfigs', cmdline_args.defconfig)).read()) else: all_config.write("CPTCFG_BACKPORT_USERSEL_BUILD_ALL=y\n") + all_config.write("CONFIG_BACKPORT_CFG80211_INTERNAL_REGDB=y\n") all_config.close() all_config_env = os.environ.copy()
devel/doc/kconfig-operation +1 -3
@@ -63,7 +63,7 @@ being compiled against is older than X. All together, this allows the correct options to be selected by the user. -There's one more caveat: At backport configuration time, the CONFIG_ +When using Linux backports as a packaged solution the the CONFIG_ environment variable is set to CPTCFG_ ("compat config", but also chosen because it has the same length as CONFIG_). This shows up in the .config file and other places, and in fact in all makefiles and in the code. The
@@ -73,8 +73,6 @@ This allows code to, for example, have "#ifdef CONFIG_PM" which can only be set or cleared in the kernel, not in the backport configuration. Since this is needed, a transformation step is done at backport creation time. - - Backport creation for Kconfig -------------------------------
gentree.py +39 -14
135 lines not on this page · raw message
lib/kconfig.py +93 -1
108 lines not on this page · raw message
Signature · 1 line
2.1.1
Re: [PATCH v1 03/11] backports: allow for different backport prefix
devel/ckmake def process_kernel(num, kset, cmdline_args): · line 168
Quoted 7 lines · Luis R. Rodriguez
devel/ckmake +1
-0@@ -165,6 +165,7 @@ def process_kernel(num, kset, cmdline_args): all_config_name = os.path.join(work_dir, 'all.config') all_config = open(all_config_name, 'w') all_config.write("CPTCFG_CFG80211_INTERNAL_REGDB=n\n") + all_config.write("CONFIG_BACKPORT_CFG80211_INTERNAL_REGDB=n\n")
don't you know the prefix here?
devel/ckmake def process_kernel(num, kset, cmdline_args): · line 178
Quoted 9 lines
devel/ckmake +1
-0config_name = 'allnoconfig' if cmdline_args.allyesconfig: config_name = 'allyesconfig'@@ -173,6 +174,7 @@ def process_kernel(num, kset, cmdline_args): open(os.path.join(work_dir, 'defconfigs', cmdline_args.defconfig)).read()) else: all_config.write("CPTCFG_BACKPORT_USERSEL_BUILD_ALL=y\n") + all_config.write("CONFIG_BACKPORT_CFG80211_INTERNAL_REGDB=y\n") all_config.close()
Not sure this part is right?
johannes
Re: [PATCH v1 03/11] backports: allow for different backport prefix
Quoted 11 lines · Johannes Berg
devel/ckmake def process_kernel(num, kset, cmdline_args): · line 168
Quoted 7 lines · Luis R. Rodriguez
devel/ckmake +1
-0@@ -165,6 +165,7 @@ def process_kernel(num, kset, cmdline_args): all_config_name = os.path.join(work_dir, 'all.config') all_config = open(all_config_name, 'w') all_config.write("CPTCFG_CFG80211_INTERNAL_REGDB=n\n") + all_config.write("CONFIG_BACKPORT_CFG80211_INTERNAL_REGDB=n\n")don't you know the prefix here?
Yeah, good point, for built-in I suppose we'll need something different or if ckmake is extended it would know that too. Dropping this.
Luis
PATCH 4/11 backports: replace BACKPORT_PWD with BACKPORT_DIR
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This will also be used for built-in kernel integration, by using this we can share more code with the built-in kernel approach.
--- backport/Makefile | 6 +++--- backport/Makefile.build | 4 ++-- backport/Makefile.real | 2 +- backport/scripts/uninstall.sh | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-)
backport/Makefile +3 -3
@@ -6,7 +6,7 @@ ifeq ($(KERNELRELEASE),) MAKEFLAGS += --no-print-directory SHELL := /bin/bash -BACKPORT_PWD := $(shell pwd) +BACKPORT_DIR := $(shell pwd) KMODDIR ?= updates ifneq ($(origin KLIB), undefined)
@@ -20,7 +20,7 @@ KERNEL_CONFIG := $(KLIB_BUILD)/.config KERNEL_MAKEFILE := $(KLIB_BUILD)/Makefile CONFIG_MD5 := $(shell md5sum $(KERNEL_CONFIG) 2>/dev/null | sed 's/\s.*//') -export KLIB KLIB_BUILD BACKPORT_PWD KMODDIR KMODPATH_ARG +export KLIB KLIB_BUILD BACKPORT_DIR KMODDIR KMODPATH_ARG # disable built-in rules for this file .SUFFIXES:
@@ -159,5 +159,5 @@ help: defconfig-help @echo "" @echo "Execute "make" or "make all" to build all targets marked with [*]" else -include $(BACKPORT_PWD)/Makefile.kernel +include $(BACKPORT_DIR)/Makefile.kernel endif
backport/Makefile.build +2 -2
@@ -3,8 +3,8 @@ export .PHONY: modules modules: - @$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_PWD) modules + @$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_DIR) modules .PHONY: clean clean: - @$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_PWD) clean + @$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_DIR) clean
backport/Makefile.real +1 -1
@@ -89,7 +89,7 @@ modules: backport-include/backport/autoconf.h .PHONY: install install: modules - @$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_PWD) \ + @$(MAKE) -C $(KLIB_BUILD) M=$(BACKPORT_DIR) \ INSTALL_MOD_DIR=$(KMODDIR) $(KMODPATH_ARG) \ modules_install @./scripts/blacklist.sh $(KLIB)/ $(KLIB)/$(KMODDIR)
backport/scripts/uninstall.sh +2 -2
@@ -10,8 +10,8 @@ else compr="" fi -for driver in $(find ${BACKPORT_PWD} -type f -name *.ko); do - mod_name=${driver/${BACKPORT_PWD}/${KLIB}${KMODDIR}}${compr} +for driver in $(find ${BACKPORT_DIR} -type f -name *.ko); do + mod_name=${driver/${BACKPORT_DIR}/${KLIB}${KMODDIR}}${compr} echo " uninstall" $mod_name rm -f $mod_name done
Signature · 1 line
2.1.1
PATCH 5/11 backports: use BACKPORT_DIR prefix on kconfig sources
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This will allow us to do less work for built-in integration support. This requires a bit of self evaluation of the variable within our kconfig library, ideally we'd have support for groking all variables defined within the Kconfig setup but that requires quite a lot more work as it means also parsing Makefiles and inheriting these definitions within config symbols when used. Since we only define one right now and its used for built-in support we deal with it ourselves for now.
Please consider the complexity of adding others, it doesn't seem like there would be much need for others though. If others wanted to use a different BACKPORT_DIR path other than 'backports' that would require tweaking here, but we'll start by assuming no one will want to do that.
--- backport/Kconfig | 37 ++++++++++++++++++++----------------- lib/kconfig.py | 53 ++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 62 insertions(+), 28 deletions(-)
backport/Kconfig +20 -17
@@ -1,5 +1,8 @@ mainmenu "Linux Backports from $BACKPORTED_KERNEL_NAME $BACKPORTED_KERNEL_VERSION (with backports $BACKPORTS_VERSION)" +config BACKPORT_DIR + string + option env="BACKPORT_DIR" config BACKPORTS_VERSION string option env="BACKPORTS_VERSION"
@@ -11,8 +14,8 @@ config BACKPORTED_KERNEL_NAME option env="BACKPORTED_KERNEL_NAME" # these will be generated -source Kconfig.kernel -source Kconfig.versions +source "$BACKPORT_DIR/Kconfig.kernel" +source "$BACKPORT_DIR/Kconfig.versions" # some hacks for when we use backports to generate a package # to build modules out of tree.
@@ -27,25 +30,25 @@ config EXPERT def_bool y # this has the configuration for the backport code -source compat/Kconfig +source "$BACKPORT_DIR/compat/Kconfig" # these are copied from the kernel -source net/wireless/Kconfig -source net/mac80211/Kconfig -source net/bluetooth/Kconfig -source drivers/net/wireless/Kconfig -source drivers/net/ethernet/Kconfig -source drivers/net/usb/Kconfig +source "$BACKPORT_DIR/net/wireless/Kconfig" +source "$BACKPORT_DIR/net/mac80211/Kconfig" +source "$BACKPORT_DIR/net/bluetooth/Kconfig" +source "$BACKPORT_DIR/drivers/net/wireless/Kconfig" +source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig" +source "$BACKPORT_DIR/drivers/net/usb/Kconfig" -source drivers/ssb/Kconfig -source drivers/bcma/Kconfig +source "$BACKPORT_DIR/drivers/ssb/Kconfig" +source "$BACKPORT_DIR/drivers/bcma/Kconfig" -source net/nfc/Kconfig +source "$BACKPORT_DIR/net/nfc/Kconfig" -source drivers/media/Kconfig +source "$BACKPORT_DIR/drivers/media/Kconfig" -source net/ieee802154/Kconfig -source net/mac802154/Kconfig -source drivers/net/ieee802154/Kconfig +source "$BACKPORT_DIR/net/ieee802154/Kconfig" +source "$BACKPORT_DIR/net/mac802154/Kconfig" +source "$BACKPORT_DIR/drivers/net/ieee802154/Kconfig" -source drivers/usb/class/Kconfig +source "$BACKPORT_DIR/drivers/usb/class/Kconfig"
lib/kconfig.py +42 -11
71 lines not on this page · raw message
Signature · 1 line
2.1.1
PATCH 6/11 backports: update dependencies map file
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
During development of kernel integration support using CONFIG_BACKPORT was evaluated as a prefix over CPTCFG even for packaging backports, for some reason this change lifted some restrictions one some device drivers which was present before and as such requires some changes to the dependencies map file to ensure correct compilation for respective kernel versions.
--- dependencies | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-)
dependencies +23 -8
@@ -16,6 +16,8 @@ USB_GSPCA_OV534 3.5 # we only support on >= 3.4 give that reguatory itself depends # on -EPROBE_DEFER. SOC_CAMERA 3.4 +VIDEO_S5K5BAF 3.4 +VIDEO_S5K4ECGX 3.4 # 49920bc6 and 1003cab8 and while it seems there is a # one to one map DMA_FROM_DEVICE to DMA_DEV_TO_MEM # I can't verify this fully yet.
@@ -29,16 +31,29 @@ DVB_USB_RTL28XXU 3.4 # missing linux/gpio/consumer.h VIDEO_ADV7604 3.13 # missing function clk_prepare_enable(), clk_disable_unprepare() and devm_regulator_bulk_get() -VIDEO_MT9P031 3.3 -VIDEO_MT9T001 3.3 VIDEO_MT9V032 3.3 -VIDEO_NOON010PC30 3.3 -VIDEO_S5K6A3 3.3 VIDEO_S5K6AA 3.3 -VIDEO_S5K5BAF 3.3 -VIDEO_S5K4ECGX 3.3 -VIDEO_M5MOLS 3.3 -VIDEO_S5C73M3 3.3 + +# missing devm_regulator_bulk_get +VIDEO_MT9T001 3.5 +VIDEO_NOON010PC30 3.5 +VIDEO_MT9P031 3.5 + +# missing of_property_read_bool() added via fa4d34cc on v3.4-rc1~71, backport +# that attomically and you can enable this for older kernels. +VIDEO_ADV7343 3.4 + +# for whoever wants to backport this: GPIOF_EXPORT was redefined via commit +# 79a9becd on v3.13-rc1~120^2~15, before this it was redefined via commit +# f567fde2 on v3.5-rc7~32^2~4 and finally added via commit fc3a1f04 on +# v3.5-rc1~93^2~25. We don't address any of these changes yet so we require +# the latest interpretation. +VIDEO_S5K6AA 3.13 +VIDEO_S5K6A3 3.13 + +# missing linux/sizes.h +VIDEO_M5MOLS 3.6 +VIDEO_S5C73M3 3.6 # missing function devm_regmap_init_i2c() VIDEO_LM3646 3.3
Signature · 1 line
2.1.1
PATCH 7/11 backports: split Kconfig into Kconfig.package and Kconfig.sources
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This splits up the Kconfig from things which are needed due to our copy of code from the kernel and things which we need specifically only for packaging backports. We will later then share the Kconfig.souce for instance for kernel integration.
While at it, split up the list of files that we need to copy into what we know could be shared for integration. The the case of backport packaging Kconfig.package will be copied to the package's Kconfig when building the package with gentree.py.
--- backport/Kconfig | 54 ------------------------------------------------ backport/Kconfig.package | 32 ++++++++++++++++++++++++++++ backport/Kconfig.sources | 23 +++++++++++++++++++++ gentree.py | 22 +++++++++++++++++--- 4 files changed, 74 insertions(+), 57 deletions(-) delete mode 100644 backport/Kconfig create mode 100644 backport/Kconfig.package create mode 100644 backport/Kconfig.sources
backport/Kconfig deleted +0 -54
@@ -1,54 +0,0 @@ -mainmenu "Linux Backports from $BACKPORTED_KERNEL_NAME $BACKPORTED_KERNEL_VERSION (with backports $BACKPORTS_VERSION)" - -config BACKPORT_DIR - string - option env="BACKPORT_DIR" -config BACKPORTS_VERSION - string - option env="BACKPORTS_VERSION" -config BACKPORTED_KERNEL_VERSION - string - option env="BACKPORTED_KERNEL_VERSION" -config BACKPORTED_KERNEL_NAME - string - option env="BACKPORTED_KERNEL_NAME" - -# these will be generated -source "$BACKPORT_DIR/Kconfig.kernel" -source "$BACKPORT_DIR/Kconfig.versions" - -# some hacks for when we use backports to generate a package -# to build modules out of tree. -#ignore-parser-package -config WIRELESS - def_bool y -#ignore-parser-package -config NET_CORE - def_bool y -#ignore-parser-package -config EXPERT - def_bool y - -# this has the configuration for the backport code -source "$BACKPORT_DIR/compat/Kconfig" - -# these are copied from the kernel -source "$BACKPORT_DIR/net/wireless/Kconfig" -source "$BACKPORT_DIR/net/mac80211/Kconfig" -source "$BACKPORT_DIR/net/bluetooth/Kconfig" -source "$BACKPORT_DIR/drivers/net/wireless/Kconfig" -source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig" -source "$BACKPORT_DIR/drivers/net/usb/Kconfig" - -source "$BACKPORT_DIR/drivers/ssb/Kconfig" -source "$BACKPORT_DIR/drivers/bcma/Kconfig" - -source "$BACKPORT_DIR/net/nfc/Kconfig" - -source "$BACKPORT_DIR/drivers/media/Kconfig" - -source "$BACKPORT_DIR/net/ieee802154/Kconfig" -source "$BACKPORT_DIR/net/mac802154/Kconfig" -source "$BACKPORT_DIR/drivers/net/ieee802154/Kconfig" - -source "$BACKPORT_DIR/drivers/usb/class/Kconfig"
backport/Kconfig.package new file +32 -0
@@ -0,0 +1,32 @@ +mainmenu "Backports from $BACKPORTED_KERNEL_NAME $BACKPORTED_KERNEL_VERSION (backports $BACKPORTS_VERSION)" + +config BACKPORT_DIR + string + option env="BACKPORT_DIR" +config BACKPORTS_VERSION + string + option env="BACKPORTS_VERSION" +config BACKPORTED_KERNEL_VERSION + string + option env="BACKPORTED_KERNEL_VERSION" +config BACKPORTED_KERNEL_NAME + string + option env="BACKPORTED_KERNEL_NAME" + +# some hacks for when we use backports to generate a package +# to build modules out of tree. +#ignore-parser-package +config WIRELESS + def_bool y +#ignore-parser-package +config NET_CORE + def_bool y +#ignore-parser-package +config EXPERT + def_bool y + +source "$BACKPORT_DIR/Kconfig.sources" + +# these will be generated +source "$BACKPORT_DIR/Kconfig.kernel" +source "$BACKPORT_DIR/Kconfig.versions"
backport/Kconfig.sources new file +23 -0
@@ -0,0 +1,23 @@ +# this has the configuration for the backport code +source "$BACKPORT_DIR/compat/Kconfig" + +# these are copied from the kernel +source "$BACKPORT_DIR/net/wireless/Kconfig" +source "$BACKPORT_DIR/net/mac80211/Kconfig" +source "$BACKPORT_DIR/net/bluetooth/Kconfig" +source "$BACKPORT_DIR/drivers/net/wireless/Kconfig" +source "$BACKPORT_DIR/drivers/net/ethernet/Kconfig" +source "$BACKPORT_DIR/drivers/net/usb/Kconfig" + +source "$BACKPORT_DIR/drivers/ssb/Kconfig" +source "$BACKPORT_DIR/drivers/bcma/Kconfig" + +source "$BACKPORT_DIR/net/nfc/Kconfig" + +source "$BACKPORT_DIR/drivers/media/Kconfig" + +source "$BACKPORT_DIR/net/ieee802154/Kconfig" +source "$BACKPORT_DIR/net/mac802154/Kconfig" +source "$BACKPORT_DIR/drivers/net/ieee802154/Kconfig" + +source "$BACKPORT_DIR/drivers/usb/class/Kconfig"
gentree.py +19 -3
@@ -746,11 +746,27 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None, check_output_dir(args.outdir, args.clean) # do the copy + backport_package_files = [(x, x) for x in [ + 'Makefile', + 'kconf/', + 'Makefile.real', + 'Makefile.kernel', + 'scripts/', + '.blacklist.map', + '.gitignore', + 'Makefile.build'] ] + backport_package_files += [ + ('Kconfig.package', 'Kconfig'), + ] backport_files = [(x, x) for x in [ - 'Kconfig', 'Makefile', 'Makefile.build', 'Makefile.kernel', '.gitignore', - 'Makefile.real', 'compat/', 'backport-include/', 'kconf/', - 'scripts/', '.blacklist.map', + 'Kconfig.sources', + 'compat/', + 'backport-include/', ]] + + if not integrate: + backport_files += backport_package_files + if not args.git_revision: logwrite('Copy original source files ...') else:
Signature · 1 line
2.1.1
PATCH 8/11 backports: move version file generation to run earlier
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
The version file contains:
* BACKPORTS_VERSION
* BACKPORTED_KERNEL_VERSION
* BACKPORTED_KERNEL_NAME
This file is used by the Makefile to export variable definitions used to identify the backport. For kernel integration we'll be using a generated Kconfig file instead and since these are needed when processing kconfig logic this will need to be defined earlier.
Just move the generation of the version file for packaging up early to match where we will generate the Kconfig with the backports versioning identification.
This change has no real functional change other than the move of some code running earlier.
--- gentree.py | 50 ++++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-)
gentree.py +26 -24
@@ -789,6 +789,25 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None, git_debug_snapshot(args, 'Add driver sources') + if git_tracked_version: + backports_version = "(see git)" + kernel_version = "(see git)" + else: + backports_version = git.describe(tree=source_dir, extra_args=['--long']) + kernel_version = git.describe(rev=args.git_revision or 'HEAD', + tree=args.kerneldir, + extra_args=['--long']) + + if not integrate: + f = open(os.path.join(args.outdir, 'versions'), 'w') + f.write('BACKPORTS_VERSION="%s"\n' % backports_version) + f.write('BACKPORTED_KERNEL_VERSION="%s"\n' % kernel_version) + f.write('BACKPORTED_KERNEL_NAME="%s"\n' % args.base_name) + if git_tracked_version: + f.write('BACKPORTS_GIT_TRACKED="backport tracker ID: $(shell git rev-parse HEAD 2>/dev/null || echo \'not built in git tree\')"\n') + f.close() + git_debug_snapshot(args, "generate kernel version info file: version") + disable_list = add_automatic_backports(args, bp_prefix) if disable_list: bpcfg = kconfig.ConfigTree(os.path.join(args.outdir, 'compat', 'Kconfig'))
@@ -815,32 +834,15 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None, configtree.modify_selects() git_debug_snapshot(args, "convert select to depends on") - # write the versioning file - if git_tracked_version: - backports_version = "(see git)" - kernel_version = "(see git)" - else: - backports_version = git.describe(tree=source_dir, extra_args=['--long']) - kernel_version = git.describe(rev=args.git_revision or 'HEAD', - tree=args.kerneldir, - extra_args=['--long']) - f = open(os.path.join(args.outdir, 'versions'), 'w') - f.write('BACKPORTS_VERSION="%s"\n' % backports_version) - f.write('BACKPORTED_KERNEL_VERSION="%s"\n' % kernel_version) - f.write('BACKPORTED_KERNEL_NAME="%s"\n' % args.base_name) - if git_tracked_version: - f.write('BACKPORTS_GIT_TRACKED="backport tracker ID: $(shell git rev-parse HEAD 2>/dev/null || echo \'not built in git tree\')"\n') - f.close() - symbols = configtree.symbols() - # write local symbol list -- needed during build - f = open(os.path.join(args.outdir, '.local-symbols'), 'w') - for sym in symbols: - f.write('%s=\n' % sym) - f.close() - - git_debug_snapshot(args, "add versions/symbols files") + if not integrate: + # write local symbol list -- needed during build + f = open(os.path.join(args.outdir, '.local-symbols'), 'w') + for sym in symbols: + f.write('%s=\n' % sym) + f.close() + git_debug_snapshot(args, "add symbols files") # add defconfigs that we want defconfigs_dir = os.path.join(source_dir, 'backport', 'defconfigs')
Signature · 1 line
2.1.1
PATCH 9/11 backports: use Kconfig for backport version information
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
Instead of relying on Makefile hacks just use Kconfig for defining the variables needed. We can do this since these variables are all known at packaging time. The exception is BACKPORTS_GIT_TRACKED, but for that we can define a kconfig variable which only if set will we rely on the environment for picking it up and later exporting it through Kconfig. Since Kconfig doesn't keep config variables defined with option env we use a secondary config entry for that.
With this we can remove all those extra defines and we can rely on CPTCFG_ variables as typically expected in our backport kernel code.
--- backport/Kconfig.package | 25 ++++++++++++++++--- backport/Makefile.kernel | 4 --- backport/Makefile.real | 10 ++++---- backport/backport-include/linux/module.h | 6 ++--- backport/compat/main.c | 42 ++++++++++++++++---------------- gentree.py | 30 ++++++++++++++++------- 6 files changed, 71 insertions(+), 46 deletions(-)
backport/Kconfig.package +21 -4
@@ -1,17 +1,34 @@ -mainmenu "Backports from $BACKPORTED_KERNEL_NAME $BACKPORTED_KERNEL_VERSION (backports $BACKPORTS_VERSION)" +mainmenu "Backports from %%BACKPORTED_KERNEL_NAME%% %%BACKPORTED_KERNEL_VERSION%% (backports %%BACKPORTS_VERSION%%)" config BACKPORT_DIR string option env="BACKPORT_DIR" + config BACKPORTS_VERSION string - option env="BACKPORTS_VERSION" + default "%%BACKPORTS_VERSION%%" + config BACKPORTED_KERNEL_VERSION string - option env="BACKPORTED_KERNEL_VERSION" + default "%%BACKPORTED_KERNEL_VERSION%%" + config BACKPORTED_KERNEL_NAME string - option env="BACKPORTED_KERNEL_NAME" + default "%%BACKPORTED_KERNEL_NAME%%" + +config BACKPORT_IS_GIT_TRACKED + def_bool %%BACKPORT_IS_GIT_TRACKED%% + +if BACKPORT_IS_GIT_TRACKED +config __BACKPORT_GIT_TRACKED + string + option env="__BACKPORT_GIT_TRACKED" + +# The option env isn't sticky on .config / autoconf, so we need this +config BACKPORTS_GIT_TRACKED + string + default $__BACKPORT_GIT_TRACKED +endif # BACKPORT_IS_GIT_TRACKED # some hacks for when we use backports to generate a package # to build modules out of tree.
backport/Makefile.kernel +0 -4
@@ -10,10 +10,6 @@ NOSTDINC_FLAGS := \ -I$(M)/include/uapi \ -include $(M)/backport-include/backport/backport.h \ $(call backport-cc-disable-warning, unused-but-set-variable) \ - -DBACKPORTS_VERSION=\"$(BACKPORTS_VERSION)\" \ - -DBACKPORTED_KERNEL_VERSION=\"$(BACKPORTED_KERNEL_VERSION)\" \ - -DBACKPORTED_KERNEL_NAME=\"$(BACKPORTED_KERNEL_NAME)\" \ - $(BACKPORTS_GIT_TRACKER_DEF) \ $(CFLAGS) export backport_srctree = $(M)
backport/Makefile.real +5 -5
@@ -1,9 +1,9 @@ -include versions -export BACKPORTS_VERSION BACKPORTED_KERNEL_VERSION BACKPORTED_KERNEL_NAME -ifdef BACKPORTS_GIT_TRACKED -export BACKPORTS_GIT_TRACKER_DEF=-DBACKPORTS_GIT_TRACKED=\"$(BACKPORTS_GIT_TRACKED)\" +ifeq ($(CPTCFG_BACKPORT_IS_GIT_TRACKED),y) +export __BACKPORT_GIT_TRACKED="backport tracker ID: $(shell git rev-parse HEAD 2>/dev/null || echo \'not built in git tree\')" else -export BACKPORTS_GIT_TRACKER_DEF= +# Technically not required but Kconfig will complain otherwise for +# undefined option env even if your kconfig environment does not need it +export __BACKPORT_GIT_TRACKED="not built in git tree" endif # disable built-in rules for this file
backport/backport-include/linux/module.h +3 -3
@@ -20,9 +20,9 @@ extern void backport_dependency_symbol(void);#define BACKPORT_MOD_VERSIONS MODULE_VERSION(BACKPORTS_GIT_TRACKED);#else #define BACKPORT_MOD_VERSIONS \ - MODULE_VERSION("backported from " BACKPORTED_KERNEL_NAME \ - " (" BACKPORTED_KERNEL_VERSION ")" \ - " using backports " BACKPORTS_VERSION); + MODULE_VERSION("backported from " CPTCFG_BACKPORTED_KERNEL_NAME \ + " (" CPTCFG_BACKPORTED_KERNEL_VERSION ")" \ + " using backports " CPTCFG_BACKPORTS_VERSION);#endif #ifndef MODULE
backport/compat/main.c +21 -21
76 lines not on this page · raw message
gentree.py +21 -9
@@ -798,15 +798,27 @@ def process(kerneldir, outdir, copy_list_file, git_revision=None, tree=args.kerneldir, extra_args=['--long']) - if not integrate: - f = open(os.path.join(args.outdir, 'versions'), 'w') - f.write('BACKPORTS_VERSION="%s"\n' % backports_version) - f.write('BACKPORTED_KERNEL_VERSION="%s"\n' % kernel_version) - f.write('BACKPORTED_KERNEL_NAME="%s"\n' % args.base_name) - if git_tracked_version: - f.write('BACKPORTS_GIT_TRACKED="backport tracker ID: $(shell git rev-parse HEAD 2>/dev/null || echo \'not built in git tree\')"\n') - f.close() - git_debug_snapshot(args, "generate kernel version info file: version") + is_git_tracked_version = 'n' + if git_tracked_version: + git_tracked_version = 'y' + kconf_regexes = [ + (re.compile(r'.*(?P<key>%%BACKPORT_DIR%%)'), '%%BACKPORT_DIR%%', 'backports/'), + (re.compile(r'.*(?P<key>%%BACKPORTS_VERSION%%).*'), '%%BACKPORTS_VERSION%%', backports_version), + (re.compile(r'.*(?P<key>%%BACKPORTED_KERNEL_VERSION%%).*'), '%%BACKPORTED_KERNEL_VERSION%%', kernel_version), + (re.compile(r'.*(?P<key>%%BACKPORTED_KERNEL_NAME%%).*'), '%%BACKPORTED_KERNEL_NAME%%', args.base_name), + (re.compile(r'.*(?P<key>%%BACKPORT_IS_GIT_TRACKED%%).*'), '%%BACKPORT_IS_GIT_TRACKED%%', is_git_tracked_version), + ] + out = '' + for l in open(os.path.join(args.outdir, 'Kconfig'), 'r'): + for r in kconf_regexes: + m = r[0].match(l) + if m: + l = re.sub(r'(' + r[1] + ')', r'' + r[2] + '', l) + out += l + outf = open(os.path.join(args.outdir, 'Kconfig'), 'w') + outf.write(out) + outf.close() + git_debug_snapshot(args, "modify top level backports/Kconfig with backports identity") disable_list = add_automatic_backports(args, bp_prefix) if disable_list:
Signature · 1 line
2.1.1
Re: [PATCH v1 09/11] backports: use Kconfig for backport version information
Quoted 10 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
Instead of relying on
Makefilehacks just useKconfigfor defining the variables needed. We can do this since these variables are all known at packaging time. The exception isBACKPORTS_GIT_TRACKED, but for that we can define a kconfig variable which only if set will we rely on the environment for picking it up and later exporting it throughKconfig. SinceKconfigdoesn't keep config variables defined with option env we use a secondary config entry for that.
I'd prefer you didn't do this. When we track the backports in a git tree this will mean constant changes to these files, where currently the changes are constrained to just the "versions" file.
johannes
Re: [PATCH v1 09/11] backports: use Kconfig for backport version information
Quoted 12 lines · Johannes Berg
Quoted 10 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
Instead of relying on
Makefilehacks just useKconfigfor defining the variables needed. We can do this since these variables are all known at packaging time. The exception isBACKPORTS_GIT_TRACKED, but for that we can define a kconfig variable which only if set will we rely on the environment for picking it up and later exporting it throughKconfig. SinceKconfigdoesn't keep config variables defined with option env we use a secondary config entry for that.
Quoted 3 lines
I'd prefer you didn't do this. When we track the backports in a git tree this will mean constant changes to these files, where currently the changes are constrained to just the "versions" file.
OK.
Luis
Re: [PATCH v1 09/11] backports: use Kconfig for backport version information
In reply to Johannes BergQuoted 12 lines · Johannes Berg
Quoted 10 lines · Luis R. Rodriguez
From: "Luis R. Rodriguez" <[email protected]>
Instead of relying on
Makefilehacks just useKconfigfor defining the variables needed. We can do this since these variables are all known at packaging time. The exception isBACKPORTS_GIT_TRACKED, but for that we can define a kconfig variable which only if set will we rely on the environment for picking it up and later exporting it throughKconfig. SinceKconfigdoesn't keep config variables defined with option env we use a secondary config entry for that.
Quoted 3 lines
I'd prefer you didn't do this. When we track the backports in a git tree this will mean constant changes to these files, where currently the changes are constrained to just the "versions" file.
I wanted to at least unify the C code defines for the shared versioning information, I've come up with a way that minimizes the changes to the existing packaging stuff, will send in my respin. Hopefully that's OK.
Luis
PATCH 10/11 backports: prefix c-file / h-file auto backport with BPAUTO
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
Things we backport are now prefixed with BACKPORT_, when we copy over libraries with the c-files / h-files trick on the compat/Kconfig trick we prefix these with BACKPORT_ already so in order to help distinguish them use BACKPORT_BPAUTO_ for them and prevent a double BACKPORT_ prefix.
--- backport/backport-include/asm/dma-mapping.h | 4 +- backport/backport-include/backport/leds-disabled.h | 2 +- backport/compat/Kconfig | 80 +++++++++++----------- backport/compat/Makefile | 4 +- backport/compat/backports.h | 4 +- gentree.py | 12 +++- lib/kconfig.py | 4 +- patches/backport-adjustments/devcoredump.patch | 4 +- 8 files changed, 61 insertions(+), 53 deletions(-)
backport/backport-include/asm/dma-mapping.h +2 -2
@@ -3,12 +3,12 @@#include_next <asm/dma-mapping.h>#include <linux/version.h> -#if defined(CPTCFG_BACKPORT_BUILD_DMA_SHARED_HELPERS ) +#if defined(CPTCFG_BPAUTO_BUILD_DMA_SHARED_HELPERS )#define dma_common_get_sgtable LINUX_BACKPORT(dma_common_get_sgtable)int dma_common_get_sgtable (struct device *dev,struct sg_table *sgt,void *cpu_addr,dma_addr_t dma_addr,size_t size); -#endif /* defined(CPTCFG_BACKPORT_BUILD_DMA_SHARED_HELPERS) */ +#endif /* defined(CPTCFG_BPAUTO_BUILD_DMA_SHARED_HELPERS) */ #if LINUX_VERSION_CODE <KERNEL_VERSION (3 ,6 ,0 )
backport/backport-include/backport/leds-disabled.h +1 -1
@@ -8,7 +8,7 @@* allows compilation. */ -#ifdef CPTCFG_BACKPORT_BUILD_LEDS +#ifdef CPTCFG_BPAUTO_BUILD_LEDS #include <linux/list.h> #include <linux/spinlock.h> #include <linux/rwsem.h>
backport/compat/Kconfig +40 -40
170 lines not on this page · raw message
backport/compat/Makefile +2 -2
@@ -21,5 +21,5 @@ compat-$(CPTCFG_BACKPORT_KERNEL_3_15) += backport-3.15.o compat-$(CPTCFG_BACKPORT_KERNEL_3_17) += backport-3.17.o compat-$(CPTCFG_BACKPORT_KERNEL_3_18) += backport-3.18.o -compat-$(CPTCFG_BACKPORT_BUILD_CRYPTO_CCM) += crypto-ccm.o -compat-$(CPTCFG_BACKPORT_BUILD_DMA_SHARED_HELPERS) += dma-shared-helpers.o +compat-$(CPTCFG_BPAUTO_BUILD_CRYPTO_CCM) += crypto-ccm.o +compat-$(CPTCFG_BPAUTO_BUILD_DMA_SHARED_HELPERS) += dma-shared-helpers.o
backport/compat/backports.h +2 -2
@@ -3,7 +3,7 @@#include <linux/version.h> -#ifdef CPTCFG_BACKPORT_BUILD_CRYPTO_CCM +#ifdef CPTCFG_BPAUTO_BUILD_CRYPTO_CCM int crypto_ccm_module_init (void );void crypto_ccm_module_exit (void );#else
@@ -13,7 +13,7 @@ static inline void crypto_ccm_module_exit(void) {}#endif -#ifdef CPTCFG_BACKPORT_BUILD_WANT_DEV_COREDUMP +#ifdef CPTCFG_BPAUTO_WANT_DEV_COREDUMP int devcoredump_init (void );void devcoredump_exit (void );#else
gentree.py +9 -3
@@ -205,7 +205,7 @@ def add_automatic_backports(args, bp_prefix): configtree = kconfig.ConfigTree(os.path.join(args.outdir, 'Kconfig')) all_selects = configtree.all_selects() for sym, vals in bpi.items(): - if sym.startswith('BACKPORT_BUILD_'): + if sym.startswith('BPAUTO_BUILD_'): if not sym[15:] in all_selects: disable_list.append(sym) continue
@@ -231,9 +231,15 @@ def add_automatic_backports(args, bp_prefix): raise Exception('backporting a module requires a #module-name') for of in o_files: mf.write('%s-objs += %s\n' % (module_name, of)) - mf.write('obj-$(%s%s) += %s.o\n' % (bp_prefix, sym, module_name)) + if bp_prefix not in sym: + mf.write('obj-$(%s%s) += %s.o\n' % (bp_prefix, sym, module_name)) + else: + mf.write('obj-$(%s) += %s.o\n' % (sym, module_name)) elif symtype == 'bool': - mf.write('compat-$(%s%s) += %s\n' % (bp_prefix, sym, ' '.join(o_files))) + if bp_prefix not in sym: + mf.write('compat-$(%s%s) += %s\n' % (bp_prefix, sym, ' '.join(o_files))) + else: + mf.write('compat-$(%s) += %s\n' % (sym, ' '.join(o_files))) # finally create the include file syms = []
lib/kconfig.py +3 -1
@@ -93,7 +93,9 @@ class ConfigTree(object): prefix = re.sub(r'^CONFIG_(.*)', r'\1', bp_prefix) for sym in orig_symbols: if sym in l: - return re.sub(r' (' + sym + ')', r' ' + prefix + '\1', l) + if prefix not in sym: + return re.sub(r' (' + sym + ')', r' ' + prefix + '\\1', l) + return l return l def adjust_backported_configs(self, integrate, orig_symbols, bp_prefix):
patches/backport-adjustments/devcoredump.patch +2 -2
@@ -107,7 +107,7 @@ index c0a360e99f64..da20e61f6c06 100644 #include <linux/vmalloc.h> -#ifdef CONFIG_DEV_COREDUMP -+#ifdef CPTCFG_BACKPORT_BUILD_WANT_DEV_COREDUMP ++#ifdef CPTCFG_BPAUTO_WANT_DEV_COREDUMP void dev_coredumpv(struct device *dev, const void *data, size_t datalen, gfp_t gfp);
@@ -116,6 +116,6 @@ index c0a360e99f64..da20e61f6c06 100644 free(data); } -#endif /* CONFIG_DEV_COREDUMP */ -+#endif /* CPTCFG_BACKPORT_BUILD_WANT_DEV_COREDUMP */ ++#endif /* CPTCFG_BPAUTO_WANT_DEV_COREDUMP */ #endif /* __DEVCOREDUMP_H */
Signature · 1 line
2.1.1
Re: [PATCH v1 10/11] backports: prefix c-file / h-file auto backport with BPAUTO
gentree.py def add_automatic_backports(args, bp_prefix): · line 242
Quoted 5 lines · Luis R. Rodriguez
gentree.py +4
-1- mf.write('compat-$(%s%s) += %s\n' % (bp_prefix, sym, ' '.join(o_files))) + if bp_prefix not in sym: + mf.write('compat-$(%s%s) += %s\n' % (bp_prefix, sym, ' '.join(o_files))) + else: + mf.write('compat-$(%s) += %s\n' % (sym, ' '.join(o_files)))
I don't think these changes are correct, the bp_prefix is needed anyway, and there's no way it could already be. Looks like this comes from a previous attempt where you misunderstood and thought CONFIG_BACKPORT_BACKPORT_... was actually wrong, when in fact it is correct (and would now be CONFIG_BACKPORT_BPAUTO_...)
johannes
Re: [PATCH v1 10/11] backports: prefix c-file / h-file auto backport with BPAUTO
Quoted 8 lines · Johannes Berg
gentree.py def add_automatic_backports(args, bp_prefix): · line 242
Quoted 5 lines · Luis R. Rodriguez
gentree.py +4
-1- mf.write('compat-$(%s%s) += %s\n' % (bp_prefix, sym, ' '.join(o_files))) + if bp_prefix not in sym: + mf.write('compat-$(%s%s) += %s\n' % (bp_prefix, sym, ' '.join(o_files))) + else: + mf.write('compat-$(%s) += %s\n' % (sym, ' '.join(o_files)))
Quoted 5 lines
I don't think these changes are correct, the
bp_prefixis needed anyway, and there's no way it could already be. Looks like this comes from a previous attempt where you misunderstood and thoughtCONFIG_BACKPORT_BACKPORT_... was actually wrong, when in fact it is correct (and would now beCONFIG_BACKPORT_BPAUTO_...)
I did at one point have BACKPORT_BPAUTO_* stuff on the compat/Kconfig for the auto stuff but figured that was superfluous. I'll respin with it.
Luis
Re: [PATCH v1 10/11] backports: prefix c-file / h-file auto backport with BPAUTO
Quoted 9 lines · Luis R. Rodriguez
Quoted 8 lines · Johannes Berg
Quoted 5 lines · Luis R. Rodriguez
gentree.py +4
-1- mf.write('compat-$(%s%s) += %s\n' % (bp_prefix, sym, ' '.join(o_files))) + if bp_prefix not in sym: + mf.write('compat-$(%s%s) += %s\n' % (bp_prefix, sym, ' '.join(o_files))) + else: + mf.write('compat-$(%s) += %s\n' % (sym, ' '.join(o_files)))
Quoted 8 lines
Quoted 5 lines
I don't think these changes are correct, the
bp_prefixis needed anyway, and there's no way it could already be. Looks like this comes from a previous attempt where you misunderstood and thoughtCONFIG_BACKPORT_BACKPORT_... was actually wrong, when in fact it is correct (and would now beCONFIG_BACKPORT_BPAUTO_...)I did at one point have BACKPORT_BPAUTO_* stuff on the compat/Kconfig for the auto stuff but figured that was superfluous. I'll respin with it.
Not sure what you mean? It seems to me you should just drop the changes like the one I quoted above.
johannes
Re: [PATCH v1 10/11] backports: prefix c-file / h-file auto backport with BPAUTO
Quoted 16 lines · Johannes Berg
Quoted 15 lines · Luis R. Rodriguez
Quoted 13 lines · Johannes Berg
gentree.py def add_automatic_backports(args, bp_prefix): · line 242
Quoted 5 lines · Luis R. Rodriguez
gentree.py +4
-1- mf.write('compat-$(%s%s) += %s\n' % (bp_prefix, sym, ' '.join(o_files))) + if bp_prefix not in sym: + mf.write('compat-$(%s%s) += %s\n' % (bp_prefix, sym, ' '.join(o_files))) + else: + mf.write('compat-$(%s) += %s\n' % (sym, ' '.join(o_files)))I don't think these changes are correct, the
bp_prefixis needed anyway, and there's no way it could already be. Looks like this comes from a previous attempt where you misunderstood and thoughtCONFIG_BACKPORT_BACKPORT_... was actually wrong, when in fact it is correct (and would now beCONFIG_BACKPORT_BPAUTO_...)
Quoted 5 lines
Quoted 2 lines
I did at one point have BACKPORT_BPAUTO_* stuff on the compat/Kconfig for the auto stuff but figured that was superfluous. I'll respin with it.
Not sure what you mean? It seems to me you should just drop the changes like the one I quoted above.
If we keep BACKPORT_BPAUTO as prefix on compat/Kconfig for auto backport stuff we'll end up with BACKPORT_BACKPORT_BPAUTO, while technically correct as you have pointed out, I find it personally superfluous. If we however only use BPAUTO_ prefix on the compat/Kconfig we'll end up with BACKPORT_BPAUTO. Its subjective then, but I was opting in to prefer to just keep BPAUTO_ prefix with the resulting CPTCFG_BPAUTO for packaging and CONFIG_BACKPORT_BPAUTO for integration for these, if you however feel its best to double the BACKPORT prefix that's fine too, it just seemed odd (although I realize correct).
To do what I just described I think you're right will try removing that, testing that now. The other case that I ran into issues was the backport versioning variables but I have solved that through other non intrusive means to packaging (just use the C define with CPTCFG_ prefix, keeping the original Makefile variables) which will be part of my next respin.
We still do need to decide if we want double BACKPORT_ prefix for BPAUTO though, that remains subjective and I don't feel strongly about any way we go.
Luis
Re: [PATCH v1 10/11] backports: prefix c-file / h-file auto backport with BPAUTO
Quoted 10 lines · Luis R. Rodriguez
Quoted 5 lines
Quoted 2 lines
I did at one point have BACKPORT_BPAUTO_* stuff on the compat/Kconfig for the auto stuff but figured that was superfluous. I'll respin with it.
Not sure what you mean? It seems to me you should just drop the changes like the one I quoted above.
If we keep
BACKPORT_BPAUTOas prefix on compat/Kconfig for auto backport stuff we'll end up withBACKPORT_BACKPORT_BPAUTO, while technically correct as you have pointed out, I find it personally superfluous. If we however only useBPAUTO_prefix on the compat/Kconfig we'll end up withBACKPORT_BPAUTO.
Correct.
Quoted 4 lines
Its subjective then, but I was opting in to prefer to just keep
BPAUTO_prefix with the resultingCPTCFG_BPAUTOfor packaging andCONFIG_BACKPORT_BPAUTOfor integration for these, if you however feel its best to double the BACKPORT prefix that's fine too, it just seemed odd (although I realize correct).
No, I'm perfectly happy with CPTCFG_BPAUTO. But the *code* changes you're making here that check whether bp_prefix is being duplicated aren't necessary for that, and are in fact confusing and dangerous.
johannes
Re: [PATCH v1 10/11] backports: prefix c-file / h-file auto backport with BPAUTO
Quoted 13 lines · Johannes Berg
Quoted 10 lines · Luis R. Rodriguez
Quoted 5 lines
Quoted 2 lines
I did at one point have BACKPORT_BPAUTO_* stuff on the compat/Kconfig for the auto stuff but figured that was superfluous. I'll respin with it.
Not sure what you mean? It seems to me you should just drop the changes like the one I quoted above.
If we keep
BACKPORT_BPAUTOas prefix on compat/Kconfig for auto backport stuff we'll end up withBACKPORT_BACKPORT_BPAUTO, while technically correct as you have pointed out, I find it personally superfluous. If we however only useBPAUTO_prefix on the compat/Kconfig we'll end up withBACKPORT_BPAUTO.
Quoted 8 lines
Correct.
Quoted 4 lines
Its subjective then, but I was opting in to prefer to just keep
BPAUTO_prefix with the resultingCPTCFG_BPAUTOfor packaging andCONFIG_BACKPORT_BPAUTOfor integration for these, if you however feel its best to double the BACKPORT prefix that's fine too, it just seemed odd (although I realize correct).No, I'm perfectly happy with
CPTCFG_BPAUTO.
OK cool.
Quoted 3 lines
But the *code* changes
you're making here that check whetherbp_prefixis being duplicated aren't necessary for that, and are in fact confusing and dangerous.
Understood, thanks for the review, hopefully this is addressed with the latest series.
Luis
Re: [PATCH v1 10/11] backports: prefix c-file / h-file auto backport with BPAUTO
Quoted 6 lines · Luis R. Rodriguez
Quoted 3 lines
But the *code* changes
you're making here that check whetherbp_prefixis being duplicated aren't necessary for that, and are in fact confusing and dangerous.Understood, thanks for the review, hopefully this is addressed with the latest series.
Actually, maybe you wanted these changes because you didn't want to end up with CONFIG_BACKPORT_BPAUTO_ for integration? I think that's a small price to pay though for code complexity trade-off, IMHO you should accept CONFIG_BACKPORT_BPAUTO_ and remove the code changes.
johannes
Re: [PATCH v1 10/11] backports: prefix c-file / h-file auto backport with BPAUTO
Quoted 6 lines · Johannes Berg
Quoted 4 lines · Luis R. Rodriguez
Quoted 3 lines
But the *code* changes
you're making here that check whetherbp_prefixis being duplicated aren't necessary for that, and are in fact confusing and dangerous.
Quoted 7 lines
Quoted 2 lines
Understood, thanks for the review, hopefully this is addressed with the latest series.
Actually, maybe you wanted these changes because you didn't want to end up with
CONFIG_BACKPORT_BPAUTO_for integration? I think that's a small price to pay though for code complexity trade-off, IMHO you should acceptCONFIG_BACKPORT_BPAUTO_and remove the code changes.
Quite the contrary, I did this to get CONFIG_BACKPORT_BPAUTO_ and not CONFIG_BACKPORT_BACKPORT_. So right now I do get CONFIG_BACKPORT_BPAUTO_ for integration (with the v2 patch series).
Luis
PATCH 11/11 backports: add full kernel integration support
In reply to Luis R. RodriguezFrom: "Luis R. Rodriguez" <[email protected]>
This enables support for using the backports project to integrate device drivers from a future version of Linux into an older version of Linux. What you end up seeing is a backports submenu when configuring your kernel and the ability to select specific device drivers from subsystems supported through the Linux backports project.
At this time enabling one device driver from a future version of Linux will require using only the latest version of the subsystem modules and other subsystem drivers. For example enabling cfg80211 and mac80211 from a future version of Linux will require you to only use future version of the respective device drivers. In order to enable the backported version of 802.11 drivers for example, you will have to enable first:
Networking support -->
Wireless -->
But under that menu disable all options, then jump to the backports submenu to now enable:
Backports -->
cfg80211
mac80211
Wireless LAN --->
etc
You build these device drivers modular or built-in to the kernel. Integration support requires only slight modifications to the original kernel sources, one to the top level Kconfig to add our entry, and also the top level Makefile to enable backports code to be part of the built-in vmlinux.
Support for integration takes advantage over the existing infrastructure added by Johannes to keep track of each indvidual change done by the backports infrastructure if --gitdebug is used.
1 3.0.101 [ OK ] 2 3.1.10 [ OK ] 3 3.2.62 [ OK ] 4 3.3.8 [ OK ] 5 3.4.104 [ OK ] 6 3.5.7 [ OK ] 7 3.6.11 [ OK ] 8 3.7.10 [ OK ] 9 3.8.13 [ OK ] 10 3.9.11 [ OK ] 11 3.10.58 [ OK ] 12 3.11.10 [ OK ] 13 3.12.31 [ OK ] 14 3.13.11 [ OK ] 15 3.14.22 [ OK ] 16 3.15.10 [ OK ] 17 3.16.6 [ OK ] 18 3.17.1 [ OK ] 19 3.18-rc1 [ OK ]
real 3m17.573s user 67m33.172s sys 18m27.596s
--- backport/Kconfig.integrate | 36 +++++++++++ backport/Makefile.kernel | 13 ++++ backport/backport-include/backport/backport.h | 5 ++ backport/compat/Makefile | 4 ++ backport/compat/main.c | 8 ++- devel/doc/kconfig-operation | 5 ++ gentree.py | 73 +++++++++++++++++++--- .../0001-enable-backports-built-in.patch | 40 ++++++++++++ lib/bpversion.py | 48 ++++++++++++++ lib/kconfig.py | 10 +++ 10 files changed, 233 insertions(+), 9 deletions(-) create mode 100644 backport/Kconfig.integrate create mode 100644 integration-patches/0001-enable-backports/0001-enable-backports-built-in.patch create mode 100644 lib/bpversion.py
backport/Kconfig.integrate new file +36 -0
@@ -0,0 +1,36 @@ +config BACKPORT_INTEGRATE + bool + def_bool y + +config BACKPORT_DIR + string + default "%%BACKPORT_DIR%%" + +config BACKPORTS_VERSION + string + default "%%BACKPORTS_VERSION%%" + +config BACKPORTED_KERNEL_VERSION + string + default "%%BACKPORTED_KERNEL_VERSION%%" + +config BACKPORTED_KERNEL_NAME + string + default "%%BACKPORTED_KERNEL_NAME%%" + +menuconfig BACKPORT_LINUX + bool "Backport %%BACKPORTED_KERNEL_NAME%% %%BACKPORTED_KERNEL_VERSION%% (backports %%BACKPORTS_VERSION%%)" + default n + ---help--- + Enabling this will let give you the opportunity to use features and + drivers backported from %%BACKPORTED_KERNEL_NAME%% %%BACKPORTED_KERNEL_VERSION%% + on the kernel your are using. This is experimental and you should + say no unless you'd like to help test things or want to help debug + this should we run into any issues. + +if BACKPORT_LINUX + +source "$BACKPORT_DIR/Kconfig.versions" +source "$BACKPORT_DIR/Kconfig.sources" + +endif # BACKPORT_LINUX
backport/Makefile.kernel +13 -0
@@ -1,3 +1,4 @@ +ifeq ($(CONFIG_BACKPORT_INTEGRATE),) # Since 2.6.21, try-run is available, but cc-disable-warning # was only added later, so we add it here ourselves: backport-cc-disable-warning = $(call try-run,\
@@ -13,6 +14,18 @@ NOSTDINC_FLAGS := \ $(CFLAGS) export backport_srctree = $(M) +else +export BACKPORT_DIR = backports/ +export backport_srctree = $(BACKPORT_DIR) +NOSTDINC_FLAGS := \ + -I$(BACKPORT_DIR)/backport-include/ \ + -I$(BACKPORT_DIR)/backport-include/uapi \ + -I$(BACKPORT_DIR)/include/ \ + -I$(BACKPORT_DIR)/include/uapi \ + -include $(BACKPORT_DIR)/backport-include/backport/backport.h \ + $(CFLAGS) +endif + obj-y += compat/
backport/backport-include/backport/backport.h +5 -0
@@ -1,11 +1,16 @@#ifndef __BACKPORT_H#define __BACKPORT_H +#include <generated/autoconf.h> +#ifndef CONFIG_BACKPORT_INTEGRATE #include <backport/autoconf.h> +#endif #include <linux/kconfig.h> #ifndef __ASSEMBLY__#define LINUX_BACKPORT (__sym) backport_ ##__sym +#ifndef CONFIG_BACKPORT_INTEGRATE #include <backport/checks.h> #endif +#endif #endif /* __BACKPORT_H */
backport/compat/Makefile +4 -0
@@ -1,5 +1,9 @@ ccflags-y += -I$(src) +ifeq ($(CONFIG_BACKPORT_INTEGRATE),) obj-m += compat.o +else +obj-y += compat.o +endif compat-y += main.o # Kernel backport compatibility code
backport/compat/main.c +7 -1
@@ -71,8 +71,14 @@ static int __init backport_init(void)#ifdef CPTCFG_BACKPORTS_GIT_TRACKED printk(KERN_INFO CPTCFG_BACKPORTS_GIT_TRACKED "\n");#else + +#ifdef CONFIG_BACKPORT_INTEGRATE +printk (KERN_INFO "Backport integrated by backports.git " CPTCFG_BACKPORTS_VERSION "\n" ); +#else printk (KERN_INFO "Backport generated by backports.git " CPTCFG_BACKPORTS_VERSION "\n" ); -#endif +#endif /* CPTCFG_BACKPORTS_GIT_TRACKED */ + +#endif /* CPTCFG_BACKPORTS_GIT_TRACKED */ return 0 ; }
devel/doc/kconfig-operation +5 -0
@@ -73,6 +73,11 @@ This allows code to, for example, have "#ifdef CONFIG_PM" which can only be set or cleared in the kernel, not in the backport configuration. Since this is needed, a transformation step is done at backport creation time. +When using Linux backports to integrate into an existing Linux tree +the CONFIG_BACKPORT_ prefix is used, this allows a CONFIG_BACKPORT_ +symbol to depend on the non-backported respective symbol to be selected +allowing these to be mutually exclusive. + Backport creation for Kconfig -------------------------------
gentree.py +65 -8
179 lines not on this page · raw message
integration-patches/0001-enable-backports/0001-enable-backports-built-in.patch new file +40 -0
@@ -0,0 +1,40 @@ +Allow backports to be integrated into vmlinux. + +diff --git a/Makefile b/Makefile +index 6d1e304..de26b18 100644 +--- a/Makefile ++++ b/Makefile +@@ -542,6 +542,7 @@ scripts: scripts_basic include/config/auto.conf include/config/tristate.conf \ + $(Q)$(MAKE) $(build)=$(@) + + # Objects we will link into vmlinux / subdirs we need to visit ++backports-y := backports/ + init-y := init/ + drivers-y := drivers/ sound/ firmware/ + net-y := net/ +@@ -820,13 +821,16 @@ core-y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/ + + vmlinux-dirs := $(patsubst %/,%,$(filter %/, $(init-y) $(init-m) \ + $(core-y) $(core-m) $(drivers-y) $(drivers-m) \ ++ $(backports-y) $(backports-m) \ + $(net-y) $(net-m) $(libs-y) $(libs-m))) + + vmlinux-alldirs := $(sort $(vmlinux-dirs) $(patsubst %/,%,$(filter %/, \ + $(init-n) $(init-) \ + $(core-n) $(core-) $(drivers-n) $(drivers-) \ ++ $(backports-n) $(backports-) \ + $(net-n) $(net-) $(libs-n) $(libs-)))) + ++backports-y := $(patsubst %/, %/built-in.o, $(backports-y)) + init-y := $(patsubst %/, %/built-in.o, $(init-y)) + core-y := $(patsubst %/, %/built-in.o, $(core-y)) + drivers-y := $(patsubst %/, %/built-in.o, $(drivers-y)) +@@ -837,7 +841,7 @@ libs-y := $(libs-y1) $(libs-y2) + + # Externally visible symbols (used by link-vmlinux.sh) + export KBUILD_VMLINUX_INIT := $(head-y) $(init-y) +-export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y) ++export KBUILD_VMLINUX_MAIN := $(core-y) $(libs-y) $(drivers-y) $(net-y) $(backports-y) + export KBUILD_LDS := arch/$(SRCARCH)/kernel/vmlinux.lds + export LDFLAGS_vmlinux + # used by scripts/pacmage/Makefile
lib/bpversion.py new file +48 -0
48 lines not on this page · raw message
lib/kconfig.py +10 -0
@@ -12,6 +12,8 @@ cfg_line = re.compile(r'^(?P<opt>config|menuconfig)\s+(?P<sym>[^\s]*)') sel_line = re.compile(r'^(?P<spc>\s+)select\s+(?P<sym>[^\s]*)\s*$') backport_line = re.compile(r'^\s+#(?P<key>[ch]-file|module-name)\s*(?P<name>.*)') ignore_parse_p = re.compile(r'^\s*#(?P<key>ignore-parser-package)') +kernel_version_config = re.compile(r'^(?P<opt>config)\s+(?P<sym>BACKPORT_KERNEL_[\d])') +ignore_syms = re.compile(r'^(?P<opt>config|menuconfig)\s+(?P<sym>BACKPORT_DIR|BACKPORTS_VERSION|BACKPORTED_KERNEL_VERSION|BACKPORTED_KERNEL_NAME|BACKPORT_LINUX)') class ConfigTree(object): def __init__(self, rootfile):
@@ -109,6 +111,14 @@ class ConfigTree(object): if pm: ignore_parse_modular = True continue + vm = kernel_version_config.match(l) + if vm: + out += l + continue + ig = ignore_syms.match(l) + if ig: + out += l + continue n = cfg_line.match(l) if n: m = n
Signature · 1 line
2.1.1