diff --git a/.circleci/config.yml b/.circleci/config.yml index e30f374a..9c72f1d2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -491,6 +491,13 @@ workflows: requires: - librem_14 + - build: + name: librem_11 + target: librem_11 + subcommand: "" + requires: + - librem_14 + # dasharo release - build: name: nitropad-ns50 diff --git a/bin/seed_package_mirror.sh b/bin/seed_package_mirror.sh new file mode 100755 index 00000000..ca1dfa61 --- /dev/null +++ b/bin/seed_package_mirror.sh @@ -0,0 +1,64 @@ +#! /usr/bin/env bash + +set -eo pipefail + +usage() { +cat >&2 < + +Downloads all current package artifacts needed to build Heads and copies them +to a mirror directory, for seeding a package mirror. + +Parameters: + : Path to a directory where the packages are placed. + Created if it does not already exist. +USAGE_END +} + +ARGS_DONE= +while [[ $# -ge 1 ]] && [ -z "$ARGS_DONE" ]; do + case "$1" in + --) + ARGS_DONE=y + shift + ;; + --help) + usage + exit 0 + ;; + --*) + echo "unknown parameter: $1" >&2 + usage + exit 1 + ;; + *) + ARGS_DONE=y + ;; + esac +done + +if [[ $# -ne 1 ]]; then + usage + exit 1 +fi + +ARG_MIRROR_DIR="$(realpath "$1")" + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +echo +echo "Cleaning build to download all packages..." +# fetch packages for representative boards +rm -rf build/x86 build/ppc64 +rm -rf packages/x86 packages/ppc64 +echo +echo "Downloading packages..." +make packages BOARD=qemu-coreboot-fbwhiptail-tpm1-hotp +make packages BOARD=talos-2 # newt, PPC +make packages BOARD=librem_l1um_v2 # TPM2 +make packages BOARD=librem_l1um # coreboot 4.11 +make packages BOARD=x230-maximized # io386 +echo +echo "Copying to mirror directory..." +mkdir -p "$ARG_MIRROR_DIR" +cp packages/x86/* packages/ppc64/* "$ARG_MIRROR_DIR/" diff --git a/config/coreboot-kgpe-d16_server-whiptail.config b/config/coreboot-kgpe-d16_server-whiptail.config index 4c74a4c9..4389cb60 100644 --- a/config/coreboot-kgpe-d16_server-whiptail.config +++ b/config/coreboot-kgpe-d16_server-whiptail.config @@ -3,6 +3,9 @@ # coreboot configuration # +# Viking HCL +# https://wiki.vikings.net/hardware:kgpe-d16 + # # General setup # diff --git a/config/coreboot-kgpe-d16_server.config b/config/coreboot-kgpe-d16_server.config index b030ab68..4095e131 100644 --- a/config/coreboot-kgpe-d16_server.config +++ b/config/coreboot-kgpe-d16_server.config @@ -3,6 +3,9 @@ # coreboot configuration # +# Viking HCL +# https://wiki.vikings.net/hardware:kgpe-d16 + # # General setup # diff --git a/config/coreboot-kgpe-d16_workstation-usb_keyboard.config b/config/coreboot-kgpe-d16_workstation-usb_keyboard.config index 4c74a4c9..4389cb60 100644 --- a/config/coreboot-kgpe-d16_workstation-usb_keyboard.config +++ b/config/coreboot-kgpe-d16_workstation-usb_keyboard.config @@ -3,6 +3,9 @@ # coreboot configuration # +# Viking HCL +# https://wiki.vikings.net/hardware:kgpe-d16 + # # General setup # diff --git a/config/coreboot-kgpe-d16_workstation.config b/config/coreboot-kgpe-d16_workstation.config index 4c74a4c9..4389cb60 100644 --- a/config/coreboot-kgpe-d16_workstation.config +++ b/config/coreboot-kgpe-d16_workstation.config @@ -3,6 +3,9 @@ # coreboot configuration # +# Viking HCL +# https://wiki.vikings.net/hardware:kgpe-d16 + # # General setup # diff --git a/config/coreboot-librem_11.config b/config/coreboot-librem_11.config index 573baee6..b153955f 100644 --- a/config/coreboot-librem_11.config +++ b/config/coreboot-librem_11.config @@ -140,7 +140,7 @@ CONFIG_DCACHE_BSP_STACK_SIZE=0x30400 CONFIG_MAX_ACPI_TABLE_SIZE_KB=144 CONFIG_HAVE_INTEL_FIRMWARE=y CONFIG_MRC_SETTINGS_CACHE_SIZE=0x10000 -# CONFIG_DRIVERS_INTEL_WIFI is not set +CONFIG_DRIVERS_INTEL_WIFI=y CONFIG_IFD_BIN_PATH="3rdparty/purism-blobs/mainboard/purism/librem_jsl/librem_11/flashdescriptor.bin" CONFIG_ME_BIN_PATH="3rdparty/purism-blobs/mainboard/purism/librem_jsl/librem_11/me.bin" CONFIG_CONSOLE_CBMEM_BUFFER_SIZE=0x20000 @@ -563,6 +563,7 @@ CONFIG_USE_PC_CMOS_ALTCENTURY=y CONFIG_PC_CMOS_BASE_PORT_BANK0=0x70 # CONFIG_DRIVERS_SIL_3114 is not set CONFIG_DRIVERS_USB_ACPI=y +CONFIG_DRIVERS_WIFI_GENERIC=y # CONFIG_DRIVERS_MTK_WIFI is not set CONFIG_MP_SERVICES_PPI=y CONFIG_MP_SERVICES_PPI_V1=y diff --git a/initrd/bin/gui-init b/initrd/bin/gui-init index 27f927cf..4bb8f4d9 100755 --- a/initrd/bin/gui-init +++ b/initrd/bin/gui-init @@ -363,7 +363,7 @@ check_gpg_key() option=$(cat /tmp/whiptail) case "$option" in g ) - gpg-gui.sh && BG_COLOR_MAIN_MENU="normnal" + gpg-gui.sh && BG_COLOR_MAIN_MENU="normal" ;; i ) skip_to_menu="true" diff --git a/initrd/bin/key-init b/initrd/bin/key-init index 68415f23..dcfaf529 100755 --- a/initrd/bin/key-init +++ b/initrd/bin/key-init @@ -1,19 +1,35 @@ #!/bin/bash set -e -o pipefail . /etc/functions +. /etc/gui_functions TRACE_FUNC # Post processing of keys -# Import user's keys -gpg --import /.gnupg/keys/*.key /.gnupg/keys/*.asc 2>/dev/null || true +# Good system clock is required for GPG to work properly. +# if system year is less then 2024, prompt user to set correct time +if [ "$(date +%Y)" -lt 2024 ]; then + if whiptail_warning --title "System Time Incorrect" \ + --yesno "The system time is incorrect. Please set the correct time." \ + 0 80 --yes-button Continue --no-button Skip --clear; then + change-time.sh + fi +fi + +# Import user's keys if they exist +if [ -d /.gnupg/keys ]; then + # This is legacy location for user's keys. cbfs-init takes for granted that keyring and trustdb are in /.gnupg + # oem-factory-reset generates keyring and trustdb which cbfs-init dumps to /.gnupg + # TODO: Remove individual key imports. This is still valid for distro keys only below. + gpg --import /.gnupg/keys/*.key /.gnupg/keys/*.asc 2>/dev/null || warn "Importing user's keys failed" +fi # Import trusted distro keys allowed for ISO signing -gpg --homedir=/etc/distro/ --import /etc/distro/keys/* 2>/dev/null || true +gpg --homedir=/etc/distro/ --import /etc/distro/keys/* 2>/dev/null || warn "Importing distro keys failed" #Set distro keys trust level to ultimate (trust anything that was signed with these keys) -gpg --homedir=/etc/distro/ --list-keys --fingerprint --with-colons|sed -E -n -e 's/^fpr:::::::::([0-9A-F]+):$/\1:6:/p' |gpg --homedir=/etc/distro/ --import-ownertrust 2>/dev/null || true -gpg --homedir=/etc/distro/ --update-trust 2>/dev/null || true +gpg --homedir=/etc/distro/ --list-keys --fingerprint --with-colons|sed -E -n -e 's/^fpr:::::::::([0-9A-F]+):$/\1:6:/p' |gpg --homedir=/etc/distro/ --import-ownertrust 2>/dev/null || warn "Setting distro keys ultimate trust failed" +gpg --homedir=/etc/distro/ --update-trust 2>/dev/null || warn "Updating distro keys trust failed" # Add user's keys to the list of trusted keys for ISO signing -gpg --export | gpg --homedir=/etc/distro/ --import 2>/dev/null || true +gpg --export | gpg --homedir=/etc/distro/ --import 2>/dev/null || warn "Adding user's keys to distro keys failed" diff --git a/initrd/bin/oem-factory-reset b/initrd/bin/oem-factory-reset index 6ed5a28f..35e41ac3 100755 --- a/initrd/bin/oem-factory-reset +++ b/initrd/bin/oem-factory-reset @@ -62,7 +62,7 @@ die() { exit 1 } -whiptail_error() { +local_whiptail_error() { local msg=$1 if [ "$msg" = "" ]; then die "whiptail error: An error msg is required" @@ -71,7 +71,7 @@ whiptail_error() { } whiptail_error_die() { - whiptail_error "$@" + local_whiptail_error "$@" die } @@ -1111,7 +1111,7 @@ if [ "$GPG_GEN_KEY_IN_MEMORY" = "n" -o "$GPG_GEN_KEY_IN_MEMORY_COPY_TO_SMARTCARD echo -e "\nChecking for USB Security Dongle...\n" enable_usb if ! gpg --card-status >/dev/null 2>&1; then - whiptail_error "Can't access USB Security Dongle; \nPlease remove and reinsert, then press Enter." + local_whiptail_error "Can't access USB Security Dongle; \nPlease remove and reinsert, then press Enter." if ! gpg --card-status >/dev/null 2>/tmp/error; then ERROR=$(tail -n 1 /tmp/error | fold -s) whiptail_error_die "Unable to detect USB Security Dongle:\n\n${ERROR}" diff --git a/initrd/etc/gui_functions b/initrd/etc/gui_functions index 5b46acb5..38958b1a 100755 --- a/initrd/etc/gui_functions +++ b/initrd/etc/gui_functions @@ -6,8 +6,8 @@ # continue with automatic boot, nonzero if user interrupted. pause_automatic_boot() { - if IFS= read -t "$CONFIG_AUTO_BOOT_TIMEOUT" -s -n 1 -p \ - "Automatic boot in $CONFIG_AUTO_BOOT_TIMEOUT seconds unless interrupted by keypress... "; then + if IFS= read -t "$CONFIG_AUTO_BOOT_TIMEOUT" -s -n 1 -r -p \ + $'Automatic boot in '"$CONFIG_AUTO_BOOT_TIMEOUT"$' seconds unless interrupted by keypress...\n'; then return 1 # Interrupt automatic boot fi return 0 # Continue with automatic boot diff --git a/initrd/init b/initrd/init index 8eccbff0..a33e601c 100755 --- a/initrd/init +++ b/initrd/init @@ -140,8 +140,14 @@ fi # # Values in user config have higher priority during combining thus effectively # changing the value for the rest of the scripts which source /tmp/config. -echo "export CONFIG_TPM=\"$CONFIG_TPM\"" >> /etc/config.user -echo "export CONFIG_TPM2_TOOLS=\"$CONFIG_TPM2_TOOLS\"" >> /etc/config.user + +#Only set CONFIG_TPM and CONFIG_TPM2_TOOLS if they are not already set in /etc/config.user +if ! grep -q 'CONFIG_TPM=' /etc/config.user; then + echo "export CONFIG_TPM=\"$CONFIG_TPM\"" >> /etc/config.user +fi +if ! grep -q 'CONFIG_TPM2_TOOLS=' /etc/config.user; then + echo "export CONFIG_TPM2_TOOLS=\"$CONFIG_TPM2_TOOLS\"" >> /etc/config.user +fi # CONFIG_BASIC was previously CONFIG_PUREBOOT_BASIC in the PureBoot distribution. # Substitute it in config.user if present for backward compatibility. diff --git a/patches/coreboot-4.11/0075-northbridge-amd-Fixed-errors-in-fam15h-DQS-timing.patch b/patches/coreboot-4.11/0075-northbridge-amd-Fixed-errors-in-fam15h-DQS-timing.patch new file mode 100644 index 00000000..6cc73009 --- /dev/null +++ b/patches/coreboot-4.11/0075-northbridge-amd-Fixed-errors-in-fam15h-DQS-timing.patch @@ -0,0 +1,62 @@ +From f6c818898b3f978bd22ed2829a881322e0eadaf9 Mon Sep 17 00:00:00 2001 +From: Mike Rothfuss <6182328+mrothfuss@users.noreply.github.com> +Date: Fri, 23 Aug 2024 19:54:54 -0600 +Subject: [PATCH 1/2] northbridge/amd: Fixed errors in fam15h DQS timing + +Fixed two errors in determining whether valid values were +found for read DQS delays in raminit. +--- + src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c | 17 ++++++----------- + 1 file changed, 6 insertions(+), 11 deletions(-) + +diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c b/src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c +index d34b2dc2ba..6cf67afa4f 100644 +--- a/src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c ++++ b/src/northbridge/amd/amdmct/mct_ddr3/mctdqs_d.c +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include "mct_d.h" + #include "mct_d_gcc.h" + +@@ -1287,6 +1288,7 @@ static uint8_t TrainDQSRdWrPos_D_Fam15(struct MCTStatStruc *pMCTstat, + uint8_t cur_count = 0; + uint8_t best_pos = 0; + uint8_t best_count = 0; ++ uint16_t region_center; + + uint32_t index_reg = 0x98; + uint32_t dev = pDCTstat->dev_dct; +@@ -1455,23 +1457,16 @@ static uint8_t TrainDQSRdWrPos_D_Fam15(struct MCTStatStruc *pMCTstat, + last_pos = 0; + } + +- if (best_count > 2) { +- uint16_t region_center = (best_pos + (best_count / 2)); +- +- if (region_center < 16) { +- printk(BIOS_WARNING, "TrainDQSRdWrPos: negative DQS recovery delay detected!" +- " Attempting to continue but your system may be unstable...\n"); +- region_center = 0; +- } else { +- region_center -= 16; +- } ++ region_center = (best_pos + (best_count / 2)); ++ if ((best_count > 2) && (region_center >= 16)) { ++ region_center -= 16; + + /* Restore current settings of other (previously trained) lanes to the active array */ + memcpy(current_read_dqs_delay, initial_read_dqs_delay, sizeof(current_read_dqs_delay)); + + /* Program the Read DQS Timing Control register with the center of the passing window */ + current_read_dqs_delay[lane] = region_center; +- passing_dqs_delay_found[lane] = 1; ++ passing_read_dqs_delay_found = 1; + + /* Commit the current Read DQS Timing Control settings to the hardware registers */ + write_dqs_read_data_timing_registers(current_read_dqs_delay, dev, dct, dimm, index_reg); +-- +2.39.2 + diff --git a/patches/coreboot-4.11/0076-northbridge-amd-Added-resets-for-ram-training-failur.patch b/patches/coreboot-4.11/0076-northbridge-amd-Added-resets-for-ram-training-failur.patch new file mode 100644 index 00000000..48734221 --- /dev/null +++ b/patches/coreboot-4.11/0076-northbridge-amd-Added-resets-for-ram-training-failur.patch @@ -0,0 +1,68 @@ +From ce1c7a35fa11b46d0478e97c4a4001179ab9d1bf Mon Sep 17 00:00:00 2001 +From: Mike Rothfuss <6182328+mrothfuss@users.noreply.github.com> +Date: Fri, 23 Aug 2024 19:59:09 -0600 +Subject: [PATCH 2/2] northbridge/amd: Added resets for ram training failures + +Instead of booting into an unstable state (and crashing), the board +resets to re-attempt raminit. +--- + src/northbridge/amd/amdmct/mct_ddr3/mcthwl.c | 7 +++++-- + src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c | 7 +++++-- + 2 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mcthwl.c b/src/northbridge/amd/amdmct/mct_ddr3/mcthwl.c +index 1ee10608b9..9a53bd352d 100644 +--- a/src/northbridge/amd/amdmct/mct_ddr3/mcthwl.c ++++ b/src/northbridge/amd/amdmct/mct_ddr3/mcthwl.c +@@ -18,6 +18,7 @@ + #include + #include + #include ++#include + #include "mct_d.h" + #include "mct_d_gcc.h" + +@@ -265,11 +266,13 @@ static void WriteLevelization_HW(struct MCTStatStruc *pMCTstat, + + pDCTstat->TargetFreq = final_target_freq; + +- if (global_phy_training_status) ++ if (global_phy_training_status) { + printk(BIOS_WARNING, + "%s: Uncorrectable invalid value(s) detected in second phase of write levelling; " +- "continuing but system may be unstable!\n", ++ "Restarting system\n", + __func__); ++ soft_reset(); ++ } + + uint8_t dct; + for (dct = 0; dct < 2; dct++) { +diff --git a/src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c b/src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c +index dbb989fe3d..c4cb53442d 100644 +--- a/src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c ++++ b/src/northbridge/amd/amdmct/mct_ddr3/mctsrc.c +@@ -26,6 +26,7 @@ + #include + #include + #include ++#include + #include "mct_d.h" + #include "mct_d_gcc.h" + +@@ -1698,8 +1699,10 @@ void dqsTrainMaxRdLatency_SW_Fam15(struct MCTStatStruc *pMCTstat, + Set_NB32_index_wait_DCT(dev, Channel, index_reg, 0x00000050, 0x13131313); + } + dword = Get_NB32_DCT(dev, Channel, 0x268) & 0x3ffff; +- if (dword) +- printk(BIOS_ERR, "WARNING: MaxRdLatency training FAILED! Attempting to continue but your system may be unstable...\n"); ++ if (dword) { ++ printk(BIOS_ERR, "WARNING: MaxRdLatency training FAILED! Restarting system\n"); ++ soft_reset(); ++ } + + /* 2.10.5.8.5.1.5 */ + nb_pstate = 0; +-- +2.39.2 +