scripts: Add an option for the build directory
When running in CI it is better to specify the build directory rather than provide a device. Add a --build-dir option. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -60,8 +60,10 @@ class BuildEfi:
|
||||
def __init__(self, args):
|
||||
self.helper = build_helper.Helper(args)
|
||||
self.helper.read_settings()
|
||||
self.img = self.helper.get_setting('efi_image_file', 'efi.img')
|
||||
self.build_dir = self.helper.get_setting("build_dir", '/tmp')
|
||||
self.img_fname = self.helper.get_setting('efi_image_file', 'efi.img')
|
||||
self.img = None
|
||||
self.build_topdir = self.helper.get_setting("build_dir", '/tmp')
|
||||
self.build_dir = None
|
||||
self.args = args
|
||||
self.imagedir = Path(self.helper.get_setting('image_dir', '~/dev'))
|
||||
|
||||
@@ -146,13 +148,12 @@ class BuildEfi:
|
||||
print(f'Packaging {build}')
|
||||
fname = f'u-boot-{build_type}.efi'
|
||||
tools.write_file(f'{dst}/startup.nsh', f'fs0:{fname}', binary=False)
|
||||
shutil.copy(f'{self.build_dir}/{build}/{fname}', dst)
|
||||
shutil.copy(f'{self.build_dir}/{fname}', dst)
|
||||
|
||||
def do_build(self, build):
|
||||
"""Build U-Boot for the selected board"""
|
||||
res = command.run_one('buildman', '-w', '-o',
|
||||
f'{self.build_dir}/{build}', '--board', build,
|
||||
'-I', raise_on_error=False)
|
||||
res = command.run_one('buildman', '-w', '-o', self.build_dir,
|
||||
'--board', build, '-I', raise_on_error=False)
|
||||
if res.return_code and res.return_code != 101: # Allow warnings
|
||||
raise ValueError(
|
||||
f'buildman exited with {res.return_code}: {res.combined}')
|
||||
@@ -164,6 +165,12 @@ class BuildEfi:
|
||||
build_type = 'payload' if args.payload else 'app'
|
||||
build = f'efi-{arch}_{build_type}{self.helper.bitness}'
|
||||
|
||||
if args.build_dir:
|
||||
self.build_dir = args.build_dir
|
||||
self.img = f'{self.build_dir}/{self.img_fname}'
|
||||
else:
|
||||
self.build_dir = f'{self.build_topdir}/{build}'
|
||||
self.img = self.img_fname
|
||||
if not args.no_build:
|
||||
self.do_build(build)
|
||||
|
||||
|
||||
@@ -287,6 +287,7 @@ def add_common_args(parser):
|
||||
help='Select architecture (arm, x86) Default: arm')
|
||||
parser.add_argument('-B', '--no-build', action='store_true',
|
||||
help="Don't build; assume a build exists")
|
||||
parser.add_argument('--build-dir', help='Directory to use for the build')
|
||||
parser.add_argument('-C', '--enable-console', action='store_true',
|
||||
help="Enable linux console (x86 only)")
|
||||
parser.add_argument('-d', '--disk', nargs='*',
|
||||
|
||||
Reference in New Issue
Block a user