1import os 2import rtconfig 3import subprocess 4from building import * 5 6group = [] 7cwd = GetCurrentDir() 8CPPPATH = [cwd, cwd + "/kernel"] 9list = os.listdir(cwd) 10src = Glob('kernel/*.c') + Glob('kernel/*.S') 11 12if not GetDepend(['RT_USING_VDSO']): 13 Return('group') 14 15if rtconfig.ARCH != "aarch64" and rtconfig.ARCH != "risc-v": 16 # not supported arch 17 src = [] 18else: 19 if not hasattr(rtconfig, 'CPP') or rtconfig.CPP is None: 20 rtconfig.CPP = rtconfig.PREFIX + 'cpp' 21 if not hasattr(rtconfig, 'CPPFLAGS') or rtconfig.CPPFLAGS is None: 22 rtconfig.CPPFLAGS = ' -E -P -x assembler-with-cpp' 23 24 if not os.path.exists(cwd + "/user" + "/arch" +"/" + rtconfig.ARCH + "/vdso.lds"): 25 Preprocessing("user/arch/" + rtconfig.ARCH + "/vdso.lds.S", ".lds", CPPPATH=[cwd]) 26 27 vdso_arch = os.path.join(cwd, 'user',"arch", rtconfig.ARCH) 28 29 process_env = os.environ.copy() 30 if hasattr(rtconfig, 'EXEC_PATH') and rtconfig.EXEC_PATH is not None: 31 process_env['RTT_EXEC_PATH'] = rtconfig.EXEC_PATH 32 if hasattr(rtconfig, 'PREFIX') and rtconfig.PREFIX is not None: 33 process_env['RTT_CC_PREFIX'] = rtconfig.PREFIX 34 if hasattr(rtconfig, 'DEVICE') and rtconfig.DEVICE is not None: 35 process_env['RTT_DEVICE'] = rtconfig.DEVICE 36 37 command = ["scons", "-C", vdso_arch] 38 if GetOption('clean'): 39 command = ["scons", "-C", vdso_arch, "--clean"] 40 41 try: 42 result = subprocess.run(command, env=process_env, check=True) 43 # generic error handle 44 except : 45 print('exec command: "%s" failed.' % ' '.join(command)) 46 exit(1) 47 48 print("Command executed successfully") 49 50group = DefineGroup('lwProcess', src, depend = ['RT_USING_SMART','RT_USING_VDSO'], CPPPATH = CPPPATH) 51Return('group') 52