From 5cacba94808aec585d2a8ab9e2e48c4467b455a6 Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Fri, 17 Jan 2020 18:27:57 -0500 Subject: [PATCH] u-boot: Add pkgs.uBootPinebookProExternalFirst --- overlay.nix | 3 ++ ...c1-before-mmc0-in-default-boot-order.patch | 29 ++++++++++++ ...sb0-after-mmc1-in-default-boot-order.patch | 44 +++++++++++++++++++ u-boot/default.nix | 8 ++++ 4 files changed, 84 insertions(+) create mode 100644 u-boot/0002-rockchip-move-mmc1-before-mmc0-in-default-boot-order.patch create mode 100644 u-boot/0006-rockchip-move-usb0-after-mmc1-in-default-boot-order.patch diff --git a/overlay.nix b/overlay.nix index b4c71a9..c63a6ea 100644 --- a/overlay.nix +++ b/overlay.nix @@ -7,6 +7,9 @@ in # Alternative BSP u-boot, with nvme support if desired # * https://gitlab.manjaro.org/manjaro-arm/packages/core/uboot-pinebookpro uBootPinebookPro = callPackage ./u-boot {}; + uBootPinebookProExternalFirst = callPackage ./u-boot { + externalFirst = true; + }; linux_pinebookpro = callPackage ./kernel { kernelPatches = [ kernelPatches.bridge_stp_helper diff --git a/u-boot/0002-rockchip-move-mmc1-before-mmc0-in-default-boot-order.patch b/u-boot/0002-rockchip-move-mmc1-before-mmc0-in-default-boot-order.patch new file mode 100644 index 0000000..d9cefd6 --- /dev/null +++ b/u-boot/0002-rockchip-move-mmc1-before-mmc0-in-default-boot-order.patch @@ -0,0 +1,29 @@ +From 30c7d9054de2b43dfac742b968586707964f4b96 Mon Sep 17 00:00:00 2001 +From: dhivael +Date: Sat, 11 Jan 2020 15:04:04 +0100 +Subject: [PATCH 2/6] rockchip: move mmc1 before mmc0 in default boot order + +on pinebooks mmc1 is the external card, which should take boot priority +over the internal emmc even if the emmc is bootable. +--- + include/configs/rockchip-common.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h +index 68e1105a4b1..906c22ed0fb 100644 +--- a/include/configs/rockchip-common.h ++++ b/include/configs/rockchip-common.h +@@ -14,8 +14,8 @@ + /* First try to boot from SD (index 0), then eMMC (index 1) */ + #if CONFIG_IS_ENABLED(CMD_MMC) + #define BOOT_TARGET_MMC(func) \ +- func(MMC, mmc, 0) \ +- func(MMC, mmc, 1) ++ func(MMC, mmc, 1) \ ++ func(MMC, mmc, 0) + #else + #define BOOT_TARGET_MMC(func) + #endif +-- +2.23.1 + diff --git a/u-boot/0006-rockchip-move-usb0-after-mmc1-in-default-boot-order.patch b/u-boot/0006-rockchip-move-usb0-after-mmc1-in-default-boot-order.patch new file mode 100644 index 0000000..ef62abe --- /dev/null +++ b/u-boot/0006-rockchip-move-usb0-after-mmc1-in-default-boot-order.patch @@ -0,0 +1,44 @@ +From 908d441fefc2203affe1bb0d79f75f611888fc1f Mon Sep 17 00:00:00 2001 +From: dhivael +Date: Sat, 11 Jan 2020 15:04:04 +0100 +Subject: [PATCH 6/6] rockchip: move usb0 after mmc1 in default boot order + +now that we support booting from USB we should prefer USB boot over eMMC +boot. we still try to boot from SD cards first. +--- + include/configs/rockchip-common.h | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/include/configs/rockchip-common.h b/include/configs/rockchip-common.h +index 906c22ed0fb..90e06e120f8 100644 +--- a/include/configs/rockchip-common.h ++++ b/include/configs/rockchip-common.h +@@ -13,11 +13,10 @@ + + /* First try to boot from SD (index 0), then eMMC (index 1) */ + #if CONFIG_IS_ENABLED(CMD_MMC) +- #define BOOT_TARGET_MMC(func) \ +- func(MMC, mmc, 1) \ +- func(MMC, mmc, 0) ++ #define BOOT_TARGET_MMC(func, idx) \ ++ func(MMC, mmc, idx) + #else +- #define BOOT_TARGET_MMC(func) ++ #define BOOT_TARGET_MMC(func, idx) + #endif + + #if CONFIG_IS_ENABLED(CMD_USB) +@@ -39,8 +38,9 @@ + #endif + + #define BOOT_TARGET_DEVICES(func) \ +- BOOT_TARGET_MMC(func) \ ++ BOOT_TARGET_MMC(func, 1) \ + BOOT_TARGET_USB(func) \ ++ BOOT_TARGET_MMC(func, 0) \ + BOOT_TARGET_PXE(func) \ + BOOT_TARGET_DHCP(func) + +-- +2.23.1 + diff --git a/u-boot/default.nix b/u-boot/default.nix index 0756dea..29fa20e 100644 --- a/u-boot/default.nix +++ b/u-boot/default.nix @@ -1,9 +1,11 @@ { buildUBoot +, lib , python , armTrustedFirmwareRK3399 , fetchpatch , fetchFromGitLab , fetchFromGitHub +, externalFirst ? false }: let @@ -48,6 +50,12 @@ in # My own patch ./0001-HACK-Add-changing-LEDs-signal-at-boot-on-pinebook-pr.patch + + ] ++ lib.optionals (externalFirst) [ + # Patches from this fork: + # https://git.eno.space/pbp-uboot.git + ./0002-rockchip-move-mmc1-before-mmc0-in-default-boot-order.patch + ./0006-rockchip-move-usb0-after-mmc1-in-default-boot-order.patch ]; }) .overrideAttrs(oldAttrs: {