diff options
author | Andy Lutomirski <luto@kernel.org> | 2015-12-03 18:41:13 -0800 |
---|---|---|
committer | Andy Lutomirski <luto@kernel.org> | 2015-12-03 19:35:26 -0800 |
commit | 17363c2900e8b796c80c920c6fcdcc6747784ef7 (patch) | |
tree | 27fdaaddaac52b5a1b217a550caf1ee8573a2dcc | |
parent | 676a20e4cf181c3f5108a76929a9755ba37461b1 (diff) | |
download | virtme-17363c2900e8b796c80c920c6fcdcc6747784ef7.tar.gz |
configkernel: Add --update to fix up an existing config
Signed-off-by: Andy Lutomirski <luto@kernel.org>
-rw-r--r-- | virtme/commands/configkernel.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/virtme/commands/configkernel.py b/virtme/commands/configkernel.py index e30d354..4d2946c 100644 --- a/virtme/commands/configkernel.py +++ b/virtme/commands/configkernel.py @@ -24,12 +24,17 @@ def make_parser(): default=uname.machine, help='Target architecture') - parser.add_argument('--allnoconfig', action='store_true', + g = parser.add_argument_group(title='Mode').add_mutually_exclusive_group() + + g.add_argument('--allnoconfig', action='store_true', help='Overwrite configuration with a virtme-suitable allnoconfig (unlikely to work)') - parser.add_argument('--defconfig', action='store_true', + g.add_argument('--defconfig', action='store_true', help='Overwrite configuration with a virtme-suitable defconfig') + g.add_argument('--update', action='store_true', + help='Update existing config for virtme') + return parser _ARGPARSER = make_parser() @@ -97,22 +102,23 @@ def main(): if shutil.which('%s-linux-gnu-gcc' % arch.gccname): conf.append('CONFIG_CROSS_COMPILE="%s-linux-gnu-"' % arch.gccname) - if args.allnoconfig and args.defconfig: - arg_fail('allnoconfig and defconfig are incompatible') - if args.allnoconfig: maketarget = 'allnoconfig' updatetarget = 'silentoldconfig' elif args.defconfig: maketarget = arch.defconfig_target updatetarget = 'olddefconfig' + elif args.update: + maketarget = None + updatetarget = 'olddefconfig' else: - arg_fail('One of --allnoconfig and --defconfig must be specified') + arg_fail('No mode selected') # TODO: Get rid of most of the noise and check the result. # Set up an initial config - subprocess.check_call(['make', 'ARCH=%s' % arch.linuxname, maketarget]) + if maketarget: + subprocess.check_call(['make', 'ARCH=%s' % arch.linuxname, maketarget]) with open('.config', 'ab') as conffile: conffile.write('\n'.join(conf).encode('utf-8')) |