Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building from source os works #545

Draft
wants to merge 5 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 120 additions & 0 deletions dasharo-stability/building-boot-os.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
*** Settings ***
Library Collections
Library Dialogs
Library OperatingSystem
Library Process
Library String
Library Telnet timeout=20 seconds connection_timeout=120 seconds
Library SSHLibrary timeout=90 seconds
Library RequestsLibrary
# TODO: maybe have a single file to include if we need to include the same
# stuff in all test cases
Resource ../variables.robot
Resource ../keywords.robot
Resource ../keys.robot

# TODO:
# - document which setup/teardown keywords to use and what are they doing
# - go threough them and make sure they are doing what the name suggest (not
# exactly the case right now)
Suite Setup Run Keywords
... Prepare Test Suite
... AND
... Skip If not ${BUILD_ON_NEWLY_INSTALLED_OS_SUPPORT}
... AND
... Install Ubuntu From Connected Drive
Suite Teardown Run Keywords
... Log Out And Close Connection

*** Test Cases ***
BNO001.001 Build on a Newly installed OS
[Documentation] Check if the ns5x-tgl binary will be built
... properly on a fresh install of Ubuntu

Power On
Boot System Or From Connected Disk ubuntu
Login To Linux

Switch To Root User
Install Package git
Install Docker Packages

Build Qemu

BNO002.001 Build NS5x-tgl on a Newly installed OS
[Documentation] Check if the qemu binary will be built properly
... on a fresh install of Ubuntu

Power On
Boot System Or From Connected Disk ubuntu
Login To Linux

Switch To Root User
Install Package git
Install Docker Packages

Build Novacustom Ns5x-tgl

*** Keywords ***
Install Ubuntu From Connected Drive
[Documentation] Installs ubuntu from a drive connected by `scripts/ci/run_qemu.sh os_install`
... which is called in `scripts/ci/qemu-build-test.sh`

Power On
Enter UEFI Shell
Execute UEFI Shell Command FS0:
Execute UEFI Shell Command cd EFI
Execute UEFI Shell Command cd boot
Execute UEFI Shell Command grubx64.efi
Sleep 15m # wait 15m for the installation to complete

Build Qemu
[Documentation] Build the firmware for qemu

Execute Command In Terminal rm -rf coreboot
Execute Command In Terminal git clone https://github.com/Dasharo/coreboot
... 5m

Execute Command In Terminal cd coreboot; git switch dasharo; cd ..
${out}= Execute Command In Terminal cd coreboot; ./build.sh qemu; cd ..
... 120m

Should Contain ${out} FMAP REGION: COREBOOT
${out}= Execute Command In Terminal ls coreboot/qemu_q35*.rom
Should Not Contain ${out} No such file

Build Novacustom Ns5x-tgl
[Documentation] Build the firmware for ns5x-tgl

Execute Command In Terminal rm -rf coreboot
Execute Command In Terminal rm -rf ec

Execute Command In Terminal git clone https://github.com/Dasharo/coreboot
... 5m
Execute Command In Terminal git clone https://github.com/dasharo/ec
... 5m

Execute Command In Terminal cd ec; git switch ns5x_tgl_v1.5.2 ; cd ..
... 5m
Execute Command In Terminal cd ec; git submodule update --init --recursive --checkout; cd ..
... 5m
${out}= Execute Command In Terminal cd ec; EC_BOARD_VENDOR=novacustom EC_BOARD_MODEL=ns5x_tgl ./build.sh; cd ..
... 15m

${out}= Execute Command In Terminal ls ec/novacustom_ns5x_tgl_ec.rom
Should Contain ${out} novacustom_ns5x_tgl_ec.rom
Execute Command In Terminal cp ec/novacustom_ns5x_tgl_ec.rom coreboot/ec.rom

Execute Command In Terminal cd coreboot; git switch ns5x_tgl_v1.5.2 ; cd ..
... 5m
Execute Command In Terminal cd coreboot; git submodule update --init --recursive --checkout; cd ..
... 5m

${docker_command}= Set Variable
... /bin/bash -c "make distclean && cp configs/config.novacustom_ns5x_tgl .config && make olddefconfig && make"
${out}= Execute Command In Terminal
... cd coreboot; docker run --rm -it -u $UID -v $PWD:/home/coreboot/coreboot -w /home/coreboot/coreboot coreboot/coreboot-sdk:2023-11-24_2731fa619b ${docker_command}; cd ..
... 30m
Should Contain ${out} FMAP REGION: COREBOOT
${out}= Execute Command In Terminal ls build/coreboot.rom
Should Not Contain ${out} No such file
3 changes: 2 additions & 1 deletion lib/flash.robot
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@ Flash Via Internal Programmer
IF ${read_only}
Fail Make sure that SPI locks are disabled prior flashing internally
END
Send File To DUT ${fw_file_path} /tmp/${fw_file_path}

# If no region is given, flash the whole binary
IF "${region}" != "${EMPTY}"
${args}= Set Variable -N --ifd -i ${region}
ELSE
${args}= Set Variable ${EMPTY}
END
Flash Via Internal Programmer With Args ${fw_file_path} ${args}
Flash Via Internal Programmer With Args /tmp/${fw_file_path} ${args}

Check If RW SECTION B Is Present In A Firmware File
[Documentation] Parses ROM with cbfstool to check if A or A + B sections are there
Expand Down
3 changes: 3 additions & 0 deletions platform-configs/include/default.robot
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,6 @@ ${STABILITY_DETECTION_COLDBOOT_ITERATIONS}= 2
${STABILITY_DETECTION_WARMBOOT_ITERATIONS}= 2
${STABILITY_DETECTION_REBOOT_ITERATIONS}= 5
${STABILITY_DETECTION_SUSPEND_ITERATIONS}= 5
# Command used in the ./build script of coreboot repo
${BUILD_ON_NEWLY_INSTALLED_OS_SUPPORT}= ${FALSE}
${COREBOOT_BUILD_WRAPPER_SUBCOMMAND}= ${TBD}
3 changes: 3 additions & 0 deletions platform-configs/qemu.robot
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ ${AUTO_BOOT_TIME_OUT_DEFAULT_VALUE}= 0
# Test module: dasharo-stability
${CAPSULE_UPDATE_SUPPORT}= ${TRUE}

${BUILD_ON_NEWLY_INSTALLED_OS_SUPPORT}= ${TRUE}
${COREBOOT_BUILD_WRAPPER_SUBCOMMAND}= qemu


*** Keywords ***
Power On
Expand Down
9 changes: 9 additions & 0 deletions scripts/ci/qemu-build-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

git clone https://github.com/Dasharo/preseeds
mkdir ./qemu-data &> /dev/null
preseeds/ubuntu/create_image.sh -o ./qemu-data/ubuntu.iso
qemu-img create -f qcow2 ./qemu-data/hdd.qcow2 40G
./scripts/ci/qemu-run.sh graphic os_install &
sleep 5
robot -L TRACE -v config:qemu -v rte_ip:127.0.0.1 -d ./logs/$(date +%Y.%m.%d_%H.%M.%S)/setup-and-boot-menus -v snipeit:no dasharo-stability/building-boot-os.robot
Loading