diff options
Diffstat (limited to 'projects/depthcharge')
11 files changed, 512 insertions, 0 deletions
diff --git a/projects/depthcharge/configs/install b/projects/depthcharge/configs/install new file mode 100644 index 00000000..2ac6126d --- /dev/null +++ b/projects/depthcharge/configs/install @@ -0,0 +1 @@ +depthcharge.elf:depthcharge.elf diff --git a/projects/depthcharge/configs/nyan/arch b/projects/depthcharge/configs/nyan/arch new file mode 100644 index 00000000..fb05f39d --- /dev/null +++ b/projects/depthcharge/configs/nyan/arch @@ -0,0 +1 @@ +arm diff --git a/projects/depthcharge/configs/revision b/projects/depthcharge/configs/revision new file mode 100644 index 00000000..4b3eeea8 --- /dev/null +++ b/projects/depthcharge/configs/revision @@ -0,0 +1 @@ +91fab799a3e9f9da4e7569ca341f819319d091b0 diff --git a/projects/depthcharge/configs/targets b/projects/depthcharge/configs/targets new file mode 100644 index 00000000..792768c4 --- /dev/null +++ b/projects/depthcharge/configs/targets @@ -0,0 +1,2 @@ +nyan +veyron diff --git a/projects/depthcharge/configs/veyron/arch b/projects/depthcharge/configs/veyron/arch new file mode 100644 index 00000000..fb05f39d --- /dev/null +++ b/projects/depthcharge/configs/veyron/arch @@ -0,0 +1 @@ +arm diff --git a/projects/depthcharge/depthcharge b/projects/depthcharge/depthcharge new file mode 100755 index 00000000..ad93bdef --- /dev/null +++ b/projects/depthcharge/depthcharge @@ -0,0 +1,108 @@ +#!/bin/bash + +# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +arguments() { + project_arguments_targets "$project" "$@" +} + +usage() { + project_usage_actions "$project" + project_usage_arguments "$project" "$@" +} + +download() { + local repository=$project + + project_download_git "$project" "$repository" "https://chromium.googlesource.com/chromiumos/platform/depthcharge https://review.coreboot.org/depthcharge.git https://github.com/coreboot/depthcharge.git" "$@" +} + +download_check() { + local repository=$project + + project_download_check_git "$project" "$repository" "$@" +} + +extract() { + project_extract "$project" "$@" +} + +extract_check() { + project_extract_check "$project" "$@" +} + +update() { + local repository=$project + + project_update_git "$project" "$repository" "$@" +} + +update_check() { + local repository=$project + + project_update_check_git "$project" "$repository" "$@" +} + +build() { + local repository=$project + + project_sources_directory_missing_empty_error "$project" "$repository" "$@" + + if git_project_check $repository + then + git_project_checkout "$project" "$repository" "$@" + fi + + local sources_path=$( project_sources_path "$project" "$repository" "$@" ) + local build_path=$( project_build_path "$project" "$@" ) + + local libpayload_build_path=$( project_build_path "libpayload" "$project" "$@" ) + local libpayload_build_install_path="$libpayload_build_path/install" + local vboot_sources_path=$( project_sources_path "vboot" "vboot" "devices" ) + + local arch=$( depthcharge_arch "$@" ) + local device=$( depthcharge_device "$@" ) + + project_action "build" "crossgcc" "$arch" + project_action "build" "libpayload" "$project" "$@" + + project_action "checkout" "vboot" "devices" + + mkdir -p "$build_path" + + make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" BOARD="$device" "defconfig" + make -C "$sources_path" obj="$build_path" DOTCONFIG="$build_path/.config" LIBPAYLOAD_DIR="$libpayload_build_install_path/libpayload" VB_SOURCE="$vboot_sources_path" -j$TASKS "depthcharge" +} + +build_check() { + project_build_check "$project" "$@" +} + +release() { + local repository=$project + + project_release_sources_git "$project" "$repository" "$@" +} + +release_check() { + local repository=$project + + project_release_check_sources_git "$project" "$repository" "$@" +} + +clean() { + project_clean "$project" "$@" +} diff --git a/projects/depthcharge/depthcharge-helper b/projects/depthcharge/depthcharge-helper new file mode 100755 index 00000000..b7e896b3 --- /dev/null +++ b/projects/depthcharge/depthcharge-helper @@ -0,0 +1,26 @@ +#!/bin/bash + +# Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +ARCH="arch" + +depthcharge_arch() { + project_file_contents "$project" "$CONFIGS" "$ARCH" "$@" +} + +depthcharge_device() { + arguments_concat "_" "$@" +} diff --git a/projects/depthcharge/patches/0001-fdt-nonvolatile-context-storage-report-to-mkbp-for-E.patch b/projects/depthcharge/patches/0001-fdt-nonvolatile-context-storage-report-to-mkbp-for-E.patch new file mode 100644 index 00000000..e2866f5a --- /dev/null +++ b/projects/depthcharge/patches/0001-fdt-nonvolatile-context-storage-report-to-mkbp-for-E.patch @@ -0,0 +1,31 @@ +From 3003a569ad63a35922984a8c7d1f079cc5cbd960 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 10 Aug 2015 20:30:14 +0200 +Subject: [PATCH 1/4] fdt: nonvolatile-context-storage report to mkbp for EC NV + storage + +This allows old versions of crossystem to detect that it should use mosys to +access NV storage in case it is stored on the EC. + +Change-Id: I78ed64c2002727432def0e132f572a1c5173fa5e +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + src/vboot/crossystem/fdt.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/vboot/crossystem/fdt.c b/src/vboot/crossystem/fdt.c +index c0b10c0..5cba178 100644 +--- a/src/vboot/crossystem/fdt.c ++++ b/src/vboot/crossystem/fdt.c +@@ -51,7 +51,7 @@ static int install_crossystem_data(DeviceTreeFixup *fixup, DeviceTree *tree) + dt_add_string_prop(node, "nonvolatile-context-storage","nvram"); + } else if (CONFIG_NV_STORAGE_CROS_EC) { + dt_add_string_prop(node, +- "nonvolatile-context-storage", "cros-ec"); ++ "nonvolatile-context-storage", "mkbp"); + } else if (CONFIG_NV_STORAGE_DISK) { + dt_add_string_prop(node, "nonvolatile-context-storage", "disk"); + dt_add_u32_prop(node, "nonvolatile-context-lba", +-- +2.10.2 + diff --git a/projects/depthcharge/patches/0002-Proper-firmware-index-report-for-read-only-boot-path.patch b/projects/depthcharge/patches/0002-Proper-firmware-index-report-for-read-only-boot-path.patch new file mode 100644 index 00000000..f1435255 --- /dev/null +++ b/projects/depthcharge/patches/0002-Proper-firmware-index-report-for-read-only-boot-path.patch @@ -0,0 +1,71 @@ +From fc2f65e964fb9636db35749579c47dde15599f57 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 10 Aug 2015 20:24:50 +0200 +Subject: [PATCH 2/4] Proper firmware index report for read-only boot path + +When booting from a read-only boot path, the active firmware to report is RO. +This is detected with the lack of a vboot handoff pointer. + +Change-Id: I3b1b5823b4dde7bc4185abe2e29f5d056ef9f09c +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + src/vboot/crossystem/fdt.c | 2 +- + src/vboot/firmware_id.c | 6 +++++- + src/vboot/firmware_id.h | 1 + + 3 files changed, 7 insertions(+), 2 deletions(-) + +diff --git a/src/vboot/crossystem/fdt.c b/src/vboot/crossystem/fdt.c +index 5cba178..45cad88 100644 +--- a/src/vboot/crossystem/fdt.c ++++ b/src/vboot/crossystem/fdt.c +@@ -68,7 +68,7 @@ static int install_crossystem_data(DeviceTreeFixup *fixup, DeviceTree *tree) + nvstorage_flash_get_blob_size()); + } + +- int fw_index = vdat->firmware_index; ++ int fw_index = get_active_fw_index(vdat); + const char *fwid; + int fwid_size; + +diff --git a/src/vboot/firmware_id.c b/src/vboot/firmware_id.c +index 82acf91..d625251 100644 +--- a/src/vboot/firmware_id.c ++++ b/src/vboot/firmware_id.c +@@ -31,6 +31,7 @@ static struct fwid { + } fw_fmap_ops[] = { + {VDAT_RW_A, "RW_FWID_A", NULL, 0, "RW A: ID NOT FOUND"}, + {VDAT_RW_B, "RW_FWID_B", NULL, 0, "RW B: ID NOT FOUND"}, ++ {VDAT_RO, "RO_FRID", NULL, 0, "RO: ID NOT FOUND"}, + {VDAT_RECOVERY, "RO_FRID", NULL, 0, "RO: ID NOT FOUND"}, + }; + +@@ -125,10 +126,13 @@ static VbSharedDataHeader *get_vdat(void) + return NULL; + } + +-static inline int get_active_fw_index(VbSharedDataHeader *vdat) ++int get_active_fw_index(VbSharedDataHeader *vdat) + { + int fw_index = VDAT_UNKNOWN; + ++ if (lib_sysinfo.vboot_handoff == NULL) ++ return VDAT_RO; ++ + if (vdat) + fw_index = vdat->firmware_index; + +diff --git a/src/vboot/firmware_id.h b/src/vboot/firmware_id.h +index 181b2a1..71be302 100644 +--- a/src/vboot/firmware_id.h ++++ b/src/vboot/firmware_id.h +@@ -44,6 +44,7 @@ int get_rwb_fw_size(void); + * Get firmware details for currently active fw type. It looks up vdat, + * identifies fw_index and returns appropriate id and size for that index. + */ ++int get_active_fw_index(VbSharedDataHeader *vdat); + const char *get_active_fw_id(void); + int get_active_fw_size(void); + +-- +2.10.2 + diff --git a/projects/depthcharge/patches/0003-vboot-Display-callbacks-for-all-screens.patch b/projects/depthcharge/patches/0003-vboot-Display-callbacks-for-all-screens.patch new file mode 100644 index 00000000..51594b34 --- /dev/null +++ b/projects/depthcharge/patches/0003-vboot-Display-callbacks-for-all-screens.patch @@ -0,0 +1,240 @@ +From 1e634ac65fbdd43f35046e08b302d162e5d964d4 Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Tue, 11 Aug 2015 11:22:54 +0200 +Subject: [PATCH 3/4] vboot: Display callbacks for all screens + +We don't want to use bitmaps stored in GBB since they recommend the use of non- +free software (Chrome OS), so this implements a text-based interface instead. + +Change-Id: I4927846b385b9fdbb8d90b8dc1cd159472363baa +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + src/vboot/callbacks/display.c | 182 ++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 166 insertions(+), 16 deletions(-) + +diff --git a/src/vboot/callbacks/display.c b/src/vboot/callbacks/display.c +index bae8043..b4e9958 100644 +--- a/src/vboot/callbacks/display.c ++++ b/src/vboot/callbacks/display.c +@@ -20,6 +20,7 @@ + #include <sysinfo.h> + #include <vboot_api.h> + #include <vboot_struct.h> ++#include <vboot_nvstorage.h> + + #include "base/cleanup_funcs.h" + #include "drivers/video/coreboot_fb.h" +@@ -81,13 +82,15 @@ void print_on_center(const char *msg) + print_string(msg); + } + +-VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale) ++VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale, ++ VbDisplayInfo *info) + { +- const char *msg = NULL; +- +- if (vboot_draw_screen(screen_type, locale) == CBGFX_SUCCESS) +- return VBERROR_SUCCESS; +- ++ unsigned int rows, cols; ++ const char *fw_id; ++ int fw_index; ++ void *blob = NULL; ++ int size = 0; ++ char *msg; + /* + * Show the debug messages for development. It is a backup method + * when GBB does not contain a full set of bitmaps. +@@ -98,31 +101,178 @@ VbError_t VbExDisplayScreen(uint32_t screen_type, uint32_t locale) + video_console_clear(); + break; + case VB_SCREEN_DEVELOPER_WARNING: +- msg = "developer mode warning"; ++ video_console_clear(); ++ video_console_set_cursor(0, 0); ++ ++ if (info == NULL) ++ return VBERROR_SUCCESS; ++ ++ print_string( ++ "Welcome to developer mode!\n\n" ++ "Useful key combinations:\n" ++ "- Ctrl + H: Hold developer mode\n" ++ "- Ctrl + D: Boot from default medium\n"); ++ ++ if (info->allow_usb) ++ print_string("- Ctrl + U: Boot from external medium\n"); ++ ++ if (info->allow_legacy) ++ print_string("- Ctrl + L: Boot from legacy payload\n"); ++ ++ print_string( ++ "- Ctrl + I: Show device information\n" ++ "- Space: Disable developer mode\n\n" ++ "This screen is shown for 3 seconds (if not held)." ++ "\n\n"); ++ ++ if (!info->signed_only) ++ print_string( ++ "Warning: this device will boot kernels" ++ " without verifying their signature!" ++ "\n"); ++ ++ if (info->allow_usb) ++ print_string( ++ "Warning: this device will boot from " ++ "external media!\n"); ++ ++ if (info->allow_legacy) ++ print_string( ++ "Warning: this device will boot legacy " ++ "payloads!\n"); ++ ++ if (!info->signed_only || info->allow_usb || ++ info->allow_legacy) ++ print_string("\n"); ++ ++ print_string("Default boot medium: "); ++ ++ if (info->use_legacy) ++ print_string("legacy payload"); ++ else if (info->use_usb) ++ print_string("external"); ++ else ++ print_string("internal"); ++ ++ print_string("\n"); ++ ++ find_common_params(&blob, &size); ++ ++ if (blob != NULL) { ++ VbSharedDataHeader *vdat = (VbSharedDataHeader *) blob; ++ fw_index = get_active_fw_index(vdat); ++ fw_id = get_fw_id(fw_index); ++ ++ if (fw_id == NULL) ++ fw_id = "NOT FOUND"; ++ ++ print_string("Active firmware id: "); ++ print_string(fw_id); ++ ++ switch (fw_index) { ++ case VDAT_RW_A: ++ print_string(" (RW A)\n"); ++ break; ++ case VDAT_RW_B: ++ print_string(" (RW A)\n"); ++ break; ++ case VDAT_RO: ++ print_string(" (RO)\n"); ++ break; ++ default: ++ print_string(" (UNKNOWN)\n"); ++ break; ++ } ++ } + break; + case VB_SCREEN_DEVELOPER_EGG: +- msg = "easter egg"; ++ video_console_clear(); ++ print_on_center("Free as in Freedom!"); + break; + case VB_SCREEN_RECOVERY_REMOVE: +- msg = "remove inserted devices"; ++ video_console_clear(); ++ print_on_center( ++ "Please remove any external media before accessing " ++ "recovery screen."); + break; + case VB_SCREEN_RECOVERY_INSERT: +- msg = "insert recovery image"; +- break; + case VB_SCREEN_RECOVERY_NO_GOOD: +- msg = "insert image invalid"; ++ video_console_clear(); ++ print_string( ++ "Welcome to recovery mode!\n\n" ++ "Useful key combinations:\n" ++ "- Ctrl + D: Enable developer mode (if possible)\n\n"); ++ ++ if (screen_type == VB_SCREEN_RECOVERY_NO_GOOD) ++ print_on_center( ++ "Invalid recovery media, please instert a " ++ "valid one."); ++ else ++ print_on_center( ++ "Please insert an external recovery media."); ++ break; ++ case VB_SCREEN_RECOVERY_TO_DEV: ++ video_console_clear(); ++ video_get_rows_cols(&rows, &cols); ++ ++ video_console_set_cursor(0, 0); ++ ++ print_string( ++ "Enabling developer mode will allow booting unsigned " ++ "kernels and booting from external media (when enabled " ++ "with crossystem).\n\n" ++ "Developer mode can be disabled via the developer mode " ++ "screen."); ++ ++ msg = "Developer mode will be enabled."; ++ video_console_set_cursor((cols - strlen(msg)) / 2, rows / 2); ++ print_string(msg); ++ ++ msg = "Press enter to confirm or escape to go back."; ++ video_console_set_cursor((cols - strlen(msg)) / 2, ++ rows / 2 + 2); ++ print_string(msg); ++ break; ++ case VB_SCREEN_DEVELOPER_TO_NORM: ++ video_console_clear(); ++ video_get_rows_cols(&rows, &cols); ++ ++ video_console_set_cursor(0, 0); ++ ++ print_string( ++ "Disabling developer mode will restrict boot to signed " ++ "kernels stored on internal memory only.\n\n" ++ "Developer mode can be enabled again via the recovery " ++ "mode screen."); ++ ++ msg = "Developer mode will be disabled."; ++ video_console_set_cursor((cols - strlen(msg)) / 2, rows / 2); ++ print_string(msg); ++ ++ msg = "Press enter to confirm or escape to go back."; ++ video_console_set_cursor((cols - strlen(msg)) / 2, ++ rows / 2 + 2); ++ print_string(msg); + break; + case VB_SCREEN_WAIT: +- msg = "wait for ec update"; ++ video_console_clear(); ++ print_on_center("Waiting for EC update..."); ++ break; ++ case VB_SCREEN_TO_NORM_CONFIRMED: ++ video_console_clear(); ++ print_on_center("Disabling developer mode."); ++ break; ++ case VB_SCREEN_OS_BROKEN: ++ video_console_clear(); ++ print_on_center( ++ "Something went wrong and the device cannot boot.\n" ++ "Press Escape + Refresh + Power to access recovery."); + break; + default: + printf("Not a valid screen type: %d.\n", screen_type); + return VBERROR_INVALID_SCREEN_INDEX; + } + +- if (msg) +- print_on_center(msg); +- + return VBERROR_SUCCESS; + } + +-- +2.10.2 + diff --git a/projects/depthcharge/patches/0004-mmc-Initialize-clock-variable-in-mmc_recalculate_clo.patch b/projects/depthcharge/patches/0004-mmc-Initialize-clock-variable-in-mmc_recalculate_clo.patch new file mode 100644 index 00000000..3b4c5411 --- /dev/null +++ b/projects/depthcharge/patches/0004-mmc-Initialize-clock-variable-in-mmc_recalculate_clo.patch @@ -0,0 +1,30 @@ +From 925042a09afb9529b112eff2e4d56bf979ff32ec Mon Sep 17 00:00:00 2001 +From: Paul Kocialkowski <contact@paulk.fr> +Date: Mon, 19 Dec 2016 14:54:40 +0100 +Subject: [PATCH 4/4] mmc: Initialize clock variable in mmc_recalculate_clock + +Initializing the variable before it is used (and set to a proper value) +avoids triggering a maybe uninitialized compiler warning. + +Change-Id: I0f78e534919e892e23fbe6d38bba6e68c408b0c4 +Signed-off-by: Paul Kocialkowski <contact@paulk.fr> +--- + src/drivers/storage/mmc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/drivers/storage/mmc.c b/src/drivers/storage/mmc.c +index b877548..54306a1 100644 +--- a/src/drivers/storage/mmc.c ++++ b/src/drivers/storage/mmc.c +@@ -509,7 +509,7 @@ static void mmc_set_clock(MmcCtrlr *ctrlr, uint32_t clock) + + static void mmc_recalculate_clock(MmcMedia *media) + { +- uint32_t clock; ++ uint32_t clock = 0; + + if (IS_SD(media)) { + if (media->caps & MMC_MODE_HS) +-- +2.10.2 + |