def main(): parse_args() if args.gperf_output: eh = ElfHelper(args.kernel, args.verbose, kobjects, subsystems) syms = eh.get_symbols() max_threads = syms["CONFIG_MAX_THREAD_BYTES"] * 8 objs = eh.find_kobjects(syms) if eh.get_thread_counter() > max_threads: sys.stderr.write("Too many thread objects (%d)\n" % thread_counter) sys.stderr.write("Increase CONFIG_MAX_THREAD_BYTES to %d\n", -(-thread_counter // 8)) sys.exit(1) with open(args.gperf_output, "w") as fp: write_gperf_table(fp, eh, objs, syms["_static_kernel_objects_begin"], syms["_static_kernel_objects_end"]) if args.validation_output: with open(args.validation_output, "w") as fp: write_validation_output(fp) if args.kobj_types_output: with open(args.kobj_types_output, "w") as fp: write_kobj_types_output(fp) if args.kobj_otype_output: with open(args.kobj_otype_output, "w") as fp: write_kobj_otype_output(fp) if args.kobj_size_output: with open(args.kobj_size_output, "w") as fp: write_kobj_size_output(fp)
def main(): parse_args() eh = ElfHelper(args.kernel, args.verbose, kobjects, []) syms = eh.get_symbols() max_threads = syms["CONFIG_MAX_THREAD_BYTES"] * 8 objs = eh.find_kobjects(syms) if not objs: sys.stderr.write("WARNING: zero kobject found in %s\n" % args.kernel) thread_counter = eh.get_thread_counter() if thread_counter > max_threads: sys.exit("Too many thread objects ({})\n" "Increase CONFIG_MAX_THREAD_BYTES to {}".format( thread_counter, -(-thread_counter // 8))) with open(args.output, "w") as fp: write_gperf_table(fp, eh, objs)
def main(): parse_args() eh = ElfHelper(args.kernel, args.verbose, kobjects, []) syms = eh.get_symbols() max_threads = syms["CONFIG_MAX_THREAD_BYTES"] * 8 objs = eh.find_kobjects(syms) thread_counter = eh.get_thread_counter() if thread_counter > max_threads: sys.stderr.write("Too many thread objects (%d)\n" % thread_counter) sys.stderr.write("Increase CONFIG_MAX_THREAD_BYTES to %d\n", -(-thread_counter // 8)) sys.exit(1) with open(args.output, "w") as fp: write_gperf_table(fp, eh, objs, syms["_static_kernel_objects_begin"], syms["_static_kernel_objects_end"])
def main(): parse_args() if args.include_subsystem_list is not None: for list_file in args.include_subsystem_list: parse_subsystems_list_file(list_file) if args.gperf_output: assert args.kernel, "--kernel ELF required for --gperf-output" eh = ElfHelper(args.kernel, args.verbose, kobjects, subsystems) syms = eh.get_symbols() max_threads = syms["CONFIG_MAX_THREAD_BYTES"] * 8 objs = eh.find_kobjects(syms) if not objs: sys.stderr.write("WARNING: zero kobject found in %s\n" % args.kernel) thread_counter = eh.get_thread_counter() if thread_counter > max_threads: sys.exit("Too many thread objects ({})\n" "Increase CONFIG_MAX_THREAD_BYTES to {}".format( thread_counter, -(-thread_counter // 8))) with open(args.gperf_output, "w") as fp: write_gperf_table(fp, eh, objs, syms["_static_kernel_objects_begin"], syms["_static_kernel_objects_end"]) if args.validation_output: with open(args.validation_output, "w") as fp: write_validation_output(fp) if args.kobj_types_output: with open(args.kobj_types_output, "w") as fp: write_kobj_types_output(fp) if args.kobj_otype_output: with open(args.kobj_otype_output, "w") as fp: write_kobj_otype_output(fp) if args.kobj_size_output: with open(args.kobj_size_output, "w") as fp: write_kobj_size_output(fp)