mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-26 11:41:35 +01:00
bak
This commit is contained in:
30
build-linux
30
build-linux
@@ -6,8 +6,8 @@ import shutil
|
||||
import common
|
||||
|
||||
class LinuxComponent(common.Component):
|
||||
def add_parser_arguments(self, parser):
|
||||
parser.add_argument(
|
||||
def __init__(self, parser):
|
||||
self.add_argument(
|
||||
'--config', default=[], action='append',
|
||||
help='''\
|
||||
Add a single kernel config configs to the current build. Sample value:
|
||||
@@ -15,14 +15,14 @@ Add a single kernel config configs to the current build. Sample value:
|
||||
configs. Takes precedence over any config files.
|
||||
'''
|
||||
)
|
||||
parser.add_argument(
|
||||
self.add_argument(
|
||||
'--config-fragment', default=[], action='append',
|
||||
help='''\
|
||||
Also use the given kernel configuration fragment file.
|
||||
Pass multiple times to use multiple fragment files.
|
||||
'''
|
||||
)
|
||||
parser.add_argument(
|
||||
self.add_argument(
|
||||
'--custom-config-file',
|
||||
help='''\
|
||||
Ignore all default kernel configurations and use this file instead.
|
||||
@@ -30,26 +30,20 @@ Still uses options explicitly passed with `--config` and
|
||||
`--config-fragment` on top of it.
|
||||
'''
|
||||
)
|
||||
parser.add_argument(
|
||||
self.add_argument(
|
||||
'--config-only', default=False, action='store_true',
|
||||
help='''\
|
||||
Configure the kernel, but don't build it.
|
||||
'''
|
||||
)
|
||||
parser.add_argument(
|
||||
'--initramfs', default=False, action='store_true',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--initrd', default=False, action='store_true',
|
||||
)
|
||||
parser.add_argument(
|
||||
self.add_argument(
|
||||
'extra_make_args',
|
||||
default=[],
|
||||
metavar='extra-make-args',
|
||||
nargs='*'
|
||||
)
|
||||
|
||||
def do_main(self, **kwargs):
|
||||
def build(self, **kwargs):
|
||||
build_dir = self.get_build_dir(**kwargs)
|
||||
if args.initrd or args.initramfs:
|
||||
raise Exception('just trolling, --initrd and --initramfs are broken for now')
|
||||
@@ -93,11 +87,11 @@ Configure the kernel, but don't build it.
|
||||
cli_config_str = '\n'.join(args.config)
|
||||
common.write_string_to_file(cli_config_fragment_path, cli_config_str)
|
||||
config_fragments.append(cli_config_fragment_path)
|
||||
common.cp(
|
||||
self.sh.cp(
|
||||
base_config_file,
|
||||
os.path.join(build_dir, '.config'),
|
||||
)
|
||||
common.run_cmd(
|
||||
self.sh.run_cmd(
|
||||
[
|
||||
os.path.join(common.linux_src_dir, 'scripts', 'kconfig', 'merge_config.sh'), common.Newline,
|
||||
'-m', common.Newline,
|
||||
@@ -106,7 +100,7 @@ Configure the kernel, but don't build it.
|
||||
] +
|
||||
common.add_newlines(config_fragments)
|
||||
)
|
||||
common.run_cmd(
|
||||
self.sh.run_cmd(
|
||||
(
|
||||
common_make_args +
|
||||
['olddefconfig', common.Newline]
|
||||
@@ -114,14 +108,14 @@ Configure the kernel, but don't build it.
|
||||
**common_args
|
||||
)
|
||||
if not args.config_only:
|
||||
common.run_cmd(
|
||||
self.sh.run_cmd(
|
||||
(
|
||||
common_make_args +
|
||||
common.add_newlines(args.extra_make_args)
|
||||
),
|
||||
**common_args
|
||||
)
|
||||
common.run_cmd(
|
||||
self.sh.run_cmd(
|
||||
(
|
||||
common_make_args +
|
||||
[
|
||||
|
||||
Reference in New Issue
Block a user