| Summary: | =sys-boot-yaboot-1.3.16 fails to build against e2fsprogs{-libs}-1.41.14 due to missing posix_memalign() function | ||
|---|---|---|---|
| Product: | Gentoo Linux | Reporter: | Alex Buell <alex.buell> |
| Component: | New packages | Assignee: | PPC Porters <ppc> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | hiyuh.root, ppc64, stylinae |
| Priority: | High | ||
| Version: | 10.1 | ||
| Hardware: | PPC | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Package list: | Runtime testing required: | --- | |
| Attachments: |
yaboot-1.3.16-r1.ebuild w/ patch
yaboot-e2fsprogs-1.41.14.patch |
||
|
Description
Alex Buell
2011-01-20 20:37:42 UTC
This patch needs to be adapted for use with yaboot to provide the missing posix_memalign functionality:
diff -uNr silo-1.4.14/second/fs/ext2.c silo/second/fs/ext2.c
--- a/common/malloc.c
+++ b/common/malloc.c
@@ -27,6 +27,12 @@ static char *malloc_ptr = (char *) MALLOC_BASE;
static char *last_alloc = 0;
+static char *align_ptr_to(char *ptr, unsigned long align)
+{
+ return (char *) ((((unsigned long) ptr) + (align - 1UL)) &
+ ~(align - 1UL));
+}
+
void *malloc (int size)
{
char *caddr;
@@ -34,10 +40,34 @@ void *malloc (int size)
caddr = malloc_ptr;
malloc_ptr += size;
last_alloc = caddr;
- malloc_ptr = (char *) ((((unsigned long) malloc_ptr) + 7) & (~7));
+ malloc_ptr = align_ptr_to(malloc_ptr, 8UL);
return caddr;
}
+int posix_memalign(void **memptr, unsigned long alignment, unsigned long size)
+{
+ char *caddr;
+
+ if (alignment & (alignment - 1UL))
+ return -1;
+ if (alignment & (sizeof(void *) - 1UL))
+ return -1;
+
+ if (size == 0) {
+ *memptr = (void *) 0;
+ return 0;
+ }
+
+ caddr = align_ptr_to(malloc_ptr, alignment);
+ malloc_ptr = (caddr + size);
+ last_alloc = caddr;
+ malloc_ptr = align_ptr_to(malloc_ptr, 8UL);
+
+ *memptr = caddr;
+
+ return 0;
+}
+
void free (void *m)
{
if (m == last_alloc)
I will spin a patch for this within the next few days; I have a big emerge world to finish first on my PPC. Patch and ebuild attached. Please test and mark as stable if OK. Created attachment 260552 [details]
yaboot-1.3.16-r1.ebuild w/ patch
Created attachment 260553 [details, diff]
yaboot-e2fsprogs-1.41.14.patch
Thanks for submitting your patch! Assigning to yaboot maintainers FYI, i tested attached ones on my ~ppc Mac mini and would have to say ITJUSTWORKS(tm). (In reply to comment #7) > FYI, i tested attached ones on my ~ppc Mac mini and would have to say > ITJUSTWORKS(tm). Brilliant, that means I did a good job:) Why haven't we committed this patch yet? Yaboot will not compile without it. ping In CVS, thanks! |