1Bare-metal CI 2============= 3 4The bare-metal scripts run on a system with gitlab-runner and Docker, 5connected to potentially multiple bare-metal boards that run tests of 6Mesa. Currently only "fastboot" and "ChromeOS Servo" devices are 7supported. 8 9In comparison with LAVA, this doesn't involve maintaining a separate 10web service with its own job scheduler and replicating jobs between the 11two. It also places more of the board support in Git, instead of 12web service configuration. On the other hand, the serial interactions 13and bootloader support are more primitive. 14 15Requirements (fastboot) 16----------------------- 17 18This testing requires power control of the DUTs by the gitlab-runner 19machine, since this is what we use to reset the system and get back to 20a pristine state at the start of testing. 21 22We require access to the console output from the gitlab-runner system, 23since that is how we get the final results back from the tests. You 24should probably have the console on a serial connection, so that you 25can see bootloader progress. 26 27The boards need to be able to have a kernel/initramfs supplied by the 28gitlab-runner system, since the initramfs is what contains the Mesa 29testing payload. 30 31The boards should have networking, so that we can extract the dEQP .xml 32results to artifacts on GitLab. 33 34Requirements (servo) 35-------------------- 36 37For servo-connected boards, we can use the EC connection for power 38control to reboot the board. However, loading a kernel is not as easy 39as fastboot, so we assume your bootloader can do TFTP, and that your 40gitlab-runner mounts the runner's tftp directory specific to the board 41at /tftp in the container. 42 43Since we're going the TFTP route, we also use NFS root. This avoids 44packing the rootfs and sending it to the board as a ramdisk, which 45means we can support larger rootfses (for piglit or tracie testing), 46at the cost of needing more storage on the runner. 47 48Telling the board about where its TFTP and NFS should come from is 49done using dnsmasq on the runner host. For example, this snippet in 50the dnsmasq.conf.d in the google farm, with the gitlab-runner host we 51call "servo":: 52 53 dhcp-host=1c:69:7a:0d:a3:d3,10.42.0.10,set:servo 54 55 # Fixed dhcp addresses for my sanity, and setting a tag for 56 # specializing other DHCP options 57 dhcp-host=a0:ce:c8:c8:d9:5d,10.42.0.11,set:cheza1 58 dhcp-host=a0:ce:c8:c8:d8:81,10.42.0.12,set:cheza2 59 60 # Specify the next server, watch out for the double ',,'. The 61 # filename didn't seem to get picked up by the bootloader, so we use 62 # tftp-unique-root and mount directories like 63 # /srv/tftp/10.42.0.11/jwerner/cheza as /tftp in the job containers. 64 tftp-unique-root 65 dhcp-boot=tag:cheza1,cheza1/vmlinuz,,10.42.0.10 66 dhcp-boot=tag:cheza2,cheza2/vmlinuz,,10.42.0.10 67 68 dhcp-option=tag:cheza1,option:root-path,/srv/nfs/cheza1 69 dhcp-option=tag:cheza2,option:root-path,/srv/nfs/cheza2 70 71Setup 72----- 73 74Each board will be registered in fd.o GitLab. You'll want something 75like this to register a fastboot board: 76 77.. code-block:: console 78 79 sudo gitlab-runner register \ 80 --url https://gitlab.freedesktop.org \ 81 --registration-token $1 \ 82 --name MY_BOARD_NAME \ 83 --tag-list MY_BOARD_TAG \ 84 --executor docker \ 85 --docker-image "alpine:latest" \ 86 --docker-volumes "/dev:/dev" \ 87 --docker-network-mode "host" \ 88 --docker-privileged \ 89 --non-interactive 90 91For a servo board, you'll need to also volume mount the board's NFS 92root dir at /nfs and TFTP kernel directory at /tftp. 93 94The registration token has to come from a fd.o GitLab admin going to 95https://gitlab.freedesktop.org/admin/runners 96 97The name scheme for Google's lab is google-freedreno-boardname-n, and 98our tag is something like google-freedreno-db410c. The tag is what 99identifies a board type so that board-specific jobs can be dispatched 100into that pool. 101 102We need privileged mode and the /dev bind mount in order to get at the 103serial console and fastboot USB devices (--device arguments don't 104apply to devices that show up after container start, which is the case 105with fastboot, and the servo serial devices are actually links to 106/dev/pts). We use host network mode so that we can spin up a nginx 107server to collect XML results for fastboot. 108 109Once you've added your boards, you're going to need to add a little 110more customization in ``/etc/gitlab-runner/config.toml``. First, add 111``concurrent = <number of boards>`` at the top ("we should have up to 112this many jobs running managed by this gitlab-runner"). Then for each 113board's runner, set ``limit = 1`` ("only 1 job served by this board at a 114time"). Finally, add the board-specific environment variables 115required by your bare-metal script, something like:: 116 117 [[runners]] 118 name = "google-freedreno-db410c-1" 119 environment = ["BM_SERIAL=/dev/ttyDB410c8", "BM_POWERUP=google-power-up.sh 8", "BM_FASTBOOT_SERIAL=15e9e390"] 120 121If you want to collect the results for fastboot you need to add the following 122two board-specific environment variables ``BM_WEBDAV_IP`` and ``BM_WEBDAV_PORT``. 123These represent the IP address of the Docker host and the board specific port number 124that gets used to start a nginx server. 125 126Once you've updated your runners' configs, restart with ``sudo service 127gitlab-runner restart`` 128