@@ -531,23 +531,27 @@ async def gen_config(args):
# things if needed.
# Safe-guard, in case we can not quickly come to a valid
# configuration: allow at most 100 (arbitrary) iterations.
- bounded_loop = 100
+ loop = 0
while True:
- if bounded_loop == 0:
+ if loop == 100:
print("ERROR: cannot generate random configuration after 100 iterations",
file=sys.stderr)
return 1
- bounded_loop -= 1
+ print("Generating configuration, loop %d" % loop)
+ loop += 1
proc = await asyncio.create_subprocess_exec(
"make", "O=%s" % args.outputdir, "-C", args.buildrootdir,
"KCONFIG_SEED=0x%s" % hexlify(os.urandom(4)).decode("ascii").upper(),
"KCONFIG_PROBABILITY=%d" % randint(1, 20),
- "randconfig")
+ "randconfig",
+ stdout=asyncio.subprocess.DEVNULL,
+ stderr=asyncio.subprocess.DEVNULL)
ret = await proc.wait()
if ret:
return ret
if await fixup_config(sysinfo, configfile):
+ print(" configuration valid")
break
configlines = list()
@@ -570,20 +574,30 @@ async def gen_config(args):
with open(configfile, "a") as configf:
configf.writelines(configlines)
+ print(" olddefconfig")
proc = await asyncio.create_subprocess_exec(
- "make", "O=%s" % args.outputdir, "-C", args.buildrootdir, "olddefconfig")
+ "make", "O=%s" % args.outputdir, "-C", args.buildrootdir, "olddefconfig",
+ stdout=asyncio.subprocess.DEVNULL,
+ stderr=asyncio.subprocess.DEVNULL)
ret = await proc.wait()
if ret:
return ret
+ print(" savedefconfig")
proc = await asyncio.create_subprocess_exec(
- "make", "O=%s" % args.outputdir, "-C", args.buildrootdir, "savedefconfig")
+ "make", "O=%s" % args.outputdir, "-C", args.buildrootdir, "savedefconfig",
+ stdout=asyncio.subprocess.DEVNULL,
+ stderr=asyncio.subprocess.DEVNULL)
+
ret = await proc.wait()
if ret:
return ret
+ print(" dependencies")
proc = await asyncio.create_subprocess_exec(
- "make", "O=%s" % args.outputdir, "-C", args.buildrootdir, "dependencies")
+ "make", "O=%s" % args.outputdir, "-C", args.buildrootdir, "dependencies",
+ stdout=asyncio.subprocess.DEVNULL,
+ stderr=asyncio.subprocess.DEVNULL)
return await proc.wait()
Right now, genrandconfig just spits out the random messages from the different make invocations, which isn't terribly useful. Instead, let's redirect the output of make invocations to oblivion, and add some more high level logging. As part of this logging, we're interested to see how many iterations were needed to find a valid configuration, so changed the loop logic to count from 0 to 100 instead of from 100 to 0 so that we can easily show the iteration number. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> --- utils/genrandconfig | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)