mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
build-gem5: factor dtb copy with copy_dir_if_update_non_recursive
Less code, less boring + cp prints, only copy if modified.
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import glob
|
||||
import os
|
||||
import pathlib
|
||||
import subprocess
|
||||
@@ -55,9 +54,11 @@ class Gem5Component(common.Component):
|
||||
dt_src_dir = os.path.join(gem5_system_src_dir, 'arm', 'dt')
|
||||
dt_build_dir = os.path.join(common.gem5_system_dir, 'arm', 'dt')
|
||||
common.run_cmd(['make', '-C', dt_src_dir])
|
||||
os.makedirs(dt_build_dir, exist_ok=True)
|
||||
for dt in glob.glob(os.path.join(dt_src_dir, '*.dtb')):
|
||||
common.cp(dt, dt_build_dir)
|
||||
common.copy_dir_if_update_non_recursive(
|
||||
srcdir=dt_src_dir,
|
||||
destdir=dt_build_dir,
|
||||
filter_ext='.dtb',
|
||||
)
|
||||
|
||||
# Bootloader 32.
|
||||
bootloader32_dir = os.path.join(gem5_system_src_dir, 'arm', 'simple_bootloader')
|
||||
|
||||
@@ -170,6 +170,7 @@ def write_string_to_file(path, string, mode='w'):
|
||||
f.write(string)
|
||||
|
||||
def copy_dir_if_update_non_recursive(srcdir, destdir, filter_ext=None):
|
||||
# TODO print rsync equivalent.
|
||||
os.makedirs(destdir, exist_ok=True)
|
||||
for basename in os.listdir(srcdir):
|
||||
src = os.path.join(srcdir, basename)
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import glob
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
Reference in New Issue
Block a user