diff --git a/u-boot/0005-support-SPI-flash-boot.patch b/u-boot/0005-support-SPI-flash-boot.patch new file mode 100644 index 0000000..a19d301 --- /dev/null +++ b/u-boot/0005-support-SPI-flash-boot.patch @@ -0,0 +1,53 @@ +From f091aa06bfd4f7f9066dabe7a7caf268cd9c6683 Mon Sep 17 00:00:00 2001 +From: dhivael +Date: Thu, 6 Feb 2020 22:34:34 +0100 +Subject: [PATCH] support SPI flash boot + +SPI uboot images can be built with + + tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl-dtb.bin:spl/u-boot-spl-dtb.bin spl.bin + cat <(dd if=spl.bin bs=512K conv=sync) u-boot.itb >spiflash.bin + +and written to spi flash with uboot sf commands, any hardware flasher +available, rkdeveloptool, or possibly other methods. + +Origin: https://git.eno.space/pbp-uboot.git/commit/?id=3d3dbebfe8726cf2ae51ed44dc49bbc497d62ac5 +--- + arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi | 2 +- + configs/pinebook-pro-rk3399_defconfig | 10 ++++++++++ + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi +index f3d85e1dba1..a40b71fa204 100644 +--- a/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi ++++ b/arch/arm/dts/rk3399-pinebook-pro-u-boot.dtsi +@@ -12,7 +12,7 @@ + }; + + chosen { +- u-boot,spl-boot-order = "same-as-spl", &sdhci, &sdmmc; ++ u-boot,spl-boot-order = "same-as-spl", &spiflash, &sdhci, &sdmmc; + }; + }; + +diff --git a/configs/pinebook-pro-rk3399_defconfig b/configs/pinebook-pro-rk3399_defconfig +index 733463556a2..dbbd43ed9f3 100644 +--- a/configs/pinebook-pro-rk3399_defconfig ++++ b/configs/pinebook-pro-rk3399_defconfig +@@ -85,3 +85,13 @@ CONFIG_VIDEO_ROCKCHIP=y + CONFIG_DISPLAY_ROCKCHIP_EDP=y + CONFIG_SPL_TINY_MEMSET=y + CONFIG_ERRNO_STR=y ++ ++# SPI boot Support ++CONFIG_MTD=y ++CONFIG_DM_MTD=y ++CONFIG_SPI_FLASH_SFDP_SUPPORT=y ++CONFIG_SPL_DM_SPI=y ++CONFIG_SPL_SPI_FLASH_TINY=n ++CONFIG_SPL_SPI_FLASH_SFDP_SUPPORT=y ++CONFIG_SPL_SPI_LOAD=y ++CONFIG_SYS_SPI_U_BOOT_OFFS=0x80000 +-- +2.25.4 + diff --git a/u-boot/default.nix b/u-boot/default.nix index 0bddc64..2f777e4 100644 --- a/u-boot/default.nix +++ b/u-boot/default.nix @@ -67,6 +67,7 @@ in ./0001-rk3399-light-pinebook-power-and-standby-leds-during-.patch ./0002-reduce-pinebook_pro-bootdelay-to-1.patch + ./0005-support-SPI-flash-boot.patch # samueldr's patchset # ------------------- @@ -88,6 +89,11 @@ in patchShebangs arch/arm/mach-rockchip/ ''; + postInstall = '' + tools/mkimage -n rk3399 -T rkspi -d tpl/u-boot-tpl-dtb.bin:spl/u-boot-spl-dtb.bin spl.bin + cat <(dd if=spl.bin bs=512K conv=sync) u-boot.itb > $out/u-boot.spiflash.bin + ''; + src = fetchFromGitLab { domain = "gitlab.denx.de"; owner = "u-boot";