标签:min tab 环境 Requires tar cep fat 并且 lse
续前面分析,就该对bitbake_main()这个函数进行分析了,这个函数位于bitbake/lib/bb/main.py。
1. 检测主机操作系统是否为linux并且/dev/shm是否存在,python的multiprocessing需要/dev/shm支持:
# Python multiprocessing requires /dev/shm on Linux if sys.platform.startswith(‘linux‘) and not os.access(‘/dev/shm‘, os.W_OK | os.X_OK): raise BBMainException("FATAL: /dev/shm does not exist or is not writable")
2. 重新设置stdout,禁用缓冲以避免长log被截断:
# Unbuffer stdout to avoid log truncation in the event # of an unorderly exit as well as to provide timely # updates to log files for use with tail try: if sys.stdout.name == ‘<stdout>‘: # Reopen with O_SYNC (unbuffered) fl = fcntl.fcntl(sys.stdout.fileno(), fcntl.F_GETFL) fl |= os.O_SYNC fcntl.fcntl(sys.stdout.fileno(), fcntl.F_SETFL, fl) except: pass
3. 设置配置参数:
configuration.setConfigParameters(configParams)
4. 检查配置参数:server_only和remote_server在配置参数中不能同时存在:
if configParams.server_only and configParams.remote_server: raise BBMainException("FATAL: The ‘--server-only‘ option conflicts with %s.\n" % ("the BBSERVER environment variable" if "BBSERVER" in os.environ else "the ‘--remote-server‘ option"))
5. 检查配置参数:如果是observe_only,那么remote_server和bind不能同时配置:
if configParams.observe_only and not (configParams.remote_server or configParams.bind): raise BBMainException("FATAL: ‘--observe-only‘ can only be used by UI clients " "connecting to a server.\n")
6. 配置BBDEBUG级别,如果环境变量BBDEBUG配置级别大于配置参数中的debug级别,采用BBDEBUG:
if "BBDEBUG" in os.environ: level = int(os.environ["BBDEBUG"]) if level > configuration.debug: configuration.debug = level
7. 初始化消息配置:
bb.msg.init_msgconfig(configParams.verbose, configuration.debug, configuration.debug_domains)
8. 建立bitbake:并且进入ui_module的main函数
server_connection, ui_module = setup_bitbake(configParams, configuration) # No server connection if server_connection is None: if configParams.status_only: return 1 if configParams.kill_server: return 0 if not configParams.server_only: if configParams.status_only: server_connection.terminate() return 0 try: for event in bb.event.ui_queue: server_connection.events.queue_event(event) bb.event.ui_queue = [] return ui_module.main(server_connection.connection, server_connection.events, configParams) finally: server_connection.terminate() else: return 0 return 1
yocto-sumo源码解析(五): bitbake/lib/bb/main.py
标签:min tab 环境 Requires tar cep fat 并且 lse
原文地址:https://www.cnblogs.com/shortnil/p/9581549.html