1#!/usr/bin/env python
2
3# SPDX-License-Identifier: BSD-3-Clause
4#
5# Copyright (c) 2019, Intel Corporation. All rights reserved.
6#
7# Author: Janusz Jankowski <janusz.jankowski@linux.intel.com>
8
9# Loads current config file and saves minimal configuration to
10# the given file.
11#
12# Usage:
13#   savedefconfig.py KCONFIG_FILENAME DEFCONFIG_OUTPUT_FILE
14
15import os
16import sys
17
18import kconfiglib
19
20
21def main():
22    if len(sys.argv) < 3:
23        sys.exit("usage: {} KCONFIG_FILENAME DEFCONFIG_OUTPUT_FILE"
24            .format(sys.argv[0]))
25
26    kconf = kconfiglib.Kconfig(sys.argv[1])
27    kconf.load_config()
28    kconf.write_min_config(sys.argv[2])
29
30
31if __name__ == "__main__":
32    main()
33