diff options
author | Jerome Brunet <jbrunet@baylibre.com> | 2017-09-15 10:33:21 +0200 |
---|---|---|
committer | Jerome Brunet <jbrunet@baylibre.com> | 2017-09-19 15:28:29 +0200 |
commit | 6d8721a6c24bb6b681d9c369e0032a05e54db26a (patch) | |
tree | 01de76930070633b3d6f74a719fb6c4d28ce73c2 | |
parent | 36d0e4617c16c193a8a9932f1b09cfe97f9f767e (diff) |
rfs-image: provide command line options to setup the image name
Provide 2 new command line options: --img-name and --img-ext
These two options require one another since the name image will be
composed from both of them in the following way:
rfs_image = img_name + "-" + yocto-machine + "." + img_ext
Change-Id: I2b6d174b4c141cea28ce63c3c7c7beae1a82ed4c
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
-rw-r--r-- | templates/base/agl-base-defaults.jinja2 | 4 | ||||
-rw-r--r-- | templates/machines/dra7xx-evm.jinja2 | 1 | ||||
-rw-r--r-- | templates/machines/qemux86-64.jinja2 | 1 | ||||
-rw-r--r-- | utils/agljobtemplate.py | 5 | ||||
-rwxr-xr-x | utils/create-jobs.py | 18 |
5 files changed, 22 insertions, 7 deletions
diff --git a/templates/base/agl-base-defaults.jinja2 b/templates/base/agl-base-defaults.jinja2 index c8b18b4..af82379 100644 --- a/templates/base/agl-base-defaults.jinja2 +++ b/templates/base/agl-base-defaults.jinja2 @@ -21,13 +21,13 @@ {%- if rootfs_type == 'nbd' %} {%- set deploy_to = "nbd" %} {%- set boot_commands = "nbd" %} -{%- set nbdroot = nbdroot|default("core-image-minimal-" + yocto_machine + ".ext4.xz") %} +{%- set nbdroot = rfs_image|default("core-image-minimal-" + yocto_machine + ".ext4.xz") %} {%- set nbdroot_url = nbdroot_url|default(baseurl(nbdroot)) %} {%- set nbdroot_compression = nbdroot_compression|default(nbdroot|get_extension) %} {%- set nbdinitrd = nbdinitrd|default("initramfs-netboot-image-" + yocto_machine +".ext4.gz") %} {%- set nbdinitrd_url = nbdinitrd_url|default(baseurl(nbdinitrd)) %} {%- elif rootfs_type == 'ramdisk' %} -{%- set initrd = initrd|default("initramfs-boot-image-" + yocto_machine +".gz") %} +{%- set initrd = rfs_image|default("initramfs-boot-image-" + yocto_machine + ".gz") %} {%- set initrd_compression = initrd_compression|default(initrd|get_extension) %} {%- endif %} {%- if initrd %} diff --git a/templates/machines/dra7xx-evm.jinja2 b/templates/machines/dra7xx-evm.jinja2 index 502ac56..e092530 100644 --- a/templates/machines/dra7xx-evm.jinja2 +++ b/templates/machines/dra7xx-evm.jinja2 @@ -4,4 +4,3 @@ {%- set dtb = "zImage-dra7-evm-lcd-lg.dtb" %} {%- set kernel_image = "zImage" %} {%- set uboot_type = "bootz" %} -{%- set nbdroot = "agl-demo-platform-" + yocto_machine + ".ext4.xz" %} diff --git a/templates/machines/qemux86-64.jinja2 b/templates/machines/qemux86-64.jinja2 index 7361c0d..905136e 100644 --- a/templates/machines/qemux86-64.jinja2 +++ b/templates/machines/qemux86-64.jinja2 @@ -6,4 +6,3 @@ {%- set qemu_args = "-cpu qemu64,+ssse3,+sse4.1,+sse4.2,+popcnt -m 1048 -soundhw hda" %} {%- set qemu_arch = "x86_64" %} {%- set deploy_to = "tmpfs" %} -{%- set initrd = "agl-demo-platform-" + yocto_machine + ".ext4.xz" %} diff --git a/utils/agljobtemplate.py b/utils/agljobtemplate.py index df3800d..0d34867 100644 --- a/utils/agljobtemplate.py +++ b/utils/agljobtemplate.py @@ -60,7 +60,7 @@ class Agljobtemplate(object): return self.RFS_TYPE def render_job(self, url, machine, job_name="AGL-short-smoke", priority="medium", tests=[], rfs_type=None, - kci_callback=None): + kci_callback=None, rfs_image=None): test_templates = [] if machine not in self.machines: @@ -83,6 +83,9 @@ class Agljobtemplate(object): if rfs_type is not None: job['rootfs_type'] = rfs_type + if rfs_image is not None: + job['rfs_image'] = rfs_image + if kci_callback: if test_templates: job['callback_name'] = 'lava/test' diff --git a/utils/create-jobs.py b/utils/create-jobs.py index 4a866d5..d3374ed 100755 --- a/utils/create-jobs.py +++ b/utils/create-jobs.py @@ -32,14 +32,27 @@ def parse_cmdline(machines, tests, rfs_types): help='job id for link creation: URLBASE/JOB_ID') parser.add_argument('-i', '--jobidx', dest='job_index', action='store', help='job index for link creation: URLBASE/JOB_ID/JOB_INDEX', default='1') + parser.add_argument('--img-name', dest='img_name', action='store', + help="img base name (such as agl-demo-platform) - require img_ext") + parser.add_argument('--img-ext', dest='img_ext', action='store', + help="img extension (such as ext4.xz) - require img_name") - return parser.parse_args() + args = parser.parse_args() + + if (not args.img_name) != (not args.img_ext): + parser.error("--img-name and --img-ext require one another") + + return args def main(): + img = None ajt = agljobtemplate.Agljobtemplate('templates') args = parse_cmdline(ajt.machines, ajt.tests, ajt.rfs_types) + if args.img_name: + img = args.img_name + "-" + args.machine + "." + args.img_ext + if args.tests is not None and 'all' in args.tests: args.tests = ajt.tests @@ -52,7 +65,8 @@ def main(): args.job_name += ' - {}'.format(args.job_index) job = ajt.render_job(args.urlbase, args.machine, tests=args.tests, priority=args.priority, - rfs_type=args.rfs_type, job_name=args.job_name, kci_callback=args.callback) + rfs_type=args.rfs_type, job_name=args.job_name, kci_callback=args.callback, + rfs_image=img) if args.job_file is None: print job |