From cc6cbf14507044fb5bf693c1c45818ba204884a5 Mon Sep 17 00:00:00 2001 From: Liu Wenlong Date: Wed, 21 Nov 2018 15:17:57 +0800 Subject: templates: add job generation support for iPXE based boards Since iPXE based boards can use NBD boot[1], now in releng-scripts, we also add support to generate LAVA jobs for iPXE based boards. With this support, Intel-UP2, one of the community reference boards, can do validation tests with the generated jobs easily. [1] https://git.lavasoftware.org/lava/lava/merge_requests/64/diffs Change-Id: I9adce67d7e9207181675e82bf22a653c73682eb8 Signed-off-by: Liu Wenlong --- README.md | 6 ++-- templates/boot/generic-ipxe-tftp.jinja2 | 46 +++++++++++++++++++++++++++++++ templates/machines/intel-corei7-64.jinja2 | 7 +++++ utils/job-prereq.py | 20 ++++++++++---- 4 files changed, 71 insertions(+), 8 deletions(-) create mode 100644 templates/boot/generic-ipxe-tftp.jinja2 create mode 100644 templates/machines/intel-corei7-64.jinja2 diff --git a/README.md b/README.md index dd978c9..64f5c03 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Command line tool that prints the packages needed by LAVA to execute a test job. #### Required arguments: - `--machine` - - Available machine names: ```{dra7xx-evm,qemux86-64,porter,m3ulcb,raspberrypi3}``` + - Available machine names: ```{dra7xx-evm,qemux86-64,porter,m3ulcb,raspberrypi3,intel-corei7-64}``` - For an up to date list of machine names run: ```./utils/create-jobs.py --help``` - `--build-type` - Needs three arguments formatted as follow: `{build-type-name,branch,version}`. @@ -52,6 +52,7 @@ _Examples:_ ./utils/job-prereq.py --machine m3ulcb --build-type {daily,eel,v4.9.3} --kernel --dtb ./utils/job-prereq.py --machine dra7xx-evm --build-type {ci,11524,2} --initrd --nbdroot ./utils/job-prereq.py --machine porter --build-type {ci,11524,2} --kernel --initrd --nbdroot --dtb +./utils/job-prereq.py --machine intel-corei7-64 --build-type {ci,11524,2} --kernel --initrd --nbdroot ``` @@ -60,7 +61,7 @@ Command line tool to generate AGL jobs for LAVA. ##### Required arguments: - ```./utils/create-jobs.py --machine machine-name``` - - Available machine names: ```{dra7xx-evm,qemux86-64,porter,m3ulcb,raspberrypi3}``` + - Available machine names: ```{dra7xx-evm,qemux86-64,porter,m3ulcb,raspberrypi3,intel-corei7-64}``` - For an up to date list of machine names run: ```./utils/create-jobs.py --help``` ##### Artifacts fetching from URL: @@ -86,6 +87,7 @@ _Examples:_ ```bash ./utils/create-jobs.py --machine m3ulcb ./utils/create-jobs.py --machine qemux86-64 +./utils/create-jobs.py --machine intel-corei7-64 ./utils/create-jobs.py --build-type release --branch eel --version 4.99.1 --machine m3ulcb ./utils/create-jobs.py --build-type release --branch eel --version 4.99.1 --machine qemux86-64 ./utils/create-jobs.py --build-type daily --branch master --version latest --machine m3ulcb diff --git a/templates/boot/generic-ipxe-tftp.jinja2 b/templates/boot/generic-ipxe-tftp.jinja2 new file mode 100644 index 0000000..25aa9f1 --- /dev/null +++ b/templates/boot/generic-ipxe-tftp.jinja2 @@ -0,0 +1,46 @@ +{%- extends 'boot/generic-base-boot.jinja2' %} +{%- set boot_method = "ipxe" %} +{%- block main %} +{{ super() }} +{%- if rootfs_type == 'nbd' %} +protocols: + lava-xnbd: + port: auto + +# context allows specific values to be overridden or included +context: + extra_kernel_args: initrd={{ initrd }} +{%- endif %} +{% endblock %} +{%- block boot %} +{{ super() }} + commands: {{ boot_commands|default("ramdisk") }} +{%- if rootfs_type == 'nbd' %} + transfer_overlay: + download_command: wget + unpack_command: tar -C / -xvpf +{%- endif %} +{%- endblock %} +{%- block deploy -%} +{{ super() }} + kernel: + url: {{ kernel_url }} +{%- if rootfs_type == 'ramdisk' %} + type: {{ kernel_type }} + ramdisk: + url: {{ initrd_url }} + compression: {{ initrd_compression }} +{%- elif rootfs_type == 'nbd' %} + initrd: + url: {{ initrd_url }} + allow_modify: false + nbdroot: + url: {{ rootfs_url }} + compression: {{ rootfs_compression }} +{%- endif %} +{%- if modules_url %} + modules: + url: {{ modules_url }} + compression: {{ modules_compression }} +{%- endif %} +{%- endblock %} diff --git a/templates/machines/intel-corei7-64.jinja2 b/templates/machines/intel-corei7-64.jinja2 new file mode 100644 index 0000000..2cbc072 --- /dev/null +++ b/templates/machines/intel-corei7-64.jinja2 @@ -0,0 +1,7 @@ +{%- extends 'boot/generic-ipxe-tftp.jinja2' %} +{%- set device_arch = "x86" %} +{%- set device_mach = "intel" %} +{%- set device_type = "x86" %} +{%- set kernel_image = kernel_image|default("bzImage") %} +{%- set rootfs_type = rootfs_type|default("nbd") %} +{%- set rfs_image = rfs_image|default("agl-demo-platform-crosssdk-intel-corei7-64.ext4.xz") %} diff --git a/utils/job-prereq.py b/utils/job-prereq.py index 2dadc61..f688aca 100755 --- a/utils/job-prereq.py +++ b/utils/job-prereq.py @@ -13,13 +13,18 @@ FILE_MAP = { "nbdroot", } +FILE_MAP_X86 = { + "kernel", + "initrd", + "nbdroot", +} + # Mapping for qemu between command line QEMU args and LAVA yaml template file names FILE_MAP_QEMU = { "kernel": "kernel", "initrd": "ramdisk", } - def parse_cmdline(machines): description = "Print to stdout the file names needed to create a LAVA job" parser = argparse.ArgumentParser(description=description, @@ -51,15 +56,18 @@ def main(): url_version=args.build_type[2], machine=args.machine) job_yaml = yaml.load(job) - if args.machine != "qemux86-64": - for key in FILE_MAP: + if args.machine == "qemux86-64": + for key in FILE_MAP_QEMU: + if getattr(args, key): + print job_yaml["actions"][0]["deploy"]["images"][FILE_MAP_QEMU[key]].get("url").split('/')[-1] + elif args.machine == "intel-corei7-64": + for key in FILE_MAP_X86: if getattr(args, key): print job_yaml["actions"][0]["deploy"][key].get("url").split('/')[-1] else: - for key in FILE_MAP_QEMU: + for key in FILE_MAP: if getattr(args, key): - print job_yaml["actions"][0]["deploy"]["images"][FILE_MAP_QEMU[key]].get("url").split('/')[-1] - + print job_yaml["actions"][0]["deploy"][key].get("url").split('/')[-1] if __name__ == '__main__': main() -- cgit 1.2.3-korg