• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2#coding=utf-8
3
4'''
5* Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED.
6* Licensed under the Apache License, Version 2.0 (the "License");
7* you may not use this file except in compliance with the License.
8* You may obtain a copy of the License at
9*
10*     http://www.apache.org/licenses/LICENSE-2.0
11*
12* Unless required by applicable law or agreed to in writing, software
13* distributed under the License is distributed on an "AS IS" BASIS,
14* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15* See the License for the specific language governing permissions and
16* limitations under the License.
17*
18* Description: Menuconfig entry
19'''
20
21import os
22from kconfiglib import Kconfig
23from menuconfig import menuconfig
24
25def mconf_set_env(style, conf, header):
26    """
27    These parameters would not be effect unless kconflib supported these.
28    """
29    os.environ["MENUCONFIG_STYLE"] = style
30    os.environ["KCONFIG_CONFIG"] = conf
31    os.environ["KCONFIG_CONFIG_HEADER"] = header
32
33def hi_mconfig():
34    kconfig = os.path.join("tools", "menuconfig", "Kconfig")
35    display_style = "default selection=fg:white,bg:red"
36    target_conf = os.path.join("build", "config", "usr_config.mk")
37    header = "# Generated by HiSilicon menuconfig tool"
38    mconf_set_env(display_style, target_conf, header)
39    kconf = Kconfig(filename=kconfig)
40    menuconfig(kconf)
41
42if __name__ == "__main__":
43    hi_mconfig()
44