summaryrefslogtreecommitdiffstats
path: root/meta-initramfs
diff options
context:
space:
mode:
authorAndrea Adami <andrea.adami@gmail.com>2018-12-17 19:17:48 +0100
committerKhem Raj <raj.khem@gmail.com>2018-12-18 18:44:59 -0800
commit62779390653d869f64ed655a3cd0b194a131a789 (patch)
tree24ccedd7c464666a02a8419f137fc7a73b3b4a7e /meta-initramfs
parentafadc2ca4d72f5cdf3d191d96ec56057d9ca07b5 (diff)
downloadmeta-openembedded-62779390653d869f64ed655a3cd0b194a131a789.tar.gz
kexec-tools-klibc: implement the --no-dtb option for older mips kernels
Fix borrowed from LEDE-DEV. Signed-off-by: Andrea Adami <andrea.adami@gmail.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-initramfs')
-rw-r--r--meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch163
-rw-r--r--meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb3
2 files changed, 166 insertions, 0 deletions
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
new file mode 100644
index 000000000..b3ef3c82d
--- /dev/null
+++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc/140-mips_disable_devicetree_support.patch
@@ -0,0 +1,163 @@
1From 5ea7cd78cd252ffd3a9f3fbc8dc795d6e1596084 Mon Sep 17 00:00:00 2001
2From: Andrea Adami <andrea.adami@gmail.com>
3Date: Mon, 17 Dec 2018 11:25:20 +0100
4Subject: [PATCH] kexec-tools: fix non-device tree devices on mips
5
6Add additional argument '--no-dtb' which disables device tree
7search in currently loaded kernel.
8
9Taken from LEDE-DEV:
10https://patchwork.ozlabs.org/patch/852961/
11
12Rebased for kexec-tools 2.0.18
13Removed ppc change (unwanted ?)
14
15Signed-off-by: Konstantin Kuzov <master.nosferatu@gmail.com>
16Signed-off-by: Andrea Adami <andrea.adami@gmail.com>
17---
18 kexec/arch/mips/include/arch/options.h | 4 +-
19 kexec/arch/mips/kexec-elf-mips.c | 58 ++++++++++++++------------
20 kexec/arch/mips/kexec-mips.c | 4 ++
21 kexec/arch/mips/kexec-mips.h | 1 +
22 4 files changed, 39 insertions(+), 28 deletions(-)
23
24diff --git a/kexec/arch/mips/include/arch/options.h b/kexec/arch/mips/include/arch/options.h
25index 416e224..18d2811 100644
26--- a/kexec/arch/mips/include/arch/options.h
27+++ b/kexec/arch/mips/include/arch/options.h
28@@ -5,6 +5,7 @@
29 #define OPT_APPEND (OPT_ARCH_MAX+0)
30 #define OPT_DTB (OPT_ARCH_MAX+1)
31 #define OPT_RAMDISK (OPT_ARCH_MAX+2)
32+#define OPT_NO_DTB (OPT_ARCH_MAX+3)
33
34 /* Options relevant to the architecture (excluding loader-specific ones),
35 * in this case none:
36@@ -14,7 +15,8 @@
37 {"command-line", 1, 0, OPT_APPEND}, \
38 {"append", 1, 0, OPT_APPEND}, \
39 {"dtb", 1, 0, OPT_DTB }, \
40- {"initrd", 1, 0, OPT_RAMDISK },
41+ {"initrd", 1, 0, OPT_RAMDISK }, \
42+ {"no-dtb", 0, 0, OPT_NO_DTB },
43
44
45 #define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""
46diff --git a/kexec/arch/mips/kexec-elf-mips.c b/kexec/arch/mips/kexec-elf-mips.c
47index 849a7ba..5c0e535 100644
48--- a/kexec/arch/mips/kexec-elf-mips.c
49+++ b/kexec/arch/mips/kexec-elf-mips.c
50@@ -141,35 +141,37 @@ int elf_mips_load(int argc, char **argv, const char *buf, off_t len,
51 else
52 cmdline_addr = 0;
53
54- /* MIPS systems that have been converted to use device tree
55- * passed through UHI will use commandline in the DTB and
56- * the DTB passed as a separate buffer. Note that
57- * CMDLINE_PREFIX is skipped here intentionally, as it is
58- * used only in the legacy method */
59-
60- if (arch_options.dtb_file) {
61- dtb_buf = slurp_file(arch_options.dtb_file, &dtb_length);
62- } else {
63- create_flatten_tree(&dtb_buf, &dtb_length, cmdline_buf + strlen(CMDLINE_PREFIX));
64- }
65
66- if (arch_options.initrd_file) {
67- initrd_buf = slurp_file(arch_options.initrd_file, &initrd_size);
68+ if (!arch_options.no_dtb) {
69+ /* MIPS systems that have been converted to use device tree
70+ * passed through UHI will use commandline in the DTB and
71+ * the DTB passed as a separate buffer. Note that
72+ * CMDLINE_PREFIX is skipped here intentionally, as it is
73+ * used only in the legacy method */
74+
75+ if (arch_options.dtb_file) {
76+ dtb_buf = slurp_file(arch_options.dtb_file, &dtb_length);
77+ } else {
78+ create_flatten_tree(&dtb_buf, &dtb_length, cmdline_buf + strlen(CMDLINE_PREFIX));
79+ }
80
81- /* Create initrd entries in dtb - although at this time
82- * they would not point to the correct location */
83- dtb_set_initrd(&dtb_buf, &dtb_length, initrd_buf, initrd_buf + initrd_size);
84+ if (arch_options.initrd_file) {
85+ initrd_buf = slurp_file(arch_options.initrd_file, &initrd_size);
86
87- initrd_base = add_buffer(info, initrd_buf, initrd_size,
88- initrd_size, sizeof(void *),
89- _ALIGN_UP(kernel_addr + kernel_size + dtb_length,
90- pagesize), 0x0fffffff, 1);
91+ /* Create initrd entries in dtb - although at this time
92+ * they would not point to the correct location */
93+ dtb_set_initrd(&dtb_buf, &dtb_length, initrd_buf, initrd_buf + initrd_size);
94
95- /* Now that the buffer for initrd is prepared, update the dtb
96- * with an appropriate location */
97- dtb_set_initrd(&dtb_buf, &dtb_length, initrd_base, initrd_base + initrd_size);
98- }
99+ initrd_base = add_buffer(info, initrd_buf, initrd_size,
100+ initrd_size, sizeof(void *),
101+ _ALIGN_UP(kernel_addr + kernel_size + dtb_length,
102+ pagesize), 0x0fffffff, 1);
103
104+ /* Now that the buffer for initrd is prepared, update the dtb
105+ * with an appropriate location */
106+ dtb_set_initrd(&dtb_buf, &dtb_length, initrd_base, initrd_base + initrd_size);
107+ }
108+ }
109
110 /* This is a legacy method for commandline passing used
111 * currently by Octeon CPUs only */
112@@ -177,9 +179,11 @@ int elf_mips_load(int argc, char **argv, const char *buf, off_t len,
113 sizeof(cmdline_buf), sizeof(void *),
114 cmdline_addr, 0x0fffffff, 1);
115
116- add_buffer(info, dtb_buf, dtb_length, dtb_length, 0,
117- _ALIGN_UP(kernel_addr + kernel_size, pagesize),
118- 0x0fffffff, 1);
119+ if (!arch_options.no_dtb) {
120+ add_buffer(info, dtb_buf, dtb_length, dtb_length, 0,
121+ _ALIGN_UP(kernel_addr + kernel_size, pagesize),
122+ 0x0fffffff, 1);
123+ }
124
125 return 0;
126 }
127diff --git a/kexec/arch/mips/kexec-mips.c b/kexec/arch/mips/kexec-mips.c
128index 415c2ed..e557f8b 100644
129--- a/kexec/arch/mips/kexec-mips.c
130+++ b/kexec/arch/mips/kexec-mips.c
131@@ -89,6 +89,7 @@ void arch_usage(void)
132 " --append=STRING Set the kernel command line to STRING.\n"
133 " --dtb=FILE Use FILE as the device tree blob.\n"
134 " --initrd=FILE Use FILE as initial ramdisk.\n"
135+ " --no-dtb Don't try to find device tree\n"
136 );
137 }
138
139@@ -121,6 +122,9 @@ int arch_process_options(int argc, char **argv)
140 case OPT_RAMDISK:
141 arch_options.initrd_file = optarg;
142 break;
143+ case OPT_NO_DTB:
144+ arch_options.no_dtb = 1;
145+ break;
146 default:
147 break;
148 }
149diff --git a/kexec/arch/mips/kexec-mips.h b/kexec/arch/mips/kexec-mips.h
150index 222c815..90b21c3 100644
151--- a/kexec/arch/mips/kexec-mips.h
152+++ b/kexec/arch/mips/kexec-mips.h
153@@ -22,6 +22,7 @@ struct arch_options_t {
154 char *dtb_file;
155 char *initrd_file;
156 int core_header_type;
157+ int no_dtb;
158 };
159
160 extern struct memory_ranges usablemem_rgns;
161--
1622.17.1
163
diff --git a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb
index 6ffa2aad6..ebf5ff5ae 100644
--- a/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb
+++ b/meta-initramfs/recipes-kernel/kexec/kexec-tools-klibc_git.bb
@@ -42,6 +42,9 @@ SRC_URI += "${BUILD_PATCHES} ${KLIBC_PATCHES} ${WARNING_FIXES} ${FROM_OE_CORE}"
42 42
43SRC_URI_append_arm = " file://arm_crashdump.patch" 43SRC_URI_append_arm = " file://arm_crashdump.patch"
44 44
45SRC_URI_append_mips = " file://140-mips_disable_devicetree_support.patch"
46SRC_URI_append_mipsel = " file://140-mips_disable_devicetree_support.patch"
47
45SRC_URI_append_x86 = " file://x86_sys_io.patch file://x86_basename.patch \ 48SRC_URI_append_x86 = " file://x86_sys_io.patch file://x86_basename.patch \
46 file://x86_vfscanf.patch file://x86_kexec_test.patch" 49 file://x86_vfscanf.patch file://x86_kexec_test.patch"
47 50