-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path0003-integrate-with-balenaOS.patch
118 lines (115 loc) · 5.12 KB
/
0003-integrate-with-balenaOS.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
From 7b1b4c421896e6d2ead52d8ac38a185594e5be40 Mon Sep 17 00:00:00 2001
From: Alexandru Costache <[email protected]>
Date: Fri, 17 Nov 2023 10:24:27 +0100
Subject: [PATCH] integrate with balenaOS
Upstream-status: inaproppriate [configuration]
Signed-off-by: Alexandru Costache <[email protected]>
---
configs/iot-gate-imx8plus_defconfig | 8 +++++
include/configs/compulab-imx8m-plus.h | 44 +++++++++++++--------------
2 files changed, 30 insertions(+), 22 deletions(-)
diff --git a/configs/iot-gate-imx8plus_defconfig b/configs/iot-gate-imx8plus_defconfig
index ce4561486f4d..d848df2e85ab 100644
--- a/configs/iot-gate-imx8plus_defconfig
+++ b/configs/iot-gate-imx8plus_defconfig
@@ -156,3 +156,11 @@ CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
CONFIG_EFI_CAPSULE_ON_DISK=y
CONFIG_EFI_CAPSULE_FIRMWARE_FIT=y
CONFIG_EFI_CAPSULE_FIRMWARE_RAW=y
+CONFIG_CMD_UNZIP=y
+CONFIG_CMD_IMPORTENV=y
+CONFIG_CMD_EXPORTENV=y
+CONFIG_CMD_SETEXPR=y
+CONFIG_PARTITION_UUIDS=y
+CONFIG_CMD_PART=y
+CONFIG_CMD_FS_UUID=y
+CONFIG_CMD_USB_MASS_STORAGE
diff --git a/include/configs/compulab-imx8m-plus.h b/include/configs/compulab-imx8m-plus.h
index ba8e706f8d1c..61529bde1900 100644
--- a/include/configs/compulab-imx8m-plus.h
+++ b/include/configs/compulab-imx8m-plus.h
@@ -79,11 +79,13 @@
"scriptaddr=0x43500000\0" \
"kernel_addr_r=" __stringify(CONFIG_LOADADDR) "\0" \
"bsp_script=boot.scr\0" \
- "image=Image\0" \
+ "image=Image.gz\0" \
"splashimage=0x50000000\0" \
- "console=ttymxc1,115200 console=tty1\0" \
- "fdt_addr_r=0x43000000\0" \
- "fdt_addr=0x43000000\0" \
+ "console=ttymxc1,115200\0" \
+ "fdt_addr_r=0x45000000\0" \
+ "fdt_addr=0x45000000\0" \
+ "fdto_addr_r=0x45800000\0" \
+ "zip_addr=48440000\0" \
"boot_fdt=try\0" \
"fdt_high=0xffffffffffffffff\0" \
"boot_fit=no\0" \
@@ -93,7 +95,7 @@
"mmcpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
"mmcroot=" CONFIG_MMCROOT " rootwait rw\0" \
"mmcautodetect=yes\0" \
- "mmcargs=setenv bootargs ${jh_clk} console=${console} root=${mmcroot}\0 " \
+ "mmcargs=setenv bootargs ${jh_clk} ${resin_kernel_root} ${root_opt} ${os_cmdline} "__stringify(BALENA_STAGE2)" \0 " \
"loadbootscript=load mmc ${mmcdev}:${mmcpart} ${loadaddr} ${bsp_script};\0" \
"bootscript=echo Running bootscript from mmc ...; " \
"source\0" \
@@ -110,7 +112,7 @@
"echo WARN: Cannot load the DT; " \
"fi; " \
"fi;\0" \
- "netargs=setenv bootargs ${jh_clk} console=${console} " \
+ "netargs=setenv bootargs ${jh_clk} " \
"root=/dev/nfs " \
"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
"netboot=echo Booting from net ...; " \
@@ -136,26 +138,25 @@
"usb_dev=0\0" \
"boot_part=1\0" \
"root_opt=rootwait rw\0" \
- "emmc_ul=setenv iface mmc; setenv dev ${emmc_dev}; setenv part ${boot_part};" \
- "setenv bootargs console=${console} root=${emmc_root} ${root_opt};\0" \
+ "emmc_ul=setenv iface mmc; setenv dev ${emmc_dev}; setenv part ${resin_root_part};" \
+ "run mmcargs; \0" \
"sd_ul=setenv iface mmc; setenv dev ${sd_dev}; setenv part ${boot_part};" \
- "setenv bootargs console=${console} root=${sd_root} ${root_opt};\0" \
+ "setenv bootargs root=${sd_root} ${root_opt} "__stringify(BALENA_STAGE2)"; \0" \
"usb_ul=usb start; setenv iface usb; setenv dev ${usb_dev}; setenv part ${boot_part};" \
- "setenv bootargs console=${console} root=${usb_root} ${root_opt};\0" \
+ "setenv bootargs root=${usb_root} ${root_opt} "__stringify(BALENA_STAGE2)"; \0" \
"ulbootscript=load ${iface} ${dev}:${part} ${loadaddr} ${script};\0" \
- "ulimage=load ${iface} ${dev}:${part} ${loadaddr} ${image}\0" \
- "ulfdt=if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
- "load ${iface} ${dev}:${part} ${fdt_addr_r} ${fdtfile}; fi;\0" \
+ "ulimage=if load ${iface} ${dev}:${resin_boot_part} ${zip_addr} ${image}; then unzip ${zip_addr} ${loadaddr}; run balena_kernel_load_crc_save; else if load ${iface} ${dev}:${resin_root_part} ${zip_addr} boot/${image}; then unzip ${zip_addr} ${loadaddr}; run balena_kernel_load_crc_save; else false; fi; fi; \0" \
+ "ulfdt=if load ${iface} ${dev}:${resin_boot_part} ${fdt_addr_r} ${fdtfile}; then run balena_fdt_load_crc_save; else if load ${iface} ${dev}:${resin_root_part} boot/${fdt_addr_r} ${fdtfile}; then run balena_fdt_load_crc_save; else false; fi; fi; \0" \
"bootlist=sd_ul usb_ul emmc_ul\0" \
- "bsp_bootcmd=echo Running BSP bootcmd ...; " \
- "for src in ${bootlist}; do " \
- "run ${src}; " \
- "env exist boot_opt && env exists bootargs && setenv bootargs ${bootargs} ${boot_opt}; " \
- "if run ulbootscript; then " \
- "run bootscript; " \
- "else " \
+ "bsp_bootcmd=echo Running BSP bootcmd ...; " \
+ "for src in ${bootlist}; do " \
+ "mmc dev 2; " \
+ "setenv resin_kernel_load_addr ${loadaddr};" \
+ "run resin_set_kernel_root; run set_os_cmdline; run emmc_ul;" \
"if run ulimage; then " \
"if run ulfdt; then " \
+ "run balena_kernel_load_crc_check; " \
+ "run balena_fdt_load_crc_check; " \
"booti ${loadaddr} - ${fdt_addr_r}; " \
"else " \
"if test ${boot_fdt} != yes; then " \
@@ -163,8 +164,7 @@
"fi; " \
"fi; " \
"fi; " \
- "fi; " \
- "done; "
+ "done; "
#endif
/* Link Definitions */