mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
dry run for all common
This commit is contained in:
@@ -3787,6 +3787,8 @@ although this can be useful when someone gives you a random image.
|
|||||||
|
|
||||||
TODO: explain link:update-buildroot-kernel-config[]
|
TODO: explain link:update-buildroot-kernel-config[]
|
||||||
|
|
||||||
|
TODO: mention `--dry-run`
|
||||||
|
|
||||||
TODO Beware that Buildroot can `sed` override some of the configurations we make no matter what, e.g. it forces `CONFIG_BLK_DEV_INITRD=y` when `BR2_TARGET_ROOTFS_CPIO` is on, so you might want to double check as explained at <<find-the-kernel-config>>. TODO check if there is a way to prevent that patching and maybe patch Buildroot for it, it is too fuzzy. People should be able to just build with whatever `.config` they want.
|
TODO Beware that Buildroot can `sed` override some of the configurations we make no matter what, e.g. it forces `CONFIG_BLK_DEV_INITRD=y` when `BR2_TARGET_ROOTFS_CPIO` is on, so you might want to double check as explained at <<find-the-kernel-config>>. TODO check if there is a way to prevent that patching and maybe patch Buildroot for it, it is too fuzzy. People should be able to just build with whatever `.config` they want.
|
||||||
|
|
||||||
We have managed to come up with minimalistic kernel configs that work for both QEMU and gem5 (oh, the hours of bisection).
|
We have managed to come up with minimalistic kernel configs that work for both QEMU and gem5 (oh, the hours of bisection).
|
||||||
|
|||||||
4
build
4
build
@@ -153,9 +153,7 @@ passing this option multiple times. Default: [{}]
|
|||||||
'''.format(common.default_arch))
|
'''.format(common.default_arch))
|
||||||
for component in component_names:
|
for component in component_names:
|
||||||
add_bool_arg(parser, component)
|
add_bool_arg(parser, component)
|
||||||
parser.add_argument('--dry-run', default=False, action='store_true', help='''\
|
common.add_dry_run_argument(parser)
|
||||||
Print the commands that would be run, but don't run them.
|
|
||||||
''')
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Decide archs.
|
# Decide archs.
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ args = common.setup(parser)
|
|||||||
if args.clean:
|
if args.clean:
|
||||||
common.rmrf(common.linux_build_dir)
|
common.rmrf(common.linux_build_dir)
|
||||||
else:
|
else:
|
||||||
start_time = time.time()
|
if not common.dry_run:
|
||||||
|
start_time = time.time()
|
||||||
os.makedirs(common.linux_build_dir, exist_ok=True)
|
os.makedirs(common.linux_build_dir, exist_ok=True)
|
||||||
shutil.copy2(
|
shutil.copy2(
|
||||||
os.path.join(common.linux_config_dir, 'buildroot-{}'.format(args.arch)),
|
os.path.join(common.linux_config_dir, 'buildroot-{}'.format(args.arch)),
|
||||||
@@ -82,5 +83,6 @@ else:
|
|||||||
),
|
),
|
||||||
**common_args,
|
**common_args,
|
||||||
) == 0
|
) == 0
|
||||||
end_time = time.time()
|
if not common.dry_run:
|
||||||
common.print_time(end_time - start_time)
|
end_time = time.time()
|
||||||
|
common.print_time(end_time - start_time)
|
||||||
|
|||||||
@@ -80,6 +80,11 @@ def add_build_arguments(parser):
|
|||||||
action='store_true',
|
action='store_true',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def add_dry_run_argument(parser):
|
||||||
|
parser.add_argument('--dry-run', default=False, action='store_true', help='''\
|
||||||
|
Print the commands that would be run, but don't run them.
|
||||||
|
''')
|
||||||
|
|
||||||
def base64_encode(string):
|
def base64_encode(string):
|
||||||
return base64.b64encode(string.encode()).decode()
|
return base64.b64encode(string.encode()).decode()
|
||||||
|
|
||||||
@@ -122,6 +127,7 @@ def get_argparse(default_args=None, argparse_args=None):
|
|||||||
formatter_class=argparse.RawTextHelpFormatter,
|
formatter_class=argparse.RawTextHelpFormatter,
|
||||||
**argparse_args
|
**argparse_args
|
||||||
)
|
)
|
||||||
|
this.add_dry_run_argument(parser)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'-a', '--arch', choices=this.arch_choices, default=this.default_arch,
|
'-a', '--arch', choices=this.arch_choices, default=this.default_arch,
|
||||||
help='CPU architecture. Default: %(default)s'
|
help='CPU architecture. Default: %(default)s'
|
||||||
@@ -508,7 +514,7 @@ def run_cmd(
|
|||||||
#sigpipe_old = signal.getsignal(signal.SIGPIPE)
|
#sigpipe_old = signal.getsignal(signal.SIGPIPE)
|
||||||
#signal.signal(signal.SIGPIPE, signal.SIG_DFL)
|
#signal.signal(signal.SIGPIPE, signal.SIG_DFL)
|
||||||
|
|
||||||
if not dry_run:
|
if not dry_run and not this.dry_run:
|
||||||
# https://stackoverflow.com/questions/15535240/python-popen-write-to-stdout-and-log-file-simultaneously/52090802#52090802
|
# https://stackoverflow.com/questions/15535240/python-popen-write-to-stdout-and-log-file-simultaneously/52090802#52090802
|
||||||
with subprocess.Popen(cmd, stdout=stdout, stderr=stderr, env=env, **kwargs) as proc:
|
with subprocess.Popen(cmd, stdout=stdout, stderr=stderr, env=env, **kwargs) as proc:
|
||||||
if out_file is not None:
|
if out_file is not None:
|
||||||
@@ -550,6 +556,7 @@ def setup(parser):
|
|||||||
if args.gem5_worktree is not None and not gem5_build_id_given:
|
if args.gem5_worktree is not None and not gem5_build_id_given:
|
||||||
args.gem5_build_id = args.gem5_worktree
|
args.gem5_build_id = args.gem5_worktree
|
||||||
this.machine = args.machine
|
this.machine = args.machine
|
||||||
|
this.dry_run = args.dry_run
|
||||||
if args.arch == 'arm':
|
if args.arch == 'arm':
|
||||||
this.armv = 7
|
this.armv = 7
|
||||||
this.gem5_arch = 'ARM'
|
this.gem5_arch = 'ARM'
|
||||||
|
|||||||
Reference in New Issue
Block a user