1From 4a923e0e4ef6d2b41cb89d658e269adada847573 Mon Sep 17 00:00:00 2001
2From: Peter Korsgaard <peter@korsgaard.com>
3Date: Thu, 4 Nov 2021 22:32:04 +0100
4Subject: [PATCH] Makefile: HACK: Support building u-boot.toc1 for nezda board
5
6For easier integration into Buildroot.  The boot0 / toc1 logic is WIP until
7U-Boot gains SPL support for the D1, so add a hack to make it easier to
8integrate in Buildroot as-is.
9
10Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
11---
12 Makefile  | 9 +++++++++
13 nezha.cfg | 9 +++++++++
14 2 files changed, 18 insertions(+)
15 create mode 100644 nezha.cfg
16
17diff --git a/Makefile b/Makefile
18index f911f70344..259d93bf80 100644
19--- a/Makefile
20+++ b/Makefile
21@@ -1084,6 +1084,15 @@ endif
22 .binman_stamp: FORCE
23 	@touch $@
24
25+fw_dynamic.bin: $(OPENSBI)
26+	$(call if_changed,copy)
27+
28+MKIMAGEFLAGS_u-boot.toc1 = -T sunxi_toc1
29+u-boot.toc1: nezha.cfg fw_dynamic.bin inputs
30+	$(call if_changed,mkimage)
31+
32+all: u-boot.toc1
33+
34 ifeq ($(CONFIG_DEPRECATED),y)
35 	$(warning "You have deprecated configuration options enabled in your .config! Please check your configuration.")
36 endif
37diff --git a/nezha.cfg b/nezha.cfg
38new file mode 100644
39index 0000000000..2d23b9b388
40--- /dev/null
41+++ b/nezha.cfg
42@@ -0,0 +1,9 @@
43+[opensbi]
44+file = fw_dynamic.bin
45+addr = 0x40000000
46+[dtb]
47+file = arch/riscv/dts/sun20i-d1-nezha.dtb
48+addr = 0x44000000
49+[u-boot]
50+file = u-boot-nodtb.bin
51+addr = 0x4a000000
52--
532.20.1
54
55