From patchwork Tue Apr 21 19:26:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Schramm X-Patchwork-Id: 238229 List-Id: U-Boot discussion From: t.schramm at manjaro.org (Tobias Schramm) Date: Tue, 21 Apr 2020 21:26:34 +0200 Subject: [PATCH 1/2] distro_bootcmd: make BOOTENV_DEV_NAME and BOOTENV_DEV macro variadic In-Reply-To: <20200421192635.3289648-1-t.schramm@manjaro.org> References: <20200421192635.3289648-1-t.schramm@manjaro.org> Message-ID: <20200421192635.3289648-2-t.schramm@manjaro.org> Using a variadic macro allows boot device macros to take additional arguments Signed-off-by: Tobias Schramm Cc: Patrick Wildt Cc: AKASHI Takahiro --- include/config_distro_bootcmd.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index fc0935fa21..aacfb309da 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -398,13 +398,13 @@ BOOT_TARGET_DEVICES_references_PXE_without_CONFIG_CMD_DHCP_or_PXE #endif -#define BOOTENV_DEV_NAME(devtypeu, devtypel, instance) \ - BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance) +#define BOOTENV_DEV_NAME(devtypeu, devtypel, instance, ...) \ + BOOTENV_DEV_NAME_##devtypeu(devtypeu, devtypel, instance, ##__VA_ARGS__) #define BOOTENV_BOOT_TARGETS \ "boot_targets=" BOOT_TARGET_DEVICES(BOOTENV_DEV_NAME) "\0" -#define BOOTENV_DEV(devtypeu, devtypel, instance) \ - BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance) +#define BOOTENV_DEV(devtypeu, devtypel, instance, ...) \ + BOOTENV_DEV_##devtypeu(devtypeu, devtypel, instance, ##__VA_ARGS__) #define BOOTENV \ BOOTENV_SHARED_HOST \ BOOTENV_SHARED_MMC \ From patchwork Tue Apr 21 19:26:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Schramm X-Patchwork-Id: 238230 List-Id: U-Boot discussion From: t.schramm at manjaro.org (Tobias Schramm) Date: Tue, 21 Apr 2020 21:26:35 +0200 Subject: [PATCH 2/2] distro_bootcmd: add sf SPI flash boot support In-Reply-To: <20200421192635.3289648-1-t.schramm@manjaro.org> References: <20200421192635.3289648-1-t.schramm@manjaro.org> Message-ID: <20200421192635.3289648-3-t.schramm@manjaro.org> This commit adds generic boot support for SPI flash. Adding SPI flash support to a device can be achieved by adding following declaration to the BOOT_TARGET_DEVICES func(SF, sf, [:], ) Signed-off-by: Tobias Schramm Cc: Patrick Wildt Cc: AKASHI Takahiro --- include/config_distro_bootcmd.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index aacfb309da..02b70dd271 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -67,6 +67,27 @@ BOOT_TARGET_DEVICES_references_MMC_without_CONFIG_CMD_MMC #endif +#ifdef CONFIG_CMD_SF +#define BOOTENV_SHARED_SF \ + "sf_boot=if sf probe ${devnum}; then " \ + "sf read ${scriptaddr} ${distro_bootpart} && "\ + "source ${scriptaddr}; " \ + "fi\0" +#define BOOTENV_DEV_SF(devtypeu, devtypel, instance, bootpart) \ + "bootcmd_" #devtypel #instance "=" \ + "devnum=" #instance "; " \ + "distro_bootpart=" #bootpart "; " \ + "run " #devtypel "_boot\0" +#define BOOTENV_DEV_NAME_SF(devtypeu, devtypel, instance, bootpart) \ + #devtypel #instance " " +#else +#define BOOTENV_SHARED_MMC +#define BOOTENV_DEV_SF \ + BOOT_TARGET_DEVICES_references_SF_without_CONFIG_CMD_SF +#define BOOTENV_DEV_NAME_SF \ + BOOT_TARGET_DEVICES_references_SF_without_CONFIG_CMD_SF +#endif + #ifdef CONFIG_CMD_UBIFS #define BOOTENV_SHARED_UBIFS \ "ubifs_boot=" \ @@ -408,6 +429,7 @@ #define BOOTENV \ BOOTENV_SHARED_HOST \ BOOTENV_SHARED_MMC \ + BOOTENV_SHARED_SF \ BOOTENV_SHARED_PCI \ BOOTENV_SHARED_USB \ BOOTENV_SHARED_SATA \