11bd4fe43Sopenharmony_ci#!/usr/bin/env python3 21bd4fe43Sopenharmony_ci#coding=utf-8 31bd4fe43Sopenharmony_ci 41bd4fe43Sopenharmony_ci''' 51bd4fe43Sopenharmony_ci* Copyright (c) 2020 HiSilicon (Shanghai) Technologies CO., LIMITED. 61bd4fe43Sopenharmony_ci* Licensed under the Apache License, Version 2.0 (the "License"); 71bd4fe43Sopenharmony_ci* you may not use this file except in compliance with the License. 81bd4fe43Sopenharmony_ci* You may obtain a copy of the License at 91bd4fe43Sopenharmony_ci* 101bd4fe43Sopenharmony_ci* http://www.apache.org/licenses/LICENSE-2.0 111bd4fe43Sopenharmony_ci* 121bd4fe43Sopenharmony_ci* Unless required by applicable law or agreed to in writing, software 131bd4fe43Sopenharmony_ci* distributed under the License is distributed on an "AS IS" BASIS, 141bd4fe43Sopenharmony_ci* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 151bd4fe43Sopenharmony_ci* See the License for the specific language governing permissions and 161bd4fe43Sopenharmony_ci* limitations under the License. 171bd4fe43Sopenharmony_ci* 181bd4fe43Sopenharmony_ci* Description: Menuconfig entry 191bd4fe43Sopenharmony_ci''' 201bd4fe43Sopenharmony_ci 211bd4fe43Sopenharmony_ciimport os 221bd4fe43Sopenharmony_cifrom kconfiglib import Kconfig 231bd4fe43Sopenharmony_cifrom menuconfig import menuconfig 241bd4fe43Sopenharmony_ci 251bd4fe43Sopenharmony_cidef mconf_set_env(style, conf, header): 261bd4fe43Sopenharmony_ci """ 271bd4fe43Sopenharmony_ci These parameters would not be effect unless kconflib supported these. 281bd4fe43Sopenharmony_ci """ 291bd4fe43Sopenharmony_ci os.environ["MENUCONFIG_STYLE"] = style 301bd4fe43Sopenharmony_ci os.environ["KCONFIG_CONFIG"] = conf 311bd4fe43Sopenharmony_ci os.environ["KCONFIG_CONFIG_HEADER"] = header 321bd4fe43Sopenharmony_ci 331bd4fe43Sopenharmony_cidef hi_mconfig(): 341bd4fe43Sopenharmony_ci kconfig = os.path.join("tools", "menuconfig", "Kconfig") 351bd4fe43Sopenharmony_ci display_style = "default selection=fg:white,bg:red" 361bd4fe43Sopenharmony_ci target_conf = os.path.join("build", "config", "usr_config.mk") 371bd4fe43Sopenharmony_ci header = "# Generated by HiSilicon menuconfig tool" 381bd4fe43Sopenharmony_ci mconf_set_env(display_style, target_conf, header) 391bd4fe43Sopenharmony_ci kconf = Kconfig(filename=kconfig) 401bd4fe43Sopenharmony_ci menuconfig(kconf) 411bd4fe43Sopenharmony_ci 421bd4fe43Sopenharmony_ciif __name__ == "__main__": 431bd4fe43Sopenharmony_ci hi_mconfig() 44