Skip to content

Commit 8d081f8

Browse files
committed
Local patches to convert imx6/sabre to solox
1 parent 93d5697 commit 8d081f8

File tree

7 files changed

+214
-1
lines changed

7 files changed

+214
-1
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "libsel4-sys"]
2+
path = libsel4-sys
3+
url = https://github.com/jonlamb-gh/libsel4-sys.git

Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ version = "0.0.1"
44
authors = ["jonlamb-gh <[email protected]>"]
55

66
[dependencies]
7-
libsel4-sys = {git = "https://github.com/jonlamb-gh/libsel4-sys.git", branch = "devel"}
7+
# tracked as a submodule currently
8+
#libsel4-sys = {git = "https://github.com/jonlamb-gh/libsel4-sys.git", branch = "devel"}
9+
libsel4-sys = {path = "libsel4-sys"}
810

911
[dependencies.wee_alloc]
1012
version = "0.4"

libsel4-sys

Submodule libsel4-sys added at 6b0d281

patches/elfloader-tool.patch

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
diff --git a/elfloader-tool/CMakeLists.txt b/elfloader-tool/CMakeLists.txt
2+
index b8df6e1..e60e001 100644
3+
--- a/elfloader-tool/CMakeLists.txt
4+
+++ b/elfloader-tool/CMakeLists.txt
5+
@@ -135,7 +135,8 @@ if (ElfloaderImageEFI)
6+
set_property(TARGET elfloader APPEND_STRING PROPERTY LINK_FLAGS " -pie ")
7+
else()
8+
if(KernelPlatImx6 OR KernelPlatformRpi3)
9+
- set(PlatformEntryAddr 0x20000000)
10+
+ #set(PlatformEntryAddr 0x20000000)
11+
+ set(PlatformEntryAddr 0x83000000)
12+
elseif(KernelPlatformKZM OR KernelPlatformOMAP3 OR KernelPlatformAM335X OR KernelPlatformImx7Sabre)
13+
set(PlatformEntryAddr 0x82000000)
14+
elseif(KernelPlatExynos5 OR KernelPlatformExynos4)
15+
diff --git a/elfloader-tool/gen_boot_image.sh b/elfloader-tool/gen_boot_image.sh
16+
index a5dfaf6..c1fd2b7 100755
17+
--- a/elfloader-tool/gen_boot_image.sh
18+
+++ b/elfloader-tool/gen_boot_image.sh
19+
@@ -40,7 +40,7 @@ case "$PLAT" in
20+
FORMAT=elf32-littlearm
21+
;;
22+
"imx6")
23+
- ENTRY_ADDR=0x20000000;
24+
+ ENTRY_ADDR=0x80000000;
25+
FORMAT=elf32-littlearm
26+
;;
27+
"imx7")
28+
diff --git a/elfloader-tool/include/plat/imx6/platform.h b/elfloader-tool/include/plat/imx6/platform.h
29+
index 9c46af3..e972f07 100644
30+
--- a/elfloader-tool/include/plat/imx6/platform.h
31+
+++ b/elfloader-tool/include/plat/imx6/platform.h
32+
@@ -20,14 +20,17 @@
33+
* (from IMX6 SoC Manual).
34+
*/
35+
36+
+/* UART1_URXD */
37+
#define IMX6_UART1_PADDR 0x02020000
38+
+/* UART2_URXD */
39+
#define IMX6_UART2_PADDR 0x021e8000
40+
#define IMX6_UART3_PADDR 0x021ec000
41+
#define IMX6_UART4_PADDR 0x021f0000
42+
#define IMX6_UART5_PADDR 0x021F4000
43+
44+
#ifdef CONFIG_PLAT_SABRE
45+
-#define UART_PPTR IMX6_UART2_PADDR
46+
+//#define UART_PPTR IMX6_UART2_PADDR
47+
+#define UART_PPTR IMX6_UART1_PADDR
48+
#elif CONFIG_PLAT_WANDQ
49+
#define UART_PPTR IMX6_UART1_PADDR
50+
#else
51+
diff --git a/elfloader-tool/src/plat/imx6/monitor.S b/elfloader-tool/src/plat/imx6/monitor.S
52+
index b549b98..ee8db69 100644
53+
--- a/elfloader-tool/src/plat/imx6/monitor.S
54+
+++ b/elfloader-tool/src/plat/imx6/monitor.S
55+
@@ -12,7 +12,8 @@
56+
57+
#include <autoconf.h>
58+
59+
-#define VECTOR_BASE 0x10000000
60+
+/* #define VECTOR_BASE 0x10000000 */
61+
+#define VECTOR_BASE 0x80000000
62+
#define STACK_TOP (VECTOR_BASE + (1 << 12) - 0x10)
63+
64+
/* vector table for monitor mode
65+
diff --git a/elfloader-tool/src/plat/imx6/platform_init.c b/elfloader-tool/src/plat/imx6/platform_init.c
66+
index b24f5cf..2b48b92 100644
67+
--- a/elfloader-tool/src/plat/imx6/platform_init.c
68+
+++ b/elfloader-tool/src/plat/imx6/platform_init.c
69+
@@ -76,6 +76,7 @@ check_mode(void)
70+
71+
asm (".arch_extension sec\n");
72+
73+
+
74+
#ifndef CONFIG_ARM_S_SUPERVISOR_MODE
75+
__attribute__((unused)) static void
76+
switch_to_mon_mode(void)
77+
@@ -117,7 +118,8 @@ switch_to_mon_mode(void)
78+
* must not be used by the seL4 kernel. The VECTOR_BASE must be
79+
* the same as MON_VECTOR_START */
80+
81+
-#define MON_VECTOR_START (0x10000000)
82+
+/* #define MON_VECTOR_START (0x10000000) */
83+
+#define MON_VECTOR_START (0x80000000)
84+
extern void arm_monitor_vector(void);
85+
extern void arm_monitor_vector_end(void);
86+
extern void *memcpy(void *dest, void *src, size_t n);

patches/kernel.patch

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
diff --git a/include/plat/imx6/plat/machine/devices.h b/include/plat/imx6/plat/machine/devices.h
2+
index 892ee9c..414bfc7 100644
3+
--- a/include/plat/imx6/plat/machine/devices.h
4+
+++ b/include/plat/imx6/plat/machine/devices.h
5+
@@ -13,7 +13,8 @@
6+
7+
/* These devices are used by the seL4 kernel. */
8+
#ifdef CONFIG_PLAT_SABRE
9+
-#define UART_PADDR UART2_PADDR
10+
+//#define UART_PADDR UART2_PADDR
11+
+#define UART_PADDR UART1_PADDR
12+
#elif defined(CONFIG_PLAT_WANDQ)
13+
#define UART_PADDR UART1_PADDR
14+
#else
15+
@@ -39,6 +40,7 @@
16+
//#define RESERVED_PADDR 0x02C00000 /* 84 MB */
17+
#define IPU2_PADDR 0x02800000 /* 4 MB */
18+
#define IPU1_PADDR 0x02400000 /* 4 MB */
19+
+#define AIPS3_CONFIG_PADDR 0x0227C000 /* 4 pages */
20+
//#define RESERVED_PADDR 0x0220C000 /* 1 MB */
21+
#define MIPI_HSI_PADDR 0x02208000 /* 4 pages */
22+
#define OPENVG_PADDR 0x02204000 /* 4 pages */
23+
@@ -168,6 +170,7 @@
24+
#define OCRAM_ALIASED_PADDR 0x00940000 /* 192 pages */
25+
#define OCRAM_PADDR 0x00900000 /* 64 pages */
26+
#define GPV4_PL301_CONFIG_PADDR 0x00800000 /* 1 MB */
27+
+#define TCML_PADDR 0x007F8000 /* 8 pages */
28+
//#define RESERVED_PADDR 0x00400000 /* 4 MB */
29+
#define GPV3_PL301_CONFIG_PADDR 0x00300000 /* 1 MB */
30+
#define GPV2_PL301_CONFIG_PADDR 0x00200000 /* 1 MB */
31+
diff --git a/include/plat/imx6/plat/machine/hardware.h b/include/plat/imx6/plat/machine/hardware.h
32+
index 4365048..f2d0555 100644
33+
--- a/include/plat/imx6/plat/machine/hardware.h
34+
+++ b/include/plat/imx6/plat/machine/hardware.h
35+
@@ -18,7 +18,8 @@
36+
#include <plat/machine/devices.h>
37+
#include <arch/benchmark_overflowHandler.h>
38+
39+
-#define physBase 0x10000000
40+
+//#define physBase 0x10000000
41+
+#define physBase 0x80000000
42+
#define kernelBase 0xe0000000
43+
44+
static const kernel_frame_t BOOT_RODATA kernel_devices[] = {
45+
@@ -54,7 +55,8 @@ static const kernel_frame_t BOOT_RODATA kernel_devices[] = {
46+
static const p_region_t BOOT_RODATA avail_p_regs[] = {
47+
#if defined(CONFIG_PLAT_SABRE)
48+
/* Sabre has 1 GiB */
49+
- { /* .start = */ 0x10000000, /* .end = */ 0x50000000 }
50+
+ //{ /* .start = */ 0x10000000, /* .end = */ 0x50000000 }
51+
+ { /* .start = */ 0x80000000, /* .end = */ 0xc0000000 }
52+
#elif defined(CONFIG_PLAT_WANDQ)
53+
/* Wandboard Quad: 2 GiB */
54+
{ /* .start = */ 0x10000000, /* .end = */ 0x90000000 }
55+
@@ -65,6 +67,7 @@ static const p_region_t BOOT_RODATA dev_p_regs[] = {
56+
// { /* .start = */ EIM_CS0_PADDR , /* .end = */ EIM_CS0_PADDR + (128 << 20)},
57+
{ /* .start = */ IPU2_PADDR , /* .end = */ IPU2_PADDR + ( 4 << 20)},
58+
{ /* .start = */ IPU1_PADDR , /* .end = */ IPU1_PADDR + ( 4 << 20)},
59+
+ { /* .start = */ AIPS3_CONFIG_PADDR , /* .end = */ AIPS3_CONFIG_PADDR + ( 4 << 12)},
60+
{ /* .start = */ MIPI_HSI_PADDR , /* .end = */ MIPI_HSI_PADDR + ( 4 << 12)},
61+
{ /* .start = */ OPENVG_PADDR , /* .end = */ OPENVG_PADDR + ( 4 << 12)},
62+
{ /* .start = */ SATA_PADDR , /* .end = */ SATA_PADDR + ( 4 << 12)},
63+
@@ -174,6 +177,7 @@ static const p_region_t BOOT_RODATA dev_p_regs[] = {
64+
{ /* .start = */ OCRAM_ALIASED_PADDR , /* .end = */ OCRAM_ALIASED_PADDR + (192 << 12)},
65+
{ /* .start = */ OCRAM_PADDR , /* .end = */ OCRAM_PADDR + ( 64 << 12)},
66+
{ /* .start = */ GPV4_PL301_CONFIG_PADDR, /* .end = */ GPV4_PL301_CONFIG_PADDR + ( 1 << 20)},
67+
+ { /* .start = */ TCML_PADDR , /* .end = */ TCML_PADDR + ( 8 << 12)},
68+
{ /* .start = */ GPV3_PL301_CONFIG_PADDR, /* .end = */ GPV3_PL301_CONFIG_PADDR + ( 1 << 20)},
69+
{ /* .start = */ GPV2_PL301_CONFIG_PADDR, /* .end = */ GPV2_PL301_CONFIG_PADDR + ( 1 << 20)},
70+
{ /* .start = */ DTCP_PADDR , /* .end = */ DTCP_PADDR + ( 4 << 12)},
71+
diff --git a/src/plat/imx6/linker.lds b/src/plat/imx6/linker.lds
72+
index 836ca3c..a31ef7f 100644
73+
--- a/src/plat/imx6/linker.lds
74+
+++ b/src/plat/imx6/linker.lds
75+
@@ -11,8 +11,12 @@
76+
ENTRY(_start)
77+
78+
/* WARNING: constants also defined in plat/machine/hardware.h */
79+
-KERNEL_BASE = 0xe0000000;
80+
-PHYS_BASE = 0x10000000;
81+
+/* KERNEL_BASE = 0xe0000000; */
82+
+/* PHYS_BASE = 0x10000000; */
83+
+
84+
+KERNEL_BASE = 0xe0000000;
85+
+PHYS_BASE = 0x80000000;
86+
+
87+
KERNEL_OFFSET = KERNEL_BASE - PHYS_BASE;
88+
89+
SECTIONS

scripts/apply-patches

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
git submodule update --init
6+
7+
pushd libsel4-sys/
8+
git submodule update --init
9+
popd
10+
11+
pushd libsel4-sys/deps/seL4_tools/elfloader-tool/
12+
echo "Patching elfloader-tool"
13+
git apply ../../../../patches/elfloader-tool.patch
14+
popd
15+
16+
pushd libsel4-sys/deps/seL4_kernel/
17+
echo "Patching kernel"
18+
git apply ../../../patches/kernel.patch
19+
popd
20+
21+
exit 0

scripts/hard-reset-submodules

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
git submodule foreach git reset --hard
6+
7+
pushd libsel4-sys
8+
git submodule foreach git reset --hard
9+
popd
10+
11+
exit 0

0 commit comments

Comments
 (0)