def METHOD_NAME(path):
    oldline = ''
    newline = ''
    for root, dirs, files in os.walk(path): #递归扫描里面的所有文件
        for file in files:
            if os.path.splitext(file)[1] == '.s': #找.s文件
                file_path = os.path.join(root,file)
                flag_need_replace = False
                with open(file_path,'r+',) as f:
                    while True:
                        line = f.readline()
                        if line == '':
                            break
                        elif ('bl' in line) and ('main' in line): #发现'bl main'
                            oldline = line # bl main
                            newline = line.replace('main', 'entry') #将main替换为entry，形成新的字符串
                            flag_need_replace = True #标记该文件需要做entry替换
                            break
                    if (flag_need_replace == True): #若该文件需要将main替换为entry
                        f.seek(0)
                        content = f.read()
                        f.seek(0)
                        f.truncate()
                        newcontent = content.replace(oldline, newline)
                        f.write(newcontent)