From 01ddfab322ae50bedaa250630661ebed0c1a9101 Mon Sep 17 00:00:00 2001 From: Brad Bishop Date: Fri, 23 Mar 2018 23:32:26 -0400 Subject: Use BB collections for Aspeed tree patches Move the Aspeed u-boot tree patches to a directory where they can be conditionally applied when the Aspeed layer is in the build configuration. This is a better way to achieve 273ec60e436 since it enables the Aspeed BSP layer to name its u-boot/kernel recipes whatever it wants. Remove stubbed do_configure from u-boot_%.bbappend. It is no longer required since the bbappend is only activated when the aspeed layer and associated u-boot recipes are in the layer configuration. Tested: Built u-boot recipe for witherspoon and palmetto targets Change-Id: I52dceb65598e0cf660ad035a8f14e9894325ca71 Signed-off-by: Brad Bishop --- .../0001-configs-ast-Add-redundnant-env.patch | 33 +++++++++++ .../0002-config-ast-common-hack-bootopts.patch | 28 +++++++++ ...common-Add-bootopts-to-support-ubi-and-mt.patch | 69 ++++++++++++++++++++++ ...common-Add-conditional-factory-reset-comm.patch | 46 +++++++++++++++ ...common-Fall-back-to-secondary-flash-on-fa.patch | 34 +++++++++++ .../recipes-bsp/u-boot/u-boot-aspeed.inc | 23 ++++++++ .../recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend | 3 + .../recipes-bsp/u-boot/u-boot_%.bbappend | 3 + 8 files changed, 239 insertions(+) create mode 100644 meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0001-configs-ast-Add-redundnant-env.patch create mode 100644 meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0002-config-ast-common-hack-bootopts.patch create mode 100644 meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0003-config-ast-common-Add-bootopts-to-support-ubi-and-mt.patch create mode 100644 meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0004-config-ast-common-Add-conditional-factory-reset-comm.patch create mode 100644 meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0005-config-ast-common-Fall-back-to-secondary-flash-on-fa.patch create mode 100644 meta-phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed.inc create mode 100644 meta-phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend create mode 100644 meta-phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot_%.bbappend (limited to 'meta-phosphor/aspeed-layer') diff --git a/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0001-configs-ast-Add-redundnant-env.patch b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0001-configs-ast-Add-redundnant-env.patch new file mode 100644 index 000000000..ee115e8e2 --- /dev/null +++ b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0001-configs-ast-Add-redundnant-env.patch @@ -0,0 +1,33 @@ +From 8ef2f4dcd208e072ab491874c06722c3a8ec69e3 Mon Sep 17 00:00:00 2001 +From: "Edward A. James" +Date: Thu, 13 Jul 2017 13:42:18 -0500 +Subject: [PATCH 1/4] configs/ast: Add redundnant env + +Configure ast chips to run redundant u-boot environments. + +Signed-off-by: Edward A. James +--- + include/configs/ast-common.h | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h +index eff6d2b529..a0243083bd 100644 +--- a/include/configs/ast-common.h ++++ b/include/configs/ast-common.h +@@ -104,9 +104,12 @@ + #define CONFIG_SYS_MAX_FLASH_SECT (8192) /* max number of sectors on one chip */ + #define CONFIG_ENV_IS_IN_FLASH 1 + #define CONFIG_ENV_ADDR (AST_FMC_CS0_BASE + 0x60000) ++#define CONFIG_ENV_ADDR_REDUND (AST_FMC_CS0_BASE + 0x70000) + + #define CONFIG_ENV_OFFSET 0x60000 /* environment starts here */ +-#define CONFIG_ENV_SIZE 0x20000 /* Total Size of Environment Sector */ ++#define CONFIG_ENV_OFFSET_REDUND 0x70000 ++#define CONFIG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */ ++#define CONFIG_ENV_SIZE_REDUND 0x10000 + + #define CONFIG_BOOTCOMMAND "bootm 20080000" + #define CONFIG_ENV_OVERWRITE +-- +2.14.3 + diff --git a/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0002-config-ast-common-hack-bootopts.patch b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0002-config-ast-common-hack-bootopts.patch new file mode 100644 index 000000000..d04156712 --- /dev/null +++ b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0002-config-ast-common-hack-bootopts.patch @@ -0,0 +1,28 @@ +From c678bbdad037604850613e775baacc52ed92c9c1 Mon Sep 17 00:00:00 2001 +From: Patrick Williams +Date: Fri, 21 Jul 2017 16:30:01 -0500 +Subject: [PATCH 2/4] config/ast-common: hack bootopts + +Signed-off-by: Patrick Williams +--- + include/configs/ast-common.h | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h +index a0243083bd..7ddba62298 100644 +--- a/include/configs/ast-common.h ++++ b/include/configs/ast-common.h +@@ -96,7 +96,10 @@ + #define CONFIG_CMD_MTDPARTS + #endif + ++#if 0 + #define CONFIG_BOOTARGS "console=ttyS4,115200n8 root=/dev/ram rw" ++#endif ++#define CONFIG_BOOTARGS "console=ttyS4,115200n8 root=/dev/mtdblock4 ro" + + #define CONFIG_AST_SPI_NOR /* AST SPI NOR Flash */ + #define CONFIG_FMC_CS 1 +-- +2.14.3 + diff --git a/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0003-config-ast-common-Add-bootopts-to-support-ubi-and-mt.patch b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0003-config-ast-common-Add-bootopts-to-support-ubi-and-mt.patch new file mode 100644 index 000000000..2c8dee019 --- /dev/null +++ b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0003-config-ast-common-Add-bootopts-to-support-ubi-and-mt.patch @@ -0,0 +1,69 @@ +From 0c77be343fc4781719dcc0748bc29a26ea83e0a3 Mon Sep 17 00:00:00 2001 +From: Adriana Kobylak +Date: Wed, 9 Aug 2017 14:11:56 -0500 +Subject: [PATCH 3/4] config/ast-common: Add bootopts to support ubi and mtd + partitioning + +Signed-off-by: Adriana Kobylak +--- + include/configs/ast-common.h | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h +index 7ddba62298..14191e4ab0 100644 +--- a/include/configs/ast-common.h ++++ b/include/configs/ast-common.h +@@ -84,6 +84,12 @@ + #define CONFIG_SYS_MAXARGS 16 + #define CONFIG_SYS_BARGSIZE CONFIG_SYS_CBSIZE + ++/* ++ * Dynamic MTD Partition support ++ */ ++#define MTDIDS_DEFAULT "nor0=bmc" ++#define MTDPARTS_DEFAULT "mtdparts=bmc:384k(u-boot),128k(u-boot-env),-(obmc-ubi)" ++ + /* + * Optional MTD and UBI support + */ +@@ -99,7 +105,7 @@ + #if 0 + #define CONFIG_BOOTARGS "console=ttyS4,115200n8 root=/dev/ram rw" + #endif +-#define CONFIG_BOOTARGS "console=ttyS4,115200n8 root=/dev/mtdblock4 ro" ++#define CONFIG_BOOTARGS "console=ttyS4,115200n8 ubi.mtd=obmc-ubi,0,0,0 ubi.mtd=alt-obmc-ubi,0,0,4 ro rootfstype=squashfs" + + #define CONFIG_AST_SPI_NOR /* AST SPI NOR Flash */ + #define CONFIG_FMC_CS 1 +@@ -108,18 +114,27 @@ + #define CONFIG_ENV_IS_IN_FLASH 1 + #define CONFIG_ENV_ADDR (AST_FMC_CS0_BASE + 0x60000) + #define CONFIG_ENV_ADDR_REDUND (AST_FMC_CS0_BASE + 0x70000) ++#define CONFIG_LOADADDR 80800000 + + #define CONFIG_ENV_OFFSET 0x60000 /* environment starts here */ + #define CONFIG_ENV_OFFSET_REDUND 0x70000 + #define CONFIG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */ + #define CONFIG_ENV_SIZE_REDUND 0x10000 + +-#define CONFIG_BOOTCOMMAND "bootm 20080000" ++#define CONFIG_BOOTCOMMAND "run set_bootargs; run obmc_bootcmd" + #define CONFIG_ENV_OVERWRITE + + #define ASPEED_ENV_SETTINGS \ ++ "ubiblock=0,1 \0" \ ++ "root=/dev/ubiblock0_1 \0" \ ++ "kernelname=kernel-0 \0" \ ++ "loadaddr=" __stringify(CONFIG_LOADADDR) "\0" \ ++ "set_bootargs=setenv bootargs " CONFIG_BOOTARGS " ubi.block=\${ubiblock} root=\${root} \0" \ ++ "obmc_bootcmd=ubi part obmc-ubi; ubi read ${loadaddr} ${kernelname}; bootm ${loadaddr} \0" \ + "verify=yes\0" \ + "spi_dma=yes\0" \ ++ "mtdids=" MTDIDS_DEFAULT "\0" \ ++ "mtdparts=" MTDPARTS_DEFAULT "\0" \ + "" + + #endif /* __AST_COMMON_CONFIG_H */ +-- +2.14.3 + diff --git a/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0004-config-ast-common-Add-conditional-factory-reset-comm.patch b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0004-config-ast-common-Add-conditional-factory-reset-comm.patch new file mode 100644 index 000000000..6bf9bb798 --- /dev/null +++ b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0004-config-ast-common-Add-conditional-factory-reset-comm.patch @@ -0,0 +1,46 @@ +From 878651bbaa8a7da203fafccb164ca7b32287b8f9 Mon Sep 17 00:00:00 2001 +From: "Edward A. James" +Date: Thu, 9 Nov 2017 11:39:10 -0600 +Subject: [PATCH 4/4] config/ast-common: Add conditional factory reset command + +Factory reset (removing persistant rwfs) has to occur before we've +mounted the rwfs. However, the variable to determine whether or not to +do the reset is stored in the u-boot env. This is tricky to access +before rwfs is mounted except in u-boot. So, check it before every boot. + +Signed-off-by: Edward A. James +--- + include/configs/ast-common.h | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h +index 14191e4ab0..aaa5155e00 100644 +--- a/include/configs/ast-common.h ++++ b/include/configs/ast-common.h +@@ -121,6 +121,8 @@ + #define CONFIG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */ + #define CONFIG_ENV_SIZE_REDUND 0x10000 + ++#define CONFIG_RWFS_SIZE 0x600000 ++ + #define CONFIG_BOOTCOMMAND "run set_bootargs; run obmc_bootcmd" + #define CONFIG_ENV_OVERWRITE + +@@ -130,11 +132,13 @@ + "kernelname=kernel-0 \0" \ + "loadaddr=" __stringify(CONFIG_LOADADDR) "\0" \ + "set_bootargs=setenv bootargs " CONFIG_BOOTARGS " ubi.block=\${ubiblock} root=\${root} \0" \ +- "obmc_bootcmd=ubi part obmc-ubi; ubi read ${loadaddr} ${kernelname}; bootm ${loadaddr} \0" \ ++ "obmc_bootcmd=ubi part obmc-ubi; run do_rwreset; ubi read ${loadaddr} ${kernelname}; bootm ${loadaddr} \0" \ + "verify=yes\0" \ + "spi_dma=yes\0" \ + "mtdids=" MTDIDS_DEFAULT "\0" \ + "mtdparts=" MTDPARTS_DEFAULT "\0" \ ++ "rwfs_size=" __stringify(CONFIG_RWFS_SIZE) "\0" \ ++ "do_rwreset=if test \"\${rwreset}\" = \"true\"; then ubi remove rwfs; ubi create rwfs \${rwfs_size}; fi \0" \ + "" + + #endif /* __AST_COMMON_CONFIG_H */ +-- +2.14.3 + diff --git a/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0005-config-ast-common-Fall-back-to-secondary-flash-on-fa.patch b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0005-config-ast-common-Fall-back-to-secondary-flash-on-fa.patch new file mode 100644 index 000000000..c54b73475 --- /dev/null +++ b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/files/0005-config-ast-common-Fall-back-to-secondary-flash-on-fa.patch @@ -0,0 +1,34 @@ +From 345b1ade63576f5a8a1c3a4a1b75aab41d84b714 Mon Sep 17 00:00:00 2001 +From: Andrew Jeffery +Date: Fri, 20 Apr 2018 13:29:58 +0930 +Subject: [PATCH] config/ast-common: Fall-back to secondary flash on failed + bootm + +Signed-off-by: Andrew Jeffery +--- + include/configs/ast-common.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/include/configs/ast-common.h b/include/configs/ast-common.h +index ad08016ec110..10ef6a1955b7 100644 +--- a/include/configs/ast-common.h ++++ b/include/configs/ast-common.h +@@ -127,12 +127,14 @@ + #define CONFIG_ENV_OVERWRITE + + #define ASPEED_ENV_SETTINGS \ ++ "wdt2bite=mw.l 0x1e785024 0xa 1; mw.b 0x1e78502c 0xb3 1 \0" \ ++ "bootalt=run wdt2bite \0" \ + "ubiblock=0,1 \0" \ + "root=/dev/ubiblock0_1 \0" \ + "kernelname=kernel-0 \0" \ + "loadaddr=" __stringify(CONFIG_LOADADDR) "\0" \ + "set_bootargs=setenv bootargs " CONFIG_BOOTARGS " ubi.block=\${ubiblock} root=\${root} \0" \ +- "obmc_bootcmd=ubi part obmc-ubi; run do_rwreset; ubi read ${loadaddr} ${kernelname}; bootm ${loadaddr} \0" \ ++ "obmc_bootcmd=ubi part obmc-ubi; run do_rwreset; ubi read ${loadaddr} ${kernelname}; bootm ${loadaddr} || run bootalt \0" \ + "verify=yes\0" \ + "spi_dma=yes\0" \ + "mtdids=" MTDIDS_DEFAULT "\0" \ +-- +2.14.1 + diff --git a/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed.inc b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed.inc new file mode 100644 index 000000000..5286c1b0a --- /dev/null +++ b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot-aspeed.inc @@ -0,0 +1,23 @@ +inherit image_version + +SRC_URI_append_aspeed = " file://0001-configs-ast-Add-redundnant-env.patch" + +SRC_URI_append_aspeed_df-obmc-ubi-fs = " \ + file://0002-config-ast-common-hack-bootopts.patch \ + file://0003-config-ast-common-Add-bootopts-to-support-ubi-and-mt.patch \ + file://0004-config-ast-common-Add-conditional-factory-reset-comm.patch \ + file://0005-config-ast-common-Fall-back-to-secondary-flash-on-fa.patch \ + " + +do_patch[depends] += "os-release:do_populate_sysroot" + +python do_patch_append_aspeed_df-obmc-ubi-fs () { + version_id=do_get_versionID(d) + d.setVar('VERSION_ID', version_id) + bb.build.exec_func("patch_kernelname", d) +} + +patch_kernelname () { + sed -ri "s/kernel-(0|[a-fA-F0-9]{8})/kernel-${VERSION_ID}/g" \ + ${S}/include/configs/ast-common.h &> /dev/null +} diff --git a/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend new file mode 100644 index 000000000..6c6849436 --- /dev/null +++ b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot-fw-utils_%.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +require u-boot-aspeed.inc diff --git a/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot_%.bbappend b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot_%.bbappend new file mode 100644 index 000000000..6c6849436 --- /dev/null +++ b/meta-phosphor/aspeed-layer/recipes-bsp/u-boot/u-boot_%.bbappend @@ -0,0 +1,3 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +require u-boot-aspeed.inc -- cgit v1.2.3