Skip to content

Add Qemu adn UEFI Capsule Update support #26

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

Merged
merged 58 commits into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
0f9d3cc
tests: add pre-commit fixes
DaniilKl Aug 7, 2024
cb60fb2
reports: dasharo-hcl-report: delete surplus definition
DaniilKl Aug 8, 2024
b1202bf
add missing shellcheck source statements
DaniilKl Aug 8, 2024
43ce343
include: dts-functions: add QEMU q35 configuration
DaniilKl Aug 9, 2024
4232214
include: dts-functions: clean up platforms configuration
DaniilKl Aug 19, 2024
3f02401
include: dts-functions: erase DTS menu after entering shell
DaniilKl Aug 19, 2024
9fee55d
scripts: dasharo-deploy: dont use hash variables in conditions
DaniilKl Aug 20, 2024
cee2d5b
use test -n instead of test -v
DaniilKl Aug 21, 2024
89367a5
include: dts-functions: make func verify_artifacts more reusable
DaniilKl Sep 10, 2024
e6d4617
scripts: dasharo-deploy: add check_for_firmware_access func
DaniilKl Sep 10, 2024
ca790b3
scripts: dasharo-deploy: rework display_warning func
DaniilKl Sep 10, 2024
4a80617
scripts: dasharo-deploy: rework deploying config
DaniilKl Sep 10, 2024
c93114f
include: add UEFI Capusle Update configuration
DaniilKl Sep 24, 2024
c584d6e
scripts: dasharo-deploy: add UEFI Capsule Update configuration
DaniilKl Sep 24, 2024
bebd97b
scripts: dasharo-deploy: clean up installation and update funcs
DaniilKl Sep 24, 2024
fd45d4e
scripts: dasharo-deploy: add UEFI Capsule Update workflows
DaniilKl Sep 24, 2024
6b3eee9
scripts: dasharo-deploy: pre-commit fixes
DaniilKl Sep 24, 2024
1e152dc
scripts: ec_transition: delete surplus definitions
DaniilKl Sep 25, 2024
05606c7
scripts: dasharo-deploy: delete backup option
DaniilKl Sep 26, 2024
ce92021
include: dts-functions.sh: fix QEMU config
DaniilKl Sep 26, 2024
ecbb7b1
include: dts-functions: fix footer rendering
DaniilKl Sep 26, 2024
2aef6c3
Add more comments
DaniilKl Sep 26, 2024
97aebd8
scripts: dasharo-deploy: pre-commit fixes
DaniilKl Sep 26, 2024
61f68f0
remove -x flag from all files permissions
DaniilKl Sep 27, 2024
b447b8c
include: dts-functions: downloading artifacts: add capsules
DaniilKl Sep 27, 2024
3910890
scripts: dasharo-deploy: add some collors to output
DaniilKl Sep 30, 2024
a99ba02
scripts: dasharo-deploy: installation_workflow: fix downloading and
DaniilKl Sep 30, 2024
d7780f2
include: hal: add
DaniilKl Oct 14, 2024
6d53e2c
integrate HAL
DaniilKl Oct 14, 2024
5d31053
fix sourcing libs
DaniilKl Oct 14, 2024
ad3958c
include: fix transaction to Heads
DaniilKl Oct 17, 2024
0004f91
scripts: dasharo-deploy: add check_flash_chip
DaniilKl Oct 17, 2024
4f7f237
scripts: dasharo-deploy: check for EC firmware in update_workflow
DaniilKl Oct 17, 2024
04ab1e1
include: dts-functions.sh: add capsules for MSI
DaniilKl Oct 17, 2024
ef75759
include: dts-functions.sh: check_if_fused: add mocks
DaniilKl Oct 19, 2024
1fde2de
include: dts-functions.sh: check_if_boot_guard_enabled add mocks
DaniilKl Oct 21, 2024
183ae6a
include: dts-subscription.sh: fix creds problem warning printing
DaniilKl Oct 21, 2024
e78ced7
tests: these tests are replaced with OSVF
DaniilKl Oct 21, 2024
821e708
include: hal: dts-hal: add usage comment for tool_wrapper
DaniilKl Oct 23, 2024
965a1bf
scripts: dasharo-deploy: standardize firmware access warn
DaniilKl Oct 28, 2024
09258fb
include: hal: dts-hal.sh: use $@ instead of $*
DaniilKl Oct 29, 2024
f6ed238
include: do not modify SHELL env. var.
DaniilKl Oct 29, 2024
4934117
include: dts-functions.sh: fix AC adapter mocking
DaniilKl Oct 29, 2024
8e05b0f
delete explicit redirection to stdout (1>&1)
DaniilKl Oct 29, 2024
332f30f
include: dts-functions.sh: board_config: cleanup Novacustom config
DaniilKl Oct 29, 2024
55256f5
do not use flashrom with QEMU
DaniilKl Nov 7, 2024
84c7b60
include: dts-functions.sh: download_artifacts: delete
DaniilKl Nov 7, 2024
c4e607a
scripts: dasharo-deploy: send logs before trying to reboot
DaniilKl Nov 7, 2024
0f2abda
include: dts-functions.sh: cleanup download_ec func
DaniilKl Nov 12, 2024
79e4033
check for Capsule Update compatibility with currently installed firm
DaniilKl Nov 13, 2024
e85031f
scripts: dasharo-deploy: rework update routine to always reboot
DaniilKl Nov 14, 2024
8a2fc2f
include: dts-functions: fix pre-commit warnings
DaniilKl Nov 14, 2024
7087b78
include: dts-subscription: add UEFI Capsule Update
DaniilKl Nov 18, 2024
adb410e
include: dts-subscription: print warning instead of error
DaniilKl Nov 18, 2024
750629b
scripts: dasharo-deploy: fix version comparison in update workflow
DaniilKl Nov 18, 2024
0cd3f0a
Ask only for enter to continue
DaniilKl Nov 18, 2024
472ab6f
include: dts-subscription: move warning print outside login_to_dpp_se…
DaniilKl Nov 20, 2024
fd823a9
scripts: dasharo-deploy: got to handle_fw_switching in case of Heads
DaniilKl Nov 20, 2024
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
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ install:
install -m 0755 include/dts-environment.sh $(DESTDIR)$(SBINDIR)
install -m 0755 include/dts-functions.sh $(DESTDIR)$(SBINDIR)
install -m 0755 include/dts-subscription.sh $(DESTDIR)$(SBINDIR)
install -m 0755 include/hal/dts-hal.sh $(DESTDIR)$(SBINDIR)
install -m 0755 include/hal/common-mock-func.sh $(DESTDIR)$(SBINDIR)

install -m 0755 scripts/cloud_list $(DESTDIR)$(SBINDIR)
install -m 0755 scripts/dasharo-deploy $(DESTDIR)$(SBINDIR)
Expand Down
151 changes: 108 additions & 43 deletions include/dts-environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
# SPDX-License-Identifier: Apache-2.0

# shellcheck disable=SC2034
# shellcheck source=../include/hal/dts-hal.sh
source $DTS_HAL
# shellcheck source=../include/dts-functions.sh
source $DTS_FUNCS

# Text colors:
NORMAL='\033[0m'
Expand All @@ -13,15 +17,22 @@ YELLOW='\033[0;33m'
GREEN='\033[0;32m'
BLUE='\033[0;36m'

# DPP options:
# DPP variables:
DPP_SERVER_ADDRESS="https://dl.dasharo.com"
DPP_SERVER_USER_ALIAS="premium"
DPP_PACKAGE_MANAGER_DIR="/var/dasharo-package-manager"
DPP_AVAIL_PACKAGES_LIST="$DPP_PACKAGE_MANAGER_DIR/packages-list.json"
DPP_PACKAGES_SCRIPTS_PATH="$DPP_PACKAGE_MANAGER_DIR/packages-scripts"
DPP_SUBMENU_JSON="$DPP_PACKAGES_SCRIPTS_PATH/submenu.json"
DPP_CREDENTIAL_FILE="/etc/cloud-pass"
FW_STORE_URL="${FW_STORE_URL_DEV:-https://dl.3mdeb.com/open-source-firmware/Dasharo}"
FW_STORE_URL_DPP="https://cloud.3mdeb.com/public.php/webdav"
CLOUD_REQUEST="X-Requested-With: XMLHttpRequest"
BASE_CLOUDSEND_LOGS_URL="39d4biH4SkXD8Zm"
BASE_CLOUDSEND_PASSWORD="1{\[\k6G"
DEPLOY_REPORT="false"

# DTS options:
# DTS menu options:
HCL_REPORT_OPT="1"
DASHARO_FIRM_OPT="2"
REST_FIRM_OPT="3"
Expand All @@ -42,20 +53,24 @@ SEND_LOGS_OPT_LOW="$(echo $SEND_LOGS_OPT | awk '{print tolower($0)}')"
VERBOSE_OPT="V"
VERBOSE_OPT_LOW="$(echo $VERBOSE_OPT | awk '{print tolower($0)}')"

SYSTEM_VENDOR="${SYSTEM_VENDOR:-$(dmidecode -s system-manufacturer)}"
SYSTEM_MODEL="${SYSTEM_MODEL:-$(dmidecode -s system-product-name)}"
BOARD_VENDOR="${BOARD_VENDOR:-$(dmidecode -s system-manufacturer)}"
BOARD_MODEL="${BOARD_MODEL:-$(dmidecode -s baseboard-product-name)}"
# Hardware variables:
SYSTEM_VENDOR="$($DMIDECODE dump_var_mock -s system-manufacturer)"
SYSTEM_MODEL="$($DMIDECODE dump_var_mock -s system-product-name)"
BOARD_MODEL="$($DMIDECODE dump_var_mock -s baseboard-product-name)"
CPU_VERSION="$($DMIDECODE dump_var_mock -s processor-version)"

CPU_VERSION="$(dmidecode -s processor-version)"
BIOS_VENDOR="${BIOS_VENDOR:-$(dmidecode -s bios-vendor)}"
BIOS_VERSION="${BIOS_VERSION:-$(dmidecode -s bios-version)}"
# Firmware variables
BIOS_VENDOR="$($DMIDECODE dump_var_mock -s bios-vendor)"
BIOS_VERSION="$($DMIDECODE dump_var_mock -s bios-version)"
DASHARO_VERSION="$(echo $BIOS_VERSION | cut -d ' ' -f 3 | tr -d 'v')"
DASHARO_FLAVOR="$(echo $BIOS_VERSION | cut -d ' ' -f 1,2)"

# path to temporary files, created while deploying or updating Dasharo firmware
BIOS_UPDATE_FILE="/tmp/biosupdate.rom"
EC_UPDATE_FILE="/tmp/ecupdate.rom"
# Paths to temporary files, created while deploying or updating Dasharo
# firmware, are used globally for both: updating via binaries and via UEFI
# Capsule Update.
BIOS_UPDATE_FILE="/tmp/biosupdate"
BIOS_DUMP_FILE="/tmp/bios.bin"
EC_UPDATE_FILE="/tmp/ecupdate"
BIOS_HASH_FILE="/tmp/bioshash.sha256"
EC_HASH_FILE="/tmp/echash.sha256"
BIOS_SIGN_FILE="/tmp/biossignature.sig"
Expand All @@ -65,10 +80,6 @@ RESIGNED_BIOS_UPDATE_FILE="/tmp/biosupdate_resigned.rom"
SYSTEM_UUID_FILE="/tmp/system_uuid.txt"
SERIAL_NUMBER_FILE="/tmp/serial_number.txt"

# default value for flash chip related information
FLASH_CHIP_SELECT=""
FLASH_CHIP_SIZE=""

# dasharo-deploy backup cmd related variables, do we still use and need this as
# backup is placed in HCL?
ROOT_DIR="/"
Expand All @@ -77,50 +88,104 @@ FW_BACKUP_DIR="${ROOT_DIR}${FW_BACKUP_NAME}"
FW_BACKUP_TAR="${FW_BACKUP_DIR}.tar.gz"
FW_BACKUP_TAR="$(echo "$FW_BACKUP_TAR" | sed 's/\ /_/g')"

# path to system files
# Paths to system files
ERR_LOG_FILE="/var/local/dts-err.log"
FLASHROM_LOG_FILE="/var/local/flashrom.log"
FLASH_INFO_FILE="/tmp/flash_info"
OS_VERSION_FILE="/etc/os-release"
KEYS_DIR="/tmp/devkeys"

# path to system commands
CMD_POWEROFF="/sbin/poweroff"
CMD_REBOOT="/sbin/reboot"
CMD_SHELL="/bin/bash"
# Paths to system commands:
CMD_SHELL="bash"

# Paths to DTS commands:
CMD_DASHARO_HCL_REPORT="/usr/sbin/dasharo-hcl-report"
CMD_NCMENU="/usr/sbin/novacustom_menu"
CMD_DASHARO_DEPLOY="/usr/sbin/dasharo-deploy"
CMD_CLOUD_LIST="/usr/sbin/cloud_list"
CMD_EC_TRANSITION="/usr/sbin/ec_transition"

# default values for flashrom programmer
FLASHROM="${FLASHROM:-flashrom}"
# Configuration variables declaration and default values (see dts-functions.sh/
# board_config function for more inf.):
# Versions and names:
declare DASHARO_REL_NAME
declare DASHARO_REL_VER
declare DASHARO_REL_VER_DPP
declare DASHARO_REL_VER_DPP_CAP
declare HEADS_REL_VER_DPP
declare DASHARO_REL_VER_DPP_SEABIOS
declare COMPATIBLE_EC_FW_VERSION
# and for capsules:
declare DASHARO_REL_VER_CAP
declare DASHARO_REL_VER_DPP_CAP
# To use capsule update a platform should already run a firmware with capsule
# update support. Therefore DTS should check, from which Dasharo firmware
# version capsule update is supported for the platform and compare with the
# version of the currently installed firmware. This variable holds the version
# from which Dasharo firmware supports capsule update for current patform. It is
# set in board_config:
declare DASHARO_SUPPORT_CAP_FROM
# Links to files:
declare BIOS_LINK_COMM
declare BIOS_HASH_LINK_COMM
declare BIOS_SIGN_LINK_COMM
declare BIOS_LINK_DPP
declare BIOS_HASH_LINK_DPP
declare BIOS_SIGN_LINK_DPP
declare BIOS_LINK_DPP_SEABIOS
declare BIOS_HASH_LINK_DPP_SEABIOS
declare BIOS_SIGN_LINK_DPP_SEABIOS
declare EC_LINK_COMM
declare EC_HASH_LINK_COMM
declare EC_SIGN_LINK_COMM
declare EC_LINK_DPP
declare EC_HASH_LINK_DPP
declare EC_SIGN_LINK_DPP
declare HEADS_LINK_DPP
declare HEADS_HASH_LINK_DPP
declare HEADS_SIGN_LINK_DPP
# and for capsules:
declare BIOS_LINK_COMM_CAP
declare BIOS_HASH_LINK_COMM_CAP
declare BIOS_SIGN_LINK_COMM_CAP
declare BIOS_LINK_DPP_CAP
declare BIOS_HASH_LINK_DPP_CAP
declare BIOS_SIGN_LINK_DPP_CAP
declare EC_LINK_COMM_CAP
declare EC_HASH_LINK_COMM_CAP
declare EC_SIGN_LINK_COMM_CAP
# Configs, are used in dasharo-deploy script:
CAN_INSTALL_BIOS="false"
HAVE_HEADS_FW="false"
HAVE_EC="false"
NEED_EC_RESET="false"
NEED_SMBIOS_MIGRATION="false"
NEED_SMMSTORE_MIGRATION="false"
NEED_BOOTSPLASH_MIGRATION="false"
NEED_BLOB_TRANSMISSION="false"
NEED_ROMHOLE_MIGRATION="false"
# Default flashrom parameters, may differ depending on a platform:
PROGRAMMER_BIOS="internal"
PROGRAMMER_EC="ite_ec"

DASHARO_ECTOOL="${DASHARO_ECTOOL:-dasharo_ectool}"

# variables defining Dasharo specific entries in DMI tables, used to check if
# Dasharo FW is already installed
PROGRAMMER_EC="ite_ec:boardmismatch=force,romsize=128K,autoload=disable"
declare FLASHROM_ADD_OPT_UPDATE_OVERRIDE
declare HEADS_SWITCH_FLASHROM_OPT_OVERRIDE
# Platform-specific:
declare PLATFORM_SIGN_KEY

# Other variables:
# Default values for flash chip related information:
declare FLASH_CHIP_SELECT
declare FLASH_CHIP_SIZE
# Default UEFI Capsule Update device:
CAP_UPD_DEVICE="/dev/efi_capsule_loader"
# Variables defining Dasharo specific entries in DMI tables, used to check if
# Dasharo FW is already installed:
DASHARO_VENDOR="3mdeb"
DASHARO_NAME="Dasharo"

# most the time one flash chipset will be detected, for other cases (like for
# ASUS KGPE-D16) we will test the following list in check_flash_chip function
# Most the time one flash chipset will be detected, for other cases (like for
# ASUS KGPE-D16) we will test the following list in check_flash_chip function:
FLASH_CHIP_LIST="W25Q64BV/W25Q64CV/W25Q64FV W25Q64JV-.Q W25Q128.V..M"

# Dasharo Supporters Entrance variables
DPP_credential_file="/etc/cloud-pass"
FW_STORE_URL="${FW_STORE_URL_DEV:-https://dl.3mdeb.com/open-source-firmware/Dasharo}"
FW_STORE_URL_DPP="https://cloud.3mdeb.com/public.php/webdav"
CLOUD_REQUEST="X-Requested-With: XMLHttpRequest"

## base values
BASE_CLOUDSEND_LOGS_URL="39d4biH4SkXD8Zm"
BASE_CLOUDSEND_PASSWORD="1{\[\k6G"
DEPLOY_REPORT="false"

BASE_DTS_LOGS_URL="xjBCYbzFdyq3WLt"
DTS_LOGS_PASSWORD="/w\J&<y1"

Expand Down
Loading