ci/lava: implement fastboot support

Based on work from Tomeu Vizoso.

Acked-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Signed-off-by: David Heidelberg <david.heidelberg@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22604>
This commit is contained in:
David Heidelberg 2023-04-06 01:17:26 +02:00 committed by Marge Bot
parent 3f553c6adb
commit 5dd68b6ba6

View file

@ -46,27 +46,84 @@ def generate_lava_yaml_payload(args) -> dict[str, Any]:
# URLs to our kernel rootfs to boot from, both generated by the base
# container build
deploy = {
"timeout": {"minutes": 10},
"to": "tftp",
"os": "oe",
"kernel": {"url": f"{args.kernel_url_prefix}/{args.kernel_image_name}"},
"nfsrootfs": {
nfsrootfs = {
"url": f"{args.rootfs_url_prefix}/lava-rootfs.tar.zst",
"compression": "zstd",
}
fastboot_deploy_nfs = {
"timeout": {"minutes": 10},
"to": "nfs",
"nfsrootfs": nfsrootfs,
}
fastboot_deploy_prepare = {
"timeout": {"minutes": 5},
"to": "downloads",
"os": "oe",
"images": {
"kernel": {
"url": f"{args.kernel_url_prefix}/{args.kernel_image_name}",
},
},
"postprocess": {
"docker": {
"image": "registry.gitlab.collabora.com/lava/health-check-docker",
"steps": [
'gzip Image',
"cat Image.gz " + args.dtb_filename + ".dtb > Image.gz+dtb",
"mkbootimg --kernel Image.gz+dtb" +
' --cmdline "root=/dev/nfs rw nfsroot=$NFS_SERVER_IP:$NFS_ROOTFS,tcp,hard rootwait ip=dhcp init=/init"' +
" --pagesize 4096 --base 0x80000000 -o boot.img",
],
},
}
}
if args.kernel_image_type:
deploy["kernel"]["type"] = args.kernel_image_type
fastboot_deploy_prepare["images"]["kernel"]["type"] = args.kernel_image_type
if args.dtb_filename:
deploy["dtb"] = {"url": f"{args.kernel_url_prefix}/{args.dtb_filename}.dtb"}
fastboot_deploy_prepare["images"]["dtb"] = {"url": f"{args.kernel_url_prefix}/{args.dtb_filename}.dtb"}
# always boot over NFS
boot = {
tftp_deploy = {
"timeout": {"minutes": 5},
"to": "tftp",
"os": "oe",
"kernel": {
"url": f"{args.kernel_url_prefix}/{args.kernel_image_name}",
},
"nfsrootfs": nfsrootfs,
}
if args.kernel_image_type:
tftp_deploy["kernel"]["type"] = args.kernel_image_type
if args.dtb_filename:
tftp_deploy["dtb"] = {"url": f"{args.kernel_url_prefix}/{args.dtb_filename}.dtb"}
fastboot_deploy = {
"timeout": {"minutes": 2},
"to": "fastboot",
"docker": {
"image": "registry.gitlab.collabora.com/lava/health-check-docker",
},
"images": {
"boot": {"url": "downloads://boot.img"},
},
}
fastboot_boot = {
"timeout": {"minutes": 2},
"docker": {"image": "registry.gitlab.collabora.com/lava/health-check-docker"},
"failure_retry": NUMBER_OF_ATTEMPTS_LAVA_BOOT,
"method": args.boot_method,
"commands": "nfs",
"prompts": ["lava-shell:"],
"commands": ["set_active a"]
}
tftp_boot = {
"failure_retry": NUMBER_OF_ATTEMPTS_LAVA_BOOT,
"method": args.boot_method,
"prompts": ["lava-shell:"],
"commands": "nfs"
}
# skeleton test definition: only declaring each job as a single 'test'
@ -136,10 +193,19 @@ def generate_lava_yaml_payload(args) -> dict[str, Any]:
f"lava-test-case 'mesa-ci_{args.mesa_job_name}' --shell /init-stage2.sh",
]
values["actions"] = [
{"deploy": deploy},
{"boot": boot},
{"test": test},
]
if args.boot_method == "fastboot":
values["actions"] = [
{"deploy": fastboot_deploy_nfs},
{"deploy": fastboot_deploy_prepare},
{"deploy": fastboot_deploy},
{"boot": fastboot_boot},
{"test": test},
]
else: # tftp
values["actions"] = [
{"deploy": tftp_deploy},
{"boot": tftp_boot},
{"test": test},
]
return values