From d9ec7f1a8d1920dca358dc1f4396d64f055b4275 Mon Sep 17 00:00:00 2001 From: Andrea Adami Date: Mon, 5 Oct 2009 23:31:46 +0200 Subject: kexec-tools_klibc-static_2.0.1: rewrite some functions for klibc compatibility (getline, fscanf). Now it builds...WIP --- recipes/kexec/files/kexec-tools-2-klibc.patch | 43 +++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/recipes/kexec/files/kexec-tools-2-klibc.patch b/recipes/kexec/files/kexec-tools-2-klibc.patch index 581d8a4aa0..43b2ebc173 100644 --- a/recipes/kexec/files/kexec-tools-2-klibc.patch +++ b/recipes/kexec/files/kexec-tools-2-klibc.patch @@ -143,7 +143,7 @@ Index: kexec-tools-2.0.1/purgatory/string.c 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-09-26 01:58:53.545624148 +0200 ++++ kexec-tools-2.0.1/kexec/kexec.c 2009-10-05 23:19:39.000000000 +0200 @@ -38,9 +38,9 @@ #include "config.h" @@ -157,7 +157,8 @@ Index: kexec-tools-2.0.1/kexec/kexec.c #include #include "kexec.h" #include "kexec-syscall.h" -@@ -555,6 +555,6 @@ +@@ -554,7 +554,7 @@ + return buf; } -#if HAVE_LIBZ @@ -165,6 +166,44 @@ Index: kexec-tools-2.0.1/kexec/kexec.c char *slurp_decompress_file(const char *filename, off_t *r_size) { gzFile fp; +@@ -935,11 +935,19 @@ + { + int ret; + FILE *fp; ++ char *endptr; ++ char *line = NULL; + + fp = fopen("/sys/kernel/kexec_loaded", "r"); + if (fp == NULL) + return -1; +- fscanf(fp, "%d", &ret); ++/* fscanf(fp, "%d", &ret); */ ++ ++ if ( NULL == fgets(line, sizeof(line), fp) ) { ++ return -1; ++ ret = strtol(line, &endptr, 10); ++ } ++ + fclose(fp); + return ret; + } +@@ -994,9 +1002,14 @@ + + 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 */ Index: kexec-tools-2.0.1/kexec/arch/arm/kexec-zImage-arm.c =================================================================== -- cgit v1.2.3