[PATCH 2/4] RISC-V: fix crash on start if CONFIG_IMAGE_COMPRESSION_NONE=y

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use the same approach as ARM barebox uses.

See also 6c03bdf8f99 ("kbuild: pbl: use same compression algo for both
barebox and DTB").

Signed-off-by: Antony Pavlov <antonynpavlov@xxxxxxxxx>
---
 arch/riscv/boot/start.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/riscv/boot/start.c b/arch/riscv/boot/start.c
index 2e18105bbfb..ab9bb6f320f 100644
--- a/arch/riscv/boot/start.c
+++ b/arch/riscv/boot/start.c
@@ -35,7 +35,7 @@ static unsigned long barebox_boarddata_size;
 void *barebox_riscv_boot_dtb(void)
 {
 	void *dtb;
-	int ret;
+	int ret = 0;
 	struct barebox_boarddata_compressed_dtb *compressed_dtb;
 	static void *boot_dtb;
 
@@ -58,8 +58,13 @@ void *barebox_riscv_boot_dtb(void)
 	if (!dtb)
 		return NULL;
 
-	ret = uncompress(compressed_dtb->data, compressed_dtb->datalen,
-			 NULL, NULL, dtb, NULL, NULL);
+	if (IS_ENABLED(CONFIG_IMAGE_COMPRESSION_NONE))
+		memcpy(dtb, compressed_dtb->data,
+		       compressed_dtb->datalen_uncompressed);
+	else
+		ret = uncompress(compressed_dtb->data, compressed_dtb->datalen,
+				 NULL, NULL, dtb, NULL, NULL);
+
 	if (ret) {
 		pr_err("uncompressing dtb failed\n");
 		free(dtb);
-- 
2.39.0





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux