From 16fb9a8a316bf6ea838e79d1c207523da165f9fe Mon Sep 17 00:00:00 2001 From: Daniil Klimuk Date: Mon, 8 Apr 2024 11:41:39 +0200 Subject: [PATCH] distro: recipes-dts: move DTS scripts to another repo Move all DTS scripts to another repo and add as git package. Signed-off-by: Daniil Klimuk --- .../dts-scripts/dts-scripts_git.bb | 44 + .../recipes-dts/dts/dasharo-deploy.bb | 23 - .../dts/dasharo-deploy/dasharo-deploy | 883 ------------ meta-dts-distro/recipes-dts/dts/dts.bb | 40 - .../recipes-dts/dts/dts/cloud_list | 58 - meta-dts-distro/recipes-dts/dts/dts/dts | 227 ---- meta-dts-distro/recipes-dts/dts/dts/dts-boot | 14 - .../recipes-dts/dts/dts/dts-environment.sh | 91 -- .../recipes-dts/dts/dts/dts-functions.sh | 1208 ----------------- .../recipes-dts/dts/dts/dts-profile.sh | 5 - .../recipes-dts/dts/dts/ec_transition | 130 -- .../packagegroups/packagegroup-dts.bb | 4 +- .../recipes-dts/reports/dasharo-hcl-report.bb | 30 - .../dasharo-hcl-report/dasharo-hcl-report | 370 ----- .../recipes-dts/reports/touchpad-info.bb | 23 - .../reports/touchpad-info/touchpad-info | 42 - 16 files changed, 45 insertions(+), 3147 deletions(-) create mode 100644 meta-dts-distro/recipes-dts/dts-scripts/dts-scripts_git.bb delete mode 100644 meta-dts-distro/recipes-dts/dts/dasharo-deploy.bb delete mode 100755 meta-dts-distro/recipes-dts/dts/dasharo-deploy/dasharo-deploy delete mode 100644 meta-dts-distro/recipes-dts/dts/dts.bb delete mode 100755 meta-dts-distro/recipes-dts/dts/dts/cloud_list delete mode 100644 meta-dts-distro/recipes-dts/dts/dts/dts delete mode 100644 meta-dts-distro/recipes-dts/dts/dts/dts-boot delete mode 100644 meta-dts-distro/recipes-dts/dts/dts/dts-environment.sh delete mode 100644 meta-dts-distro/recipes-dts/dts/dts/dts-functions.sh delete mode 100644 meta-dts-distro/recipes-dts/dts/dts/dts-profile.sh delete mode 100644 meta-dts-distro/recipes-dts/dts/dts/ec_transition delete mode 100644 meta-dts-distro/recipes-dts/reports/dasharo-hcl-report.bb delete mode 100755 meta-dts-distro/recipes-dts/reports/dasharo-hcl-report/dasharo-hcl-report delete mode 100644 meta-dts-distro/recipes-dts/reports/touchpad-info.bb delete mode 100644 meta-dts-distro/recipes-dts/reports/touchpad-info/touchpad-info diff --git a/meta-dts-distro/recipes-dts/dts-scripts/dts-scripts_git.bb b/meta-dts-distro/recipes-dts/dts-scripts/dts-scripts_git.bb new file mode 100644 index 00000000..eef78397 --- /dev/null +++ b/meta-dts-distro/recipes-dts/dts-scripts/dts-scripts_git.bb @@ -0,0 +1,44 @@ +SUMMARY = "Dasharo Tools Suite scripts." +SECTION = "tools" +HOMEPAGE = "https://github.com/Dasharo/dts-v2" + +LICENSE = "MIT" +LIC_FILES_CHKSUM = "file://LICENSE;md5=575ab8837c52eafc7b9eb8b244072bc7" + +SRCREV = "13dad8ea6901cf921de0dd45d464bea3535892e0" +SRC_URI = "git://github.com/Dasharo/dts-v2;protocol=https;branch=main" + +PV = "0.1+git${SRCPV}" + +S = "${WORKDIR}/git" + +RDEPENDS:${PN} = " \ + packagegroup-coreboot-utils \ + flashrom \ + iasl \ + tar \ + i2c-tools \ + i2c-tools-misc \ + bash \ + dmidecode \ + acpi-call-dkms \ + iotools \ +" + +do_install () { + install -d ${D}/${sbindir} + install -m 0755 ${S}/scripts/dts ${D}/${sbindir} + install -m 0755 ${S}/scripts/dts-boot ${D}/${sbindir} + install -m 0755 ${S}/scripts/ec_transition ${D}/${sbindir} + install -m 0755 ${S}/scripts/cloud_list ${D}/${sbindir} + install -m 0755 ${S}/scripts/dasharo-deploy ${D}/${sbindir} + install -m 0755 ${S}/reports/dasharo-hcl-report ${D}/${sbindir} + install -m 0755 ${S}/reports/touchpad-info ${D}/${sbindir} + install -m 0664 ${S}/include/dts-environment.sh ${D}/${sbindir} + install -m 0664 ${S}/include/dts-functions.sh ${D}/${sbindir} + + # install profile dropin so the DTS_ENV and DTS_FUNCS variables are set when + # loged via SSH + install -d ${D}${sysconfdir}/profile.d/ + install -m 0755 ${S}/scripts/dts-profile.sh ${D}${sysconfdir}/profile.d/ +} diff --git a/meta-dts-distro/recipes-dts/dts/dasharo-deploy.bb b/meta-dts-distro/recipes-dts/dts/dasharo-deploy.bb deleted file mode 100644 index 45591719..00000000 --- a/meta-dts-distro/recipes-dts/dts/dasharo-deploy.bb +++ /dev/null @@ -1,23 +0,0 @@ -DESCRIPTION = "Dasharo Deploy Tools" -SECTION = "tools" -HOMEPAGE = "https://docs.dasharo.com" - -LICENSE = "MIT" - -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" - -SRC_URI = " \ - file://dasharo-deploy \ -" - -S = "${WORKDIR}" - -RDEPENDS:${PN} = " \ - bash \ - packagegroup-coreboot-utils \ -" - -do_install () { - install -d ${D}/${sbindir} - install -m 0755 ${S}/dasharo-deploy ${D}/${sbindir} -} diff --git a/meta-dts-distro/recipes-dts/dts/dasharo-deploy/dasharo-deploy b/meta-dts-distro/recipes-dts/dts/dasharo-deploy/dasharo-deploy deleted file mode 100755 index a40deef1..00000000 --- a/meta-dts-distro/recipes-dts/dts/dasharo-deploy/dasharo-deploy +++ /dev/null @@ -1,883 +0,0 @@ -#!/usr/bin/env bash - -source $DTS_ENV -source $DTS_FUNCS - -[ -z "$BOARD_VENDOR" ] && error_exit "BOARD_VENDOR not given" -[ -z "$SYSTEM_MODEL" ] && error_exit "SYSTEM_MODEL not given" - -CMD="$1" -FUM="$2" - -ask_for_version() { - while : ; do - echo - echo "Please, select Dasharo firmware version to install" - - # -v: True if the shell variable varname is set (has been assigned a value). - if [ -v BIOS_HASH_LINK_COMM ]; then - echo " c) Community version" - fi - if [ -v BIOS_HASH_LINK_DES ]; then - if [ -v DES_IS_LOGGED ]; then - echo " d) DES version" - else - echo " DES version available, if you are interested, please visit https://shop.3mdeb.com/product-category/dasharo-entry-subscription/" - fi - fi - echo " b) Back to main menu" - echo - read -r -p "Enter an option: " OPTION - echo - - case ${OPTION} in - c|C|comm|community|COMMUNITY|COMM|Community) - if [ -v BIOS_HASH_LINK_COMM ]; then - BIOS_LINK=$BIOS_LINK_COMM - BIOS_HASH_LINK=$BIOS_HASH_LINK_COMM - BIOS_SIGN_LINK=$BIOS_SIGN_LINK_COMM - if [ -v EC_HASH_LINK_COMM ]; then - EC_LINK=$EC_LINK_COMM - EC_HASH_LINK=$EC_HASH_LINK_COMM - EC_SIGN_LINK=$EC_SIGN_LINK_COMM - fi - echo "Community version selected" - break - else - error_exit "Bad option or resignation. Returning to main menu..." - fi - ;; - d|D|des|DES|Des) - if [ -v BIOS_HASH_LINK_DES ]; then - BIOS_LINK=$BIOS_LINK_DES - BIOS_HASH_LINK=$BIOS_HASH_LINK_DES - BIOS_SIGN_LINK=$BIOS_SIGN_LINK_DES - if [ -v EC_HASH_LINK_DES ]; then - EC_LINK=$EC_LINK_DES - EC_HASH_LINK=$EC_HASH_LINK_DES - EC_SIGN_LINK=$EC_SIGN_LINK_DES - fi - echo "Dasharo Entry Subscription version selected" - break - else - error_exit "Bad option. Returning to main menu..." - fi - ;; - b|B) - echo "Returning to main menu..." - exit 0 - ;; - *) - ;; - esac - done -} - -display_flashing_warning() { - while : ; do - echo - print_warning "Please verify detected hardware!" - echo - - if [ -v BOARD_VENDOR ]; then - echo "Board vendor: $BOARD_VENDOR" - fi - if [ -v SYSTEM_MODEL ]; then - echo "System model: $SYSTEM_MODEL" - fi - if [ -v BOARD_MODEL ]; then - echo "Board model: $BOARD_MODEL" - fi - echo - read -r -p "Does it match your actual specification? (Y|n) " OPTION - echo - - case ${OPTION} in - yes|y|Y|Yes|YES) - break - ;; - n|N) - echo "Returning to main menu..." - exit 0 - ;; - *) - ;; - esac - done - - while : ; do - echo "Following firmware will be used to install Dasharo" - if [ -v BIOS_HASH_LINK ]; then - local _bios_hash="$(cat $BIOS_HASH_FILE | cut -d ' ' -f 1)" - echo "Dasharo BIOS firmware:" - echo " - link: $BIOS_LINK" - echo " - hash: $_bios_hash" - fi - if [ -v EC_HASH_LINK ]; then - local _ec_hash="$(cat $EC_HASH_FILE | cut -d ' ' -f 1)" - echo "Dasharo EC firmware:" - echo " - link: $EC_LINK" - echo " - hash: $_ec_hash" - fi - echo - echo "You can learn more about this release on: https://docs.dasharo.com/" - - if check_if_dasharo; then - echo - read -r -p "Do you want to update Dasharo firmware on your hardware? (Y|n) " OPTION - echo - else - echo - read -r -p "Do you want to install Dasharo firmware on your hardware? (Y|n) " OPTION - echo - fi - - case ${OPTION} in - yes|y|Y|Yes|YES) - break - ;; - n|N) - echo "Returning to main menu..." - exit 0 - ;; - *) - ;; - esac - done -} - -backup() { - rm -rf "$FW_BACKUP_DIR" - mkdir -p "$FW_BACKUP_DIR" - - echo "Backing up BIOS firmware and store it locally..." - echo "Remember that firmware is also backed up in HCL report." - check_intel_regions - if [ $BOARD_HAS_FD_REGION -ne 0 ]; then - # Use safe defaults. Descriptor may contain additional regions not detected - # by flashrom and will return failure when attempted to be read. BIOS and - # Flash descriptor regions should always be readable. If not, then we have - # some ugly case, hard to deal with. - FLASHROM_ADD_OPT_READ="--ifd -i fd -i bios" - if [ $BOARD_HAS_ME_REGION -ne 0 ] && [ $BOARD_ME_REGION_LOCKED -eq 0 ]; then - # ME region is not locked, read it as well - FLASHROM_ADD_OPT_READ+=" -i me" - fi - if [ $BOARD_HAS_GBE_REGION -ne 0 ] && [ $BOARD_GBE_REGION_LOCKED -eq 0 ]; then - # GBE region is present and not locked, read it as well - FLASHROM_ADD_OPT_READ+=" -i gbe" - fi - else - # No descriptor, probably safe to read everything - FLASHROM_ADD_OPT_READ="" - fi - $FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} -r "${FW_BACKUP_DIR}"/rom.bin ${FLASHROM_ADD_OPT_READ} >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - error_check "Failed to read BIOS firmware backup" - - if [ "$HAVE_EC" == "true" ]; then - echo "Checking for Open Source Embedded Controller firmware" - $DASHARO_ECTOOL info >> $ERR_LOG_FILE 2>&1 - if [ $? -eq 0 ]; then - echo "Device has already Open Source Embedded Controller firmware, do not backup EC..." - else - echo "Backing up EC firmware..." - $FLASHROM -p "$PROGRAMMER_EC" ${FLASH_CHIP_SELECT} -r "${FW_BACKUP_DIR}"/ec.bin >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - error_check "Failed to read EC firmware backup" - fi - fi - - echo "Saving backup to: $FW_BACKUP_TAR" - tar --gzip -cf "$FW_BACKUP_TAR" "$FW_BACKUP_DIR" - error_check "Failed to create firmware backup archive" - rm -rf "${FW_BACKUP_DIR}" - - echo "Successfully backed up firmware locally at: $FW_BACKUP_TAR" -} - -romhole_migration() { - cbfstool $BIOS_UPDATE_FILE layout -w | grep -q "ROMHOLE" || return - - $FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} -r /tmp/rom.bin --ifd -i bios >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - error_check "Failed to read current firmware to migrate MSI ROMHOLE" - if check_if_dasharo; then - cbfstool /tmp/rom.bin layout -w | grep -q "ROMHOLE" || return - # This one is rather unlikely to fail, but just in case print a warning - cbfstool /tmp/rom.bin read -r ROMHOLE -f /tmp/romhole.bin 2> /dev/null - if [ $? -ne 0 ]; then - print_warning "Failed to migrate MSI ROMHOLE, your platform's unique SMBIOS/DMI data may be lost" - return - fi - else - dd if=/tmp/rom.bin of=/tmp/romhole.bin skip=$((0x17C0000)) bs=128K count=1 iflag=skip_bytes > /dev/null 2>&1 - fi - - cbfstool "$BIOS_UPDATE_FILE" write -r ROMHOLE -f /tmp/romhole.bin -u 2> /dev/null -} - -smbios_migration() { - echo -n "$(dmidecode -s system-uuid)" > $SYSTEM_UUID_FILE - echo -n "$(dmidecode -s baseboard-serial-number)" > $SERIAL_NUMBER_FILE - - COREBOOT_SEC=$(cbfstool $BIOS_UPDATE_FILE layout -w | grep "COREBOOT") - FW_MAIN_A_SEC=$(cbfstool $BIOS_UPDATE_FILE layout -w | grep "FW_MAIN_A") - FW_MAIN_B_SEC=$(cbfstool $BIOS_UPDATE_FILE layout -w | grep "FW_MAIN_B") - - if [ -n "$COREBOOT_SEC" ]; then - # if the migration can be done there for sure will be COREBOOT section - echo "Beginning SMBIOS migration process..." - echo "Migrate to COREBOOT section." - cbfstool $BIOS_UPDATE_FILE add -f $SERIAL_NUMBER_FILE -n serial_number -t raw -r COREBOOT - cbfstool $BIOS_UPDATE_FILE add -f $SYSTEM_UUID_FILE -n system_uuid -t raw -r COREBOOT - fi - - if [ -n "$FW_MAIN_A_SEC" ]; then - echo "Migrate to FW_MAIN_A section." - cbfstool $BIOS_UPDATE_FILE expand -r FW_MAIN_A - cbfstool $BIOS_UPDATE_FILE add -f $SERIAL_NUMBER_FILE -n serial_number -t raw -r FW_MAIN_A - cbfstool $BIOS_UPDATE_FILE add -f $SYSTEM_UUID_FILE -n system_uuid -t raw -r FW_MAIN_A - cbfstool $BIOS_UPDATE_FILE truncate -r FW_MAIN_A - fi - - if [ -n "$FW_MAIN_B_SEC" ]; then - echo "Migrate to FW_MAIN_B section." - cbfstool $BIOS_UPDATE_FILE expand -r FW_MAIN_B - cbfstool $BIOS_UPDATE_FILE add -f $SERIAL_NUMBER_FILE -n serial_number -t raw -r FW_MAIN_B - cbfstool $BIOS_UPDATE_FILE add -f $SYSTEM_UUID_FILE -n system_uuid -t raw -r FW_MAIN_B - cbfstool $BIOS_UPDATE_FILE truncate -r FW_MAIN_B - fi -} - -smmstore_migration() { - echo -n "Backing up firmware configuration... " - $FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} -r /tmp/dasharo_dump.rom ${FLASHROM_ADD_OPT_READ} --fmap -i FMAP -i SMMSTORE >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - cbfstool /tmp/dasharo_dump.rom read -r SMMSTORE -f /tmp/smmstore.bin >> $ERR_LOG_FILE 2>&1 || \ - print_warning "Failed! Default settings will be used." - cbfstool "$BIOS_UPDATE_FILE" write -r SMMSTORE -f /tmp/smmstore.bin -u >> $ERR_LOG_FILE 2>&1 || \ - print_warning "Failed! Default settings will be used." - print_green Done. -} - -bootsplash_migration() { - $FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} -r /tmp/dasharo_dump.rom ${FLASHROM_ADD_OPT_READ} --fmap -i FMAP -i BOOTSPLASH >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - # If no custom logo, return from bootsplash_migration early and don't show - # unnecessary messages - cbfstool /tmp/dasharo_dump.rom extract -r BOOTSPLASH -n logo.bmp -f /tmp/logo.bmp >> $ERR_LOG_FILE 2>&1 || return 1 - echo -n "Backing up custom boot logo... " - dcu logo $BIOS_UPDATE_FILE -l /tmp/logo.bmp >> $ERR_LOG_FILE 2>&1 || \ - print_warning "Failed! Default boot splash will be used." || return 1 - print_green Done. -} - -resign_binary() { - if [ "$HAVE_VBOOT" -eq 0 ]; then - download_keys - sign_firmware.sh $BIOS_UPDATE_FILE $KEYS_DIR $RESIGNED_BIOS_UPDATE_FILE - error_check "Cannot resign binary file. Please, make sure if you have proper keys. Aborting..." - BIOS_UPDATE_FILE="$RESIGNED_BIOS_UPDATE_FILE" - fi -} - -check_vboot_keys() { - if [ "$HAVE_VBOOT" -eq 0 ]; then - # If we flash whole BIOS region, no need to check if keys match - grep -q "\--ifd" <<< "$FLASHROM_ADD_OPT_UPDATE" && grep -q "\-i bios" <<< "$FLASHROM_ADD_OPT_UPDATE" && return - # No FMAP flashing? Also skip - grep -q "\--fmap" <<< "$FLASHROM_ADD_OPT_UPDATE" || return - - BINARY_KEYS=$(CBFSTOOL=$(which cbfstool) futility show $BIOS_UPDATE_FILE| grep -i 'key sha1sum') - - if [ $BOARD_HAS_FD_REGION -eq 0 ]; then - FLASHROM_ADD_OPT_READ="" - else - FLASHROM_ADD_OPT_READ="--ifd -i bios" - fi - echo "Checking vboot keys." - $FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_READ} -r /tmp/bios.bin > /dev/null 2>/dev/null - if [ $? -eq 0 ] && [ -f "/tmp/bios.bin" ]; then - FLASH_KEYS=$(CBFSTOOL=$(which cbfstool) futility show /tmp/bios.bin | grep -i 'key sha1sum') - diff <(echo "$BINARY_KEYS") <(echo "$FLASH_KEYS") > /dev/null 2>&1 - # If keys are different we must additionally flash at least GBB region as well - if [ $? -ne 0 ]; then - FLASHROM_ADD_OPT_UPDATE+=" -i GBB" - fi - fi - fi -} - -blob_transmission() { - echo "Extracting the UEFI image from BIOS update" - wget -O "$DBT_BIOS_UPDATE_FILENAME" --user-agent='Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)' "$DBT_BIOS_UPDATE_URL" >> $ERR_LOG_FILE 2>&1 - error_file_check "$DBT_BIOS_UPDATE_FILENAME" "Failed to download BIOS for $SYSTEM_MODEL. Please make sure Ethernet cable is connected and try again." - - sha256sum --check <(echo "$DBT_BIOS_UPDATE_HASH") - error_check "Failed SHA-256 sum check on the downloaded BIOS for $SYSTEM_MODEL" - - binwalk --run-as=root -e "$DBT_BIOS_UPDATE_FILENAME" -C /tmp >> $ERR_LOG_FILE 2>&1 - error_file_check "$DBT_UEFI_IMAGE" "Failed to extract UEFI image from BIOS update" - - uefi-firmware-parser -e "$DBT_UEFI_IMAGE" -O >> $ERR_LOG_FILE 2>&1 - - if [ -n "$SINIT_ACM_FILENAME" ] && [ -n "$SINIT_ACM_URL" ]; then - echo "Downloading the Intel SINIT ACM" - wget -O "$SINIT_ACM_FILENAME" "$SINIT_ACM_URL" >> $ERR_LOG_FILE 2>&1 - error_file_check "$SINIT_ACM_FILENAME" "Failed to download Intel SINIT ACM. Please make sure Ethernet cable is connected and try again." - - # Intel does not provide hash of the package, use SHA256 we know is good - sha256sum --check <(echo "$SINIT_ACM_HASH") - error_check "Failed SHA-256 sum check on the downloaded Intel SINIT ACM." - - unzip -o "$SINIT_ACM_FILENAME" -d /tmp >> $ERR_LOG_FILE 2>&1 - error_check "Failed to decompress Intel SINIT ACM package." - fi - - echo "Beginning Dasharo Blobs Transmission process..." - - if [ -n "$SCH5545_FW" ]; then - error_file_check "$SCH5545_FW" "Failed to find SCH5545 EC firmware binary." - echo -n "Adding SCH5545 EC firmware..." - cbfstool "$BIOS_UPDATE_FILE" add -f "$SCH5545_FW" -n sch5545_ecfw.bin -t raw - print_green "Done" - fi - - if [ -n "$ACM_BIN" ]; then - error_file_check "$ACM_BIN" "Failed to find BIOS ACM binary." - echo -n "Adding BIOS ACM..." - cbfstool "$BIOS_UPDATE_FILE" add -f "$ACM_BIN" -n txt_bios_acm.bin -t raw - print_green "Done" - fi - - if [ -n "$SINIT_ACM" ]; then - error_file_check "$SINIT_ACM" "Failed to find Intel SINIT ACM binary." - echo -n "Adding SINIT ACM..." - cbfstool "$BIOS_UPDATE_FILE" add -f "$SINIT_ACM" -n txt_sinit_acm.bin -t raw - print_green "Done" - fi -} - -install_ec() { - verify_artifacts ec - echo "Installing EC..." - $FLASHROM -p "$PROGRAMMER_EC" ${FLASH_CHIP_SELECT} -w "$EC_UPDATE_FILE" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - error_check "Failed to install Dasharo EC firmware" - echo "Successfully installed Dasharo EC firmware" -} - -install() { - ask_for_version - download_artifacts - display_flashing_warning - check_flash_lock - verify_artifacts bios - - check_intel_regions - check_blobs_in_binary $BIOS_UPDATE_FILE - check_if_me_disabled - set_intel_regions_update_params "-N --ifd -i bios" - - if [ "$HAVE_EC" == "true" ]; then - echo "Checking for Open Source Embedded Controller firmware" - $DASHARO_ECTOOL info >> $ERR_LOG_FILE 2>&1 - if [ $? -eq 0 ]; then - echo "Device has already Open Source Embedded Controller firmware, do not flash EC..." - else - _ec_fw_version=$($FLASHROM -p "$PROGRAMMER_EC" ${FLASH_CHIP_SELECT} | grep "Mainboard EC Version" | tr -d ' ' | cut -d ':' -f 2) - if [ "$_ec_fw_version" != "$COMPATIBLE_EC_FW_VERSION" ]; then - print_warning "EC version: $_ec_fw_version is not supported, update required" - install_ec - fi - fi - fi - - cbfstool "$BIOS_UPDATE_FILE" extract -r COREBOOT -n config -f "$BIOS_UPDATE_CONFIG_FILE" - grep "CONFIG_VBOOT=y" "$BIOS_UPDATE_CONFIG_FILE" - HAVE_VBOOT="$?" - - if [ "$NEED_ROMHOLE_MIGRATION" = "true" ]; then - romhole_migration - fi - - if [ "$NEED_BOOTSPLASH_MIGRATION" = "true" ]; then - bootsplash_migration - fi - - if [ "$NEED_SMBIOS_MIGRATION" = "true" ]; then - smbios_migration - resign_binary - fi - - if [ "$NEED_BLOB_TRANSMISSION" = "true" ]; then - blob_transmission - fi - - echo "Installing Dasharo firmware..." - $FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_REGIONS} -w "$BIOS_UPDATE_FILE" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - error_check "Failed to install Dasharo firmware" - - print_green "Successfully installed Dasharo firmware" - - echo -n "Syncing disks... " - sync - echo "Done." - if [ "$NEED_EC_RESET" = "true" ]; then - echo "The computer will shut down automatically in 5 seconds" - else - echo "The computer will reboot automatically in 5 seconds" - fi - sleep 0.5 - echo "Rebooting in 5s:" - echo "5..." - sleep 1 - echo "4..." - sleep 1 - echo "3..." - sleep 1 - echo "2..." - sleep 1 - echo "1..." - sleep 0.5 - echo "Rebooting" - sleep 1 - if [ "$NEED_EC_RESET" = "true" ]; then - it5570_shutdown - else - ${CMD_REBOOT} - fi -} - -update_ec() { - verify_artifacts ec - echo "Updating EC..." - $DASHARO_ECTOOL flash "$EC_UPDATE_FILE" &>> $ERR_LOG_FILE - error_check "Failed to update EC firmware" -} - -update() { - local _can_switch_to_heads="false" - - check_if_ac - error_check "Firmware update process interrupted on user request." - - echo "Checking for the latest Dasharo update available..." - echo "Current Dasharo version: $DASHARO_VERSION" - if [ -v DES_IS_LOGGED ]; then - if [ -v DASHARO_REL_VER_DES ]; then - if [ "$DASHARO_FLAVOR" != "Dasharo (coreboot+heads)" ]; then - echo "Latest available Dasharo version: $DASHARO_REL_VER_DES" - fi - curl -sfI -u "$USER_DETAILS" -H "$CLOUD_REQUEST" "$BIOS_LINK_DES" -o /dev/null - if [ $? -ne 0 ]; then - echo "Current DES credentials do not match the current platform/firmware flavor." - echo "Latest possible and available update is $DASHARO_REL_VER" - BIOS_HASH_LINK=$BIOS_HASH_LINK_COMM - BIOS_SIGN_LINK=$BIOS_SIGN_LINK_COMM - BIOS_LINK=$BIOS_LINK_COMM - if [ "$HAVE_EC" == "true" ]; then - EC_HASH_LINK=$EC_HASH_LINK_COMM - EC_SIGN_LINK=$EC_SIGN_LINK_COMM - EC_LINK=$EC_LINK_COMM - fi - UPDATE_VERSION=$DASHARO_REL_VER - else - BIOS_HASH_LINK=$BIOS_HASH_LINK_DES - BIOS_SIGN_LINK=$BIOS_SIGN_LINK_DES - BIOS_LINK=$BIOS_LINK_DES - if [ "$HAVE_EC" == "true" ]; then - EC_HASH_LINK=$EC_HASH_LINK_DES - EC_SIGN_LINK=$EC_SIGN_LINK_DES - EC_LINK=$EC_LINK_DES - fi - UPDATE_VERSION=$DASHARO_REL_VER_DES - fi - else - if [ "$DASHARO_FLAVOR" != "Dasharo (coreboot+heads)" ]; then - echo "Latest available Dasharo version: $DASHARO_REL_VER" - fi - BIOS_HASH_LINK=$BIOS_HASH_LINK_COMM - BIOS_SIGN_LINK=$BIOS_SIGN_LINK_COMM - BIOS_LINK=$BIOS_LINK_COMM - if [ "$HAVE_EC" == "true" ]; then - EC_HASH_LINK=$EC_HASH_LINK_COMM - EC_SIGN_LINK=$EC_SIGN_LINK_COMM - EC_LINK=$EC_LINK_COMM - fi - UPDATE_VERSION=$DASHARO_REL_VER - fi - if [ -v HAVE_HEADS_FW ] && [ "$DASHARO_FLAVOR" != "Dasharo (coreboot+heads)" ]; then - # Check if given SE credentials give access to heads, if not, - # then it means DES is for regualar releases - curl -sfI -u "$USER_DETAILS" -H "$CLOUD_REQUEST" "$HEADS_LINK_DES" -o /dev/null - if [ $? -ne 0 ]; then - print_warning "Dasharo Heads firmware version is available, but your" - print_warning "subscription does not give you the access to this firmware." - print_warning "If you are interested, please visit https://shop.3mdeb.com/product-category/dasharo-entry-subscription/" - else - # Access to the heads FW is possible, allow to switch to heads - _can_switch_to_heads="true" - print_green "Dasharo Heads firmware version is available and your subscription" - print_green "gives you access to this firmware." - fi - elif [ -v HAVE_HEADS_FW ] && [ "$DASHARO_FLAVOR" == "Dasharo (coreboot+heads)" ]; then - # Set the switch flag to offer switch back - echo "Latest available Dasharo version: $HEADS_REL_VER_DES" - _can_switch_to_heads="true" - fi - else - if [ -v DASHARO_REL_VER_DES ]; then - print_green "DES version available, if you are interested" - print_green "please visit https://shop.3mdeb.com/product-category/dasharo-entry-subscription/" - fi - if [ "$DASHARO_FLAVOR" != "Dasharo (coreboot+heads)" ]; then - echo "Latest available Dasharo version: $DASHARO_REL_VER" - fi - BIOS_HASH_LINK=$BIOS_HASH_LINK_COMM - BIOS_SIGN_LINK=$BIOS_SIGN_LINK_COMM - BIOS_LINK=$BIOS_LINK_COMM - if [ "$HAVE_EC" == "true" ]; then - EC_HASH_LINK=$EC_HASH_LINK_COMM - EC_SIGN_LINK=$EC_SIGN_LINK_COMM - EC_LINK=$EC_LINK_COMM - fi - UPDATE_VERSION=$DASHARO_REL_VER - if [ -v HAVE_HEADS_FW ] && [ "$DASHARO_FLAVOR" != "Dasharo (coreboot+heads)" ]; then - print_green "Dasharo heads firmware version is available. If you are interested," - print_green "please provide your subscription credentials in the main DTS menu" - print_green "and select 'Update Dasharo firmware' again to check if you are eligible." - elif [ -v HAVE_HEADS_FW ] && [ "$DASHARO_FLAVOR" == "Dasharo (coreboot+heads)" ]; then - # Set the switch flag to offer switch back - _can_switch_to_heads="true" - fi - fi - - handle_fw_switching $_can_switch_to_heads - - if [[ "$UPDATE_VERSION" == "1.1.1" && \ - ( "$BOARD_MODEL" == "PRO Z690-A WIFI DDR4(MS-7D25)" || \ - "$BOARD_MODEL" == "PRO Z690-A DDR4(MS-7D25)" || \ - "$BOARD_MODEL" == "PRO Z690-A (MS-7D25)" || \ - "$BOARD_MODEL" == "PRO Z690-A WIFI (MS-7D25)" ) ]]; then - - cpu_gen_check=$(lscpu | grep -F "Model name" | grep -E "\-(13|14)[0-9]{3}" | wc -l) - - if [ $cpu_gen_check -ne 0 ]; then - echo "You have a 13th gen or above CPU and are trying to flash Dasharo v1.1.1 on a MSI PRO Z690-A DDR4 or DDR5 board" - echo "That version does not support gen 13 and above CPU. Therefore we cannot continue with flashing." - error_exit "Aborting update process..." - fi - - fi - - while : ; do - echo - read -r -p "Are you sure you want to proceed with update? (Y|n) " OPTION - echo - - case ${OPTION} in - yes|y|Y|Yes|YES) - break - ;; - n|N) - error_exit "Aborting update process..." - ;; - *) - ;; - esac - done - - download_artifacts - if [ ! "$FUM" == "fum" ]; then - display_flashing_warning - fi - check_flash_lock - - verify_artifacts bios - - if [ "$HAVE_EC" == "true" ]; then - $DASHARO_ECTOOL info >> $ERR_LOG_FILE 2>&1 - error_check "Device does not have Dasharo EC firmware - cannot continue update!" - fi - - if [ "$NEED_SMMSTORE_MIGRATION" = "true" ]; then - smmstore_migration - fi - - if [ "$NEED_BOOTSPLASH_MIGRATION" = "true" ]; then - bootsplash_migration - fi - - cbfstool "$BIOS_UPDATE_FILE" extract -r COREBOOT -n config -f "$BIOS_UPDATE_CONFIG_FILE" - grep -q "CONFIG_VBOOT=y" "$BIOS_UPDATE_CONFIG_FILE" - HAVE_VBOOT="$?" - - check_intel_regions - check_blobs_in_binary $BIOS_UPDATE_FILE - check_if_me_disabled - set_flashrom_update_params $BIOS_UPDATE_FILE - set_intel_regions_update_params "-N --ifd" - check_vboot_keys - - echo "Updating Dasharo firmware..." - print_warning "This may take several minutes. Please be patient and do not power off your computer or touch the keyboard!" - - # FLASHROM_ADD_OPT_UPDATE_OVERRIDE takes priority over auto-detected update params. - # It set only by platform-specific and firmware version-specific conditions - if [ -v FLASHROM_ADD_OPT_UPDATE_OVERRIDE ]; then - # To standardize the operation of the FLASHROM_ADD_OPT_UPDATE_OVERRIDE flag, - # by default it contains only the bios section, below we verify the - # downloaded binary and add more sections when they were detected after - # using the `check_blobs_in_binary` function. - set_intel_regions_update_params "$FLASHROM_ADD_OPT_UPDATE_OVERRIDE" - FLASHROM_ADD_OPT_UPDATE_OVERRIDE="$FLASHROM_ADD_OPT_REGIONS" - $FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_UPDATE_OVERRIDE} -w "$BIOS_UPDATE_FILE" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - error_check "Failed to update Dasharo firmware" - else - $FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_UPDATE} -w "$BIOS_UPDATE_FILE" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - error_check "Failed to update Dasharo firmware" - - if [ $BINARY_HAS_RW_B -eq 0 ]; then - echo "Updating second firmware partition..." - $FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} --fmap -N -i RW_SECTION_B -w "$BIOS_UPDATE_FILE" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - error_check "Failed to update second firmware partition" - fi - fi - - # We use FLASHROM_ADD_OPT_REGIONS for updating ME and IFD. - # If FLASHROM_ADD_OPT_REGIONS remains the same after - # set_intel_regions_update_params or is cleared, it means - # we either cannot update any region, or were not allowed to, - # or platform has no descriptor. - if [ "$FLASHROM_ADD_OPT_REGIONS" != "-N --ifd" ] && [ "$FLASHROM_ADD_OPT_REGIONS" != "" ]; then - UPDATE_STRING="" - grep -q "\-i fd" <<< "$FLASHROM_ADD_OPT_REGIONS" - UPDATE_IFD=$? - grep -q "\-i me" <<< "$FLASHROM_ADD_OPT_REGIONS" - UPDATE_ME=$? - if [ $UPDATE_IFD -eq 0 ]; then - UPDATE_STRING+="Flash Descriptor" - if [ $UPDATE_ME -eq 0 ]; then - UPDATE_STRING+=" and " - fi - fi - if [ $UPDATE_ME -eq 0 ]; then - UPDATE_STRING+="Managment Engine" - fi - echo "Updating $UPDATE_STRING" - $FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_REGIONS} -w "$BIOS_UPDATE_FILE" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - error_check "Failed to update $UPDATE_STRING" - fi - - if [ ! -z "$SWITCHING_TO" ]; then - # Any post-branch-switch messaging should go here - case "$SWITCHING_TO" in - "uefi") - print_green "Successfully switched to Dasharo UEFI firmware." - print_warning "You may need to re-create boot manager entries!" - ;; - "heads") - print_green "Successfully switched to Dasharo Heads firmware." - print_warning "On first boot you will see a warning about unsealing TOTP secrets." - print_warning "This is expected. Run OEM Factory Reset / Re-Ownership to finish deploying Heads." - ;; - esac - echo "Press any key to continue" # Make sure the user acknowledges. - read -n 1 -r input - else - # Regular update flow - print_green "Successfully updated Dasharo firmware." - fi - - if [ "$HAVE_EC" == "true" ]; then - echo "Updating Embedded Controller firmware. Your computer will power off automatically when done." - update_ec # Ends in a reset, does not exit - else - echo -n "Syncing disks... " - sync - echo "Done." - echo "The computer will reboot automatically in 5 seconds" - sleep 0.5 - echo "Rebooting in 5s:" - echo "5..." - sleep 1 - echo "4..." - sleep 1 - echo "3..." - sleep 1 - echo "2..." - sleep 1 - echo "1..." - sleep 0.5 - echo "Rebooting" - sleep 1 - ${CMD_REBOOT} - fi - - -} - -restore() { - while : ; do - echo - echo "Restoring firmware from HCL report." - echo "Take note that this will only restore BIOS firmware, no EC." - echo "Please select one of available options." - - echo " 1) Check for HCL report stored locally" - if [ -n "${DES_IS_LOGGED}" ]; then - echo " 2) Check for HCL report stored on 3mdeb cloud" - fi - echo " b) Back to main menu" - echo - read -r -p "Enter an option: " OPTION - echo - - # HCL report should be named as in dasharo-hcl-report so we can find - # the package based on uuid saved in name, we need to check two options - # with and without MAC address - uuid_string=`cat /sys/class/net/$(ip route show default | awk '/default/ {print $5}')/address` - # if above gives error then there is no internet connection and first - # part of uuid should be blank - if [ ! $? -eq 0 ]; then - uuid_string="" - fi - uuid_string+="_$(dmidecode -s system-product-name)" - uuid_string+="_$(dmidecode -s system-manufacturer)" - uuid=`uuidgen -n @x500 -N $uuid_string -s` - - case ${OPTION} in - 1) - echo - echo "Searching for HCL report on device..." - - HCL_REPORT_PACKAGE="$(find / -name "*$uuid*" | head -n1)" - if [ ! -z $HCL_REPORT_PACKAGE ]; then - tar -zxf "$HCL_REPORT_PACKAGE" -C /tmp - echo "Restoring BIOS firmware..." - if [ -f "/tmp/logs/rom.bin" ]; then - print_green "Found $HCL_REPORT_PACKAGE" - read -p "Do you want to restore firmware from the given HCL report? [N/y] " - case ${REPLY} in - yes|y|Y|Yes|YES) - # Ideally we would like to write the entire flash when restoring, - # but in reality we may face locked or unaccessible regions. - # To be on the safe side, flash whatever can be flashed by determining - # what is writable. - check_flash_lock - check_intel_regions - check_blobs_in_binary /tmp/logs/rom.bin - check_if_me_disabled - set_intel_regions_update_params "-N --ifd -i bios" - $FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_REGIONS} -w "/tmp/logs/rom.bin" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - error_check "Failed to restore BIOS firmware! You can try one more time." - print_green "Successfully restored firmware" - echo "Returning to main menu..." - exit 0 - ;; - *) - echo "Returning to main menu..." - exit 0 - ;; - esac - else - print_error "Report does not have firmware backup!" - fi - else - print_warning "No HCL report found, cannot restore firmware" - echo "Returning to main menu..." - exit 0 - fi - ;; - 2) - echo - echo "Searching for HCL report on cloud..." - - ${CMD_CLOUD_LIST} $uuid - error_check "Could not download HCL report from cloud." - - HCL_REPORT_PACKAGE="$(find / -name *$uuid* | head -n1)" - tar -zxf "$HCL_REPORT_PACKAGE" -C /tmp - echo "Restoring BIOS firmware..." - if [ -f "/tmp/logs/rom.bin" ]; then - # Ideally we would like to write the entire flash when restoring, - # but in reality we may face locked or unaccessible regions. - # To be on the safe side, flash whatever can be flashed by determining - # what is writable. - check_flash_lock - check_intel_regions - check_blobs_in_binary /tmp/logs/rom.bin - check_if_me_disabled - set_intel_regions_update_params "-N --ifd -i bios" - flashrom -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_REGIONS} -w "/tmp/logs/rom.bin" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - error_check "Failed to restore BIOS firmware! You can try one more time." - print_green "Successfully restored firmware" - else - print_error "Report does not have firmware backup!" - fi - ;; - b|B) - echo "Returning to main menu..." - exit 0 - ;; - *) - ;; - esac - done -} - -usage() { - echo "Usage:" - echo " $0 install - Install Dasharo on this device" - echo " $0 backup - Backup current firmware" - echo " $0 restore - Restore from a previously saved backup" -} - -# for FUM we start in dasharo-deploy so we need to verify that we have internet -# connection to download shasums in board_config -if [ "$FUM" == "fum" ]; then - check_network_connection -fi - -board_config -check_flash_chip -if [ -v PLATFORM_SIGN_KEY ]; then - get_signing_keys -fi - -case "$CMD" in - install) - if check_if_dasharo; then - error_exit "Dasharo Firmware is already installed. This script is only for\r - initial deployment of Dasharo Firmware. Aborting..." - fi - backup - install - ;; - update) - if [ "$FUM" == "fum" ]; then - echo "Firmware Update Mode detected; proceed with automatic update in 5 seconds" - echo "Updating in 5s:" - echo "5..." - sleep 1 - echo "4..." - sleep 1 - echo "3..." - sleep 1 - echo "2..." - sleep 1 - echo "1..." - sleep 0.5 - fi - update - ;; - backup) - backup - ;; - restore) - if ! check_if_dasharo; then - error_exit "Dasharo Firmware is not installed. This script is only for\r - restoring original firmware on platforms that runs Dasharo Firmware. Aborting..." - fi - restore - ;; - *) - usage - ;; -esac diff --git a/meta-dts-distro/recipes-dts/dts/dts.bb b/meta-dts-distro/recipes-dts/dts/dts.bb deleted file mode 100644 index 6542d422..00000000 --- a/meta-dts-distro/recipes-dts/dts/dts.bb +++ /dev/null @@ -1,40 +0,0 @@ -DESCRIPTION = "Dasharo Tools Suite" -SECTION = "tools" -HOMEPAGE = "https://docs.dasharo.com" - -LICENSE = "MIT" - -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" - -SRC_URI = " \ - file://dts \ - file://dts-boot \ - file://dts-profile.sh \ - file://ec_transition \ - file://cloud_list \ - file://dts-environment.sh \ - file://dts-functions.sh \ -" - -S = "${WORKDIR}" - -RDEPENDS:${PN} = " \ - bash \ - dasharo-hcl-report \ - iotools \ -" - -do_install () { - install -d ${D}/${sbindir} - install -m 0755 ${S}/dts ${D}/${sbindir} - install -m 0755 ${S}/dts-boot ${D}/${sbindir} - install -m 0755 ${S}/ec_transition ${D}/${sbindir} - install -m 0755 ${S}/cloud_list ${D}/${sbindir} - install -m 0664 ${S}/dts-environment.sh ${D}/${sbindir} - install -m 0664 ${S}/dts-functions.sh ${D}/${sbindir} - - # install profile dropin so the DTS_ENV and DTS_FUNCS variables are set when - # loged via SSH - install -d ${D}${sysconfdir}/profile.d/ - install -m 0755 ${WORKDIR}/dts-profile.sh ${D}${sysconfdir}/profile.d/ -} diff --git a/meta-dts-distro/recipes-dts/dts/dts/cloud_list b/meta-dts-distro/recipes-dts/dts/dts/cloud_list deleted file mode 100755 index e5831318..00000000 --- a/meta-dts-distro/recipes-dts/dts/dts/cloud_list +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash - -TMP_RESPONSE="/tmp/webdav_response" -TMP_LIST="/tmp/cloud_list" -HW_UUID="$1" - -### Error checks -print_error() { - echo -e "$RED""$1""$COLOR_OFF" -} - -error_exit() { - _error_msg="$1" - print_error "$_error_msg" - exit 1 -} - -error_check() { - _error_code=$? - _error_msg="$1" - [ "$_error_code" -ne 0 ] && error_exit "$_error_msg : ($_error_code)" -} - -USER_DETAILS="$CLOUDSEND_LOGS_URL:$CLOUDSEND_PASSWORD" -CLOUD_REQUEST="X-Requested-With: XMLHttpRequest" - -tmpURL="https://cloud.3mdeb.com/public.php/webdav/" - -curl -L -f -u "$USER_DETAILS" -H "$CLOUD_REQUEST" -X PROPFIND "$tmpURL" -o "$TMP_RESPONSE" -error_check "Cannot access list of files on cloud." - -# parse response -sed -i 's/\://g' "$TMP_RESPONSE" -sed -i 's/\?//g' "$TMP_RESPONSE" -sed -i 's//&\n&\n/g' "$TMP_RESPONSE" -sed -i 's#<&/dresponse>#<&/dresponse>&\n#g' "$TMP_RESPONSE" - -# create line per record -grep "public.php/webdav/" "$TMP_RESPONSE" > "$TMP_LIST" -# remove xml tags -sed -i 's#/dhref.*#\/dhref>#' "$TMP_LIST" -sed -i 's#<*dresponse>##g' "$TMP_LIST" -sed -i 's###g' "$TMP_LIST" -sed -i 's###g' "$TMP_LIST" -sed -i 's#/public.php/webdav/##g' "$TMP_LIST" - -# get first, oldest HCL report with given UUID in name -HCL_REPORT_NAME=$(cat $TMP_LIST | grep -m1 $HW_UUID) - -# download HCL report -tmpURL="https://cloud.3mdeb.com/public.php/webdav/$HCL_REPORT_NAME" -curl -L -f -u "$USER_DETAILS" -H "$CLOUD_REQUEST" -X GET "$tmpURL" -o /$HCL_REPORT_NAME -if [ -f /$HCL_REPORT_NAME ]; then - echo "Report downloaded" -else - echo "Report not found!" - exit 1 -fi diff --git a/meta-dts-distro/recipes-dts/dts/dts/dts b/meta-dts-distro/recipes-dts/dts/dts/dts deleted file mode 100644 index f24a729a..00000000 --- a/meta-dts-distro/recipes-dts/dts/dts/dts +++ /dev/null @@ -1,227 +0,0 @@ -#!/usr/bin/env bash - -source $DTS_ENV -source $DTS_FUNCS - -trap : 2 -trap : 3 - -check_os_version() { - local os_version=$(grep "VERSION_ID" ${OS_VERSION_FILE} | cut -d "=" -f 2-) - echo " DTS version v${os_version}" -} - -print_disclaimer() { -echo -e \ -"Please note that the report is not anonymous, but we will use it only for\r -backup and future improvement of the Dasharo product. Every log is encrypted\r -and sent over HTTPS, so security is assured.\r -If you still have doubts, you can skip HCL report generation.\r\n -What is inside the HCL report? We gather information about:\r - - PCI, Super I/O, GPIO, EC, audio, and Intel configuration,\r - - MSRs, CMOS NVRAM, CPU info, DIMMs, state of touchpad, SMBIOS and ACPI tables,\r - - Decoded BIOS information, full firmware image backup, kernel dmesg,\r - - IO ports, input bus types, and topology - including I2C and USB,\r -\r -You can find more info about HCL in docs.dasharo.com/glossary\r" -} - -print_banner() { -echo ' ____ __ ______ __ _____ _ __' -echo ' / __ \____ ______/ /_ ____ __________ /_ __/___ ____ / /____ / ___/__ __(_) /'____ -echo ' / / / / __ `/ ___/ __ \/ __ `/ ___/ __ \ / / / __ \/ __ \/ / ___/ \__ \/ / / / / __/ _ \' -echo ' / /_/ / /_/ (__ ) / / / /_/ / / / /_/ / / / / /_/ / /_/ / (__ ) ___/ / /_/ / / /_/ __/' -echo '/_____/\__,_/____/_/ /_/\__,_/_/ \____/ /_/ \____/\____/_/____/ /____/\__,_/_/\__/\___/' -echo -} - -print_banner - -logs_sent="" - -while : ; do - # Each time the main menu is displayed, check for DES credentials and export - # them, if file exists - if [ -e "${SE_credential_file}" ]; then - export CLOUDSEND_LOGS_URL=$(sed -n '1p' < ${SE_credential_file} | tr -d '\n') - export CLOUDSEND_DOWNLOAD_URL=$(sed -n '2p' < ${SE_credential_file} | tr -d '\n') - export CLOUDSEND_PASSWORD=$(sed -n '3p' < ${SE_credential_file} | tr -d '\n') - export USER_DETAILS="$CLOUDSEND_DOWNLOAD_URL:$CLOUDSEND_PASSWORD" - export DES_IS_LOGGED="true" - else - export CLOUDSEND_LOGS_URL="$BASE_CLOUDSEND_LOGS_URL" - export CLOUDSEND_PASSWORD="$BASE_CLOUDSEND_PASSWORD" - unset CLOUDSEND_DOWNLOAD_URL - unset DES_IS_LOGGED - fi - - echo - check_os_version - echo - echo " 1) Dasharo HCL report - dump hardware information from this device" - if ! check_if_dasharo; then - echo " 2) Install Dasharo firmware" - fi - if check_if_dasharo; then - echo " 3) Restore firmware from Dasharo HCL report" - fi - if [ -n "${DES_IS_LOGGED}" ]; then - echo " 4) Edit your DES keys" - echo " Logs key : " ${CLOUDSEND_LOGS_URL} - echo " Download key: " ${CLOUDSEND_DOWNLOAD_URL} - echo " Password : " ${CLOUDSEND_PASSWORD} - else - echo " 4) Load your DES keys" - fi - if check_if_dasharo; then - echo " 5) Check and apply Dasharo firmware updates" - fi - if systemctl is-active sshd.socket > /dev/null 2>&1; then - echo " 8) Stop SSH server" - else - echo " 8) Start SSH server" - fi - echo " 9) Shell" - echo " 10) Power off system" - echo " 11) Reboot system" - echo - read -p "Enter an option: " OPTION - echo - - case ${OPTION} in - 1) - print_disclaimer - read -p "Do you want to support Dasharo development by sending us logs with your hardware configuration? [N/y] " - case ${REPLY} in - yes|y|Y|Yes|YES) - export SEND_LOGS="true" - echo "Thank you for contributing to the Dasharo development!" - ;; - *) - export SEND_LOGS="false" - echo "Logs will be saved in root directory." - echo "Please consider supporting Dasharo by sending the logs next time." - ;; - esac - if [ "${SEND_LOGS}" == "true" ]; then - # DEPLOY_REPORT variable is used in dasharo-hcl-report to determine - # which logs should be printed in the terminal, in the future whole - # dts scripting should get some LOGLEVEL and maybe dumping working - # logs to file - export DEPLOY_REPORT="false" - check_network_connection && ${CMD_DASHARO_HCL_REPORT} && logs_sent="1" - else - export DEPLOY_REPORT="false" - ${CMD_DASHARO_HCL_REPORT} - fi - ;; - 2) - if ! check_if_dasharo; then - if check_network_connection; then - echo "Preparing ..." - if [ -z "${logs_sent}" ]; then - export SEND_LOGS="true" - export DEPLOY_REPORT="true" - if ! ${CMD_DASHARO_HCL_REPORT}; then - echo -e "Unable to connect to cloud.3mdeb.com for submitting the - \rHCL report. Please recheck your internet connection." - else - logs_sent="1" - fi - fi - fi - fi - - if [ -n "${logs_sent}" ]; then - ${CMD_DASHARO_DEPLOY} install - fi - ;; - 3) - if check_if_dasharo; then - ${CMD_DASHARO_DEPLOY} restore - fi - ;; - 4) - echo "" - read -p "Enter logs key: " 'TMP_CLOUDSEND_LOGS_URL' - echo "" - read -p "Enter firmware download key: " 'TMP_CLOUDSEND_DOWNLOAD_URL' - echo "" - read -p "Enter password: " 'TMP_CLOUDSEND_PASSWORD' - - echo ${TMP_CLOUDSEND_LOGS_URL} > ${SE_credential_file} - echo ${TMP_CLOUDSEND_DOWNLOAD_URL} >> ${SE_credential_file} - echo ${TMP_CLOUDSEND_PASSWORD} >> ${SE_credential_file} - - print_green "Dasharo DES credentials have been saved" - echo "Verifying Dasharo DES credentials..." - - check_se_creds - if [ $? -eq 0 ]; then - print_green "Verification of the Dasharo DES was successful. They are valid and will be used." - else - echo -e "Something may be wrong with the DES credentials. Please use option 4 to change the DES keys - \rand make sure that there is no typo." - rm ${SE_credential_file} - export CLOUDSEND_LOGS_URL="$BASE_CLOUDSEND_LOGS_URL" - export CLOUDSEND_PASSWORD="$BASE_CLOUDSEND_PASSWORD" - unset CLOUDSEND_DOWNLOAD_URL - unset DES_IS_LOGGED - fi - ;; - 5) - if check_if_dasharo; then - # For NovaCustom TGL laptops with Dasharo version lower than 1.3.0, - # we shall run the ec_transition script instead. See: - # https://docs.dasharo.com/variants/novacustom_nv4x_tgl/releases/#v130-2022-10-18 - if [ "$BOARD_VENDOR" = "Notebook" ]; then - case "$SYSTEM_MODEL" in - "NS50_70MU"|"NV4XMB,ME,MZ") - compare_versions $DASHARO_VERSION 1.3.0 - if [ $? -eq 1 ]; then - # For Dasharo version lesser than 1.3.0 - print_warning "Detected NovaCustom hardware with version < 1.3.0" - print_warning "Need to perform EC transition after which the platform will turn off" - print_warning "Then, please power it on and proceed with update again" - print_warning "EC transition procedure will start in 5 seconds" - sleep 5 - ${CMD_EC_TRANSITION} - error_check "Could not perform EC transition" - fi - # Continue with regular update process for Dasharo version - # greater or equal 1.3.0 - ;; - esac - fi - - # Use regular update process for everything else - ${CMD_DASHARO_DEPLOY} update - fi - ;; - 8) - if systemctl is-active sshd.socket > /dev/null 2>&1; then - print_green "Turning off the SSH server..." - systemctl stop sshd.socket - else - print_warning "Starting SSH server!" - print_warning "Now you can log in into the system using root account." - print_warning "Stopping server will not drop all connected sessions." - systemctl start sshd.socket - print_green "Listening on IPs: $(ip -br -f inet a show scope global | grep UP | awk '{ print $3 }' | tr '\n' ' ')" - fi - ;; - 9) - echo "Entering shell, to leave type exit and press Enter or press LCtrl+D" - echo "" - ${CMD_SHELL} - ;; - 10) - ${CMD_POWEROFF} - ;; - 11) - ${CMD_REBOOT} - ;; - *) - ;; - esac -done diff --git a/meta-dts-distro/recipes-dts/dts/dts/dts-boot b/meta-dts-distro/recipes-dts/dts/dts/dts-boot deleted file mode 100644 index a1be141a..00000000 --- a/meta-dts-distro/recipes-dts/dts/dts/dts-boot +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash - -SBIN_DIR="/usr/sbin" -FUM_EFIVAR="/sys/firmware/efi/vars/FirmwareUpdateMode-d15b327e-ff2d-4fc1-abf6-c12bd08c1359" - -export DTS_FUNCS="$SBIN_DIR/dts-functions.sh" -export DTS_ENV="$SBIN_DIR/dts-environment.sh" - -if [ -d $FUM_EFIVAR ]; then - $SBIN_DIR/dasharo-deploy update fum -else - $SBIN_DIR/dts -fi - diff --git a/meta-dts-distro/recipes-dts/dts/dts/dts-environment.sh b/meta-dts-distro/recipes-dts/dts/dts/dts-environment.sh deleted file mode 100644 index 66804c81..00000000 --- a/meta-dts-distro/recipes-dts/dts/dts/dts-environment.sh +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env bash - -# Text Reset -COLOR_OFF='\033[0m' -RED='\033[0;31m' -YELLOW='\033[0;33m' -GREEN='\033[0;32m' - -BOARD_VENDOR="$(dmidecode -s system-manufacturer)" -SYSTEM_MODEL="$(dmidecode -s system-product-name)" -BOARD_MODEL="$(dmidecode -s baseboard-product-name)" - -BIOS_VENDOR="$(dmidecode -s bios-vendor)" -BIOS_VERSION="$(dmidecode -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" -BIOS_HASH_FILE="/tmp/bioshash.sha256" -EC_HASH_FILE="/tmp/echash.sha256" -BIOS_SIGN_FILE="/tmp/biossignature.sig" -EC_SIGN_FILE="/tmp/ecsignature.sig" -BIOS_UPDATE_CONFIG_FILE="/tmp/biosupdate_config" -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="/" -FW_BACKUP_NAME="fw_backup" -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 -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" -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" -PROGRAMMER_BIOS="internal" -PROGRAMMER_EC="ite_ec" - -DASHARO_ECTOOL="dasharo_ectool" - -# 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 -FLASH_CHIP_LIST="W25Q64BV/W25Q64CV/W25Q64FV W25Q64JV-.Q W25Q128.V..M" - -# Dasharo Supporters Entrance variables -SE_credential_file="/etc/cloud-pass" -FW_STORE_URL="${FW_STORE_URL_DEV:-https://dl.3mdeb.com/open-source-firmware/Dasharo}" -FW_STORE_URL_DES="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" - -# set custom localization for PGP keys -if [ -d /home/root/.dasharo-gnupg ]; then - GNUPGHOME=/home/root/.dasharo-gnupg - - export GNUPGHOME -fi diff --git a/meta-dts-distro/recipes-dts/dts/dts/dts-functions.sh b/meta-dts-distro/recipes-dts/dts/dts/dts-functions.sh deleted file mode 100644 index 926e784d..00000000 --- a/meta-dts-distro/recipes-dts/dts/dts/dts-functions.sh +++ /dev/null @@ -1,1208 +0,0 @@ -#!/usr/bin/env bash - -source $DTS_ENV - -### Color functions -print_warning() { - echo -e "$YELLOW""$1""$COLOR_OFF" -} - -print_error() { - echo -e "$RED""$1""$COLOR_OFF" -} - -print_green() { - echo -e "$GREEN""$1""$COLOR_OFF" -} - -check_if_dasharo() { - if [[ $BIOS_VENDOR == *$DASHARO_VENDOR* && $BIOS_VERSION == *$DASHARO_NAME* ]]; then - return 0 - else - return 1 - fi -} - -check_if_ac() { - local _ac_file="/sys/class/power_supply/AC/online" - - if [ ! -e "${_ac_file}" ]; then - # We want to silently skip if AC file is not there. Most likely this is - # not battery-powered device then. - return 0 - fi - - while true; do - ac_status=$(cat ${_ac_file}) - - if [ "$ac_status" -eq 1 ]; then - echo "AC adapter is connected. Continuing with firmware update." - return - else - print_warning "Warning: AC adapter must be connected before performing firmware update." - print_warning "Please connect the AC adapter and press 'C' to continue, or 'Q' to quit." - - read -n 1 -r input - case $input in - [Cc]) - echo "Checking AC status again..." - ;; - [Qq]) - echo "Quitting firmware update." - return 1 - ;; - *) - echo "Invalid input. Press 'C' to continue, or 'Q' to quit." - continue - ;; - esac - fi - done -} - -### Error checks - -# instead of error exit in dasharo-deploy exit we need to reboot the platform -# in cases where there would be some problem with updating the platform -fum_exit() { - if [ "$FUM" == "fum" ]; then - print_error "Update cannot be performed" - print_warning "Starting bash session - please make sure you get logs from\r - \r$ERR_LOG_FILE and $FLASHROM_LOG_FILE; then you can poweroff the platform" - /bin/bash - fi -} - -error_exit() { - _error_msg="$1" - if [ -n "$_error_msg" ]; then - # Avoid printing empty line if no message was passed - print_error "$_error_msg" - fi - fum_exit - exit 1 -} - -error_check() { - _error_code=$? - _error_msg="$1" - [ "$_error_code" -ne 0 ] && error_exit "$_error_msg : ($_error_code)" -} - -function error_file_check { - if [ ! -f "$1" ]; then - print_error "$2" - fi -} - -### Clevo-specific functions -# Method to access IT5570 IO Depth 2 registers -it5570_i2ec() { - # TODO: Use /dev/port instead of iotools - - # Address high byte - iotools io_write8 0x2e 0x2e - iotools io_write8 0x2f 0x11 - iotools io_write8 0x2e 0x2f - iotools io_write8 0x2f $(($2>>8 & 0xff)) - - # Address low byte - iotools io_write8 0x2e 0x2e - iotools io_write8 0x2f 0x10 - iotools io_write8 0x2e 0x2f - iotools io_write8 0x2f $(($2 & 0xff)) - - # Data - iotools io_write8 0x2e 0x2e - iotools io_write8 0x2f 0x12 - iotools io_write8 0x2e 0x2f - - case $1 in - "r") - iotools io_read8 0x2f - ;; - "w") - iotools io_write8 0x2f "$3" - ;; - esac -} - -it5570_shutdown() { - # shut down using EC external watchdog reset - it5570_i2ec w 0x1f01 0x20 - it5570_i2ec w 0x1f07 0x01 -} - -check_network_connection() { - echo 'Waiting for network connection ...' - n="10" - while : ; do - ping -c 3 cloud.3mdeb.com > /dev/null 2>&1 && break - n=$((n-1)) - if [ "${n}" == "0" ]; then - echo 'No network connection to 3mdeb cloud, please recheck Ethernet connection' - return 1 - fi - sleep 1 - done - return 0 -} - -## Supported boards configuration - -board_config() { - # We download firmwares via network. At this point, the network connection - # must be up already. - check_network_connection - - echo "Checking if board is Dasharo compatible." - case "$BOARD_VENDOR" in - "Notebook") - case "$SYSTEM_MODEL" in - "NV4XMB,ME,MZ") - DASHARO_REL_NAME="novacustom_nv4x_tgl" - DASHARO_REL_VER="1.5.2" - BIOS_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER/${DASHARO_REL_NAME}_v${DASHARO_REL_VER}.rom" - EC_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER/${DASHARO_REL_NAME}_ec_v${DASHARO_REL_VER}.rom" - HAVE_EC="true" - NEED_EC_RESET="true" - COMPATIBLE_EC_FW_VERSION="2022-10-07_c662165" - EC_HASH_LINK_COMM="$EC_LINK_COMM.sha256" - BIOS_HASH_LINK_COMM="$BIOS_LINK_COMM.sha256" - EC_SIGN_LINK_COMM="$EC_LINK_COMM.sha256.sig" - BIOS_SIGN_LINK_COMM="$BIOS_LINK_COMM.sha256.sig" - PLATFORM_SIGN_KEY="customer-keys/novacustom/novacustom-open-source-firmware-release-1.x-key.asc \ - customer-keys/novacustom/dasharo-release-0.9.x-for-novacustom-signing-key.asc" - NEED_SMBIOS_MIGRATION="false" - NEED_SMMSTORE_MIGRATION="true" - NEED_BOOTSPLASH_MIGRATION="false" - NEED_BLOB_TRANSMISSION="false" - PROGRAMMER_BIOS="internal" - PROGRAMMER_EC="ite_ec:boardmismatch=force,romsize=128K,autoload=disable" - if check_if_dasharo; then - # if v1.5.1 or older, flash the whole bios region - # TODO: Let DTS determine which parameters are suitable. - # FIXME: Can we ever get rid of that? We change so much in each release, - # that we almost always need to flash whole BIOS regions - # because of non-backward compatbile or breaking changes. - compare_versions $DASHARO_VERSION 1.5.2 - if [ $? -eq 1 ]; then - # For Dasharo version lesser than 1.5.2 - NEED_BOOTSPLASH_MIGRATION="true" - FLASHROM_ADD_OPT_UPDATE_OVERRIDE="--ifd -i bios" - fi - fi - ;; - "NS50_70MU") - DASHARO_REL_NAME="novacustom_ns5x_tgl" - DASHARO_REL_VER="1.5.2" - BIOS_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER/${DASHARO_REL_NAME}_v${DASHARO_REL_VER}.rom" - EC_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER/${DASHARO_REL_NAME}_ec_v${DASHARO_REL_VER}.rom" - HAVE_EC="true" - NEED_EC_RESET="true" - COMPATIBLE_EC_FW_VERSION="2022-08-31_cbff21b" - EC_HASH_LINK_COMM="$EC_LINK_COMM.sha256" - BIOS_HASH_LINK_COMM="$BIOS_LINK_COMM.sha256" - EC_SIGN_LINK_COMM="$EC_LINK_COMM.sha256.sig" - BIOS_SIGN_LINK_COMM="$BIOS_LINK_COMM.sha256.sig" - PLATFORM_SIGN_KEY="customer-keys/novacustom/novacustom-open-source-firmware-release-1.x-key.asc \ - customer-keys/novacustom/dasharo-release-0.9.x-for-novacustom-signing-key.asc" - NEED_SMBIOS_MIGRATION="false" - NEED_SMMSTORE_MIGRATION="true" - NEED_BOOTSPLASH_MIGRATION="false" - NEED_BLOB_TRANSMISSION="false" - PROGRAMMER_BIOS="internal" - PROGRAMMER_EC="ite_ec:boardmismatch=force,romsize=128K,autoload=disable" - if check_if_dasharo; then - # if v1.5.1 or older, flash the whole bios region - # TODO: Let DTS determine which parameters are suitable. - # FIXME: Can we ever get rid of that? We change so much in each release, - # that we almost always need to flash whole BIOS regions - # because of non-backward compatbile or breaking changes. - compare_versions $DASHARO_VERSION 1.5.2 - if [ $? -eq 1 ]; then - # For Dasharo version lesser than 1.5.2 - NEED_BOOTSPLASH_MIGRATION="true" - FLASHROM_ADD_OPT_UPDATE_OVERRIDE="--ifd -i bios" - fi - fi - ;; - "NS5x_NS7xPU") - DASHARO_REL_NAME="novacustom_ns5x_adl" - DASHARO_REL_VER="1.7.2" - BIOS_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER/${DASHARO_REL_NAME}_v${DASHARO_REL_VER}.rom" - EC_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER/${DASHARO_REL_NAME}_ec_v${DASHARO_REL_VER}.rom" - HAVE_EC="true" - NEED_EC_RESET="true" - COMPATIBLE_EC_FW_VERSION="2022-08-31_cbff21b" - EC_HASH_LINK_COMM="$EC_LINK_COMM.sha256" - BIOS_HASH_LINK_COMM="$BIOS_LINK_COMM.sha256" - EC_SIGN_LINK_COMM="$EC_LINK_COMM.sha256.sig" - BIOS_SIGN_LINK_COMM="$BIOS_LINK_COMM.sha256.sig" - PLATFORM_SIGN_KEY="customer-keys/novacustom/novacustom-open-source-firmware-release-1.x-key.asc \ - customer-keys/novacustom/dasharo-release-0.9.x-for-novacustom-signing-key.asc" - NEED_SMBIOS_MIGRATION="false" - NEED_SMMSTORE_MIGRATION="true" - NEED_BLOB_TRANSMISSION="false" - PROGRAMMER_BIOS="internal" - PROGRAMMER_EC="ite_ec:boardmismatch=force,romsize=128K,autoload=disable" - if check_if_dasharo; then - # if v1.7.2 or older, flash the whole bios region - # TODO: Let DTS determine which parameters are suitable. - # FIXME: Can we ever get rid of that? We change so much in each release, - # that we almost always need to flash whole BIOS regions - # because of non-backward compatbile or breaking changes. - compare_versions $DASHARO_VERSION 1.7.2 - if [ $? -eq 1 ]; then - # For Dasharo version lesser than 1.7.2 - NEED_BOOTSPLASH_MIGRATION="true" - FLASHROM_ADD_OPT_UPDATE_OVERRIDE="--ifd -i bios" - fi - fi - ;; - "NV4xPZ") - DASHARO_REL_NAME="novacustom_nv4x_adl" - DASHARO_REL_VER="1.7.2" - HEADS_REL_VER_DES="0.9.0" - HEADS_LINK_DES="${FW_STORE_URL_DES}/${DASHARO_REL_NAME}/v${HEADS_REL_VER_DES}/${DASHARO_REL_NAME}_v${HEADS_REL_VER_DES}_heads.rom" - HEADS_SWITCH_FLASHROM_OPT_OVERRIDE="--ifd -i bios" - BIOS_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER/${DASHARO_REL_NAME}_v${DASHARO_REL_VER}.rom" - EC_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER/${DASHARO_REL_NAME}_ec_v${DASHARO_REL_VER}.rom" - HAVE_EC="true" - NEED_EC_RESET="true" - COMPATIBLE_EC_FW_VERSION="2022-08-31_cbff21b" - EC_HASH_LINK_COMM="$EC_LINK_COMM.sha256" - BIOS_HASH_LINK_COMM="$BIOS_LINK_COMM.sha256" - EC_SIGN_LINK_COMM="$EC_LINK_COMM.sha256.sig" - BIOS_SIGN_LINK_COMM="$BIOS_LINK_COMM.sha256.sig" - PLATFORM_SIGN_KEY="customer-keys/novacustom/novacustom-open-source-firmware-release-1.x-key.asc \ - customer-keys/novacustom/dasharo-release-0.9.x-for-novacustom-signing-key.asc" - NEED_SMBIOS_MIGRATION="false" - NEED_SMMSTORE_MIGRATION="true" - NEED_BOOTSPLASH_MIGRATION="false" - NEED_BLOB_TRANSMISSION="false" - PROGRAMMER_BIOS="internal" - PROGRAMMER_EC="ite_ec:boardmismatch=force,romsize=128K,autoload=disable" - if check_if_dasharo; then - # if v1.7.2 or older, flash the whole bios region - # TODO: Let DTS determine which parameters are suitable. - # FIXME: Can we ever get rid of that? We change so much in each release, - # that we almost always need to flash whole BIOS regions - # because of non-backward compatbile or breaking changes. - compare_versions $DASHARO_VERSION 1.7.2 - if [ $? -eq 1 ]; then - # For Dasharo version lesser than 1.7.2 - NEED_BOOTSPLASH_MIGRATION="true" - FLASHROM_ADD_OPT_UPDATE_OVERRIDE="--ifd -i bios" - else - HAVE_HEADS_FW="true" - fi - if [ "$DASHARO_FLAVOR" == "Dasharo (coreboot+heads)" ]; then - HAVE_HEADS_FW="true" - fi - fi - ;; - *) - error_exit "Board model $SYSTEM_MODEL is currently not supported" - ;; - esac - ;; - "Micro-Star International Co., Ltd.") - case "$SYSTEM_MODEL" in - "MS-7D25") - case "$BOARD_MODEL" in - "PRO Z690-A WIFI DDR4(MS-7D25)" | "PRO Z690-A DDR4(MS-7D25)") - DASHARO_REL_NAME="msi_ms7d25" - DASHARO_REL_VER="1.1.1" - DASHARO_REL_VER_DES="1.1.3" - BIOS_LINK_COMM="${FW_STORE_URL}/${DASHARO_REL_NAME}/v${DASHARO_REL_VER}/${DASHARO_REL_NAME}_v${DASHARO_REL_VER}_ddr4.rom" - BIOS_LINK_DES="${FW_STORE_URL_DES}/MS-7D25/v${DASHARO_REL_VER_DES}/${DASHARO_REL_NAME}_v${DASHARO_REL_VER_DES}_ddr4.rom" - HAVE_HEADS_FW="true" - HEADS_REL_VER_DES="0.9.0" - HEADS_LINK_DES="${FW_STORE_URL_DES}/MS-7D25/v${HEADS_REL_VER_DES}/${DASHARO_REL_NAME}_v${HEADS_REL_VER_DES}_ddr4_heads.rom" - HEADS_SWITCH_FLASHROM_OPT_OVERRIDE="--ifd -i bios" - HAVE_EC="false" - NEED_EC_RESET="false" - BIOS_HASH_LINK_COMM="${BIOS_LINK_COMM}.sha256" - BIOS_HASH_LINK_DES="${BIOS_LINK_DES}.sha256" - BIOS_SIGN_LINK_COMM="${BIOS_LINK_COMM}.sha256.sig" - BIOS_SIGN_LINK_DES="${BIOS_LINK_DES}.sha256.sig" - PLATFORM_SIGN_KEY="dasharo/msi_ms7d25/dasharo-release-1.x-compatible-with-msi-ms-7d25-signing-key.asc \ - dasharo/msi_ms7d25/dasharo-release-0.x-compatible-with-msi-ms-7d25-signing-key.asc" - NEED_SMBIOS_MIGRATION="true" - NEED_SMMSTORE_MIGRATION="true" - NEED_BOOTSPLASH_MIGRATION="false" - NEED_BLOB_TRANSMISSION="false" - PROGRAMMER_BIOS="internal" - PROGRAMMER_EC="" - NEED_ROMHOLE_MIGRATION="true" - if check_if_dasharo; then - # if v1.1.3 or older, flash the whole bios region - # TODO: Let DTS determine which parameters are suitable. - # FIXME: Can we ever get rid of that? We change so much in each release, - # that we almost always need to flash whole BIOS region - # because of non-backward compatbile or breaking changes. - compare_versions $DASHARO_VERSION 1.1.3 - if [ $? -eq 1 ]; then - # For Dasharo version lesser than 1.1.3 - NEED_BOOTSPLASH_MIGRATION="true" - FLASHROM_ADD_OPT_UPDATE_OVERRIDE="--ifd -i bios" - fi - fi - ;; - "PRO Z690-A WIFI (MS-7D25)" | "PRO Z690-A (MS-7D25)") - DASHARO_REL_NAME="msi_ms7d25" - DASHARO_REL_VER="1.1.1" - DASHARO_REL_VER_DES="1.1.3" - BIOS_LINK_COMM="${FW_STORE_URL}/${DASHARO_REL_NAME}/v${DASHARO_REL_VER}/${DASHARO_REL_NAME}_v${DASHARO_REL_VER}_ddr5.rom" - BIOS_LINK_DES="${FW_STORE_URL_DES}/MS-7D25/v${DASHARO_REL_VER_DES}/${DASHARO_REL_NAME}_v${DASHARO_REL_VER_DES}_ddr5.rom" - HAVE_HEADS_FW="true" - HEADS_REL_VER_DES="0.9.0" - HEADS_LINK_DES="${FW_STORE_URL_DES}/MS-7D25/v${HEADS_REL_VER_DES}/${DASHARO_REL_NAME}_v${HEADS_REL_VER_DES}_ddr5_heads.rom" - HEADS_SWITCH_FLASHROM_OPT_OVERRIDE="--ifd -i bios" - HAVE_EC="false" - NEED_EC_RESET="false" - BIOS_HASH_LINK_COMM="${BIOS_LINK_COMM}.sha256" - BIOS_HASH_LINK_DES="${BIOS_LINK_DES}.sha256" - BIOS_SIGN_LINK_COMM="${BIOS_LINK_COMM}.sha256.sig" - BIOS_SIGN_LINK_DES="${BIOS_LINK_DES}.sha256.sig" - PLATFORM_SIGN_KEY="dasharo/msi_ms7d25/dasharo-release-1.x-compatible-with-msi-ms-7d25-signing-key.asc \ - dasharo/msi_ms7d25/dasharo-release-0.x-compatible-with-msi-ms-7d25-signing-key.asc" - NEED_SMBIOS_MIGRATION="true" - NEED_SMMSTORE_MIGRATION="true" - NEED_BOOTSPLASH_MIGRATION="false" - NEED_BLOB_TRANSMISSION="false" - PROGRAMMER_BIOS="internal" - PROGRAMMER_EC="" - NEED_ROMHOLE_MIGRATION="true" - if check_if_dasharo; then - # if v1.1.3 or older, flash the whole bios region - # TODO: Let DTS determine which parameters are suitable. - # FIXME: Can we ever get rid of that? We change so much in each release, - # that we almost always need to flash whole BIOS region - # because of non-backward compatbile or breaking changes. - compare_versions $DASHARO_VERSION 1.1.3 - if [ $? -eq 1 ]; then - # For Dasharo version lesser than 1.1.3 - NEED_BOOTSPLASH_MIGRATION="true" - FLASHROM_ADD_OPT_UPDATE_OVERRIDE="--ifd -i bios" - fi - fi - ;; - *) - error_exit "Board model $BOARD_MODEL is currently not supported" - ;; - esac - ;; - "MS-7E06") - case "$BOARD_MODEL" in - "PRO Z790-P WIFI DDR4(MS-7E06)" | "PRO Z790-P DDR4(MS-7E06)" | "PRO Z790-P WIFI DDR4 (MS-7E06)" | "PRO Z790-P DDR4 (MS-7E06)") - DASHARO_REL_NAME="msi_ms7e06" - #DASHARO_REL_VER="" - DASHARO_REL_VER_DES="0.9.1" - #BIOS_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER/${DASHARO_REL_NAME}_v${DASHARO_REL_VER}_ddr4.rom" - BIOS_LINK_DES="${FW_STORE_URL_DES}/MS-7E06/v${DASHARO_REL_VER_DES}/${DASHARO_REL_NAME}_v${DASHARO_REL_VER_DES}_ddr4.rom" - HAVE_HEADS_FW="true" - HEADS_REL_VER_DES="0.9.0" - HEADS_LINK_DES="${FW_STORE_URL_DES}/MS-7E06/v${HEADS_REL_VER_DES}/${DASHARO_REL_NAME}_v${HEADS_REL_VER_DES}_ddr4_heads.rom" - HEADS_SWITCH_FLASHROM_OPT_OVERRIDE="--ifd -i bios" - HAVE_EC="false" - NEED_EC_RESET="false" - #BIOS_HASH_LINK_COMM="${BIOS_LINK_COMM}.sha256" - BIOS_HASH_LINK_DES="${BIOS_LINK_DES}.sha256" - #BIOS_SIGN_LINK_COMM="${BIOS_LINK_COMM}.sha256.sig" - BIOS_SIGN_LINK_DES="${BIOS_LINK_DES}.sha256.sig" - PLATFORM_SIGN_KEY="dasharo/msi_ms7e06/dasharo-release-0.x-compatible-with-msi-ms-7e06-signing-key.asc" - NEED_SMBIOS_MIGRATION="false" - NEED_SMMSTORE_MIGRATION="true" - NEED_BOOTSPLASH_MIGRATION="false" - NEED_BLOB_TRANSMISSION="false" - PROGRAMMER_BIOS="internal:boardmismatch=force" - PROGRAMMER_EC="" - NEED_ROMHOLE_MIGRATION="true" - if check_if_dasharo; then - # if v0.9.1 or older, flash the whole bios region - # TODO: Let DTS determine which parameters are suitable. - # FIXME: Can we ever get rid of that? We change so much in each release, - # that we almost always need to flash whole BIOS region - # because of non-backward compatbile or breaking changes. - compare_versions $DASHARO_VERSION 0.9.1 - if [ $? -eq 1 ]; then - # For Dasharo version lesser than 0.9.1 - NEED_BOOTSPLASH_MIGRATION="true" - FLASHROM_ADD_OPT_UPDATE_OVERRIDE="--ifd -i bios" - fi - fi - ;; - "PRO Z790-P WIFI (MS-7E06)" | "PRO Z790-P (MS-7E06)") - DASHARO_REL_NAME="msi_ms7e06" - #DASHARO_REL_VER="" - DASHARO_REL_VER_DES="0.9.1" - #BIOS_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER/${DASHARO_REL_NAME}_v${DASHARO_REL_VER}_ddr5.rom" - BIOS_LINK_DES="${FW_STORE_URL_DES}/MS-7E06/v${DASHARO_REL_VER_DES}/${DASHARO_REL_NAME}_v${DASHARO_REL_VER_DES}_ddr5.rom" - HAVE_HEADS_FW="true" - HEADS_REL_VER_DES="0.9.0" - HEADS_LINK_DES="${FW_STORE_URL_DES}/MS-7E06/v${HEADS_REL_VER_DES}/${DASHARO_REL_NAME}_v${HEADS_REL_VER_DES}_ddr5_heads.rom" - HEADS_SWITCH_FLASHROM_OPT_OVERRIDE="--ifd -i bios" - HAVE_EC="false" - NEED_EC_RESET="false" - #BIOS_HASH_LINK_COMM="${BIOS_LINK_COMM}.sha256" - BIOS_HASH_LINK_DES="${BIOS_LINK_DES}.sha256" - #BIOS_SIGN_LINK_COMM="${BIOS_LINK_COMM}.sha256.sig" - BIOS_SIGN_LINK_DES="${BIOS_LINK_DES}.sha256.sig" - PLATFORM_SIGN_KEY="dasharo/msi_ms7e06/dasharo-release-0.x-compatible-with-msi-ms-7e06-signing-key.asc" - NEED_SMBIOS_MIGRATION="false" - NEED_SMMSTORE_MIGRATION="true" - NEED_BOOTSPLASH_MIGRATION="false" - NEED_BLOB_TRANSMISSION="false" - PROGRAMMER_BIOS="internal" - PROGRAMMER_EC="" - NEED_ROMHOLE_MIGRATION="true" - if check_if_dasharo; then - # if v0.9.1 or older, flash the whole bios region - # TODO: Let DTS determine which parameters are suitable. - # FIXME: Can we ever get rid of that? We change so much in each release, - # that we almost always need to flash whole BIOS region - # because of non-backward compatbile or breaking changes. - compare_versions $DASHARO_VERSION 0.9.1 - if [ $? -eq 1 ]; then - # For Dasharo version lesser than 0.9.1 - NEED_BOOTSPLASH_MIGRATION="true" - FLASHROM_ADD_OPT_UPDATE_OVERRIDE="--ifd -i bios" - fi - fi - ;; - *) - error_exit "Board model $BOARD_MODEL is currently not supported" - ;; - esac - ;; - *) - error_exit "Board model $SYSTEM_MODEL is currently not supported" - ;; - esac - ;; - "Dell Inc.") - DASHARO_REL_NAME="dell_optiplex_9010" - DASHARO_REL_VER="0.1.0" - BIOS_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER.rom" - HAVE_EC="false" - NEED_EC_RESET="false" - BIOS_HASH_LINK_COMM="a880504dfb0497f31e898f62ae5c9f3b145bca0b4fa601e41cddc54bea22ee36 $BIOS_UPDATE_FILE" - NEED_SMBIOS_MIGRATION="true" - NEED_BLOB_TRANSMISSION="true" - PROGRAMMER_BIOS="internal" - SINIT_ACM_FILENAME="/tmp/630744_003.zip" - SINIT_ACM_URL="https://cdrdv2.intel.com/v1/dl/getContent/630744" - SINIT_ACM_HASH="0b412c1832bd504d4b8f5fa01b32449c344fe0019e5e4da6bb5d80d393df5e8b $SINIT_ACM_FILENAME" - SINIT_ACM="/tmp/630744_003/SNB_IVB_SINIT_20190708_PW.bin" - FLASHROM_ADD_OPT_DEPLOY="--ifd -i bios" - FLASHROM_ADD_OPT_UPDATE="--fmap -i RW_SECTION_A" - case "$SYSTEM_MODEL" in - "OptiPlex 7010") - DBT_BIOS_UPDATE_FILENAME="/tmp/O7010A29.exe" - DBT_BIOS_UPDATE_URL="https://dl.dell.com/FOLDER05066036M/1/O7010A29.exe" - DBT_BIOS_UPDATE_HASH="ceb82586c67cd8d5933ac858c12e0cb52f6e0e4cb3249f964f1c0cfc06d16f52 $DBT_BIOS_UPDATE_FILENAME" - DBT_UEFI_IMAGE="/tmp/_O7010A29.exe.extracted/65C10" - SCH5545_FW="/tmp/_O7010A29.exe.extracted/65C10_output/pfsobject/section-7ec6c2b0-3fe3-42a0-a316-22dd0517c1e8/volume-0x50000/file-d386beb8-4b54-4e69-94f5-06091f67e0d3/section0.raw" - ACM_BIN="/tmp/_O7010A29.exe.extracted/65C10_output/pfsobject/section-7ec6c2b0-3fe3-42a0-a316-22dd0517c1e8/volume-0x500000/file-2d27c618-7dcd-41f5-bb10-21166be7e143/object-0.raw" - ;; - "OptiPlex 9010") - DBT_BIOS_UPDATE_FILENAME="/tmp/O9010A30.exe" - DBT_BIOS_UPDATE_URL="https://dl.dell.com/FOLDER05066009M/1/O9010A30.exe" - DBT_BIOS_UPDATE_HASH="b11952f43d0ad66f3ce79558b8c5dd43f30866158ed8348e3b2dae1bbb07701b $DBT_BIOS_UPDATE_FILENAME" - DBT_UEFI_IMAGE="/tmp/_O9010A30.exe.extracted/65C10" - SCH5545_FW="/tmp/_O9010A30.exe.extracted/65C10_output/pfsobject/section-7ec6c2b0-3fe3-42a0-a316-22dd0517c1e8/volume-0x50000/file-d386beb8-4b54-4e69-94f5-06091f67e0d3/section0.raw" - ACM_BIN="/tmp/_O9010A30.exe.extracted/65C10_output/pfsobject/section-7ec6c2b0-3fe3-42a0-a316-22dd0517c1e8/volume-0x500000/file-2d27c618-7dcd-41f5-bb10-21166be7e143/object-0.raw" - ;; - "Precision T1650") - # tested on Dasharo Firmware for OptiPlex 9010, will need to be - # enabled when build for T1650 exists - # - # DBT_BIOS_UPDATE_FILENAME="/tmp/T1650A28.exe" - # DBT_BIOS_UPDATE_URL="https://dl.dell.com/FOLDER05065992M/1/T1650A28.exe" - # DBT_BIOS_UPDATE_HASH="40a66210b8882f523885849c1d879e726dc58aa14718168b1e75f3e2caaa523b $DBT_BIOS_UPDATE_FILENAME" - # DBT_UEFI_IMAGE="/tmp/_T1650A28.exe.extracted/65C10" - # SCH5545_FW="/tmp/_T1650A28.exe.extracted/65C10_output/pfsobject/section-7ec6c2b0-3fe3-42a0-a316-22dd0517c1e8/volume-0x60000/file-d386beb8-4b54-4e69-94f5-06091f67e0d3/section0.raw" - # ACM_BIN="/tmp/_T1650A28.exe.extracted/65C10_output/pfsobject/section-7ec6c2b0-3fe3-42a0-a316-22dd0517c1e8/volume-0x500000/file-2d27c618-7dcd-41f5-bb10-21166be7e143/object-0.raw" - print_warning "Dasharo Firmware for Precision T1650 not available yet!" - error_exit "Board model $SYSTEM_MODEL is currently not supported" - ;; - *) - error_exit "Board model $SYSTEM_MODEL is currently not supported" - ;; - esac - ;; - "ASUS") - case "$SYSTEM_MODEL" in - "KGPE-D16") - DASHARO_REL_NAME="asus_kgpe-d16" - DASHARO_REL_VER="0.4.0" - HAVE_EC="false" - NEED_EC_RESET="false" - case "$FLASH_CHIP_SIZE" in - "2") - BIOS_HASH_LINK_COMM="65e5370e9ea6b8ae7cd6cc878a031a4ff3a8f5d36830ef39656b8e5a6e37e889 $BIOS_UPDATE_FILE" - BIOS_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER/${DASHARO_REL_NAME}_v${DASHARO_REL_VER}_vboot_notpm.rom" - ;; - "8") - BIOS_HASH_LINK_COMM="da4e6217d50f2ac199dcb9a927a0bc02aa4e792ed73c8c9bac8ba74fc787dbef $BIOS_UPDATE_FILE" - BIOS_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER/${DASHARO_REL_NAME}_v${DASHARO_REL_VER}_${FLASH_CHIP_SIZE}M_vboot_notpm.rom" - ;; - "16") - BIOS_HASH_LINK_COMM="20055cf57185f149259706f58d5e9552a1589259c6617999c1ac7d8d3c960020 $BIOS_UPDATE_FILE" - BIOS_LINK_COMM="$FW_STORE_URL/$DASHARO_REL_NAME/v$DASHARO_REL_VER/${DASHARO_REL_NAME}_v${DASHARO_REL_VER}_${FLASH_CHIP_SIZE}M_vboot_notpm.rom" - ;; - *) - error_exit "Platform uses chipset with not supported size" - ;; - esac - NEED_SMBIOS_MIGRATION="true" - NEED_BLOB_TRANSMISSION="false" - PROGRAMMER_BIOS="internal" - ;; - *) - error_exit "Board model $SYSTEM_MODEL is currently not supported" - ;; - esac - ;; - "PC Engines") - FLASH_CHIP_LIST="W25Q64JV-.Q" - shopt -s nocasematch - case "$SYSTEM_MODEL" in - "APU2") - DASHARO_REL_NAME="pcengines_apu2" - DASHARO_REL_VER_DES="0.9.0" - HAVE_EC="false" - NEED_EC_RESET="false" - BIOS_LINK_DES="${FW_STORE_URL_DES}/pcengines_apu2/v${DASHARO_REL_VER_DES}/${DASHARO_REL_NAME}_v${DASHARO_REL_VER_DES}.rom" - BIOS_HASH_LINK_DES="${BIOS_LINK_DES}.sha256" - BIOS_SIGN_LINK_DES="${BIOS_LINK_DES}.sha256.sig" - PROGRAMMER_BIOS="internal:boardmismatch=force" - NEED_SMMSTORE_MIGRATION="true" - NEED_BOOTSPLASH_MIGRATION="true" - ;; - "APU3") - DASHARO_REL_NAME="pcengines_apu3" - DASHARO_REL_VER_DES="0.9.0" - HAVE_EC="false" - NEED_EC_RESET="false" - BIOS_LINK_DES="${FW_STORE_URL_DES}/pcengines_apu2/v${DASHARO_REL_VER_DES}/${DASHARO_REL_NAME}_v${DASHARO_REL_VER_DES}.rom" - BIOS_HASH_LINK_DES="${BIOS_LINK_DES}.sha256" - BIOS_SIGN_LINK_DES="${BIOS_LINK_DES}.sha256.sig" - PROGRAMMER_BIOS="internal:boardmismatch=force" - NEED_SMMSTORE_MIGRATION="true" - NEED_BOOTSPLASH_MIGRATION="true" - ;; - "APU4") - DASHARO_REL_NAME="pcengines_apu4" - DASHARO_REL_VER_DES="0.9.0" - HAVE_EC="false" - NEED_EC_RESET="false" - BIOS_LINK_DES="${FW_STORE_URL_DES}/pcengines_apu2/v${DASHARO_REL_VER_DES}/${DASHARO_REL_NAME}_v${DASHARO_REL_VER_DES}.rom" - BIOS_HASH_LINK_DES="${BIOS_LINK_DES}.sha256" - BIOS_SIGN_LINK_DES="${BIOS_LINK_DES}.sha256.sig" - PROGRAMMER_BIOS="internal:boardmismatch=force" - NEED_SMMSTORE_MIGRATION="true" - NEED_BOOTSPLASH_MIGRATION="true" - ;; - "APU6") - DASHARO_REL_NAME="pcengines_apu6" - DASHARO_REL_VER_DES="0.9.0" - HAVE_EC="false" - NEED_EC_RESET="false" - BIOS_LINK_DES="${FW_STORE_URL_DES}/pcengines_apu2/v${DASHARO_REL_VER_DES}/${DASHARO_REL_NAME}_v${DASHARO_REL_VER_DES}.rom" - BIOS_HASH_LINK_DES="${BIOS_LINK_DES}.sha256" - BIOS_SIGN_LINK_DES="${BIOS_LINK_DES}.sha256.sig" - PROGRAMMER_BIOS="internal:boardmismatch=force" - NEED_SMMSTORE_MIGRATION="true" - NEED_BOOTSPLASH_MIGRATION="true" - ;; - *) - error_exit "Board model $SYSTEM_MODEL is currently not supported" - ;; - esac - shopt -u nocasematch - ;; - *) - error_exit "Board vendor: $BOARD_VENDOR is currently not supported" - ;; - esac -} - -check_flash_lock() { - $FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} > /tmp/check_flash_lock 2> /tmp/check_flash_lock.err - # Check in flashrom output if lock is enabled - grep -q 'PR0: Warning:.* is read-only\|SMM protection is enabled' /tmp/check_flash_lock.err - if [ $? -eq 0 ]; then - print_warning "Flash lock enabled, please go into BIOS setup / Dasharo System Features / Dasharo\r - \rSecurity Options and enable access to flash with flashrom.\r\n - \rYou can learn more about this on: https://docs.dasharo.com/dasharo-menu-docs/dasharo-system-features/#dasharo-security-options" - exit 1 - fi -} - -check_flash_chip() { - echo "Gathering flash chip and chipset information..." - $FLASHROM -p "$PROGRAMMER_BIOS" --flash-name >> "$FLASH_INFO_FILE" 2>> "$ERR_LOG_FILE" - if [ $? -eq 0 ]; then - echo -n "Flash information: " - tail -n1 "$FLASH_INFO_FILE" - FLASH_CHIP_SIZE=$(($($FLASHROM -p "$PROGRAMMER_BIOS" --flash-size 2>> /dev/null | tail -n1) / 1024 / 1024)) - echo -n "Flash size: " - echo ${FLASH_CHIP_SIZE}M - else - for flash_name in $FLASH_CHIP_LIST - do - $FLASHROM -p "$PROGRAMMER_BIOS" -c "$flash_name" --flash-name >> "$FLASH_INFO_FILE" 2>> "$ERR_LOG_FILE" - if [ $? -eq 0 ]; then - echo "Chipset found" - tail -n1 "$FLASH_INFO_FILE" - FLASH_CHIP_SELECT="-c ${flash_name}" - FLASH_CHIP_SIZE=$(($($FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} --flash-size 2>> /dev/null | tail -n1) / 1024 / 1024)) - echo "Chipset size" - echo ${FLASH_CHIP_SIZE}M - break - fi - done - if [ -z "$FLASH_CHIP_SELECT" ]; then - error_exit "No supported chipset found, exit." - fi - fi -} - -check_se_creds() { - local _check_dwn_req_resp_uefi="0" - local _check_dwn_req_resp_heads="0" - local _check_logs_req_resp="0" - CLOUDSEND_LOGS_URL=$(sed -n '1p' < ${SE_credential_file} | tr -d '\n') - CLOUDSEND_DOWNLOAD_URL=$(sed -n '2p' < ${SE_credential_file} | tr -d '\n') - CLOUDSEND_PASSWORD=$(sed -n '3p' < ${SE_credential_file} | tr -d '\n') - USER_DETAILS="$CLOUDSEND_DOWNLOAD_URL:$CLOUDSEND_PASSWORD" - board_config - TEST_LOGS_URL="https://cloud.3mdeb.com/index.php/s/${CLOUDSEND_LOGS_URL}/authenticate/showShare" - - if [ ! -v BIOS_LINK_DES ] && [ ! -v HEADS_LINK_DES ]; then - error_exit "There is no Dasharo Entry Subscription available for your platform!" - fi - - if check_network_connection; then - if [ -v BIOS_LINK_DES ]; then - _check_dwn_req_resp_uefi=$(curl -L -I -s -f -u "$USER_DETAILS" -H "$CLOUD_REQUEST" "$BIOS_LINK_DES" -o /dev/null -w "%{http_code}") - fi - if [ -v HEADS_LINK_DES ]; then - _check_dwn_req_resp_heads=$(curl -L -I -s -f -u "$USER_DETAILS" -H "$CLOUD_REQUEST" "$HEADS_LINK_DES" -o /dev/null -w "%{http_code}") - fi - - _check_logs_req_resp=$(curl -L -I -s -f -H "$CLOUD_REQUEST" "$TEST_LOGS_URL" -o /dev/null -w "%{http_code}") - if [ ${_check_dwn_req_resp_uefi} -eq 200 ] || [ ${_check_dwn_req_resp_heads} -eq 200 ]; then - if [ ${_check_logs_req_resp} -eq 200 ]; then - return 0 - else - echo "" - return 1 - fi - else - echo "" - return 1 - fi - fi -} - -compare_versions() { - # return 1 if ver2 > ver1 - # return 0 otherwise - - # Use awk to drop any suffixes (-devX or -rcY) from the version strings, so - # that only the major, minor, and patch versions are compared. If the - # resulting versions are the same (ver1 equals ver2), then the one without - # any suffix is considered to be the newer version. - local ver1="$(echo $1 | awk -F '-' '{print $1}')" - local ver2="$(echo $2 | awk -F '-' '{print $1}')" - local suffix1="$(echo $1 | sed 's/^[0-9]*\.[0-9]*\.[0-9]*-*//')" - local suffix2="$(echo $2 | sed 's/^[0-9]*\.[0-9]*\.[0-9]*-*//')" - - if [[ $ver1 =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] && [[ $ver2 =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then - IFS='.' read -r -a arr_ver1 <<< "$ver1" - IFS='.' read -r -a arr_ver2 <<< "$ver2" - - if [ ${arr_ver2[0]} -lt ${arr_ver1[0]} ]; then - return 0 - fi - - if [ ${arr_ver2[0]} -gt ${arr_ver1[0]} ]; then - return 1 - fi - - if [ ${arr_ver2[0]} -eq ${arr_ver1[0]} ]; then - if [ ${arr_ver2[1]} -lt ${arr_ver1[1]} ]; then - return 0 - fi - - if [ ${arr_ver2[1]} -gt ${arr_ver1[1]} ]; then - return 1 - fi - - if [ ${arr_ver2[1]} -eq ${arr_ver1[1]} ]; then - if [ ${arr_ver2[2]} -lt ${arr_ver1[2]} ]; then - return 0 - fi - - if [ ${arr_ver2[2]} -gt ${arr_ver1[2]} ]; then - return 1 - fi - - # check suffixes - if [ ! -z "$suffix2" ] && [ -z "$suffix1" ]; then - return 0 - fi - - if [ -z "$suffix2" ] && [ ! -z "$suffix1" ]; then - return 1 - fi - fi - fi - else - error_exit "Incorrect version format" - fi -} - -download_artifacts() { - echo -n "Downloading Dasharo firmware..." - if [ -v BIOS_LINK_COMM ] && [ ${BIOS_LINK} == ${BIOS_LINK_COMM} ]; then - curl -s -L -f "$BIOS_LINK" -o $BIOS_UPDATE_FILE - error_check "Cannot access $FW_STORE_URL while downloading binary. Please - check your internet connection" - curl -s -L -f "$BIOS_HASH_LINK" -o $BIOS_HASH_FILE - error_check "Cannot access $FW_STORE_URL while downloading signature. Please - check your internet connection" - curl -s -L -f "$BIOS_SIGN_LINK" -o $BIOS_SIGN_FILE - error_check "Cannot access $FW_STORE_URL while downloading signature. Please - check your internet connection" - if [ "$HAVE_EC" == "true" ]; then - curl -s -L -f "$EC_LINK" -o "$EC_UPDATE_FILE" - error_check "Cannot access $FW_STORE_URL while downloading binary. Please - check your internet connection" - curl -s -L -f "$EC_HASH_LINK" -o $EC_HASH_FILE - error_check "Cannot access $FW_STORE_URL while downloading signature. Please - check your internet connection" - curl -s -L -f "$EC_SIGN_LINK" -o $EC_SIGN_FILE - error_check "Cannot access $FW_STORE_URL while downloading signature. Please - check your internet connection" - fi - else - USER_DETAILS="$CLOUDSEND_DOWNLOAD_URL:$CLOUDSEND_PASSWORD" - curl -s -L -f -u "$USER_DETAILS" -H "$CLOUD_REQUEST" "$BIOS_LINK" -o $BIOS_UPDATE_FILE - error_check "Cannot access $FW_STORE_URL_DES while downloading binary. - Please check your internet connection" - curl -s -L -f -u "$USER_DETAILS" -H "$CLOUD_REQUEST" "$BIOS_HASH_LINK" -o $BIOS_HASH_FILE - error_check "Cannot access $FW_STORE_URL_DES while downloading signature. - Please check your internet connection" - curl -s -L -f -u "$USER_DETAILS" -H "$CLOUD_REQUEST" "$BIOS_SIGN_LINK" -o $BIOS_SIGN_FILE - error_check "Cannot access $FW_STORE_URL_DES while downloading signature. - Please check your internet connection" - if [ "$HAVE_EC" == "true" ]; then - if [ -v EC_LINK_COMM ] && [ ${EC_LINK} == ${EC_LINK_COMM} ]; then - curl -s -L -f "$EC_LINK" -o "$EC_UPDATE_FILE" - error_check "Cannot access $FW_STORE_URL while downloading binary. Please - check your internet connection" - curl -s -L -f "$EC_HASH_LINK" -o $EC_HASH_FILE - error_check "Cannot access $FW_STORE_URL while downloading signature. Please - check your internet connection" - curl -s -L -f "$EC_SIGN_LINK" -o $EC_SIGN_FILE - error_check "Cannot access $FW_STORE_URL while downloading signature. Please - check your internet connection" - else - curl -s -L -f -u "$USER_DETAILS" -H "$CLOUD_REQUEST" "$EC_LINK" -o $EC_UPDATE_FILE - error_check "Cannot access $FW_STORE_URL while downloading binary. Please - check your internet connection" - curl -s -L -f -u "$USER_DETAILS" -H "$CLOUD_REQUEST" "$EC_HASH_LINK" -o $EC_HASH_FILE - error_check "Cannot access $FW_STORE_URL while downloading signature. Please - check your internet connection" - curl -s -L -f -u "$USER_DETAILS" -H "$CLOUD_REQUEST" "$EC_SIGN_LINK" -o $EC_SIGN_FILE - error_check "Cannot access $FW_STORE_URL while downloading signature. Please - check your internet connection" - fi - fi - fi - print_green "Done" -} - -download_keys() { - mkdir $KEYS_DIR - wget -O $KEYS_DIR/recovery_key.vbpubk https://github.com/Dasharo/vboot/raw/dasharo/tests/devkeys/recovery_key.vbpubk >> $ERR_LOG_FILE 2>&1 - wget -O $KEYS_DIR/firmware.keyblock https://github.com/Dasharo/vboot/raw/dasharo/tests/devkeys/firmware.keyblock >> $ERR_LOG_FILE 2>&1 - wget -O $KEYS_DIR/firmware_data_key.vbprivk https://github.com/Dasharo/vboot/raw/dasharo/tests/devkeys/firmware_data_key.vbprivk >> $ERR_LOG_FILE 2>&1 - wget -O $KEYS_DIR/kernel_subkey.vbpubk https://github.com/Dasharo/vboot/raw/dasharo/tests/devkeys/kernel_subkey.vbpubk >> $ERR_LOG_FILE 2>&1 - wget -O $KEYS_DIR/root_key.vbpubk https://github.com/Dasharo/vboot/raw/dasharo/tests/devkeys/root_key.vbpubk >> $ERR_LOG_FILE 2>&1 -} - -get_signing_keys() { - local platform_keys=$PLATFORM_SIGN_KEY - echo -n "Getting platform specific GPG key... " - for key in $platform_keys; do - wget -q https://raw.githubusercontent.com/3mdeb/3mdeb-secpack/master/$key -O - | gpg --import - >> $ERR_LOG_FILE 2>&1 - error_check "Cannot get $key key to verify signatures." - done - print_green "Done" -} - -verify_artifacts() { - local _type="$1" - local _update_file="" - local _hash_file="" - local _sign_file="" - local _name="" - local _sig_result="" - - case ${_type} in - ec) - _update_file=$EC_UPDATE_FILE - _hash_file=$EC_HASH_FILE - _sign_file=$EC_SIGN_FILE - _name="Dasharo EC" - ;; - bios) - _update_file=$BIOS_UPDATE_FILE - _hash_file=$BIOS_HASH_FILE - _sign_file=$BIOS_SIGN_FILE - _name="Dasharo" - ;; - *) - ;; - esac - echo -n "Checking $_name firmware checksum... " - sha256sum --check <(echo $(cat $_hash_file | cut -d ' ' -f 1) $_update_file) >> $ERR_LOG_FILE 2>&1 - error_check "Failed to verify $_name firmware checksum" - print_green "Verified." - if [ -v PLATFORM_SIGN_KEY ]; then - echo -n "Checking $_name firmware signature... " - _sig_result="$(cat $_hash_file | gpg --verify $_sign_file - >> $ERR_LOG_FILE 2>&1)" - error_check "Failed to verify $_name firmware signature.$'\n'$_sig_result" - print_green "Verified." - fi - echo "$_sig_result" -} - -check_intel_regions() { - - FLASH_REGIONS=$($FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} 2>&1) - BOARD_HAS_FD_REGION=0 - BOARD_FD_REGION_RW=0 - BOARD_HAS_ME_REGION=0 - BOARD_ME_REGION_RW=0 - BOARD_ME_REGION_LOCKED=0 - BOARD_HAS_GBE_REGION=0 - BOARD_GBE_REGION_RW=0 - BOARD_GBE_REGION_LOCKED=0 - - grep -q "Flash Descriptor region" <<< "$FLASH_REGIONS" && BOARD_HAS_FD_REGION=1 - grep -qE "Flash Descriptor region.*read-write" <<< "$FLASH_REGIONS" && BOARD_FD_REGION_RW=1 - - grep -q "Management Engine region" <<< "$FLASH_REGIONS" && BOARD_HAS_ME_REGION=1 - grep -qE "Management Engine region.*read-write" <<< "$FLASH_REGIONS" && BOARD_ME_REGION_RW=1 - grep -qE "Management Engine region.*locked" <<< "$FLASH_REGIONS" && BOARD_ME_REGION_LOCKED=1 - - grep -q "Gigabit Ethernet region" <<< "$FLASH_REGIONS" && BOARD_HAS_GBE_REGION=1 - grep -qE "Gigabit Ethernet region.*read-write" <<< "$FLASH_REGIONS" && BOARD_GBE_REGION_RW=1 - grep -qE "Gigabit Ethernet region.*locked" <<< "$FLASH_REGIONS" && BOARD_GBE_REGION_LOCKED=1 -} - -check_blobs_in_binary() { - BINARY_HAS_FD=0 - BINARY_HAS_ME=0 - - # If there is no descriptor, there is no ME as well, so skip the check - if [ $BOARD_HAS_FD_REGION -ne 0 ]; then - ME_OFFSET=$(ifdtool -d $1 2> /dev/null | grep "Flash Region 2 (Intel ME):" | sed 's/Flash Region 2 (Intel ME)\://' |awk '{print $1;}') - # Check for IFD signature at offset 0 (old descriptors) - if [ $(tail -c +0 $1|head -c 4|xxd -ps) == "5aa5f00f" ]; then - BINARY_HAS_FD=1 - fi - # Check for IFD signature at offset 16 (new descriptors) - if [ $(tail -c +17 $1|head -c 4|xxd -ps) == "5aa5f00f" ]; then - BINARY_HAS_FD=1 - fi - # Check for ME FPT signature at ME offset + 16 (old ME) - if [ $(tail -c +$((0x$ME_OFFSET + 17)) $1|head -c 4|tr -d '\0') == "\$FPT" ]; then - BINARY_HAS_ME=1 - fi - # Check for aa55 signature at ME offset + 4096 (new ME) - if [ $(tail -c +$((0x$ME_OFFSET + 4097)) $1|head -c 2|xxd -ps) == "aa55" ]; then - BINARY_HAS_ME=1 - fi - fi -} - -check_if_me_disabled() { - - ME_DISABLED=0 - - if [ $BOARD_HAS_ME_REGION -eq 0 ]; then - # No ME region - ME_DISABLED=1 - return - fi - - # Check if HECI present - # FIXME: what if HECI is not device 16.0? - if [ -d /sys/class/pci_bus/0000:00/device/0000:00:16.0 ]; then - # Check ME Current Operation Mode at offset 0x40 bits 19:16 - ME_OPMODE="$(setpci -s 00:16.0 42.B 2> /dev/null | cut -c2-)" - if [ $ME_OPMODE == "0" ]; then - echo "ME is not disabled" >> $ERR_LOG_FILE - return - elif [ $ME_OPMODE == "2" ]; then - echo "ME is disabled (HAP/Debug Mode)" >> $ERR_LOG_FILE - ME_DISABLED=1 - return - elif [ $ME_OPMODE == "3" ]; then - echo "ME is soft disabled (HECI)" >> $ERR_LOG_FILE - ME_DISABLED=1 - return - elif [ $ME_OPMODE == "4" ]; then - echo "ME disabled by Security Override Jumper/FDOPS" >> $ERR_LOG_FILE - ME_DISABLED=1 - return - elif [ $ME_OPMODE == "5" ]; then - echo "ME disabled by Security Override MEI Message/HMRFPO" >> $ERR_LOG_FILE - ME_DISABLED=1 - return - elif [ $ME_OPMODE == "6" ]; then - echo "ME disabled by Security Override MEI Message/HMRFPO" >> $ERR_LOG_FILE - ME_DISABLED=1 - return - elif [ $ME_OPMODE == "7" ]; then - echo "ME disabled (Enhanced Debug Mode) or runs Ignition FW" >> $ERR_LOG_FILE - ME_DISABLED=1 - return - else - print_warning "Unknown ME operation mode, assuming enabled." - echo "Unknown ME operation mode, assuming enabled." >> $ERR_LOG_FILE - return - fi - else - # If we are running coreboot, check for status in logs - cbmem -1 | grep -q "ME is disabled" && ME_DISABLED=1 && return # HECI (soft) disabled - cbmem -1 | grep -q "ME is HAP disabled" && ME_DISABLED=1 && return # HAP disabled - # TODO: If proprietary BIOS, then also try to check SMBIOS for ME FWSTS - # BTW we could do the same in coreboot, expose FWSTS in SMBIOS before it - # gets disabled - print_warning "Can not determine if ME is disabled, assuming enabled." - echo "Can not determine if ME is disabled, assuming enabled." >> $ERR_LOG_FILE - fi -} - -force_me_update() { - echo - print_warning "Flashing ME when not in disabled state may cause unexpected power management issues." - print_warning "Recovering from such state may require removal of AC power supply and resetting CMOS battery." - print_warning "Keeping an older version of ME may cause a CPU to perform less efficient, e.g. if upgraded the CPU to a newer generation." - print_warning "You have been warned." - while : ; do - echo - read -r -p "Skip ME flashing and proceed with BIOS/firmware flashing/udpating? (Y|n) " OPTION - echo - - case ${OPTION} in - yes|y|Y|Yes|YES) - print_warning "Proceeding without ME flashing, because we were asked to." - break - ;; - n|N) - error_exit "Cancelling flashing process..." - ;; - *) - ;; - esac - done -} - -set_flashrom_update_params() { - # Safe defaults which should always work - if [ $BOARD_HAS_FD_REGION -eq 0 ]; then - FLASHROM_ADD_OPT_UPDATE="" - else - FLASHROM_ADD_OPT_UPDATE="-N --ifd -i bios" - fi - BINARY_HAS_RW_B=0 - # We need to read whole binary (or BIOS region), otherwise cbfstool will - # return different attributes for CBFS regions - echo "Checking flash layout." - $FLASHROM -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_UPDATE} -r /tmp/bios.bin > /dev/null 2>&1 - if [ $? -eq 0 ] && [ -f "/tmp/bios.bin" ]; then - BOARD_FMAP_LAYOUT=$(cbfstool /tmp/bios.bin layout -w 2> /dev/null) - BINARY_FMAP_LAYOUT=$(cbfstool $1 layout -w 2> /dev/null) - diff <(echo "$BOARD_FMAP_LAYOUT") <(echo "$BINARY_FMAP_LAYOUT") > /dev/null 2>&1 - # If layout is identical, perform standard update using FMAP only - if [ $? -eq 0 ]; then - # Simply update RW_A fmap region if exists - grep -q "RW_SECTION_A" <<< $BINARY_FMAP_LAYOUT - if [ $? -eq 0 ]; then - FLASHROM_ADD_OPT_UPDATE="-N --fmap -i RW_SECTION_A" - else - # RW_A does not exists, it means no vboot. Update COREBOOT region only - FLASHROM_ADD_OPT_UPDATE="-N --fmap -i COREBOOT" - fi - # If RW_B present, use this variable later to perform 2-step update - grep -q "RW_SECTION_B" <<< $BINARY_FMAP_LAYOUT && BINARY_HAS_RW_B=1 - fi - else - print_warning "Could not read the FMAP region" - echo "Could not read the FMAP region" >> $ERR_LOG_FILE - fi -} - -set_intel_regions_update_params() { - if [ $BOARD_HAS_FD_REGION -eq 0 ]; then - # No FD on board, so no further flashing - FLASHROM_ADD_OPT_REGIONS="" - else - # Safe defaults, only BIOS region and do not verify all regions, - # as some of them may not be readable. First argument is the initial - # params. - FLASHROM_ADD_OPT_REGIONS=$1 - - if [ $BINARY_HAS_FD -ne 0 ]; then - if [ $BOARD_FD_REGION_RW -ne 0 ]; then - # FD writable and the binary provides FD, safe to flash - FLASHROM_ADD_OPT_REGIONS+=" -i fd" - else - print_error "The firmware binary to be flashed contains Flash Descriptor (FD), but FD is not writable!" - print_warning "Proceeding without FD flashing, as it is not critical." - echo "The firmware binary contains Flash Descriptor (FD), but FD is not writable!" >> $ERR_LOG_FILE - fi - fi - - if [ $BINARY_HAS_ME -ne 0 ]; then - if [ $BOARD_ME_REGION_RW -ne 0 ]; then - # ME writable and the binary provides ME, safe to flash if ME disabled - if [ $ME_DISABLED -eq 1 ]; then - FLASHROM_ADD_OPT_REGIONS+=" -i me" - else - echo "The firmware binary to be flashed contains Management Engine (ME), but ME is not disabled!" >> $ERR_LOG_FILE - print_error "The firmware binary contains Management Engine (ME), but ME is not disabled!" - force_me_update - fi - else - echo "The firmware binary to be flashed contains Management Engine (ME), but ME is not writable!" >> $ERR_LOG_FILE - print_error "The firmware binary contains Management Engine (ME), but ME is not writable!" - fi - fi - fi -} - -handle_fw_switching() { - local _can_switch_to_heads=$1 - - if [ "$_can_switch_to_heads" == "true" ] && [ "$DASHARO_FLAVOR" != "Dasharo (coreboot+heads)" ]; then - while : ; do - echo - read -r -p "Would you like to switch to Dasharo heads firmware? (Y|n) " OPTION - echo - - case ${OPTION} in - yes|y|Y|Yes|YES) - UPDATE_VERSION=$HEADS_REL_VER_DES - FLASHROM_ADD_OPT_UPDATE_OVERRIDE=$HEADS_SWITCH_FLASHROM_OPT_OVERRIDE - BIOS_HASH_LINK="${HEADS_LINK_DES}.sha256" - BIOS_SIGN_LINK="${HEADS_LINK_DES}.sha256.sig" - BIOS_LINK=$HEADS_LINK_DES - export SWITCHING_TO="heads" - echo - echo "Switching to Dasharo heads firmware v$UPDATE_VERSION" - break - ;; - n|N) - compare_versions $DASHARO_VERSION $UPDATE_VERSION - if [ $? -ne 1 ]; then - error_exit "No update available for your machine" - fi - echo "Will not install Dasharo heads firmware. Proceeding with regular Dasharo firmware update." - break - ;; - *) - ;; - esac - done - elif [ -v DES_IS_LOGGED ] && [ -v HEADS_LINK_DES ]; then - local _heads_des=1 - curl -sfI -u "$USER_DETAILS" -H "$CLOUD_REQUEST" "$HEADS_LINK_DES" -o /dev/null - _heads_des=$? - # We are on heads, offer switch back or perform update if DES gives access to heads - if [ "$DASHARO_FLAVOR" == "Dasharo (coreboot+heads)" ]; then - while : ; do - echo - read -r -p "Would you like to switch back to the regular Dasharo firmware? (Y|n) " OPTION - echo - - case ${OPTION} in - yes|y|Y|Yes|YES) - echo - echo "Switching back to regular Dasharo firmware v$UPDATE_VERSION" - echo - FLASHROM_ADD_OPT_UPDATE_OVERRIDE=$HEADS_SWITCH_FLASHROM_OPT_OVERRIDE - export SWITCHING_TO="uefi" - break - ;; - n|N) - if [ $_heads_des -ne 0 ]; then - error_exit "No update available for your machine" - fi - UPDATE_VERSION=$HEADS_REL_VER_DES - compare_versions $DASHARO_VERSION $UPDATE_VERSION - if [ $? -ne 1 ]; then - error_exit "No update available for your machine" - fi - echo "Will not switch back to regular Dasharo firmware. Proceeding with Dasharo heads firmware update to $UPDATE_VERSION." - FLASHROM_ADD_OPT_UPDATE_OVERRIDE="--ifd -i bios" - BIOS_HASH_LINK="${HEADS_LINK_DES}.sha256" - BIOS_SIGN_LINK="${HEADS_LINK_DES}.sha256.sig" - BIOS_LINK=$HEADS_LINK_DES - break - ;; - *) - ;; - esac - done - fi - elif [ ! -v DES_IS_LOGGED ] && [ "$DASHARO_FLAVOR" == "Dasharo (coreboot+heads)" ]; then - # Not logged with DES and we are on heads, offer switch back - compare_versions $DASHARO_VERSION $HEADS_REL_VER_DES - if [ $? -eq 1 ]; then - print_warning "You are running heads firmware, but did not provide DES credentials." - print_warning "There are updates available if you provide DES credentials in main DTS menu." - fi - echo - echo "Latest available Dasharo version: $HEADS_REL_VER_DES" - echo - while : ; do - echo - read -r -p "Would you like to switch back to the regular Dasharo firmware? (Y|n) " OPTION - echo - - case ${OPTION} in - yes|y|Y|Yes|YES) - echo - echo "Switching back to regular Dasharo firmware v$UPDATE_VERSION" - echo - FLASHROM_ADD_OPT_UPDATE_OVERRIDE=$HEADS_SWITCH_FLASHROM_OPT_OVERRIDE - export SWITCHING_TO="uefi" - break - ;; - n|N) - print_warning "No update currently possible. Aborting update process..." - exit 0 - break; - ;; - *) - ;; - esac - done - else - compare_versions $DASHARO_VERSION $UPDATE_VERSION - if [ $? -ne 1 ]; then - error_exit "No update available for your machine" - fi - fi -} diff --git a/meta-dts-distro/recipes-dts/dts/dts/dts-profile.sh b/meta-dts-distro/recipes-dts/dts/dts/dts-profile.sh deleted file mode 100644 index 89fa0387..00000000 --- a/meta-dts-distro/recipes-dts/dts/dts/dts-profile.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -SBIN_DIR="/usr/sbin" -export DTS_FUNCS="$SBIN_DIR/dts-functions.sh" -export DTS_ENV="$SBIN_DIR/dts-environment.sh" diff --git a/meta-dts-distro/recipes-dts/dts/dts/ec_transition b/meta-dts-distro/recipes-dts/dts/dts/ec_transition deleted file mode 100644 index 019a79d8..00000000 --- a/meta-dts-distro/recipes-dts/dts/dts/ec_transition +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env bash - -source $DTS_ENV -source $DTS_FUNCS - -check_network_connection() { - echo 'Waiting for network connection ...' - n="5" - while : ; do - ping -c 3 cloud.3mdeb.com > /dev/null 2>&1 && break - n=$((n-1)) - if [ "${n}" == "0" ]; then - error_exit "No network connection to 3mdeb cloud, please recheck Ethernet connection" - fi - sleep 1 - done -} - -board_config() { - case "$BOARD_VENDOR" in - "Notebook") - case "$SYSTEM_MODEL" in - "NS50_70MU") - HAVE_EC="true" - NEED_EC_RESET="true" - COMPATIBLE_EC_FW_VERSION="2022-08-31_cbff21b" - EC_HASH="d1001465cea74a550914c14f0c8f901b14827a3b5fa0b612ae6d11594ac2b405 /tmp/ecupdate.rom" - BIOS_HASH="d4c30660c53bac505997de30b9eac4c5ac15f3212c62366730dc2ca3974bba18 /tmp/biosupdate.rom" - PROGRAMMER_BIOS="internal" - PROGRAMMER_EC="ite_ec" - BIOS_LINK="https://cloud.3mdeb.com/index.php/s/SKpqSNzfFNY7AbK/download" - EC_LINK="https://cloud.3mdeb.com/index.php/s/GK2KbXaYprkCCWM/download" - ;; - "NV4XMB,ME,MZ") - HAVE_EC="true" - NEED_EC_RESET="true" - COMPATIBLE_EC_FW_VERSION="2022-10-07_c662165" - EC_HASH="7a75fd9afd81012f7c1485cc335298979509e5929d931d898465fbddb4ce105c /tmp/ecupdate.rom" - BIOS_HASH="7271b638c87cba658162931f55bdaa6987eb5b0555075ce8e2297a79a505c8b0 /tmp/biosupdate.rom" - PROGRAMMER_BIOS="internal:boardmismatch=force" - PROGRAMMER_EC="ite_ec:boardmismatch=force,romsize=128K,autoload=disable" - BIOS_LINK="https://cloud.3mdeb.com/index.php/s/3cjkJSWBzPfb5SP/download" - EC_LINK="https://cloud.3mdeb.com/index.php/s/9S5Tmy6kwFjpcNm/download" - ;; - *) - error_exit "Board model $SYSTEM_MODEL is currently not supported" - ;; - esac - ;; - *) - error_exit "Board vendor: $BOARD_VENDOR is currently not supported" - ;; - esac -} - -check_for_opensource_firmware() -{ - echo "Checking for opensource firmware" - $DASHARO_ECTOOL info >> /dev/null 2>&1 - if [ $? -eq 0 ]; then - error_exit "Device has already Open Source Embedded Controller firmware, aborting..." - fi -} - -download_files() -{ - check_network_connection - BIOS_UPDATE_FILE="/tmp/biosupdate.rom" - EC_UPDATE_FILE="/tmp/ecupdate.rom" - wget -O $EC_UPDATE_FILE $EC_LINK - error_check "Cannot download EC update file. Aborting..." - wget -O $BIOS_UPDATE_FILE $BIOS_LINK - error_check "Cannot download FW update file. Aborting..." - echo "Successfully downloaded EC and FW files." -} - -update_ec() { - sha256sum --check <(echo "$EC_HASH") - error_check "Failed to download EC firmware update" - - echo "Updating EC..." - $FLASHROM -p ${PROGRAMMER_EC} -w /tmp/ecupdate.rom >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - error_check "Failed to update EC firmware" - - echo "Successfully updated EC firmware" -} - -install() { - sha256sum --check <(echo "$BIOS_HASH") - error_check "Failed to verify Dasharo firmware" - - if [ "$HAVE_EC" == "true" ]; then - _ec_fw_version=$($FLASHROM -p ${PROGRAMMER_EC} | grep "Mainboard EC Version" | tr -d ' ' | cut -d ':' -f 2) - - if [ "$_ec_fw_version" != "$COMPATIBLE_EC_FW_VERSION" ]; then - echo "EC version: $_ec_fw_version is not supported, update required" - update_ec - fi - fi - - echo "Installing Dasharo firmware..." - $FLASHROM -p ${PROGRAMMER_BIOS} --ifd -i bios -w /tmp/biosupdate.rom >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE - error_check "Failed to install Dasharo firmware" - - echo "Successfully installed Dasharo firmware" - - echo "Powering off" - sleep 1 - if [ "$NEED_EC_RESET" = "true" ]; then - it5570_shutdown - else - ${CMD_POWEROFF} - fi -} - -usage() { - echo "Usage:" - echo " $0 " - exit 1 -} - -ROOT_DIR="/" - -[ -z "$BOARD_VENDOR" ] && error_exit "BOARD_VENDOR not given" -[ -z "$SYSTEM_MODEL" ] && error_exit "SYSTEM_MODEL not given" - -check_for_opensource_firmware -board_config -download_files -install diff --git a/meta-dts-distro/recipes-dts/packagegroups/packagegroup-dts.bb b/meta-dts-distro/recipes-dts/packagegroups/packagegroup-dts.bb index 31ea9c38..6ef62e2f 100644 --- a/meta-dts-distro/recipes-dts/packagegroups/packagegroup-dts.bb +++ b/meta-dts-distro/recipes-dts/packagegroups/packagegroup-dts.bb @@ -42,13 +42,11 @@ RDEPENDS:${PN}-tools-base = " \ RDEPENDS:${PN}-tools-dts = " \ mei-amt-check \ cloudsend \ - dasharo-deploy \ - dasharo-hcl-report \ - dts \ dasharo-ectool \ txt-suite \ bg-suite \ dasharo-configuration-utility \ + dts-scripts \ " RDEPENDS:${PN}-python = " \ diff --git a/meta-dts-distro/recipes-dts/reports/dasharo-hcl-report.bb b/meta-dts-distro/recipes-dts/reports/dasharo-hcl-report.bb deleted file mode 100644 index 0b7471fd..00000000 --- a/meta-dts-distro/recipes-dts/reports/dasharo-hcl-report.bb +++ /dev/null @@ -1,30 +0,0 @@ -DESCRIPTION = "Dasharo HCL Report" -SECTION = "tools" -HOMEPAGE = "https://github.com/Dasharo/jubilant-octo-train/blob/master/config/includes.chroot/usr/bin/dasharo-hcl-report" - -LICENSE = "MIT" - -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" - -SRC_URI = " \ - file://dasharo-hcl-report \ -" - -S = "${WORKDIR}" - -RDEPENDS:${PN} = " \ - packagegroup-coreboot-utils \ - flashrom \ - iasl \ - tar \ - i2c-tools \ - i2c-tools-misc \ - bash \ - touchpad-info \ - dmidecode \ -" - -do_install () { - install -d ${D}/${sbindir} - install -m 0755 ${S}/dasharo-hcl-report ${D}/${sbindir} -} diff --git a/meta-dts-distro/recipes-dts/reports/dasharo-hcl-report/dasharo-hcl-report b/meta-dts-distro/recipes-dts/reports/dasharo-hcl-report/dasharo-hcl-report deleted file mode 100755 index 32c64db2..00000000 --- a/meta-dts-distro/recipes-dts/reports/dasharo-hcl-report/dasharo-hcl-report +++ /dev/null @@ -1,370 +0,0 @@ -#!/usr/bin/env bash - -source $DTS_ENV -source $DTS_FUNCS - -update_result() { - TOOL=$1 - ERRORFILE=$2 - LOGFILE=`printf $2 | sed 's/[.].*$//' && echo ".log"` - - # check if status was set as a unknown - if [ ! -v $3 ]; then - echo -e [$YELLOW"UNKNOWN"$COLOR_OFF]"\t"$TOOL >> result - return - fi - - ERR=$(stat -c%s "$ERRORFILE" 2> /dev/null) - LOG=$(stat -c%s "$LOGFILE" 2> /dev/null) - - # if ERR or LOG var is empty, set it to 1 so we will go into UNKNOWN state - if [ -z "$LOG" ]; then - LOG=1 - fi - if [ -z "$ERR" ]; then - ERR=1 - fi - # specific check for firmware dump - if [ $LOGFILE == "logs/flashrom_read.log" ]; then - if [ $LOG -ne 0 ] && [ -f "logs/rom.bin" ]; then - echo -e [$GREEN"OK"$COLOR_OFF]"\t\t"$TOOL >> result - else - echo -e [$RED"ERROR"$COLOR_OFF]"\t\t"$TOOL >> result - fi - return - fi - - # generic checks - if [ $LOG -ne 0 ] && [ $ERR -eq 0 ]; then - echo -e [$GREEN"OK"$COLOR_OFF]"\t\t"$TOOL >> result - elif [ $LOG -eq 0 ] && [ $ERR -ne 0 ]; then - echo -e [$RED"ERROR"$COLOR_OFF]"\t\t"$TOOL >> result - else - echo -e [$YELLOW"UNKNOWN"$COLOR_OFF]"\t"$TOOL >> result - fi -} - -CMD_DASHARO_DEPLOY="/usr/sbin/dasharo-deploy" - -if [ "$(id -u)" -ne 0 ]; then - echo "This script must be started as root!" - exit 1 -fi - -if [ -d logs ]; then - rm -rf logs -fi - -FULL_UPLOAD_URL="https://cloud.3mdeb.com/index.php/s/"${CLOUDSEND_LOGS_URL} - -board_config -check_flash_chip - -mkdir logs -if [ $DEPLOY_REPORT = "false" ]; then - echo "Getting hardware information. It will take a few minutes..." -fi -# echo "Dumping PCI configuration space and topology..." -lspci -nnvvvxxxx > logs/lspci.log 2> logs/lspci.err.log -update_result "PCI configuration space and topology" logs/lspci.err.log -printf '## |\r' - -# echo "Dumping USB devices and topology..." -lsusb -vvv > logs/lsusb.log 2> logs/lsusb.err.log -update_result "USB devices and topology" logs/lsusb.err.log -printf '#### |\r' - -# echo "Dumping Super I/O configuration..." -superiotool -deV > logs/superiotool.log 2> logs/superiotool.err.log -update_result "Super I/O configuration" logs/superiotool.err.log -printf '###### |\r' - -# echo "Dumping Embedded Controller configuration (this may take a while if EC is not present)..." -ectool -ip > logs/ectool.log 2> logs/ectool.err.log -update_result "EC configuration" logs/ectool.err.log -printf '######## |\r' - -# echo "Dumping MSRs..." -msrtool > logs/msrtool.log 2> logs/msrtool.err.log -update_result "MSRs" logs/msrtool.err.log -printf '########## |\r' - -# echo "Dumping SMBIOS tables..." -dmidecode > logs/dmidecode.log 2> logs/dmidecode.err.log -update_result "SMBIOS tables" logs/dmidecode.err.log -printf '############ |\r' - -# echo "Decoding BIOS information..." -biosdecode > logs/biosdecode.log 2> logs/biosdecode.err.log -update_result "BIOS information" logs/biosdecode.err.log -printf '############## |\r' - -# echo "Extracting CMOS NVRAM..." -nvramtool -x > logs/nvramtool.log 2> logs/nvramtool.err.log -update_result "CMOS NVRAM" logs/nvramtool.err.log -printf '################ |\r' - -# echo "Dumping Intel configuration registers..." -inteltool -a > logs/inteltool.log 2> logs/inteltool.err.log -update_result "Intel configuration registers" logs/inteltool.err.log -printf '################## |\r' - -# echo "Generating GPIO configuration C header files for coreboot..." -intelp2m -file logs/inteltool.log -fld cb -i -p snr -o logs/gpio_snr.h > logs/intelp2m.log 2> logs/intelp2m.err.log -intelp2m -file logs/inteltool.log -fld cb -i -p cnl -o logs/gpio_cnl.h >> logs/intelp2m.log 2>> logs/intelp2m.err.log -intelp2m -file logs/inteltool.log -fld cb -i -p apl -o logs/gpio_apl.h >> logs/intelp2m.log 2>> logs/intelp2m.err.log -intelp2m -file logs/inteltool.log -fld cb -i -p lbg -o logs/gpio_lbg.h >> logs/intelp2m.log 2>> logs/intelp2m.err.log -update_result "GPIO configuration C header files" logs/intelp2m.err.log -printf '#################### |\r' - -# echo "Dumping kernel dmesg..." -dmesg > logs/dmesg.log 2> logs/dmesg.err.log -update_result "kernel dmesg" logs/dmesg.err.log -printf '###################### |\r' - -# echo "Dumping ACPI tables..." -acpidump > logs/acpidump.log 2> logs/acpidump.err.log -update_result "ACPI tables" logs/acpidump.err.log -printf '######################## |\r' - -# echo "Dumping Audio devices configuration..." - -# This is a workaround to soundcard's files absence in short time after booting. -# Thread is continued here https://github.com/Dasharo/dasharo-issues/issues/247 -for t in {1..12} -do - SND_HW_FILES=/sys/class/sound/card0/hw*/init_pin_configs - SND_CODEC_FILES=/proc/asound/card0/codec#* - SND_HW_FILE=`echo $SND_HW_FILES | cut -d ' ' -f 1` - SND_CODEC_FILE=`echo $SND_CODEC_FILES | cut -d ' ' -f 1` - - if [ -f "$SND_HW_FILE" ] && [ -f "$SND_CODEC_FILE" ]; then - break - else - sleep 5 - if [ $t -eq 12 ]; then - if [ $DEPLOY_REPORT = "false" ]; then - echo "Sound card files are missing!" - fi - fi - fi -done - -for x in /sys/class/sound/card0/hw*; do cat "$x/init_pin_configs" > logs/pin_"$(basename "$x")" 2> logs/pin_"$(basename "$x")".err.log; done -for x in /proc/asound/card0/codec#*; do cat "$x" > logs/"$(basename "$x")" 2> logs/"$(basename "$x")".err.log; done -update_result "Audio devices configuration" 0 UNKNOWN -printf '########################## |\r' - -# echo "Dumping CPU info..." -cat /proc/cpuinfo > logs/cpuinfo.log 2> logs/cpuinfo.err.log -update_result "CPU info" logs/cpuinfo.err.log -printf '############################ |\r' - -# echo "Dumping I/O ports..." -cat /proc/ioports > logs/ioports.log 2> logs/ioports.err.log -update_result "I/O ports" logs/ioports.err.log -printf '############################## |\r' - -# echo "Dumping input bus types..." -cat /sys/class/input/input*/id/bustype > logs/input_bustypes.log -update_result "Input bus types" logs/ioports.err.log -printf '################################ |\r' - -# echo "Trying to read firmware image with flashrom..." -# Some regions may be not available so we need to use specific regions to read -check_intel_regions -if [ $BOARD_HAS_FD_REGION -eq 0 ]; then - # No descriptor, probably safe to read everything - FLASHROM_ADD_OPT_READ=" " -else - # Use safe defaults. Descriptor may contain additional regions not detected - # by flashrom and will return failure when attempted to be read. BIOS and - # Flash descriptor regions should always be readable. If not, then we have - # some ugly case, hard to deal with. - FLASHROM_ADD_OPT_READ="--ifd -i fd -i bios" - if [ $BOARD_HAS_ME_REGION -eq 0 ] && [ $BOARD_ME_REGION_LOCKED -ne 0 ]; then - # ME region is not locked, read it as well - FLASHROM_ADD_OPT_READ+=" -i me" - fi - if [ $BOARD_HAS_GBE_REGION -eq 0 ] && [ $BOARD_GBE_REGION_LOCKED -ne 0 ]; then - # GBE region is present and not locked, read it as well - FLASHROM_ADD_OPT_READ+=" -i gbe" - fi -fi - -$FLASHROM -V -p internal:laptop=force_I_want_a_brick ${FLASH_CHIP_SELECT} -r logs/rom.bin ${FLASHROM_ADD_OPT_READ} > logs/flashrom_read.log 2> logs/flashrom_read.err.log -if [ $? -ne 0 ]; then - echo "CRITICAL ERROR: cannot dump firmware" -fi -update_result "Firmware image" logs/flashrom_read.err.log -printf '################################## |\r' - -# echo "Probing all I2C buses..." -MAX_I2C_ID=$(i2cdetect -l | awk 'BEGIN{c1=0} //{c1++} END{print "",--c1}') -for bus in $(seq 0 "$MAX_I2C_ID"); -do - echo "I2C bus number: $bus" >> logs/i2cdetect.log 2>> logs/i2cdetect.err.log - i2cdetect -y "$bus" >> logs/i2cdetect.log 2>> logs/i2cdetect.err.log -done -update_result "I2C bus" logs/i2cdetect.err.log -printf '#################################### |\r' - -# echo "Decompiling ACPI tables..." -mkdir -p logs/acpi -if pushd logs/acpi &> /dev/null; then - acpixtract -a ../acpidump.log &>/dev/null - iasl -d ./*.dat &>/dev/null - popd &> /dev/null -fi -update_result "ACPI tables" 0 UNKNOWN -printf '###################################### |\r' - -# echo "Getting touchpad information..." -touchpad-info > logs/touchpad.log 2> logs/touchpad.err.log -update_result "Touchpad information" logs/touchpad.err.log -printf '######################################## |\r' - -# echo "Getting DIMMs information..." -decode-dimms > logs/decode-dimms.log 2> logs/decode-dimms.err.log -update_result "DIMMs information" logs/decode-dimms.err.log -printf '########################################## |\r' - -# echo "Getting CBMEM table..." -cbmem > logs/cbmem.log 2> logs/cbmem.err.log -update_result "CBMEM table information" logs/cbmem.err.log -printf '############################################ |\r' - -# echo "Getting TPM information..." -find `realpath /sys/class/tpm/tpm*` -type f -print -exec cat {} \; > logs/tpm_version.log 2> logs/tpm_version.err.log -update_result "TPM information" logs/tpm_version.err.log -printf '############################################# |\r' - -# echo "Checking AMT..." -mei-amt-check > logs/amt-check.log 2> logs/amt-check.err.log -update_result "AMT information" logs/amt-check.err.log -printf '############################################### |\r' - -# echo "Checking ME..." -intelmetool -m > logs/intelmetool.log 2> logs/intelmetool.err.log -update_result "ME information" logs/intelmetool.err.log -printf '################################################ |\r' - -printf '################################################## |\r' -printf '#################################################### |\r' -printf '###################################################### |\r' -printf '######################################################## |\r' -printf '########################################################## |\r' -printf '############################################################ |\r' -printf '############################################################## |\r' -printf '################################################################ |\r' -printf '################################################################## |\r' -printf '###################################################################|\r' -# next two echo cmds helps with printing -echo -echo - -echo "Results of getting data:" >> result -echo -e "\nLegend:" >> result -echo -e [$GREEN"OK"$COLOR_OFF]"\t\t Data get successfully" >> result -echo -e [$YELLOW"UNKNOWN"$COLOR_OFF]"\t Result is unknown" >> result -echo -e [$RED"ERROR"$COLOR_OFF]"\t\t Error during getting data\n" >> result - -mv result logs/result -if [ $DEPLOY_REPORT = "false" ]; then - cat logs/result -fi - -# Create name for generated report -filename="$(dmidecode -s system-manufacturer)" -filename+=" $(dmidecode -s system-product-name)" -filename+=" $(dmidecode -s bios-version)" - -# MAC address of device that is used to connect the internet -# it could return none only when there is no internet connection but -# in those cases report will be stored locally only -uuid_string=`cat /sys/class/net/$(ip route show default | head -1 | awk '/default/ {print $5}')/address` -# next two values are hardware related so they will be always the same -uuid_string+="_$(dmidecode -s system-product-name)" -uuid_string+="_$(dmidecode -s system-manufacturer)" - -# using values from above should generate the same uuid all the time if only -# the MAC address will not change -uuid=`uuidgen -n @x500 -N $uuid_string -s` - -filename+="_$uuid" -filename+="_$(date +'%Y_%m_%d_%H_%M_%S_%N')" -filename="${filename// /_}" - -if [ $DEPLOY_REPORT = "false" ]; then - echo "Creating archive with logs..." -fi - -# remove MAC address from logs as sensitive data -MAC_ADDR=`cat /sys/class/net/$(ip route show default | head -1 | awk '/default/ {print $5}')/address` -grep -rl "${MAC_ADDR}" logs > /dev/null && grep -rl "${MAC_ADDR}" logs | xargs sed -i 's/'${MAC_ADDR}'/MAC ADDRESS REMOVED/g' -tar -zcf "$filename.tar.gz" logs/* -rm -rf logs - -if [ $DEPLOY_REPORT = "false" ]; then - echo "Done! Logs saved to: $(readlink -f $filename.tar.gz)" -fi - -if [ "$SEND_LOGS" = "true" ]; then - if [ $DEPLOY_REPORT = "false" ]; then - echo "Sending logs to 3mdeb cloud..." - CLOUDSEND_OPTS="-e" - else - CLOUDSEND_OPTS="-e -q" - fi - cloudsend.sh \ - ${CLOUDSEND_OPTS} \ - $(readlink -f $filename.tar.gz) \ - ${FULL_UPLOAD_URL} - if [ "$?" -ne "0" ]; then - echo "Failed to send logs to the cloud" - if [ -a "${CMD_DASHARO_DEPLOY}" ]; then - echo -e "Something may be wrong with credentials. Please use option 4 to change DES keys - \rand make sure that there is no typo." - fi - exit 1 - fi - if [ $DEPLOY_REPORT = "false" ]; then - echo "Thank you for supporting Dasharo!" - fi -fi - -echo -e \ -"-----------------------------------------------------------------------------\r -Would you like to contribute to the \"Hardware for Linux\" project?\r -it is an open source project that that anonymously collects hardware details\r -of Linux-powered computers over the world and helps people to collaboratively\r -debug hardware related issues, check for Linux-compatibility and find drivers.\r ------------------------------------------------------------------------------\r -You can find more about it here:\r -https://linux-hardware.org/\r -https://github.com/linuxhw/hw-probe\r ------------------------------------------------------------------------------\r -Do you want to participate in this project?\r -(if you answer \"yes\", then command hw-probe --all --upload will be ran, in \r -order to participate)\r -" - -read -p "[N/y] " -case ${REPLY} in - yes|y|Y|Yes|YES) - /usr/bin/hw-probe -all -upload - if [ $? -eq 0 ]; then - echo "Thank you for contributing to the \"Hardware for Linux\" project!" - else - echo "couldn't probe/upload. Check your internet connection..." - exit 1 - fi - ;; - *) - echo -e \ - "Please consider contributing to the \"Hardware for Linux\" project in the future.\r - All you have to do is run this command:\r - hw-probe --all --upload\r - " - ;; -esac diff --git a/meta-dts-distro/recipes-dts/reports/touchpad-info.bb b/meta-dts-distro/recipes-dts/reports/touchpad-info.bb deleted file mode 100644 index fe473f8e..00000000 --- a/meta-dts-distro/recipes-dts/reports/touchpad-info.bb +++ /dev/null @@ -1,23 +0,0 @@ -SUMMARY = "Touchpad info script" -DESCRIPTION = "Gets information on the touchpad devices. Currently supports only Clevo devices" -SECTION = "tools" -HOMEPAGE = "https://github.com/3mdeb/fwdump-docker/blob/touchpad_info/scripts/get_touchpad_info.sh" - -LICENSE = "MIT" - -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" - -SRC_URI = "file://touchpad-info" - -S = "${WORKDIR}" - -RDEPENDS:${PN} = " \ - bash \ - i2c-tools \ - acpi-call-dkms \ -" - -do_install () { - install -d ${D}/${sbindir} - install -m 0755 ${S}/touchpad-info ${D}/${sbindir} -} diff --git a/meta-dts-distro/recipes-dts/reports/touchpad-info/touchpad-info b/meta-dts-distro/recipes-dts/reports/touchpad-info/touchpad-info deleted file mode 100644 index 5186fe3f..00000000 --- a/meta-dts-distro/recipes-dts/reports/touchpad-info/touchpad-info +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env bash -# A script to dump info about the touchpad - -if ! dmesg | grep hid-multitouch | grep "I2C HID" > /dev/null; then - echo "No I2C touchpads detected. Exiting" - exit 2 -fi - -devname=$(dmesg | grep hid-multitouch | awk 'NF>1{print $NF}') -hid=$(cat "/sys/bus/i2c/devices/$devname/firmware_node/hid") -path=$(cat "/sys/bus/i2c/devices/$devname/firmware_node/path") - -ACPI_CALL_PATH="/proc/acpi/call" - -if [ ! -f "$ACPI_CALL_PATH" ]; then - echo "File ${ACPI_CALL_PATH} doesn\'t exist. Exiting" - exit 3 -fi - -echo "$path._DSM bF7F6DF3C67425545AD05B30A3D8938DE 1 1" > ${ACPI_CALL_PATH} -descriptor_offset=$(tr -d '\0' < ${ACPI_CALL_PATH} | cut -d 'c' -f 1) - -i2c_row=$(i2cdetect -y -r 0 | grep UU) -i2c_col=0 -for x in $i2c_row -do - if [ "$x" = 'UU' ]; then - break; - fi - i2c_col=$(($i2c_col + 1)) -done - -i2c_addr=$(echo "$i2c_row" | cut -d ":" -f 1) -i2c_col=$(printf '%s\n' $(($i2c_col - 1))) -i2c_addr=$(printf '%s\n' $(($i2c_addr + $i2c_col))) - -echo "Found touchpad at: $path:" -echo -echo "HID: $hid" -echo "I2C address: 0x$i2c_addr" -echo "Descriptor address: $descriptor_offset" -echo