diff options
Diffstat (limited to 'recipes/kexec-tools/files')
-rw-r--r-- | recipes/kexec-tools/files/dietlibc.patch | 35 | ||||
-rw-r--r-- | recipes/kexec-tools/files/fix-arm-arch-detection.patch | 17 | ||||
-rw-r--r-- | recipes/kexec-tools/files/kexec-arm-atags.patch | 293 | ||||
-rw-r--r-- | recipes/kexec-tools/files/kexec-klibc.patch | 151 | ||||
-rw-r--r-- | recipes/kexec-tools/files/kexec-static.patch | 12 | ||||
-rw-r--r-- | recipes/kexec-tools/files/kexec-tools-2-arm-add-uImage.patch | 271 | ||||
-rw-r--r-- | recipes/kexec-tools/files/kexec-tools-2-headers.patch | 99 | ||||
-rw-r--r-- | recipes/kexec-tools/files/kexec-tools-2-klibc.patch | 295 | ||||
-rw-r--r-- | recipes/kexec-tools/files/kexec-tools-arm.patch | 417 | ||||
-rw-r--r-- | recipes/kexec-tools/files/no-getline-no-fscanf.patch | 69 |
10 files changed, 1659 insertions, 0 deletions
diff --git a/recipes/kexec-tools/files/dietlibc.patch b/recipes/kexec-tools/files/dietlibc.patch new file mode 100644 index 0000000000..0048d7a6a2 --- /dev/null +++ b/recipes/kexec-tools/files/dietlibc.patch @@ -0,0 +1,35 @@ +Index: kexec-tools-2.0.1/kexec/kexec-elf.c +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/kexec-elf.c 2009-10-03 14:19:35.347504269 +0200 ++++ kexec-tools-2.0.1/kexec/kexec-elf.c 2009-10-03 14:23:00.414497203 +0200 +@@ -9,6 +9,17 @@ + #include "kexec.h" + #include "kexec-elf.h" + ++#ifdef __dietlibc__ ++#include <limits.h> ++# define UINT32_MAX (4294967295U) ++# if __WORDSIZE == 64 ++# define __UINT64_C(c) c ## UL ++# else ++# define __UINT64_C(c) c ## ULL ++# endif ++# define UINT64_MAX (__UINT64_C(18446744073709551615)) ++#endif ++ + static const int probe_debug = 0; + + uint16_t elf16_to_cpu(const struct mem_ehdr *ehdr, uint16_t value) +Index: kexec-tools-2.0.1/kexec/Makefile +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/Makefile 2009-10-03 14:43:59.574859089 +0200 ++++ kexec-tools-2.0.1/kexec/Makefile 2009-10-03 14:44:08.190707689 +0200 +@@ -70,7 +70,7 @@ + + $(KEXEC): $(KEXEC_OBJS) $(UTIL_LIB) + @$(MKDIR) -p $(@D) +- $(LINK.o) -o $@ $^ $(LIBS) ++ $(LINK.o) -o $@ $^ $(LIBS) -lcompat + + $(KEXEC): CPPFLAGS+=-I$(srcdir)/kexec/arch/$(ARCH)/include + diff --git a/recipes/kexec-tools/files/fix-arm-arch-detection.patch b/recipes/kexec-tools/files/fix-arm-arch-detection.patch new file mode 100644 index 0000000000..6116c5bb84 --- /dev/null +++ b/recipes/kexec-tools/files/fix-arm-arch-detection.patch @@ -0,0 +1,17 @@ +--- kexec-tools/kexec/phys_arch.c.old 2008-07-15 02:46:43.000000000 +0200 ++++ kexec-tools/kexec/phys_arch.c 2009-10-04 23:58:04.000000000 +0200 +@@ -13,9 +13,12 @@ + return -1; + } + +- for (i = 0; arches[i].machine; ++i) +- if (strcmp(utsname.machine, arches[i].machine) == 0) ++ for (i = 0; arches[i].machine; ++i) { ++ if ((strcmp(arches[i].machine, "arm") == 0) && (strncmp(utsname.machine, arches[i].machine, 3) == 0)) ++ return arches[i].arch; ++ if (strcmp(utsname.machine, arches[i].machine) == 0) + return arches[i].arch; ++ } + + fprintf(stderr, "Unsupported machine type: %s\n", + utsname.machine); diff --git a/recipes/kexec-tools/files/kexec-arm-atags.patch b/recipes/kexec-tools/files/kexec-arm-atags.patch new file mode 100644 index 0000000000..eb3cb75990 --- /dev/null +++ b/recipes/kexec-tools/files/kexec-arm-atags.patch @@ -0,0 +1,293 @@ +--- + kexec/arch/arm/kexec-zImage-arm.c | 259 ++++++++++++++++++++++++++++++++++++-- + 1 file changed, 252 insertions(+), 7 deletions(-) + +Index: kexec-tools-1.101/kexec/arch/arm/kexec-zImage-arm.c +=================================================================== +--- kexec-tools-1.101.orig/kexec/arch/arm/kexec-zImage-arm.c ++++ kexec-tools-1.101/kexec/arch/arm/kexec-zImage-arm.c +@@ -1,11 +1,82 @@ ++/* ++ * - 08/21/2007 ATAG support added by Uli Luckas <u.luckas@road.de> ++ * ++ */ + #define _GNU_SOURCE + #include <stdio.h> + #include <string.h> + #include <stdlib.h> + #include <errno.h> + #include <limits.h> ++#include <stdint.h> ++#include <getopt.h> ++#include <arch/options.h> + #include "../../kexec.h" + ++#define COMMAND_LINE_SIZE 1024 ++#define BOOT_PARAMS_SIZE 1536 ++ ++struct tag_header { ++ uint32_t size; ++ uint32_t tag; ++}; ++ ++/* The list must start with an ATAG_CORE node */ ++#define ATAG_CORE 0x54410001 ++ ++struct tag_core { ++ uint32_t flags; /* bit 0 = read-only */ ++ uint32_t pagesize; ++ uint32_t rootdev; ++}; ++ ++/* it is allowed to have multiple ATAG_MEM nodes */ ++#define ATAG_MEM 0x54410002 ++ ++struct tag_mem32 { ++ uint32_t size; ++ uint32_t start; /* physical start address */ ++}; ++ ++/* describes where the compressed ramdisk image lives (virtual address) */ ++/* ++ * this one accidentally used virtual addresses - as such, ++ * it's deprecated. ++ */ ++#define ATAG_INITRD 0x54410005 ++ ++/* describes where the compressed ramdisk image lives (physical address) */ ++#define ATAG_INITRD2 0x54420005 ++ ++struct tag_initrd { ++ uint32_t start; /* physical start address */ ++ uint32_t size; /* size of compressed ramdisk image in bytes */ ++}; ++ ++/* command line: \0 terminated string */ ++#define ATAG_CMDLINE 0x54410009 ++ ++struct tag_cmdline { ++ char cmdline[1]; /* this is the minimum size */ ++}; ++ ++/* The list ends with an ATAG_NONE node. */ ++#define ATAG_NONE 0x00000000 ++ ++struct tag { ++ struct tag_header hdr; ++ union { ++ struct tag_core core; ++ struct tag_mem32 mem; ++ struct tag_initrd initrd; ++ struct tag_cmdline cmdline; ++ } u; ++}; ++ ++#define tag_next(t) ((struct tag *)((uint32_t *)(t) + (t)->hdr.size)) ++#define byte_size(t) ((t)->hdr.size << 2) ++#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type) + 3) >> 2) ++ + int zImage_arm_probe(const char *buf, off_t len) + { + /* +@@ -14,21 +85,194 @@ int zImage_arm_probe(const char *buf, of + */ + return 0; + } ++ + void zImage_arm_usage(void) + { ++ printf( " --command-line=STRING Set the kernel command line to STRING.\n" ++ " --append=STRING Set the kernel command line to STRING.\n" ++ " --initrd=FILE Use FILE as the kernel's initial ramdisk.\n" ++ " --ramdisk=FILE Use FILE as the kernel's initial ramdisk.\n" ++ ); ++} ++ ++static ++struct tag * atag_read_tags(void) ++{ ++ static unsigned long buf[BOOT_PARAMS_SIZE]; ++ const char fn[]= "/proc/atags"; ++ FILE *fp; ++ fp = fopen(fn, "r"); ++ if (!fp) { ++ fprintf(stderr, "Cannot open %s: %s\n", ++ fn, strerror(errno)); ++ return NULL; ++ } ++ ++ fread(buf, sizeof(buf[1]), BOOT_PARAMS_SIZE, fp); ++ if (ferror(fp)) { ++ fprintf(stderr, "Cannot read %s: %s\n", ++ fn, strerror(errno)); ++ fclose(fp); ++ return NULL; ++ } ++ ++ fclose(fp); ++ return (struct tag *) buf; ++} ++ ++ ++static ++int atag_arm_load(struct kexec_info *info, unsigned long base, ++ const char *command_line, off_t command_line_len, ++ const char *initrd, off_t initrd_len) ++{ ++ struct tag *saved_tags = atag_read_tags(); ++ char *buf; ++ off_t len; ++ struct tag *params; ++ uint32_t *initrd_start; ++ ++ buf = xmalloc(getpagesize()); ++ if (!buf) { ++ fprintf(stderr, "Compiling ATAGs: out of memory\n"); ++ return -1; ++ } ++ ++ memset(buf, 0xff, getpagesize()); ++ params = (struct tag *)buf; ++ ++ if (saved_tags) { ++ // Copy tags ++ saved_tags = (struct tag *) saved_tags; ++ while(byte_size(saved_tags)) { ++ switch (saved_tags->hdr.tag) { ++ case ATAG_INITRD: ++ case ATAG_INITRD2: ++ case ATAG_CMDLINE: ++ case ATAG_NONE: ++ // skip these tags ++ break; ++ default: ++ // copy all other tags ++ memcpy(params, saved_tags, byte_size(saved_tags)); ++ params = tag_next(params); ++ } ++ saved_tags = tag_next(saved_tags); ++ } ++ } else { ++ params->hdr.size = 2; ++ params->hdr.tag = ATAG_CORE; ++ params = tag_next(params); ++ } ++ ++ if (initrd) { ++ params->hdr.size = tag_size(tag_initrd); ++ params->hdr.tag = ATAG_INITRD2; ++ initrd_start = ¶ms->u.initrd.start; ++ params->u.initrd.size = initrd_len; ++ params = tag_next(params); ++ } ++ ++ if (command_line) { ++ params->hdr.size = (sizeof(struct tag_header) + command_line_len + 3) >> 2; ++ params->hdr.tag = ATAG_CMDLINE; ++ memcpy(params->u.cmdline.cmdline, command_line, ++ command_line_len); ++ params->u.cmdline.cmdline[command_line_len - 1] = '\0'; ++ params = tag_next(params); ++ } ++ ++ params->hdr.size = 0; ++ params->hdr.tag = ATAG_NONE; ++ ++ len = ((char *)params - buf) + sizeof(struct tag_header); ++ ++ add_segment(info, buf, len, base, len); ++ ++ if (initrd) { ++ struct memory_range *range; ++ int ranges; ++ get_memory_ranges(&range, &ranges); ++ *initrd_start = locate_hole(info, initrd_len, getpagesize(), range[0].start + 0x800000, ULONG_MAX, INT_MAX); ++ if (*initrd_start == ULONG_MAX) ++ return -1; ++ add_segment(info, initrd, initrd_len, *initrd_start, initrd_len); ++ } ++ ++ return 0; + } +-int zImage_arm_load(int argc, char **argv, const char *buf, off_t len, ++ ++int zImage_arm_load(int argc, char **argv, const char *buf, off_t len, + struct kexec_info *info) + { + unsigned long base; +- unsigned int offset = 0x8000; /* 32k offset from memory start */ ++ unsigned int atag_offset = 0x1000; /* 4k offset from memory start */ ++ unsigned int offset = 0x8000; /* 32k offset from memory start */ ++ const char *command_line; ++ off_t command_line_len; ++ const char *ramdisk; ++ char *ramdisk_buf; ++ off_t ramdisk_length; ++ int opt; ++#define OPT_APPEND 'a' ++#define OPT_RAMDISK 'r' ++ static const struct option options[] = { ++ KEXEC_ARCH_OPTIONS ++ { "command-line", 1, 0, OPT_APPEND }, ++ { "append", 1, 0, OPT_APPEND }, ++ { "initrd", 1, 0, OPT_RAMDISK }, ++ { "ramdisk", 1, 0, OPT_RAMDISK }, ++ { 0, 0, 0, 0 }, ++ }; ++ static const char short_options[] = KEXEC_ARCH_OPT_STR "a:r:"; ++ ++ /* ++ * Parse the command line arguments ++ */ ++ command_line = 0; ++ command_line_len = 0; ++ ramdisk = 0; ++ ramdisk_buf = 0; ++ ramdisk_length = 0; ++ while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { ++ switch(opt) { ++ default: ++ /* Ignore core options */ ++ if (opt < OPT_ARCH_MAX) { ++ break; ++ } ++ case '?': ++ usage(); ++ return -1; ++ case OPT_APPEND: ++ command_line = optarg; ++ break; ++ case OPT_RAMDISK: ++ ramdisk = optarg; ++ break; ++ } ++ } ++ if (command_line) { ++ command_line_len = strlen(command_line) + 1; ++ if (command_line_len > COMMAND_LINE_SIZE) ++ command_line_len = COMMAND_LINE_SIZE; ++ } ++ if (ramdisk) { ++ ramdisk_buf = slurp_file(ramdisk, &ramdisk_length); ++ } ++ + base = locate_hole(info,len+offset,0,0,ULONG_MAX,INT_MAX); + if (base == ULONG_MAX) +- { + return -1; +- } +- base += offset; +- add_segment(info,buf,len,base,len); +- info->entry = (void*)base; ++ ++ if (atag_arm_load(info, base + atag_offset, ++ command_line, command_line_len, ++ ramdisk_buf, ramdisk_length) == -1) ++ return -1; ++ ++ add_segment(info, buf, len, base + offset, len); ++ ++ info->entry = (void*)base + offset; ++ + return 0; + } diff --git a/recipes/kexec-tools/files/kexec-klibc.patch b/recipes/kexec-tools/files/kexec-klibc.patch new file mode 100644 index 0000000000..090b6231f1 --- /dev/null +++ b/recipes/kexec-tools/files/kexec-klibc.patch @@ -0,0 +1,151 @@ +Index: kexec-tools-1.101/kexec/arch/arm/kexec-elf-rel-arm.c +=================================================================== +--- kexec-tools-1.101.orig/kexec/arch/arm/kexec-elf-rel-arm.c 2008-02-24 14:15:46.934825202 +0100 ++++ kexec-tools-1.101/kexec/arch/arm/kexec-elf-rel-arm.c 2008-02-24 14:15:47.014827381 +0100 +@@ -1,5 +1,5 @@ + #include <stdio.h> +-#include <elf.h> ++#include "../../../include/elf.h" + #include "../../kexec.h" + #include "../../kexec-elf.h" + +Index: kexec-tools-1.101/kexec/arch/arm/kexec-zImage-arm.c +=================================================================== +--- kexec-tools-1.101.orig/kexec/arch/arm/kexec-zImage-arm.c 2008-02-24 14:15:46.982825391 +0100 ++++ kexec-tools-1.101/kexec/arch/arm/kexec-zImage-arm.c 2008-07-26 01:58:20.838624318 +0200 +@@ -2,6 +2,10 @@ + * - 08/21/2007 ATAG support added by Uli Luckas <u.luckas@road.de> + * + */ ++ ++/* work around for linux header files */ ++#define __deprecated ++ + #define _GNU_SOURCE + #include <stdio.h> + #include <string.h> +@@ -110,13 +114,13 @@ + } + + fread(buf, sizeof(buf[1]), BOOT_PARAMS_SIZE, fp); +- if (ferror(fp)) { ++/* if (ferror(fp)) { + fprintf(stderr, "Cannot read %s: %s\n", + fn, strerror(errno)); + fclose(fp); + return NULL; + } +- ++*/ + fclose(fp); + return (struct tag *) buf; + } +Index: kexec-tools-1.101/kexec/ifdown.c +=================================================================== +--- kexec-tools-1.101.orig/kexec/ifdown.c 2008-02-24 14:15:34.025828340 +0100 ++++ kexec-tools-1.101/kexec/ifdown.c 2008-02-24 14:15:47.014827381 +0100 +@@ -14,7 +14,7 @@ + #include <sys/ioctl.h> + #include <sys/socket.h> + #include <sys/time.h> +-#include <sys/errno.h> ++#include <errno.h> + + #include <net/if.h> + #include <netinet/in.h> +Index: kexec-tools-1.101/purgatory/Makefile +=================================================================== +--- kexec-tools-1.101.orig/purgatory/Makefile 2008-02-24 14:15:34.037827479 +0100 ++++ kexec-tools-1.101/purgatory/Makefile 2008-02-24 14:15:47.022825503 +0100 +@@ -13,7 +13,7 @@ + + PCFLAGS += $(call cc-option, -ffreestanding) + PCFLAGS += $(call cc-option, -fnobuiltin) +-PCFLAGS += $(call cc-option, -fnostdinc) ++PCFLAGS += $(call cc-option, -nostdinc) + PCFLAGS += $(call cc-option, -fno-zero-initialized-in-bss) + + PURGATORY_C_SRCS:= +Index: kexec-tools-1.101/kexec/kexec-elf-rel.c +=================================================================== +--- kexec-tools-1.101.orig/kexec/kexec-elf-rel.c 2008-02-24 14:15:34.025828340 +0100 ++++ kexec-tools-1.101/kexec/kexec-elf-rel.c 2008-02-24 14:15:47.030825302 +0100 +@@ -4,7 +4,7 @@ + #include <stdio.h> + #include <errno.h> + #include <stdlib.h> +-#include "elf.h" ++#include "../include/elf.h" + #include <boot/elf_boot.h> + #include "kexec.h" + #include "kexec-elf.h" +Index: kexec-tools-1.101/kexec/kexec-syscall.h +=================================================================== +--- kexec-tools-1.101.orig/kexec/kexec-syscall.h 2008-02-24 14:15:46.950825917 +0100 ++++ kexec-tools-1.101/kexec/kexec-syscall.h 2008-02-24 14:15:47.030825302 +0100 +@@ -2,7 +2,7 @@ + #define KEXEC_SYSCALL_H + + #define __LIBRARY__ +-#include <syscall.h> ++/*#include <syscall.h>*/ + #include <sys/syscall.h> + #include <unistd.h> + +@@ -21,7 +21,7 @@ + #define LINUX_REBOOT_CMD_KEXEC_OLD 0x81726354 + #define LINUX_REBOOT_CMD_KEXEC_OLD2 0x18263645 + #define LINUX_REBOOT_CMD_KEXEC 0x45584543 +- ++/* + #ifdef __i386__ + #define __NR_kexec_load 283 + #endif +@@ -43,18 +43,19 @@ + #ifndef __NR_kexec_load + #error Unknown processor architecture. Needs a kexec_load syscall number. + #endif +- ++*/ + struct kexec_segment; +- ++/* + static inline long kexec_load(void *entry, unsigned long nr_segments, + struct kexec_segment *segments, unsigned long flags) + { + return (long) syscall(__NR_kexec_load, entry, nr_segments, segments, flags); + } +- ++*/ + static inline long kexec_reboot(void) + { +- return (long) syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0); ++ //return (long) syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0); ++ return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0); + } + + +Index: kexec-tools-1.101/kexec/kexec.c +=================================================================== +--- kexec-tools-1.101.orig/kexec/kexec.c 2008-02-24 14:15:46.950825917 +0100 ++++ kexec-tools-1.101/kexec/kexec.c 2008-07-26 01:58:53.545624148 +0200 +@@ -29,9 +29,7 @@ + #include <unistd.h> + #include <fcntl.h> + #include <getopt.h> +-#ifdef HAVE_ZLIB_H +-#include <zlib.h> +-#endif ++#include "zlib.h" + #include <sha256.h> + #include "kexec.h" + #include "kexec-syscall.h" +@@ -383,7 +381,7 @@ + return buf; + } + +-#if HAVE_ZLIB_H ++#if 1 + char *slurp_decompress_file(const char *filename, off_t *r_size) + { + gzFile fp; diff --git a/recipes/kexec-tools/files/kexec-static.patch b/recipes/kexec-tools/files/kexec-static.patch new file mode 100644 index 0000000000..549300576e --- /dev/null +++ b/recipes/kexec-tools/files/kexec-static.patch @@ -0,0 +1,12 @@ +diff -ur kexec-tools-1.101.bak/configure.ac kexec-tools-1.101/configure.ac +--- kexec-tools-1.101.bak/configure.ac 2008-02-03 00:05:59.577094746 +0100 ++++ kexec-tools-1.101/configure.ac 2008-02-03 00:06:35.579146386 +0100 +@@ -96,7 +96,7 @@ + + dnl ---Hard codes + +-CFLAGS='-Wall -g -fno-strict-aliasing $(CPPFLAGS)' ++CFLAGS='-Wall -g -static -fno-strict-aliasing $(CPPFLAGS)' + BUILD_CFLAGS='-O2 -Wall $(CPPFLAGS)' + + dnl ---Sanity checks diff --git a/recipes/kexec-tools/files/kexec-tools-2-arm-add-uImage.patch b/recipes/kexec-tools/files/kexec-tools-2-arm-add-uImage.patch new file mode 100644 index 0000000000..69a1588ba2 --- /dev/null +++ b/recipes/kexec-tools/files/kexec-tools-2-arm-add-uImage.patch @@ -0,0 +1,271 @@ +From 160f15aa3b87b6b7b16ccad99f5ce110cacb8256 Mon Sep 17 00:00:00 2001 +From: Marc Andre Tanner <mat at brain-dump.org> +Date: Fri, 20 Nov 2009 15:07:42 +0100 +Subject: [PATCH 2/2] kexec-arm: add uImage support + +uImages are basically just zImages with a special header, +we therefore just skip the header and let the normal zImage +infrastructure do the actual work. + +Signed-off-by: Marc Andre Tanner <mat at brain-dump.org> +--- + kexec/arch/arm/Makefile | 2 + + kexec/arch/arm/kexec-arm.c | 3 + + kexec/arch/arm/kexec-arm.h | 4 + + kexec/arch/arm/kexec-uImage-arm.c | 33 ++++++++ + kexec/arch/arm/kexec-uImage-arm.h | 161 +++++++++++++++++++++++++++++++++++++ + 5 files changed, 203 insertions(+), 0 deletions(-) + create mode 100644 kexec/arch/arm/kexec-uImage-arm.c + create mode 100644 kexec/arch/arm/kexec-uImage-arm.h + +diff --git a/kexec/arch/arm/Makefile b/kexec/arch/arm/Makefile +index e05e4c7..806c4d9 100644 +--- a/kexec/arch/arm/Makefile ++++ b/kexec/arch/arm/Makefile +@@ -3,8 +3,10 @@ + # + arm_KEXEC_SRCS= kexec/arch/arm/kexec-elf-rel-arm.c + arm_KEXEC_SRCS+= kexec/arch/arm/kexec-zImage-arm.c ++arm_KEXEC_SRCS+= kexec/arch/arm/kexec-uImage-arm.c + arm_KEXEC_SRCS+= kexec/arch/arm/kexec-arm.c + + dist += kexec/arch/arm/Makefile $(arm_KEXEC_SRCS) \ + kexec/arch/arm/kexec-arm.h \ ++ kexec/arch/arm/kexec-uImage-arm.h \ + kexec/arch/arm/include/arch/options.h +diff --git a/kexec/arch/arm/kexec-arm.c b/kexec/arch/arm/kexec-arm.c +index 2e50489..3fdf839 100644 +--- a/kexec/arch/arm/kexec-arm.c ++++ b/kexec/arch/arm/kexec-arm.c +@@ -74,6 +74,9 @@ int get_memory_ranges(struct memory_range **range, int *ranges, + + /* Supported file types and callbacks */ + struct file_type file_type[] = { ++ /* uImage is probed before zImage because the latter also accepts ++ uncompressed images. */ ++ {"uImage", uImage_arm_probe, uImage_arm_load, zImage_arm_usage}, + {"zImage", zImage_arm_probe, zImage_arm_load, zImage_arm_usage}, + }; + int file_types = sizeof(file_type) / sizeof(file_type[0]); +diff --git a/kexec/arch/arm/kexec-arm.h b/kexec/arch/arm/kexec-arm.h +index bb41ce0..0d9a066 100644 +--- a/kexec/arch/arm/kexec-arm.h ++++ b/kexec/arch/arm/kexec-arm.h +@@ -6,4 +6,8 @@ int zImage_arm_load(int argc, char **argv, const char *buf, off_t len, + struct kexec_info *info); + void zImage_arm_usage(void); + ++int uImage_arm_probe(const char *buf, off_t len); ++int uImage_arm_load(int argc, char **argv, const char *buf, off_t len, ++ struct kexec_info *info); ++ + #endif /* KEXEC_ARM_H */ +diff --git a/kexec/arch/arm/kexec-uImage-arm.c b/kexec/arch/arm/kexec-uImage-arm.c +new file mode 100644 +index 0000000..218148a +--- /dev/null ++++ b/kexec/arch/arm/kexec-uImage-arm.c +@@ -0,0 +1,33 @@ ++/* ++ * uImage support added by Marc Andre Tanner <mat at brain-dump.org> ++ */ ++#include <stdint.h> ++#include <string.h> ++#include <sys/types.h> ++#include "../../kexec.h" ++#include "kexec-arm.h" ++#include "kexec-uImage-arm.h" ++ ++int uImage_arm_probe(const char *buf, off_t len) ++{ ++ struct image_header header; ++ ++ if (len < sizeof(header)) ++ return -1; ++ ++ memcpy(&header, buf, sizeof(header)); ++ ++ if (cpu_to_be32(header.ih_magic) != IH_MAGIC) ++ return -1; ++ ++ /* XXX: check CRC Checksum? */ ++ ++ return 0; ++} ++ ++int uImage_arm_load(int argc, char **argv, const char *buf, off_t len, ++ struct kexec_info *info) ++{ ++ return zImage_arm_load(argc, argv, buf + sizeof(struct image_header), ++ len - sizeof(struct image_header), info); ++} +diff --git a/kexec/arch/arm/kexec-uImage-arm.h b/kexec/arch/arm/kexec-uImage-arm.h +new file mode 100644 +index 0000000..b9079a4 +--- /dev/null ++++ b/kexec/arch/arm/kexec-uImage-arm.h +@@ -0,0 +1,161 @@ ++/* ++ * (C) Copyright 2000-2005 ++ * Wolfgang Denk, DENX Software Engineering, wd at denx.de. ++ * ++ * See file CREDITS for list of people who contributed to this ++ * project. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of ++ * the License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, ++ * MA 02111-1307 USA ++ * ++ ******************************************************************** ++ * NOTE: This header file defines an interface to U-Boot. Including ++ * this (unmodified) header file in another file is considered normal ++ * use of U-Boot, and does *not* fall under the heading of "derived ++ * work". ++ ******************************************************************** ++ */ ++ ++#ifndef __IMAGE_H__ ++#define __IMAGE_H__ ++ ++/* ++ * Operating System Codes ++ */ ++#define IH_OS_INVALID 0 /* Invalid OS */ ++#define IH_OS_OPENBSD 1 /* OpenBSD */ ++#define IH_OS_NETBSD 2 /* NetBSD */ ++#define IH_OS_FREEBSD 3 /* FreeBSD */ ++#define IH_OS_4_4BSD 4 /* 4.4BSD */ ++#define IH_OS_LINUX 5 /* Linux */ ++#define IH_OS_SVR4 6 /* SVR4 */ ++#define IH_OS_ESIX 7 /* Esix */ ++#define IH_OS_SOLARIS 8 /* Solaris */ ++#define IH_OS_IRIX 9 /* Irix */ ++#define IH_OS_SCO 10 /* SCO */ ++#define IH_OS_DELL 11 /* Dell */ ++#define IH_OS_NCR 12 /* NCR */ ++#define IH_OS_LYNXOS 13 /* LynxOS */ ++#define IH_OS_VXWORKS 14 /* VxWorks */ ++#define IH_OS_PSOS 15 /* pSOS */ ++#define IH_OS_QNX 16 /* QNX */ ++#define IH_OS_U_BOOT 17 /* Firmware */ ++#define IH_OS_RTEMS 18 /* RTEMS */ ++#define IH_OS_ARTOS 19 /* ARTOS */ ++#define IH_OS_UNITY 20 /* Unity OS */ ++ ++/* ++ * CPU Architecture Codes (supported by Linux) ++ */ ++#define IH_CPU_INVALID 0 /* Invalid CPU */ ++#define IH_CPU_ALPHA 1 /* Alpha */ ++#define IH_CPU_ARM 2 /* ARM */ ++#define IH_CPU_I386 3 /* Intel x86 */ ++#define IH_CPU_IA64 4 /* IA64 */ ++#define IH_CPU_MIPS 5 /* MIPS */ ++#define IH_CPU_MIPS64 6 /* MIPS 64 Bit */ ++#define IH_CPU_PPC 7 /* PowerPC */ ++#define IH_CPU_S390 8 /* IBM S390 */ ++#define IH_CPU_SH 9 /* SuperH */ ++#define IH_CPU_SPARC 10 /* Sparc */ ++#define IH_CPU_SPARC64 11 /* Sparc 64 Bit */ ++#define IH_CPU_M68K 12 /* M68K */ ++#define IH_CPU_NIOS 13 /* Nios-32 */ ++#define IH_CPU_MICROBLAZE 14 /* MicroBlaze */ ++#define IH_CPU_NIOS2 15 /* Nios-II */ ++#define IH_CPU_BLACKFIN 16 /* Blackfin */ ++#define IH_CPU_AVR32 17 /* AVR32 */ ++ ++/* ++ * Image Types ++ * ++ * "Standalone Programs" are directly runnable in the environment ++ * provided by U-Boot; it is expected that (if they behave ++ * well) you can continue to work in U-Boot after return from ++ * the Standalone Program. ++ * "OS Kernel Images" are usually images of some Embedded OS which ++ * will take over control completely. Usually these programs ++ * will install their own set of exception handlers, device ++ * drivers, set up the MMU, etc. - this means, that you cannot ++ * expect to re-enter U-Boot except by resetting the CPU. ++ * "RAMDisk Images" are more or less just data blocks, and their ++ * parameters (address, size) are passed to an OS kernel that is ++ * being started. ++ * "Multi-File Images" contain several images, typically an OS ++ * (Linux) kernel image and one or more data images like ++ * RAMDisks. This construct is useful for instance when you want ++ * to boot over the network using BOOTP etc., where the boot ++ * server provides just a single image file, but you want to get ++ * for instance an OS kernel and a RAMDisk image. ++ * ++ * "Multi-File Images" start with a list of image sizes, each ++ * image size (in bytes) specified by an "uint32_t" in network ++ * byte order. This list is terminated by an "(uint32_t)0". ++ * Immediately after the terminating 0 follow the images, one by ++ * one, all aligned on "uint32_t" boundaries (size rounded up to ++ * a multiple of 4 bytes - except for the last file). ++ * ++ * "Firmware Images" are binary images containing firmware (like ++ * U-Boot or FPGA images) which usually will be programmed to ++ * flash memory. ++ * ++ * "Script files" are command sequences that will be executed by ++ * U-Boot's command interpreter; this feature is especially ++ * useful when you configure U-Boot to use a real shell (hush) ++ * as command interpreter (=> Shell Scripts). ++ */ ++ ++#define IH_TYPE_INVALID 0 /* Invalid Image */ ++#define IH_TYPE_STANDALONE 1 /* Standalone Program */ ++#define IH_TYPE_KERNEL 2 /* OS Kernel Image */ ++#define IH_TYPE_RAMDISK 3 /* RAMDisk Image */ ++#define IH_TYPE_MULTI 4 /* Multi-File Image */ ++#define IH_TYPE_FIRMWARE 5 /* Firmware Image */ ++#define IH_TYPE_SCRIPT 6 /* Script file */ ++#define IH_TYPE_FILESYSTEM 7 /* Filesystem Image (any type) */ ++#define IH_TYPE_FLATDT 8 /* Binary Flat Device Tree Blob */ ++ ++/* ++ * Compression Types ++ */ ++#define IH_COMP_NONE 0 /* No Compression Used */ ++#define IH_COMP_GZIP 1 /* gzip Compression Used */ ++#define IH_COMP_BZIP2 2 /* bzip2 Compression Used */ ++#define IH_COMP_LZMA 3 /* lzma Compression Used */ ++ ++#define IH_MAGIC 0x27051956 /* Image Magic Number */ ++#define IH_NMLEN 32 /* Image Name Length */ ++ ++/* ++ * all data in network byte order (aka natural aka bigendian) ++ */ ++ ++typedef struct image_header { ++ uint32_t ih_magic; /* Image Header Magic Number */ ++ uint32_t ih_hcrc; /* Image Header CRC Checksum */ ++ uint32_t ih_time; /* Image Creation Timestamp */ ++ uint32_t ih_size; /* Image Data Size */ ++ uint32_t ih_load; /* Data Load Address */ ++ uint32_t ih_ep; /* Entry Point Address */ ++ uint32_t ih_dcrc; /* Image Data CRC Checksum */ ++ uint8_t ih_os; /* Operating System */ ++ uint8_t ih_arch; /* CPU architecture */ ++ uint8_t ih_type; /* Image Type */ ++ uint8_t ih_comp; /* Compression Type */ ++ uint8_t ih_name[IH_NMLEN]; /* Image Name */ ++} image_header_t; ++ ++ ++#endif /* __IMAGE_H__ */ +-- +1.6.4.4 + diff --git a/recipes/kexec-tools/files/kexec-tools-2-headers.patch b/recipes/kexec-tools/files/kexec-tools-2-headers.patch new file mode 100644 index 0000000000..091e12d9a8 --- /dev/null +++ b/recipes/kexec-tools/files/kexec-tools-2-headers.patch @@ -0,0 +1,99 @@ +Index: kexec-tools-2.0.1/purgatory/arch/arm/include/limits.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ kexec-tools-2.0.1/purgatory/arch/arm/include/limits.h 2006-02-06 18:28:37.031096672 +0100 +@@ -0,0 +1,58 @@ ++#ifndef LIMITS_H ++#define LIMITS_H 1 ++ ++ ++/* Number of bits in a `char' */ ++#define CHAR_BIT 8 ++ ++/* Minimum and maximum values a `signed char' can hold */ ++#define SCHAR_MIN (-128) ++#define SCHAR_MAX 127 ++ ++/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */ ++#define UCHAR_MAX 255 ++ ++/* Minimum and maximum values a `char' can hold */ ++#define CHAR_MIN SCHAR_MIN ++#define CHAR_MAX SCHAR_MAX ++ ++/* Minimum and maximum values a `signed short int' can hold */ ++#define SHRT_MIN (-32768) ++#define SHRT_MAX 32767 ++ ++/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */ ++#define USHRT_MAX 65535 ++ ++ ++/* Minimum and maximum values a `signed int' can hold */ ++#define INT_MIN (-INT_MAX - 1) ++#define INT_MAX 2147483647 ++ ++/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ ++#define UINT_MAX 4294967295U ++ ++ ++/* Minimum and maximum values a `signed int' can hold */ ++#define INT_MIN (-INT_MAX - 1) ++#define INT_MAX 2147483647 ++ ++/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ ++#define UINT_MAX 4294967295U ++ ++/* Minimum and maximum values a `signed long' can hold */ ++#define LONG_MAX 2147483647L ++#define LONG_MIN (-LONG_MAX - 1L) ++ ++/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */ ++#define ULONG_MAX 4294967295UL ++ ++/* Minimum and maximum values a `signed long long' can hold */ ++#define LLONG_MAX 9223372036854775807LL ++#define LLONG_MIN (-LONG_MAX - 1LL) ++ ++ ++/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */ ++#define ULLONG_MAX 18446744073709551615ULL ++ ++ ++#endif /* LIMITS_H */ +Index: kexec-tools-2.0.1/purgatory/arch/arm/include/stdint.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ kexec-tools-2.0.1/purgatory/arch/arm/include/stdint.h 2006-02-06 18:28:37.031096672 +0100 +@@ -0,0 +1,31 @@ ++#ifndef STDINT_H ++#define STDINT_H ++ ++/* +typedef unsigned long size_t; */ ++ ++typedef unsigned char uint8_t; ++typedef unsigned short uint16_t; ++typedef unsigned int uint32_t; ++typedef unsigned long long uint64_t; ++ ++typedef signed char int8_t; ++typedef signed short int16_t; ++typedef signed int int32_t; ++typedef signed long long int64_t; ++ ++/* Types for `void *' pointers. */ ++#if __WORDSIZE == 64 ++# ifndef __intptr_t_defined ++typedef long int intptr_t; ++# define __intptr_t_defined ++# endif ++typedef unsigned long int uintptr_t; ++#else ++# ifndef __intptr_t_defined ++typedef int intptr_t; ++# define __intptr_t_defined ++# endif ++typedef unsigned int uintptr_t; ++#endif ++ ++#endif /* STDINT_H */ diff --git a/recipes/kexec-tools/files/kexec-tools-2-klibc.patch b/recipes/kexec-tools/files/kexec-tools-2-klibc.patch new file mode 100644 index 0000000000..2008829b60 --- /dev/null +++ b/recipes/kexec-tools/files/kexec-tools-2-klibc.patch @@ -0,0 +1,295 @@ +Index: kexec-tools-2.0.1/kexec/kexec-elf-rel.c +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/kexec-elf-rel.c 2009-09-24 14:15:34.025828340 +0100 ++++ kexec-tools-2.0.1/kexec/kexec-elf-rel.c 2009-09-24 14:15:47.030825302 +0100 +@@ -4,7 +4,7 @@ + #include <stdio.h> + #include <errno.h> + #include <stdlib.h> +-#include "elf.h" ++#include "../include/elf.h" + #include <boot/elf_boot.h> + #include "kexec.h" + #include "kexec-elf.h" + +Index: kexec-tools-2.0.1/kexec/ifdown.c +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/ifdown.c 2009-09-24 14:15:34.025828340 +0100 ++++ kexec-tools-2.0.1/kexec/ifdown.c 2009-09-24 14:15:47.014827381 +0100 +@@ -14,7 +14,7 @@ + #include <sys/ioctl.h> + #include <sys/socket.h> + #include <sys/time.h> +-#include <sys/errno.h> ++#include <errno.h> + + #include <net/if.h> + #include <netinet/in.h> + +Index: kexec-tools-2.0.1/kexec/kexec-syscall.h +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/kexec-syscall.h 2009-09-24 14:15:46.950825917 +0100 ++++ kexec-tools-2.0.1/kexec/kexec-syscall.h 2009-09-24 14:15:47.030825302 +0100 +@@ -2,7 +2,7 @@ + #define KEXEC_SYSCALL_H + + #define __LIBRARY__ +-#include <syscall.h> ++/*#include <syscall.h>*/ + #include <sys/syscall.h> + #include <unistd.h> + +@@ -21,7 +21,7 @@ + #define LINUX_REBOOT_CMD_KEXEC_OLD 0x81726354 + #define LINUX_REBOOT_CMD_KEXEC_OLD2 0x18263645 + #define LINUX_REBOOT_CMD_KEXEC 0x45584543 +- ++/* + #ifdef __i386__ + #define __NR_kexec_load 283 + #endif +@@ -60,19 +60,20 @@ + #ifndef __NR_kexec_load + #error Unknown processor architecture. Needs a kexec_load syscall number. + #endif +- ++*/ + struct kexec_segment; +- ++/* + static inline long kexec_load(void *entry, unsigned long nr_segments, + struct kexec_segment *segments, unsigned long flags) + { + return (long) syscall(__NR_kexec_load, entry, nr_segments, segments, flags); + } +- ++*/ + static inline long kexec_reboot(void) + { +- return (long) syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0); ++ //return (long) syscall(__NR_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0); ++ return __reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_KEXEC, 0); + } + + + #define KEXEC_ON_CRASH<><------>0x00000001 + +Index: kexec-tools-2.0.1/kexec/crashdump.c +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/crashdump.c 2008-10-31 03:00:38.000000000 +0100 ++++ kexec-tools-2.0.1/kexec/crashdump.c 2009-09-26 11:16:27.000000000 +0200 +@@ -26,7 +26,7 @@ + #include <sys/types.h> + #include <sys/stat.h> + #include <unistd.h> +-#include <elf.h> ++#include "../../../include/elf.h" + #include "kexec.h" + #include "crashdump.h" + #include "kexec-syscall.h" + +Index: kexec-tools-2.0.1/kexec/crashdump-xen.c +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/crashdump-xen.c 2008-07-15 02:46:43.000000000 +0200 ++++ kexec-tools-2.0.1/kexec/crashdump-xen.c 2009-09-26 11:16:41.000000000 +0200 +@@ -3,7 +3,7 @@ + #include <stdarg.h> + #include <string.h> + #include <stdlib.h> +-#include <elf.h> ++#include "../../../include/elf.h" + #include <errno.h> + #include <limits.h> + #include <sys/types.h> + +Index: kexec-tools-2.0.1/kexec/crashdump-elf.c +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/crashdump-elf.c 2008-10-31 03:00:38.000000000 +0100 ++++ kexec-tools-2.0.1/kexec/crashdump-elf.c 2009-09-26 11:17:57.000000000 +0200 +@@ -47,7 +47,8 @@ + if (xen_present()) + nr_cpus = xen_get_nr_phys_cpus(); + else +- nr_cpus = sysconf(_SC_NPROCESSORS_CONF); ++ /*nr_cpus = sysconf(_SC_NPROCESSORS_CONF);*/ ++ nr_cpus = 1; + + if (nr_cpus < 0) { + return -1; + +Index: kexec-tools-2.0.1/kexec/arch/arm/kexec-elf-rel-arm.c +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/arch/arm/kexec-elf-rel-arm.c 2009-04-24 14:15:46.934825202 +0100 ++++ kexec-tools-2.0.1/kexec/arch/arm/kexec-elf-rel-arm.c 2009-09-24 14:15:47.014827381 +0100 +@@ -1,5 +1,5 @@ + #include <stdio.h> +-#include <elf.h> ++#include "../../../include/elf.h" + #include "../../kexec.h" + #include "../../kexec-elf.h" + +Index: kexec-tools-2.0.1/purgatory/string.c +=================================================================== +--- kexec-tools-2.0.1.orig/purgatory/string.c 2008-05-16 13:28:19.000000000 +0200 ++++ kexec-tools-2.0.1/purgatory/string.c 2009-09-16 17:49:04.000000000 +0200 +@@ -1,5 +1,5 @@ + #include <stddef.h> +-#include <string.h> ++/* #include <string.h> */ + + size_t strnlen(const char *s, size_t max) + { + +Index: kexec-tools-2.0.1/kexec/kexec.c +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/kexec.c 2008-02-24 14:15:46.950825917 +0100 ++++ kexec-tools-2.0.1/kexec/kexec.c 2009-10-06 00:37:01.000000000 +0200 +@@ -38,9 +38,9 @@ + + #include "config.h" + +-#ifdef HAVE_LIBZ +-#include <zlib.h> +-#endif ++#include "zlib.h" ++ ++ + #include <sha256.h> + #include "kexec.h" + #include "kexec-syscall.h" +@@ -554,7 +554,7 @@ + return buf; + } + +-#if HAVE_LIBZ ++#if 1 + char *slurp_decompress_file(const char *filename, off_t *r_size) + { + gzFile fp; + +Index: kexec-tools-2.0.1/kexec/arch/arm/kexec-zImage-arm.c +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/arch/arm/kexec-zImage-arm.c 2009-04-24 14:15:46.982825391 +0100 ++++ kexec-tools-2.0.1/kexec/arch/arm/kexec-zImage-arm.c 2009-09-26 01:58:20.838624318 +0200 +@@ -2,6 +2,10 @@ + * - 08/21/2007 ATAG support added by Uli Luckas <u.luckas@road.de> + * + */ ++ ++/* work around for linux header files */ ++#define __deprecated ++ + #define _GNU_SOURCE + #define _XOPEN_SOURCE + #include <stdio.h> +@@ -110,13 +114,13 @@ + } + + fread(buf, sizeof(buf[1]), BOOT_PARAMS_SIZE, fp); +- if (ferror(fp)) { ++/* if (ferror(fp)) { + fprintf(stderr, "Cannot read %s: %s\n", + fn, strerror(errno)); + fclose(fp); + return NULL; + } +- ++*/ + fclose(fp); + return (struct tag *) buf; + } + +Index: kexec-tools-2.0.1/kexec/kexec-elf-boot.c +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/kexec-elf-boot.c 2009-05-16 13:28:19.000000000 +0200 ++++ kexec-tools-2.0.1/kexec/kexec-elf-boot.c 2009-09-16 11:13:28.000000000 +0200 +@@ -22,7 +22,7 @@ + #include <string.h> + #include <stdlib.h> + #include <errno.h> +-#include <elf.h> ++#include "../include/elf.h" + #include <boot/elf_boot.h> + #include <ip_checksum.h> + #include <x86/x86-linux.h> + +Index: kexec-tools-2.0.1/kdump/kdump.c +=================================================================== +--- kexec-tools-2.0.1.orig/kdump/kdump.c 2009-05-16 13:28:19.000000000 +0200 ++++ kexec-tools-2.0.1/kdump/kdump.c 2009-09-16 11:13:08.000000000 +0200 +@@ -8,7 +8,7 @@ + #include <sys/stat.h> + #include <fcntl.h> + #include <endian.h> +-#include <elf.h> ++#include "../include/elf.h" + + #if !defined(__BYTE_ORDER) || !defined(__LITTLE_ENDIAN) || !defined(__BIG_ENDIAN) + #error Endian defines missing + +Index: kexec-tools-2.0.1/kexec/kexec.h +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/kexec.h 2008-05-16 13:28:19.000000000 +0200 ++++ kexec-tools-2.0.1/kexec/kexec.h 2009-09-16 17:32:15.000000000 +0200 +@@ -203,7 +203,7 @@ + extern char *slurp_file(const char *filename, off_t *r_size); + extern char *slurp_file_len(const char *filename, off_t size); + extern char *slurp_decompress_file(const char *filename, off_t *r_size); +-extern unsigned long virt_to_phys(unsigned long addr); ++/* extern unsigned long virt_to_phys(unsigned long addr); */ + extern void add_segment(struct kexec_info *info, + const void *buf, size_t bufsz, unsigned long base, size_t memsz); + extern void add_segment_phys_virt(struct kexec_info *info, + +Index: kexec-tools-2.0.1/Makefile.in +=================================================================== +--- kexec-tools-2.0.1.orig/Makefile.in 2009-09-29 23:49:47.000000000 +0200 ++++ kexec-tools-2.0.1/Makefile.in 2009-09-29 23:49:09.000000000 +0200 +@@ -46,7 +46,7 @@ + # where necessary. + CPPFLAGS = @CPPFLAGS@ -I$(srcdir)/include -I$(srcdir)/util_lib/include \ + -Iinclude/ +-CFLAGS = @CFLAGS@ -fno-strict-aliasing -Wall -Wstrict-prototypes ++CFLAGS = @CFLAGS@ -static -fno-strict-aliasing -Wall -Wstrict-prototypes + PURGATORY_EXTRA_CFLAGS = @PURGATORY_EXTRA_CFLAGS@ + ASFLAGS = @ASFLAGS@ + LDFLAGS = @LDFLAGS@ + +Index: kexec-tools-2.0.1/util_lib/include/sha256.h +=================================================================== +--- kexec-tools-2.0.1.orig/util_lib/include/sha256.h 2008-07-15 02:46:43.000000000 +0200 ++++ kexec-tools-2.0.1/util_lib/include/sha256.h 2009-10-02 18:28:45.000000000 +0200 +@@ -1,7 +1,8 @@ + #ifndef SHA256_H + #define SHA256_H + +-#include <sys/types.h> ++//#include <sys/types.h> ++#include <stddef.h> + #include <stdint.h> + + typedef struct + +Index: kexec-tools-2.0.1/purgatory/Makefile +=================================================================== +--- kexec-tools-2.0.1.orig/purgatory/Makefile 2008-10-09 00:32:14.000000000 +0200 ++++ kexec-tools-2.0.1.orig/purgatory/Makefile 2009-10-03 00:28:45.000000000 +0200 +@@ -47,7 +47,7 @@ + $(PURGATORY): CC=$(TARGET_CC) + $(PURGATORY): CFLAGS+=$(PURGATORY_EXTRA_CFLAGS) \ + $($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ +- -Os -fno-builtin -ffreestanding ++ -Os -fno-builtin -ffreestanding -nostdinc + + $(PURGATORY): CPPFLAGS=$($(ARCH)_PURGATORY_EXTRA_CFLAGS) \ + -I$(srcdir)/purgatory/include \ +@@ -60,7 +60,8 @@ + + $(PURGATORY): $(PURGATORY_OBJS) + $(MKDIR) -p $(@D) +- $(CC) $(LDFLAGS) -o $@ $^ ++# $(CC) $(LDFLAGS) -o $@ $^ ++ $(LD) $(LDFLAGS) -o $@ $^ + + # $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB) + diff --git a/recipes/kexec-tools/files/kexec-tools-arm.patch b/recipes/kexec-tools/files/kexec-tools-arm.patch new file mode 100644 index 0000000000..6e43b76096 --- /dev/null +++ b/recipes/kexec-tools/files/kexec-tools-arm.patch @@ -0,0 +1,417 @@ +Index: kexec-tools-1.101/kexec/arch/arm/include/arch/options.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ kexec-tools-1.101/kexec/arch/arm/include/arch/options.h 2006-02-06 18:28:37.027097280 +0100 +@@ -0,0 +1,11 @@ ++#ifndef KEXEC_ARCH_ARM_OPTIONS_H ++#define KEXEC_ARCH_ARM_OPTIONS_H ++ ++#define OPT_ARCH_MAX (OPT_MAX+0) ++ ++#define KEXEC_ARCH_OPTIONS \ ++ KEXEC_OPTIONS \ ++ ++#define KEXEC_ARCH_OPT_STR KEXEC_OPT_STR "" ++ ++#endif /* KEXEC_ARCH_ARM_OPTIONS_H */ +Index: kexec-tools-1.101/kexec/arch/arm/kexec-arm.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ kexec-tools-1.101/kexec/arch/arm/kexec-arm.c 2006-02-06 18:28:37.027097280 +0100 +@@ -0,0 +1,138 @@ ++/* ++ * kexec: Linux boots Linux ++ * ++ * modified from kexec-ppc.c ++ * ++ */ ++ ++#define _GNU_SOURCE ++#include <stddef.h> ++#include <stdio.h> ++#include <errno.h> ++#include <stdint.h> ++#include <string.h> ++#include <getopt.h> ++#include <sys/utsname.h> ++#include "../../kexec.h" ++#include "../../kexec-syscall.h" ++#include "kexec-arm.h" ++#include <arch/options.h> ++ ++#define MAX_MEMORY_RANGES 64 ++#define MAX_LINE 160 ++static struct memory_range memory_range[MAX_MEMORY_RANGES]; ++ ++/* Return a sorted list of available memory ranges. */ ++int get_memory_ranges(struct memory_range **range, int *ranges) ++{ ++ const char iomem[]= "/proc/iomem"; ++ int memory_ranges = 0; ++ char line[MAX_LINE]; ++ FILE *fp; ++ fp = fopen(iomem, "r"); ++ if (!fp) { ++ fprintf(stderr, "Cannot open %s: %s\n", ++ iomem, strerror(errno)); ++ return -1; ++ } ++ ++ while(fgets(line, sizeof(line), fp) != 0) { ++ unsigned long long start, end; ++ char *str; ++ int type; ++ int consumed; ++ int count; ++ if (memory_ranges >= MAX_MEMORY_RANGES) ++ break; ++ count = sscanf(line, "%Lx-%Lx : %n", ++ &start, &end, &consumed); ++ if (count != 2) ++ continue; ++ str = line + consumed; ++ end = end + 1; ++ ++ if (memcmp(str, "System RAM\n", 11) == 0) { ++ type = RANGE_RAM; ++ } ++ else if (memcmp(str, "reserved\n", 9) == 0) { ++ type = RANGE_RESERVED; ++ } ++ else { ++ continue; ++ } ++ ++ memory_range[memory_ranges].start = start; ++ memory_range[memory_ranges].end = end; ++ memory_range[memory_ranges].type = type; ++ memory_ranges++; ++ } ++ fclose(fp); ++ *range = memory_range; ++ *ranges = memory_ranges; ++ return 0; ++} ++ ++/* Supported file types and callbacks */ ++struct file_type file_type[] = { ++ {"zImage", zImage_arm_probe, zImage_arm_load, zImage_arm_usage}, ++}; ++int file_types = sizeof(file_type) / sizeof(file_type[0]); ++ ++ ++void arch_usage(void) ++{ ++} ++ ++static struct { ++} arch_options = { ++}; ++int arch_process_options(int argc, char **argv) ++{ ++ static const struct option options[] = { ++ KEXEC_ARCH_OPTIONS ++ { 0, 0, NULL, 0 }, ++ }; ++ static const char short_options[] = KEXEC_ARCH_OPT_STR; ++ int opt; ++ unsigned long value; ++ char *end; ++ ++ opterr = 0; /* Don't complain about unrecognized options here */ ++ while((opt = getopt_long(argc, argv, short_options, options, 0)) != -1) { ++ switch(opt) { ++ default: ++ break; ++ } ++ } ++ /* Reset getopt for the next pass; called in other source modules */ ++ opterr = 1; ++ optind = 1; ++ return 0; ++} ++ ++int arch_compat_trampoline(struct kexec_info *info, unsigned long *flags) ++{ ++ int result; ++ struct utsname utsname; ++ result = uname(&utsname); ++ if (result < 0) { ++ fprintf(stderr, "uname failed: %s\n", ++ strerror(errno)); ++ return -1; ++ } ++ if (strncmp(utsname.machine, "arm",3) == 0) ++ { ++ *flags |= KEXEC_ARCH_ARM; ++ } ++ else { ++ fprintf(stderr, "Unsupported machine type: %s\n", ++ utsname.machine); ++ return -1; ++ } ++ return 0; ++} ++ ++void arch_update_purgatory(struct kexec_info *info) ++{ ++} ++ +Index: kexec-tools-1.101/kexec/arch/arm/kexec-arm.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ kexec-tools-1.101/kexec/arch/arm/kexec-arm.h 2006-02-06 18:28:37.028097128 +0100 +@@ -0,0 +1,9 @@ ++#ifndef KEXEC_ARM_H ++#define KEXEC_ARM_H ++ ++int zImage_arm_probe(const char *buf, off_t len); ++int zImage_arm_load(int argc, char **argv, const char *buf, off_t len, ++ struct kexec_info *info); ++void zImage_arm_usage(void); ++ ++#endif /* KEXEC_ARM_H */ +Index: kexec-tools-1.101/kexec/arch/arm/kexec-elf-rel-arm.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ kexec-tools-1.101/kexec/arch/arm/kexec-elf-rel-arm.c 2006-02-06 18:28:37.028097128 +0100 +@@ -0,0 +1,35 @@ ++#include <stdio.h> ++#include <elf.h> ++#include "../../kexec.h" ++#include "../../kexec-elf.h" ++ ++int machine_verify_elf_rel(struct mem_ehdr *ehdr) ++{ ++ if (ehdr->ei_data != ELFDATA2MSB) { ++ return 0; ++ } ++ if (ehdr->ei_class != ELFCLASS32) { ++ return 0; ++ } ++ if (ehdr->e_machine != EM_ARM) ++ { ++ return 0; ++ } ++ return 1; ++} ++ ++void machine_apply_elf_rel(struct mem_ehdr *ehdr, unsigned long r_type, ++ void *location, unsigned long address, unsigned long value) ++{ ++ switch(r_type) { ++ case R_ARM_ABS32: ++ *((uint32_t *)location) += value; ++ break; ++ case R_ARM_REL32: ++ *((uint32_t *)location) += value - address; ++ break; ++ default: ++ die("Unknown rel relocation: %lu\n", r_type); ++ break; ++ } ++} +Index: kexec-tools-1.101/kexec/arch/arm/kexec-zImage-arm.c +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ kexec-tools-1.101/kexec/arch/arm/kexec-zImage-arm.c 2006-02-06 18:28:37.028097128 +0100 +@@ -0,0 +1,34 @@ ++#define _GNU_SOURCE ++#include <stdio.h> ++#include <string.h> ++#include <stdlib.h> ++#include <errno.h> ++#include <limits.h> ++#include "../../kexec.h" ++ ++int zImage_arm_probe(const char *buf, off_t len) ++{ ++ /* ++ * Only zImage loading is supported. Do not check if ++ * the buffer is valid kernel image ++ */ ++ return 0; ++} ++void zImage_arm_usage(void) ++{ ++} ++int zImage_arm_load(int argc, char **argv, const char *buf, off_t len, ++ struct kexec_info *info) ++{ ++ unsigned long base; ++ unsigned int offset = 0x8000; /* 32k offset from memory start */ ++ base = locate_hole(info,len+offset,0,0,ULONG_MAX,INT_MAX); ++ if (base == ULONG_MAX) ++ { ++ return -1; ++ } ++ base += offset; ++ add_segment(info,buf,len,base,len); ++ info->entry = (void*)base; ++ return 0; ++} +Index: kexec-tools-1.101/kexec/arch/arm/Makefile +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ kexec-tools-1.101/kexec/arch/arm/Makefile 2006-02-06 18:28:37.028097128 +0100 +@@ -0,0 +1,8 @@ ++# ++# kexec arm (linux booting linux) ++# ++KEXEC_C_SRCS+= kexec/arch/arm/kexec-elf-rel-arm.c ++KEXEC_C_SRCS+= kexec/arch/arm/kexec-zImage-arm.c ++KEXEC_C_SRCS+= kexec/arch/arm/kexec-arm.c ++ ++KEXEC_S_SRCS+= +Index: kexec-tools-1.101/kexec/kexec.c +=================================================================== +--- kexec-tools-1.101.orig/kexec/kexec.c 2005-01-13 14:24:29.000000000 +0100 ++++ kexec-tools-1.101/kexec/kexec.c 2006-02-06 18:28:37.029096976 +0100 +@@ -187,7 +187,7 @@ + } + + /* Compute the free memory ranges */ +- max_mem_ranges = memory_ranges + (info->nr_segments -1); ++ max_mem_ranges = memory_ranges + (info->nr_segments); + mem_range = malloc(max_mem_ranges *sizeof(struct memory_range)); + mem_ranges = 0; + +Index: kexec-tools-1.101/kexec/kexec-syscall.h +=================================================================== +--- kexec-tools-1.101.orig/kexec/kexec-syscall.h 2005-01-06 07:59:50.000000000 +0100 ++++ kexec-tools-1.101/kexec/kexec-syscall.h 2006-02-06 18:28:37.029096976 +0100 +@@ -37,6 +37,9 @@ + #ifdef __x86_64__ + #define __NR_kexec_load 246 + #endif ++#ifdef __arm__ ++#define __NR_kexec_load __NR_SYSCALL_BASE + 347 ++#endif + #ifndef __NR_kexec_load + #error Unknown processor architecture. Needs a kexec_load syscall number. + #endif +@@ -67,6 +70,7 @@ + #define KEXEC_ARCH_PPC (20 << 16) + #define KEXEC_ARCH_PPC64 (21 << 16) + #define KEXEC_ARCH_IA_64 (50 << 16) ++#define KEXEC_ARCH_ARM (40 << 16) + + #define KEXEC_MAX_SEGMENTS 8 + +Index: kexec-tools-1.101/purgatory/arch/arm/include/limits.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ kexec-tools-1.101/purgatory/arch/arm/include/limits.h 2006-02-06 18:28:37.031096672 +0100 +@@ -0,0 +1,58 @@ ++#ifndef LIMITS_H ++#define LIMITS_H 1 ++ ++ ++/* Number of bits in a `char' */ ++#define CHAR_BIT 8 ++ ++/* Minimum and maximum values a `signed char' can hold */ ++#define SCHAR_MIN (-128) ++#define SCHAR_MAX 127 ++ ++/* Maximum value an `unsigned char' can hold. (Minimum is 0.) */ ++#define UCHAR_MAX 255 ++ ++/* Minimum and maximum values a `char' can hold */ ++#define CHAR_MIN SCHAR_MIN ++#define CHAR_MAX SCHAR_MAX ++ ++/* Minimum and maximum values a `signed short int' can hold */ ++#define SHRT_MIN (-32768) ++#define SHRT_MAX 32767 ++ ++/* Maximum value an `unsigned short' can hold. (Minimum is 0.) */ ++#define USHRT_MAX 65535 ++ ++ ++/* Minimum and maximum values a `signed int' can hold */ ++#define INT_MIN (-INT_MAX - 1) ++#define INT_MAX 2147483647 ++ ++/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ ++#define UINT_MAX 4294967295U ++ ++ ++/* Minimum and maximum values a `signed int' can hold */ ++#define INT_MIN (-INT_MAX - 1) ++#define INT_MAX 2147483647 ++ ++/* Maximum value an `unsigned int' can hold. (Minimum is 0.) */ ++#define UINT_MAX 4294967295U ++ ++/* Minimum and maximum values a `signed long' can hold */ ++#define LONG_MAX 2147483647L ++#define LONG_MIN (-LONG_MAX - 1L) ++ ++/* Maximum value an `unsigned long' can hold. (Minimum is 0.) */ ++#define ULONG_MAX 4294967295UL ++ ++/* Minimum and maximum values a `signed long long' can hold */ ++#define LLONG_MAX 9223372036854775807LL ++#define LLONG_MIN (-LONG_MAX - 1LL) ++ ++ ++/* Maximum value an `unsigned long long' can hold. (Minimum is 0.) */ ++#define ULLONG_MAX 18446744073709551615ULL ++ ++ ++#endif /* LIMITS_H */ +Index: kexec-tools-1.101/purgatory/arch/arm/include/stdint.h +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ kexec-tools-1.101/purgatory/arch/arm/include/stdint.h 2006-02-06 18:28:37.031096672 +0100 +@@ -0,0 +1,16 @@ ++#ifndef STDINT_H ++#define STDINT_H ++ ++typedef unsigned long size_t; ++ ++typedef unsigned char uint8_t; ++typedef unsigned short uint16_t; ++typedef unsigned int uint32_t; ++typedef unsigned long long uint64_t; ++ ++typedef signed char int8_t; ++typedef signed short int16_t; ++typedef signed int int32_t; ++typedef signed long long int64_t; ++ ++#endif /* STDINT_H */ +Index: kexec-tools-1.101/purgatory/arch/arm/Makefile +=================================================================== +--- /dev/null 1970-01-01 00:00:00.000000000 +0000 ++++ kexec-tools-1.101/purgatory/arch/arm/Makefile 2006-02-06 18:28:37.031096672 +0100 +@@ -0,0 +1,7 @@ ++# ++# Purgatory arm ++# ++ ++PURGATORY_S_SRCS += ++PURGATORY_C_SRCS += ++ +Index: kexec-tools-1.101/configure.ac +=================================================================== +--- kexec-tools-1.101.orig/configure.ac 2005-01-09 02:36:57.000000000 +0100 ++++ kexec-tools-1.101/configure.ac 2006-02-06 18:30:19.274553304 +0100 +@@ -25,12 +25,15 @@ + powerpc ) + host_cpu="ppc" + ;; ++ arm* ) ++ host_cpu="arm" ++ ;; + * ) + host_cpu="$host_cpu" + ;; + esac + case $host_cpu in +- i386|ppc|x86_64|alpha|ppc64|ia64) ++ i386|ppc|x86_64|alpha|ppc64|ia64|arm) + ;; + * ) + AC_MSG_ERROR([ unsupported architecture $host_cpu]) diff --git a/recipes/kexec-tools/files/no-getline-no-fscanf.patch b/recipes/kexec-tools/files/no-getline-no-fscanf.patch new file mode 100644 index 0000000000..f2a32b4d0d --- /dev/null +++ b/recipes/kexec-tools/files/no-getline-no-fscanf.patch @@ -0,0 +1,69 @@ +Index: kexec-tools-2.0.1/kexec/kexec.c +=================================================================== +--- kexec-tools-2.0.1.orig/kexec/kexec.c 2008-02-24 14:15:46.950825917 +0100 ++++ kexec-tools-2.0.1/kexec/kexec.c 2009-10-07 22:30:58.000000000 +0200 +@@ -933,15 +933,32 @@ + + static int kexec_loaded(void) + { +- int ret; ++ long ret = -1; + FILE *fp; ++ char *p; ++ char line[3]; + + fp = fopen("/sys/kernel/kexec_loaded", "r"); + if (fp == NULL) + return -1; +- fscanf(fp, "%d", &ret); ++/* fscanf(fp, "%d", &ret); */ ++ p = fgets(line, sizeof(line), fp); + fclose(fp); +- return ret; ++ ++ if ( NULL == p) ++ return -1; ++ ++ ret = strtol(line, &p, 10); ++ ++ if (ret > INT_MAX) ++ /* Too long */ ++ return -1; ++ ++ if (p == line) ++ /* No digits were found */ ++ return -1; ++ ++ return (int)ret; + } + + /* +@@ -989,18 +1006,23 @@ + char *get_command_line(void) + { + FILE *fp; +- size_t len; +- char *line = NULL; ++ const int sizeof_line = 1024; ++ char *line = malloc(sizeof_line); /* according to strdup() later */ + + fp = fopen("/proc/cmdline", "r"); + if (!fp) +- die("Could not read /proc/cmdline."); +- getline(&line, &len, fp); ++ die("Could not open /proc/cmdline."); ++ ++ if ( NULL == fgets(line, sizeof(line), fp) ) { ++ die("Can't read /proc/cmdline."); ++ ++/* getline(&line, &len, fp); */ + fclose(fp); ++ } + + if (line) { + /* strip newline */ +- *(line + strlen(line) - 1) = 0; ++ line[strlen(line) - 1] = '\0'; + + remove_parameter(line, "BOOT_IMAGE"); + if (kexec_flags & KEXEC_ON_CRASH) |