* [PATCH v3 1/5] fdt: common API to populate kaslr seed
2023-09-12 21:34 [PATCH v3 0/5] Populate kaslr seed with RNG seanedmond
@ 2023-09-12 21:35 ` seanedmond
2023-09-21 1:02 ` Simon Glass
2023-09-12 21:35 ` [PATCH v3 2/5] fdt: kaslr seed from RNG device seanedmond
` (3 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: seanedmond @ 2023-09-12 21:35 UTC (permalink / raw)
To: u-boot; +Cc: sjg, dphadke, ilias.apalodimas
From: Dhananjay Phadke <dphadke@linux.microsoft.com>
fdt_fixup_kaslr_seed() will update given ofnode with random seed value.
Source for random seed can be TPM or RNG driver in u-boot or sec
firmware (ARM).
Signed-off-by: Dhananjay Phadke <dphadke@linux.microsoft.com>
Signed-off-by: Sean Edmond <senaedmond@microsoft.com>
---
arch/arm/cpu/armv8/sec_firmware.c | 39 +++++++++++--------------------
common/fdt_support.c | 19 +++++++++++++++
drivers/core/ofnode.c | 17 ++++++++++++++
include/dm/ofnode.h | 12 ++++++++++
include/fdt_support.h | 9 +++++++
5 files changed, 71 insertions(+), 25 deletions(-)
diff --git a/arch/arm/cpu/armv8/sec_firmware.c b/arch/arm/cpu/armv8/sec_firmware.c
index c0e8726346..5f04cd8aec 100644
--- a/arch/arm/cpu/armv8/sec_firmware.c
+++ b/arch/arm/cpu/armv8/sec_firmware.c
@@ -411,46 +411,35 @@ int sec_firmware_init(const void *sec_firmware_img,
/*
* fdt_fix_kaslr - Add kalsr-seed node in Device tree
* @fdt: Device tree
- * @eret: 0 in case of error, 1 for success
+ * @eret: 0 for success
*/
int fdt_fixup_kaslr(void *fdt)
{
- int nodeoffset;
- int err, ret = 0;
- u8 rand[8];
+ int ret = 0;
#if defined(CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT)
+ u8 rand[8];
+ ofnode root;
+
/* Check if random seed generation is supported */
if (sec_firmware_support_hwrng() == false) {
printf("WARNING: SEC firmware not running, no kaslr-seed\n");
- return 0;
+ return -EOPNOTSUPP;
}
- err = sec_firmware_get_random(rand, 8);
- if (err < 0) {
+ ret = sec_firmware_get_random(rand, 8);
+ if (ret < 0) {
printf("WARNING: No random number to set kaslr-seed\n");
- return 0;
+ return ret;
}
- err = fdt_check_header(fdt);
- if (err < 0) {
- printf("fdt_chosen: %s\n", fdt_strerror(err));
- return 0;
+ ret = root_ofnode_from_fdt(fdt, &root);
+ if (ret < 0) {
+ printf("WARNING: Unable to get root ofnode\n");
+ return ret;
}
- /* find or create "/chosen" node. */
- nodeoffset = fdt_find_or_add_subnode(fdt, 0, "chosen");
- if (nodeoffset < 0)
- return 0;
-
- err = fdt_setprop(fdt, nodeoffset, "kaslr-seed", rand,
- sizeof(rand));
- if (err < 0) {
- printf("WARNING: can't set kaslr-seed %s.\n",
- fdt_strerror(err));
- return 0;
- }
- ret = 1;
+ ret = fdt_fixup_kaslr_seed(root, rand, sizeof(rand));
#endif
return ret;
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 5e49078f8c..52be4375b4 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -631,6 +631,25 @@ void fdt_fixup_ethernet(void *fdt)
}
}
+int fdt_fixup_kaslr_seed(ofnode node, const u8 *seed, int len)
+{
+ ofnode chosen;
+ int ret;
+
+ /* find or create "/chosen" node. */
+ ret = ofnode_add_subnode(node, "chosen", &chosen);
+ if (ret && ret != -EEXIST)
+ return -ENOENT;
+
+ ret = ofnode_write_prop(chosen, "kaslr-seed", seed, len, true);
+ if (ret) {
+ printf("WARNING: can't set kaslr-seed\n");
+ return ret;
+ }
+
+ return 0;
+}
+
int fdt_record_loadable(void *blob, u32 index, const char *name,
uintptr_t load_addr, u32 size, uintptr_t entry_point,
const char *type, const char *os, const char *arch)
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 8df16e56af..4be21133b8 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -870,6 +870,23 @@ ofnode oftree_path(oftree tree, const char *path)
}
}
+int root_ofnode_from_fdt(void *fdt, ofnode *root_node)
+{
+ oftree tree;
+ /* If OFNODE_MULTI_TREE is not set, and if fdt is not the control FDT,
+ * oftree_from_fdt() will return NULL
+ */
+ tree = oftree_from_fdt(fdt);
+
+ if (!oftree_valid(tree)) {
+ printf("Cannot create oftree\n");
+ return -EINVAL;
+ }
+ *root_node = oftree_root(tree);
+
+ return 0;
+}
+
const void *ofnode_read_chosen_prop(const char *propname, int *sizep)
{
ofnode chosen_node;
diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h
index 0f38b3e736..e79bb62be8 100644
--- a/include/dm/ofnode.h
+++ b/include/dm/ofnode.h
@@ -901,6 +901,18 @@ ofnode oftree_path(oftree tree, const char *path);
*/
ofnode oftree_root(oftree tree);
+/**
+ * root_ofnode_from_fdt() - Gets the root ofnode given an FDT blob.
+ * Note, this will fail if OFNODE_MULTI_TREE
+ * is not set.
+ *
+ * @fdt: Device tree to use
+ * @root_node : Root ofnode
+ *
+ * Return: 0 if OK, -ve on error
+ */
+int root_ofnode_from_fdt(void *fdt, ofnode *root_node);
+
/**
* ofnode_read_chosen_prop() - get the value of a chosen property
*
diff --git a/include/fdt_support.h b/include/fdt_support.h
index 2cd8366898..d967118bed 100644
--- a/include/fdt_support.h
+++ b/include/fdt_support.h
@@ -11,6 +11,7 @@
!defined(USE_HOSTCC)
#include <asm/u-boot.h>
+#include <dm/ofnode.h>
#include <linux/libfdt.h>
#include <abuf.h>
@@ -121,6 +122,14 @@ static inline int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[],
#endif
void fdt_fixup_ethernet(void *fdt);
+
+/*
+ * fdt_fixup_kaslr_seed - Add kaslr-seed node in Device tree
+ * @node: ofnode
+ * @eret: 0 for success
+ */
+int fdt_fixup_kaslr_seed(ofnode node, const u8 *seed, int len);
+
int fdt_find_and_setprop(void *fdt, const char *node, const char *prop,
const void *val, int len, int create);
void fdt_fixup_qe_firmware(void *fdt);
--
2.40.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v3 1/5] fdt: common API to populate kaslr seed
2023-09-12 21:35 ` [PATCH v3 1/5] fdt: common API to populate kaslr seed seanedmond
@ 2023-09-21 1:02 ` Simon Glass
0 siblings, 0 replies; 12+ messages in thread
From: Simon Glass @ 2023-09-21 1:02 UTC (permalink / raw)
To: seanedmond; +Cc: u-boot, dphadke, ilias.apalodimas
On Tue, 12 Sept 2023 at 15:35, <seanedmond@linux.microsoft.com> wrote:
>
> From: Dhananjay Phadke <dphadke@linux.microsoft.com>
>
> fdt_fixup_kaslr_seed() will update given ofnode with random seed value.
> Source for random seed can be TPM or RNG driver in u-boot or sec
> firmware (ARM).
>
> Signed-off-by: Dhananjay Phadke <dphadke@linux.microsoft.com>
> Signed-off-by: Sean Edmond <senaedmond@microsoft.com>
> ---
> arch/arm/cpu/armv8/sec_firmware.c | 39 +++++++++++--------------------
> common/fdt_support.c | 19 +++++++++++++++
> drivers/core/ofnode.c | 17 ++++++++++++++
> include/dm/ofnode.h | 12 ++++++++++
> include/fdt_support.h | 9 +++++++
> 5 files changed, 71 insertions(+), 25 deletions(-)
>
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 2/5] fdt: kaslr seed from RNG device
2023-09-12 21:34 [PATCH v3 0/5] Populate kaslr seed with RNG seanedmond
2023-09-12 21:35 ` [PATCH v3 1/5] fdt: common API to populate kaslr seed seanedmond
@ 2023-09-12 21:35 ` seanedmond
2023-09-21 1:02 ` Simon Glass
2023-09-12 21:35 ` [PATCH v3 3/5] cmd: kaslrseed: Use common API to fixup FDT seanedmond
` (2 subsequent siblings)
4 siblings, 1 reply; 12+ messages in thread
From: seanedmond @ 2023-09-12 21:35 UTC (permalink / raw)
To: u-boot; +Cc: sjg, dphadke, ilias.apalodimas
From: Dhananjay Phadke <dphadke@linux.microsoft.com>
Add support for KASLR seed from the RNG device. Invokes dm_rng_read()
API to read 8-bytes of random bytes. Performs the FDT fixup using event
spy. To enable use CONFIG_KASLR_RNG_SEED
Signed-off-by: Dhananjay Phadke <dphadke@linux.microsoft.com>
Signed-off-by: Drew Kluemke <ankluemk@microsoft.com>
Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
---
common/fdt_support.c | 36 ++++++++++++++++++++++++++++++++++++
lib/Kconfig | 7 +++++++
2 files changed, 43 insertions(+)
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 52be4375b4..09ce582865 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -12,7 +12,10 @@
#include <log.h>
#include <mapmem.h>
#include <net.h>
+#include <rng.h>
#include <stdio_dev.h>
+#include <dm/device.h>
+#include <dm/uclass.h>
#include <dm/ofnode.h>
#include <linux/ctype.h>
#include <linux/types.h>
@@ -650,6 +653,39 @@ int fdt_fixup_kaslr_seed(ofnode node, const u8 *seed, int len)
return 0;
}
+int fdt_rng_kaslr_seed(void *ctx, struct event *event)
+{
+ u8 rand[8] = {0};
+ struct udevice *dev;
+ int ret;
+ oftree tree = event->data.ft_fixup.tree;
+ ofnode root_node = oftree_root(tree);
+
+ ret = uclass_first_device_err(UCLASS_RNG, &dev);
+ if (ret) {
+ printf("ERROR: Failed to find RNG device\n");
+ return ret;
+ }
+
+ ret = dm_rng_read(dev, rand, sizeof(rand));
+ if (ret) {
+ printf("ERROR: RNG read failed, ret=%d\n", ret);
+ return ret;
+ }
+
+ ret = fdt_fixup_kaslr_seed(root_node, rand, sizeof(rand));
+ if (ret) {
+ printf("ERROR: failed to add kaslr-seed to fdt\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+#if defined(CONFIG_KASLR_RNG_SEED)
+EVENT_SPY(EVT_FT_FIXUP, fdt_rng_kaslr_seed);
+#endif
+
int fdt_record_loadable(void *blob, u32 index, const char *name,
uintptr_t load_addr, u32 size, uintptr_t entry_point,
const char *type, const char *os, const char *arch)
diff --git a/lib/Kconfig b/lib/Kconfig
index 3926652db6..545a14343e 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -465,6 +465,13 @@ config VPL_TPM
for the low-level TPM interface, but only one TPM is supported at
a time by the TPM library.
+config KASLR_RNG_SEED
+ bool "Use RNG driver for KASLR random seed"
+ depends on DM_RNG
+ help
+ This enables support for using the RNG driver as entropy source for
+ KASLR seed populated in kernel's device tree.
+
endmenu
menu "Android Verified Boot"
--
2.40.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v3 2/5] fdt: kaslr seed from RNG device
2023-09-12 21:35 ` [PATCH v3 2/5] fdt: kaslr seed from RNG device seanedmond
@ 2023-09-21 1:02 ` Simon Glass
0 siblings, 0 replies; 12+ messages in thread
From: Simon Glass @ 2023-09-21 1:02 UTC (permalink / raw)
To: seanedmond; +Cc: u-boot, dphadke, ilias.apalodimas
On Tue, 12 Sept 2023 at 15:35, <seanedmond@linux.microsoft.com> wrote:
>
> From: Dhananjay Phadke <dphadke@linux.microsoft.com>
>
> Add support for KASLR seed from the RNG device. Invokes dm_rng_read()
> API to read 8-bytes of random bytes. Performs the FDT fixup using event
> spy. To enable use CONFIG_KASLR_RNG_SEED
>
> Signed-off-by: Dhananjay Phadke <dphadke@linux.microsoft.com>
> Signed-off-by: Drew Kluemke <ankluemk@microsoft.com>
> Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
> ---
> common/fdt_support.c | 36 ++++++++++++++++++++++++++++++++++++
> lib/Kconfig | 7 +++++++
> 2 files changed, 43 insertions(+)
Reviewed-by: Simon Glass <sjg@chromium.org>
Note that with VBE this is deterministic, in that the kernel declares
what it wants. See bootmeth_vbe_ft_fixup()
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 3/5] cmd: kaslrseed: Use common API to fixup FDT
2023-09-12 21:34 [PATCH v3 0/5] Populate kaslr seed with RNG seanedmond
2023-09-12 21:35 ` [PATCH v3 1/5] fdt: common API to populate kaslr seed seanedmond
2023-09-12 21:35 ` [PATCH v3 2/5] fdt: kaslr seed from RNG device seanedmond
@ 2023-09-12 21:35 ` seanedmond
2023-09-21 1:02 ` Simon Glass
2023-09-12 21:35 ` [PATCH v3 4/5] dm: core: Modify default for OFNODE_MULTI_TREE seanedmond
2023-09-12 21:35 ` [PATCH v3 5/5] fdt: Fix compile error for !OFNODE_MULTI_TREE seanedmond
4 siblings, 1 reply; 12+ messages in thread
From: seanedmond @ 2023-09-12 21:35 UTC (permalink / raw)
To: u-boot; +Cc: sjg, dphadke, ilias.apalodimas
From: Sean Edmond <seanedmond@microsoft.com>
Use the newly introduced common API fdt_fixup_kaslr_seed() in the
kaslrseed command.
Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
---
cmd/kaslrseed.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/cmd/kaslrseed.c b/cmd/kaslrseed.c
index 8a1d8120cd..c65607619b 100644
--- a/cmd/kaslrseed.c
+++ b/cmd/kaslrseed.c
@@ -19,7 +19,7 @@ static int do_kaslr_seed(struct cmd_tbl *cmdtp, int flag, int argc, char *const
size_t n = 0x8;
struct udevice *dev;
u64 *buf;
- int nodeoffset;
+ ofnode root;
int ret = CMD_RET_SUCCESS;
if (uclass_get_device(UCLASS_RNG, 0, &dev) || !dev) {
@@ -45,21 +45,15 @@ static int do_kaslr_seed(struct cmd_tbl *cmdtp, int flag, int argc, char *const
return CMD_RET_FAILURE;
}
- ret = fdt_check_header(working_fdt);
- if (ret < 0) {
- printf("fdt_chosen: %s\n", fdt_strerror(ret));
- return CMD_RET_FAILURE;
- }
-
- nodeoffset = fdt_find_or_add_subnode(working_fdt, 0, "chosen");
- if (nodeoffset < 0) {
- printf("Reading chosen node failed\n");
- return CMD_RET_FAILURE;
+ ret = root_ofnode_from_fdt(working_fdt, &root);
+ if (ret) {
+ printf("ERROR: Unable to get root ofnode\n");
+ goto CMD_RET_FAILURE;
}
- ret = fdt_setprop(working_fdt, nodeoffset, "kaslr-seed", buf, sizeof(buf));
- if (ret < 0) {
- printf("Unable to set kaslr-seed on chosen node: %s\n", fdt_strerror(ret));
+ ret = fdt_fixup_kaslr_seed(root, buf, sizeof(buf));
+ if (ret) {
+ printf("ERROR: failed to add kaslr-seed to fdt\n");
return CMD_RET_FAILURE;
}
--
2.40.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* [PATCH v3 4/5] dm: core: Modify default for OFNODE_MULTI_TREE
2023-09-12 21:34 [PATCH v3 0/5] Populate kaslr seed with RNG seanedmond
` (2 preceding siblings ...)
2023-09-12 21:35 ` [PATCH v3 3/5] cmd: kaslrseed: Use common API to fixup FDT seanedmond
@ 2023-09-12 21:35 ` seanedmond
2023-09-21 1:03 ` Simon Glass
2023-11-02 22:06 ` Tom Rini
2023-09-12 21:35 ` [PATCH v3 5/5] fdt: Fix compile error for !OFNODE_MULTI_TREE seanedmond
4 siblings, 2 replies; 12+ messages in thread
From: seanedmond @ 2023-09-12 21:35 UTC (permalink / raw)
To: u-boot; +Cc: sjg, dphadke, ilias.apalodimas
From: Sean Edmond <seanedmond@microsoft.com>
There is a preference to use the "ofnode" API for FDT fixups
moving forward. The FDT fixup will usually be for the kernel FDT. To
fixup the kernel FDT with the ofnode API, it's required to set the
OFNODE_MULTI_TREE option.
To ensure existing users of kaslr fdt fixup are not impacted, Let's modify
the default value for OFNODE_MULTI_TREE to ensure it's always set if
!OF_LIVE. This will cause a 1007 byte increase in the code size.
Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
---
drivers/core/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/core/Kconfig b/drivers/core/Kconfig
index f0d848f45d..38e44ef6fc 100644
--- a/drivers/core/Kconfig
+++ b/drivers/core/Kconfig
@@ -424,7 +424,7 @@ config DM_DEV_READ_INLINE
config OFNODE_MULTI_TREE
bool "Allow the ofnode interface to access any tree"
- default y if EVENT && !DM_DEV_READ_INLINE && !DM_INLINE_OFNODE
+ default y if !OF_LIVE
help
Normally U-Boot makes use of its control FDT, the one used to bind
devices and provide options. In some cases, U-Boot must also process
--
2.40.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v3 4/5] dm: core: Modify default for OFNODE_MULTI_TREE
2023-09-12 21:35 ` [PATCH v3 4/5] dm: core: Modify default for OFNODE_MULTI_TREE seanedmond
@ 2023-09-21 1:03 ` Simon Glass
2023-11-02 22:06 ` Tom Rini
1 sibling, 0 replies; 12+ messages in thread
From: Simon Glass @ 2023-09-21 1:03 UTC (permalink / raw)
To: seanedmond; +Cc: u-boot, dphadke, ilias.apalodimas
On Tue, 12 Sept 2023 at 15:35, <seanedmond@linux.microsoft.com> wrote:
>
> From: Sean Edmond <seanedmond@microsoft.com>
>
> There is a preference to use the "ofnode" API for FDT fixups
> moving forward. The FDT fixup will usually be for the kernel FDT. To
> fixup the kernel FDT with the ofnode API, it's required to set the
> OFNODE_MULTI_TREE option.
>
> To ensure existing users of kaslr fdt fixup are not impacted, Let's modify
> the default value for OFNODE_MULTI_TREE to ensure it's always set if
> !OF_LIVE. This will cause a 1007 byte increase in the code size.
>
> Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
> ---
> drivers/core/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 4/5] dm: core: Modify default for OFNODE_MULTI_TREE
2023-09-12 21:35 ` [PATCH v3 4/5] dm: core: Modify default for OFNODE_MULTI_TREE seanedmond
2023-09-21 1:03 ` Simon Glass
@ 2023-11-02 22:06 ` Tom Rini
1 sibling, 0 replies; 12+ messages in thread
From: Tom Rini @ 2023-11-02 22:06 UTC (permalink / raw)
To: seanedmond; +Cc: u-boot, sjg, dphadke, ilias.apalodimas
[-- Attachment #1: Type: text/plain, Size: 1293 bytes --]
On Tue, Sep 12, 2023 at 02:35:03PM -0700, seanedmond@linux.microsoft.com wrote:
> From: Sean Edmond <seanedmond@microsoft.com>
>
> There is a preference to use the "ofnode" API for FDT fixups
> moving forward. The FDT fixup will usually be for the kernel FDT. To
> fixup the kernel FDT with the ofnode API, it's required to set the
> OFNODE_MULTI_TREE option.
>
> To ensure existing users of kaslr fdt fixup are not impacted, Let's modify
> the default value for OFNODE_MULTI_TREE to ensure it's always set if
> !OF_LIVE. This will cause a 1007 byte increase in the code size.
>
> Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>
> ---
> drivers/core/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
This leads to failure to build such as:
Building current source for 1 boards (1 thread, 12 jobs per thread)
arm: + integratorap_cm946es
+(integratorap_cm946es) arm-linux-gnueabi-ld.bfd: common/board_r.o: in function `initr_dm':
+(integratorap_cm946es) common/board_r.c:231:(.text.initr_dm+0x4): undefined reference to `oftree_reset'
+(integratorap_cm946es) make[1]: *** [Makefile:1765: u-boot] Error 1
+(integratorap_cm946es) make: *** [Makefile:177: sub-make] Error 2
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 5/5] fdt: Fix compile error for !OFNODE_MULTI_TREE
2023-09-12 21:34 [PATCH v3 0/5] Populate kaslr seed with RNG seanedmond
` (3 preceding siblings ...)
2023-09-12 21:35 ` [PATCH v3 4/5] dm: core: Modify default for OFNODE_MULTI_TREE seanedmond
@ 2023-09-12 21:35 ` seanedmond
2023-09-21 1:03 ` Simon Glass
4 siblings, 1 reply; 12+ messages in thread
From: seanedmond @ 2023-09-12 21:35 UTC (permalink / raw)
To: u-boot; +Cc: sjg, dphadke, ilias.apalodimas
From: Sean Edmond <seanedmond@microsoft.com>
Required to fix the following compile error when building sandbox:
/tmp/cci9ibby.ltrans21.ltrans.o: In function `do_cedit_load':
<artificial>:(.text+0x601d): undefined reference to `oftree_dispose'
Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
---
drivers/core/ofnode.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index 4be21133b8..f7b3f41077 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -92,12 +92,6 @@ static oftree oftree_ensure(void *fdt)
return tree;
}
-void oftree_dispose(oftree tree)
-{
- if (of_live_active())
- of_live_free(tree.np);
-}
-
void *ofnode_lookup_fdt(ofnode node)
{
if (gd->flags & GD_FLG_RELOC) {
@@ -195,6 +189,12 @@ static inline int oftree_find(const void *fdt)
#endif /* OFNODE_MULTI_TREE */
+void oftree_dispose(oftree tree)
+{
+ if (of_live_active())
+ of_live_free(tree.np);
+}
+
/**
* ofnode_from_tree_offset() - get an ofnode from a tree offset (flat tree)
*
--
2.40.0
^ permalink raw reply related [flat|nested] 12+ messages in thread* Re: [PATCH v3 5/5] fdt: Fix compile error for !OFNODE_MULTI_TREE
2023-09-12 21:35 ` [PATCH v3 5/5] fdt: Fix compile error for !OFNODE_MULTI_TREE seanedmond
@ 2023-09-21 1:03 ` Simon Glass
0 siblings, 0 replies; 12+ messages in thread
From: Simon Glass @ 2023-09-21 1:03 UTC (permalink / raw)
To: seanedmond; +Cc: u-boot, dphadke, ilias.apalodimas
On Tue, 12 Sept 2023 at 15:35, <seanedmond@linux.microsoft.com> wrote:
>
> From: Sean Edmond <seanedmond@microsoft.com>
>
> Required to fix the following compile error when building sandbox:
> /tmp/cci9ibby.ltrans21.ltrans.o: In function `do_cedit_load':
> <artificial>:(.text+0x601d): undefined reference to `oftree_dispose'
>
> Signed-off-by: Sean Edmond <seanedmond@microsoft.com>
> ---
> drivers/core/ofnode.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 12+ messages in thread