[yaboot] Add fix from Tony Breeds for failing to link against posix_memalign() (closes 689415)
Karsten Hopp
karsten at fedoraproject.org
Tue Apr 12 14:47:03 UTC 2011
commit f9545f5c3c13de34f0c55363b0cc7021d17cb453
Author: Karsten Hopp <karsten at redhat.com>
Date: Tue Apr 12 16:46:13 2011 +0200
Add fix from Tony Breeds for failing to link against posix_memalign() (closes 689415)
yaboot-1.3.16-memalign.patch | 65 ++++++++++++++++++++++++++++++++++++++++++
yaboot.spec | 9 +++++-
2 files changed, 73 insertions(+), 1 deletions(-)
---
diff --git a/yaboot-1.3.16-memalign.patch b/yaboot-1.3.16-memalign.patch
new file mode 100644
index 0000000..43e97af
--- /dev/null
+++ b/yaboot-1.3.16-memalign.patch
@@ -0,0 +1,65 @@
+diff --git a/lib/malloc.c b/lib/malloc.c
+index 81d7717..0121112 100644
+--- a/lib/malloc.c
++++ b/lib/malloc.c
+@@ -23,6 +23,10 @@
+ #include "stddef.h"
+ #include "string.h"
+
++/* Copied from asm-generic/errno-base.h */
++#define ENOMEM 12 /* Out of memory */
++#define EINVAL 22 /* Invalid argument */
++
+ /* Imported functions */
+ extern void prom_printf (char *fmt, ...);
+
+@@ -60,6 +64,49 @@ void *malloc (unsigned int size)
+ return caddr;
+ }
+
++/* Do not fall back to the malloc above as posix_memalign is needed by
++ * external libraries not yaboot */
++int posix_memalign(void **memptr, size_t alignment, size_t size)
++{
++ char *caddr;
++ /* size of allocation including the alignment */
++ size_t alloc_size;
++
++ if (!malloc_ptr)
++ return EINVAL;
++
++ /* Minimal aligment is sizeof(void *) */
++ if (alignment < sizeof(void*))
++ alignment = sizeof(void*);
++
++ /* Check for valid alignment and power of 2 */
++ if ((alignment % sizeof(void*) != 0) || ((alignment-1)&alignment))
++ return EINVAL;
++
++ if (size == 0) {
++ *memptr=NULL;
++ return 0;
++ }
++
++ caddr = (char*)(
++ (size_t)((malloc_ptr + sizeof(int))+(alignment-1)) &
++ (~(alignment-1))
++ );
++
++ alloc_size = size + (caddr - (malloc_ptr+sizeof(int)));
++
++ if ((malloc_ptr + alloc_size + sizeof(int)) > malloc_top)
++ return ENOMEM;
++
++ *(int *)(caddr - sizeof(int)) = size;
++ malloc_ptr += alloc_size + sizeof(int);
++ last_alloc = caddr;
++ malloc_ptr = (char *) ((((unsigned int) malloc_ptr) + 3) & (~3));
++ *memptr=(void*)caddr;
++
++ return 0;
++}
++
+ void *realloc(void *ptr, unsigned int size)
+ {
+ char *caddr, *oaddr = ptr;
diff --git a/yaboot.spec b/yaboot.spec
index f042315..f39fd03 100644
--- a/yaboot.spec
+++ b/yaboot.spec
@@ -1,7 +1,7 @@
Summary: Linux bootloader for Power Macintosh "New World" computers.
Name: yaboot
Version: 1.3.16
-Release: 2%{?dist}
+Release: 3%{?dist}
License: GPLv2+
Group: System Environment/Base
Source: http://yaboot.ozlabs.org/releases/yaboot-%{version}.tar.gz
@@ -50,6 +50,9 @@ Patch43: yaboot-1.3.14-prom_getchars.patch
# Allows yaboot to allocate up to 256MB of memory
Patch44: yaboot-1.3.14-256-RMA.patch
+# Create dummy instance of posix_memalign for e3fsprogs
+Patch45: yaboot-1.3.16-memalign.patch
+
URL: http://yaboot.ozlabs.org/
BuildRoot: %{_tmppath}/%{name}-root
Obsoletes: ybin
@@ -100,6 +103,7 @@ yaboot can also bootload IBM pSeries machines.
%patch42 -p1 -b .iscsi
%patch43 -p1 -b .prom_getchars
%patch44 -p1 -b .256-RMA
+%patch45 -p1 -b .posix
%build
make VERSIONEXTRA='\ (Red Hat %version-%release)' DEBUG=1
@@ -140,6 +144,9 @@ rm -rf $RPM_BUILD_ROOT
%ghost %config(noreplace) %{_sysconfdir}/yaboot.conf
%changelog
+* Tue Apr 12 2011 Tony Breeds <tony at bakeyournoodle.com> - 1.3.16-3
+- Add fix for failing to link against posix_memalign() (closes 689415)
+
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.3.16-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
More information about the scm-commits
mailing list