summaryrefslogtreecommitdiffstats
path: root/meta/packages
diff options
context:
space:
mode:
Diffstat (limited to 'meta/packages')
-rw-r--r--meta/packages/kexec/kexec-tools-1.101/kexec-tools-arm.patch417
-rw-r--r--meta/packages/kexec/kexec-tools_1.101.bb15
2 files changed, 432 insertions, 0 deletions
diff --git a/meta/packages/kexec/kexec-tools-1.101/kexec-tools-arm.patch b/meta/packages/kexec/kexec-tools-1.101/kexec-tools-arm.patch
new file mode 100644
index 0000000000..b36a476d82
--- /dev/null
+++ b/meta/packages/kexec/kexec-tools-1.101/kexec-tools-arm.patch
@@ -0,0 +1,417 @@
1Index: kexec-tools-1.101/kexec/arch/arm/include/arch/options.h
2===================================================================
3--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4+++ kexec-tools-1.101/kexec/arch/arm/include/arch/options.h 2006-02-06 18:28:37.027097280 +0100
5@@ -0,0 +1,11 @@
6+#ifndef KEXEC_ARCH_ARM_OPTIONS_H
7+#define KEXEC_ARCH_ARM_OPTIONS_H
8+
9+#define OPT_ARCH_MAX (OPT_MAX+0)
10+
11+#define KEXEC_ARCH_OPTIONS \
12+ KEXEC_OPTIONS \
13+
14+#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR ""
15+
16+#endif /* KEXEC_ARCH_ARM_OPTIONS_H */
17Index: kexec-tools-1.101/kexec/arch/arm/kexec-arm.c
18===================================================================
19--- /dev/null 1970-01-01 00:00:00.000000000 +0000
20+++ kexec-tools-1.101/kexec/arch/arm/kexec-arm.c 2006-02-06 18:28:37.027097280 +0100
21@@ -0,0 +1,138 @@
22+/*
23+ * kexec: Linux boots Linux
24+ *
25+ * modified from kexec-ppc.c
26+ *
27+ */
28+
29+#define _GNU_SOURCE
30+#include <stddef.h>
31+#include <stdio.h>
32+#include <errno.h>
33+#include <stdint.h>
34+#include <string.h>
35+#include <getopt.h>
36+#include <sys/utsname.h>
37+#include "../../kexec.h"
38+#include "../../kexec-syscall.h"
39+#include "kexec-arm.h"
40+#include <arch/options.h>
41+
42+#define MAX_MEMORY_RANGES 64
43+#define MAX_LINE 160
44+static struct memory_range memory_range[MAX_MEMORY_RANGES];
45+
46+/* Return a sorted list of available memory ranges. */
47+int get_memory_ranges(struct memory_range **range, int *ranges)
48+{
49+ const char iomem[]= "/proc/iomem";
50+ int memory_ranges = 0;
51+ char line[MAX_LINE];
52+ FILE *fp;
53+ fp = fopen(iomem, "r");
54+ if (!fp) {
55+ fprintf(stderr, "Cannot open %s: %s\n",
56+ iomem, strerror(errno));
57+ return -1;
58+ }
59+
60+ while(fgets(line, sizeof(line), fp) != 0) {
61+ unsigned long long start, end;
62+ char *str;
63+ int type;
64+ int consumed;
65+ int count;
66+ if (memory_ranges >= MAX_MEMORY_RANGES)
67+ break;
68+ count = sscanf(line, "%Lx-%Lx : %n",
69+ &start, &end, &consumed);
70+ if (count != 2)
71+ continue;
72+ str = line + consumed;
73+ end = end + 1;
74+
75+ if (memcmp(str, "System RAM\n", 11) == 0) {
76+ type = RANGE_RAM;
77+ }
78+ else if (memcmp(str, "reserved\n", 9) == 0) {
79+ type = RANGE_RESERVED;
80+ }
81+ else {
82+ continue;
83+ }
84+
85+ memory_range[memory_ranges].start = start;
86+ memory_range[memory_ranges].end = end;
87+ memory_range[memory_ranges].type = type;
88+ memory_ranges++;
89+ }
90+ fclose(fp);
91+ *range = memory_range;
92+ *ranges = memory_ranges;
93+ return 0;
94+}
95+
96+/* Supported file types and callbacks */
97+struct file_type file_type[] = {
98+ {"zImage", zImage_arm_probe, zImage_arm_load, zImage_arm_usage},
99+};
100+int file_types = sizeof(file_type) / sizeof(file_type[0]);
101+
102+
103+void arch_usage(void)
104+{
105+}
106+
107+static struct {
108+} arch_options = {
109+};
110+int arch_process_options(int argc, char **argv)
111+{
112+ static const struct option options[] = {
113+ KEXEC_ARCH_OPTIONS
114+ { 0, 0, NULL, 0 },
115+ };
116+ static const char short_options[] = KEXEC_ARCH_OPT_STR;
117+ int opt;
118+ unsigned long value;
119+ char *end;
120+
121+ opterr = 0; /* Don't complain about unrecognized options here */
122+ while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) {
123+ switch(opt) {
124+ default:
125+ break;
126+ }
127+ }
128+ /* Reset getopt for the next pass; called in other source modules */
129+ opterr = 1;
130+ optind = 1;
131+ return 0;
132+}
133+
134+int arch_compat_trampoline(struct kexec_info *info, unsigned long *flags)
135+{
136+ int result;
137+ struct utsname utsname;
138+ result = uname(&utsname);
139+ if (result < 0) {
140+ fprintf(stderr, "uname failed: %s\n",
141+ strerror(errno));
142+ return -1;
143+ }
144+ if (strncmp(utsname.machine, "arm",3) == 0)
145+ {
146+ *flags |= KEXEC_ARCH_ARM;
147+ }
148+ else {
149+ fprintf(stderr, "Unsupported machine type: %s\n",
150+ utsname.machine);
151+ return -1;
152+ }
153+ return 0;
154+}
155+
156+void arch_update_purgatory(struct kexec_info *info)
157+{
158+}
159+
160Index: kexec-tools-1.101/kexec/arch/arm/kexec-arm.h
161===================================================================
162--- /dev/null 1970-01-01 00:00:00.000000000 +0000
163+++ kexec-tools-1.101/kexec/arch/arm/kexec-arm.h 2006-02-06 18:28:37.028097128 +0100
164@@ -0,0 +1,9 @@
165+#ifndef KEXEC_ARM_H
166+#define KEXEC_ARM_H
167+
168+int zImage_arm_probe(const char *buf, off_t len);
169+int zImage_arm_load(int argc, char **argv, const char *buf, off_t len,
170+ struct kexec_info *info);
171+void zImage_arm_usage(void);
172+
173+#endif /* KEXEC_ARM_H */
174Index: kexec-tools-1.101/kexec/arch/arm/kexec-elf-rel-arm.c
175===================================================================
176--- /dev/null 1970-01-01 00:00:00.000000000 +0000
177+++ kexec-tools-1.101/kexec/arch/arm/kexec-elf-rel-arm.c 2006-02-06 18:28:37.028097128 +0100
178@@ -0,0 +1,35 @@
179+#include <stdio.h>
180+#include <elf.h>
181+#include "../../kexec.h"
182+#include "../../kexec-elf.h"
183+
184+int machine_verify_elf_rel(struct mem_ehdr *ehdr)
185+{
186+ if (ehdr->ei_data != ELFDATA2MSB) {
187+ return 0;
188+ }
189+ if (ehdr->ei_class != ELFCLASS32) {
190+ return 0;
191+ }
192+ if (ehdr->e_machine != EM_ARM)
193+ {
194+ return 0;
195+ }
196+ return 1;
197+}
198+
199+void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type,
200+ void *location, unsigned long address, unsigned long value)
201+{
202+ switch(r_type) {
203+ case R_ARM_ABS32:
204+ *((uint32_t *)location) += value;
205+ break;
206+ case R_ARM_REL32:
207+ *((uint32_t *)location) += value - address;
208+ break;
209+ default:
210+ die("Unknown rel relocation: %lu\n", r_type);
211+ break;
212+ }
213+}
214Index: kexec-tools-1.101/kexec/arch/arm/kexec-zImage-arm.c
215===================================================================
216--- /dev/null 1970-01-01 00:00:00.000000000 +0000
217+++ kexec-tools-1.101/kexec/arch/arm/kexec-zImage-arm.c 2006-02-06 18:28:37.028097128 +0100
218@@ -0,0 +1,34 @@
219+#define _GNU_SOURCE
220+#include <stdio.h>
221+#include <string.h>
222+#include <stdlib.h>
223+#include <errno.h>
224+#include <limits.h>
225+#include "../../kexec.h"
226+
227+int zImage_arm_probe(const char *buf, off_t len)
228+{
229+ /*
230+ * Only zImage loading is supported. Do not check if
231+ * the buffer is valid kernel image
232+ */
233+ return 0;
234+}
235+void zImage_arm_usage(void)
236+{
237+}
238+int zImage_arm_load(int argc, char **argv, const char *buf, off_t len,
239+ struct kexec_info *info)
240+{
241+ unsigned long base;
242+ unsigned int offset = 0x8000; /* 32k offset from memory start */
243+ base = locate_hole(info,len+offset,0,0,ULONG_MAX,INT_MAX);
244+ if (base == ULONG_MAX)
245+ {
246+ return -1;
247+ }
248+ base += offset;
249+ add_segment(info,buf,len,base,len);
250+ info->entry = (void*)base;
251+ return 0;
252+}
253Index: kexec-tools-1.101/kexec/arch/arm/Makefile
254===================================================================
255--- /dev/null 1970-01-01 00:00:00.000000000 +0000
256+++ kexec-tools-1.101/kexec/arch/arm/Makefile 2006-02-06 18:28:37.028097128 +0100
257@@ -0,0 +1,8 @@
258+#
259+# kexec arm (linux booting linux)
260+#
261+KEXEC_C_SRCS+= kexec/arch/arm/kexec-elf-rel-arm.c
262+KEXEC_C_SRCS+= kexec/arch/arm/kexec-zImage-arm.c
263+KEXEC_C_SRCS+= kexec/arch/arm/kexec-arm.c
264+
265+KEXEC_S_SRCS+=
266Index: kexec-tools-1.101/kexec/kexec.c
267===================================================================
268--- kexec-tools-1.101.orig/kexec/kexec.c 2005-01-13 14:24:29.000000000 +0100
269+++ kexec-tools-1.101/kexec/kexec.c 2006-02-06 18:28:37.029096976 +0100
270@@ -187,7 +187,7 @@
271 }
272
273 /* Compute the free memory ranges */
274- max_mem_ranges = memory_ranges + (info->nr_segments -1);
275+ max_mem_ranges = memory_ranges + (info->nr_segments);
276 mem_range = malloc(max_mem_ranges *sizeof(struct memory_range));
277 mem_ranges = 0;
278
279Index: kexec-tools-1.101/kexec/kexec-syscall.h
280===================================================================
281--- kexec-tools-1.101.orig/kexec/kexec-syscall.h 2005-01-06 07:59:50.000000000 +0100
282+++ kexec-tools-1.101/kexec/kexec-syscall.h 2006-02-06 18:28:37.029096976 +0100
283@@ -37,6 +37,9 @@
284 #ifdef __x86_64__
285 #define __NR_kexec_load 246
286 #endif
287+#ifdef __arm__
288+#define __NR_kexec_load __NR_SYSCALL_BASE + 189
289+#endif
290 #ifndef __NR_kexec_load
291 #error Unknown processor architecture. Needs a kexec_load syscall number.
292 #endif
293@@ -67,6 +70,7 @@
294 #define KEXEC_ARCH_PPC (20 << 16)
295 #define KEXEC_ARCH_PPC64 (21 << 16)
296 #define KEXEC_ARCH_IA_64 (50 << 16)
297+#define KEXEC_ARCH_ARM (40 << 16)
298
299 #define KEXEC_MAX_SEGMENTS 8
300
301Index: kexec-tools-1.101/purgatory/arch/arm/include/limits.h
302===================================================================
303--- /dev/null 1970-01-01 00:00:00.000000000 +0000
304+++ kexec-tools-1.101/purgatory/arch/arm/include/limits.h 2006-02-06 18:28:37.031096672 +0100
305@@ -0,0 +1,58 @@
306+#ifndef LIMITS_H
307+#define LIMITS_H 1
308+
309+
310+/* Number of bits in a `char' */
311+#define CHAR_BIT 8
312+
313+/* Minimum and maximum values a `signed char' can hold */
314+#define SCHAR_MIN (-128)
315+#define SCHAR_MAX 127
316+
317+/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */
318+#define UCHAR_MAX 255
319+
320+/* Minimum and maximum values a `char' can hold */
321+#define CHAR_MIN SCHAR_MIN
322+#define CHAR_MAX SCHAR_MAX
323+
324+/* Minimum and maximum values a `signed short int' can hold */
325+#define SHRT_MIN (-32768)
326+#define SHRT_MAX 32767
327+
328+/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */
329+#define USHRT_MAX 65535
330+
331+
332+/* Minimum and maximum values a `signed int' can hold */
333+#define INT_MIN (-INT_MAX - 1)
334+#define INT_MAX 2147483647
335+
336+/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
337+#define UINT_MAX 4294967295U
338+
339+
340+/* Minimum and maximum values a `signed int' can hold */
341+#define INT_MIN (-INT_MAX - 1)
342+#define INT_MAX 2147483647
343+
344+/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */
345+#define UINT_MAX 4294967295U
346+
347+/* Minimum and maximum values a `signed long' can hold */
348+#define LONG_MAX 2147483647L
349+#define LONG_MIN (-LONG_MAX - 1L)
350+
351+/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */
352+#define ULONG_MAX 4294967295UL
353+
354+/* Minimum and maximum values a `signed long long' can hold */
355+#define LLONG_MAX 9223372036854775807LL
356+#define LLONG_MIN (-LONG_MAX - 1LL)
357+
358+
359+/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */
360+#define ULLONG_MAX 18446744073709551615ULL
361+
362+
363+#endif /* LIMITS_H */
364Index: kexec-tools-1.101/purgatory/arch/arm/include/stdint.h
365===================================================================
366--- /dev/null 1970-01-01 00:00:00.000000000 +0000
367+++ kexec-tools-1.101/purgatory/arch/arm/include/stdint.h 2006-02-06 18:28:37.031096672 +0100
368@@ -0,0 +1,16 @@
369+#ifndef STDINT_H
370+#define STDINT_H
371+
372+typedef unsigned long size_t;
373+
374+typedef unsigned char uint8_t;
375+typedef unsigned short uint16_t;
376+typedef unsigned int uint32_t;
377+typedef unsigned long long uint64_t;
378+
379+typedef signed char int8_t;
380+typedef signed short int16_t;
381+typedef signed int int32_t;
382+typedef signed long long int64_t;
383+
384+#endif /* STDINT_H */
385Index: kexec-tools-1.101/purgatory/arch/arm/Makefile
386===================================================================
387--- /dev/null 1970-01-01 00:00:00.000000000 +0000
388+++ kexec-tools-1.101/purgatory/arch/arm/Makefile 2006-02-06 18:28:37.031096672 +0100
389@@ -0,0 +1,7 @@
390+#
391+# Purgatory arm
392+#
393+
394+PURGATORY_S_SRCS +=
395+PURGATORY_C_SRCS +=
396+
397Index: kexec-tools-1.101/configure.ac
398===================================================================
399--- kexec-tools-1.101.orig/configure.ac 2005-01-09 02:36:57.000000000 +0100
400+++ kexec-tools-1.101/configure.ac 2006-02-06 18:30:19.274553304 +0100
401@@ -25,12 +25,15 @@
402 powerpc )
403 host_cpu="ppc"
404 ;;
405+ arm* )
406+ host_cpu="arm"
407+ ;;
408 * )
409 host_cpu="$host_cpu"
410 ;;
411 esac
412 case $host_cpu in
413- i386|ppc|x86_64|alpha|ppc64|ia64)
414+ i386|ppc|x86_64|alpha|ppc64|ia64|arm)
415 ;;
416 * )
417 AC_MSG_ERROR([ unsupported architecture $host_cpu])
diff --git a/meta/packages/kexec/kexec-tools_1.101.bb b/meta/packages/kexec/kexec-tools_1.101.bb
new file mode 100644
index 0000000000..fe2b5e1765
--- /dev/null
+++ b/meta/packages/kexec/kexec-tools_1.101.bb
@@ -0,0 +1,15 @@
1DESCRIPTION = "Kexec is a fast reboot feature that lets you reboot to a new Linux kernel"
2AUTHOR = "Eric Biederman"
3HOMEPAGE = "http://www.xmission.com/~ebiederm/files/kexec/"
4SECTION = "kernel/userland"
5DEPENDS = "virtual/kernel zlib"
6LICENSE = "GPL"
7PR = "r0"
8
9inherit autotools
10
11EXTRA_OEMAKE = "LDFLAGS=-L${STAGING_LIBDIR} -Wl,--rpath-link,${STAGING_LIBDIR} "
12EXTRA_OECONF = " --with-zlib=${STAGING_LIBDIR}/.."
13
14SRC_URI = "http://www.xmission.com/~ebiederm/files/kexec/kexec-tools-${PV}.tar.gz \
15 file://kexec-tools-arm.patch;patch=1 "