Patchwork silo fails to build with e2fsprogs-1.41.14 (undefined references to posix_memalign)

login
register
mail settings
Submitter David Miller
Date Jan. 10, 2011, 7:29 p.m.
Message ID <20110110.112907.235685272.davem@davemloft.net>
Download mbox | patch
Permalink /patch/78196/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

David Miller - Jan. 10, 2011, 7:29 p.m.
From: Raúl Porcel <armin76@gentoo.org>
Date: Mon, 10 Jan 2011 20:10:36 +0100

> Hi,
> 
> SILO fails to build here with e2fsprogs-1.41.14 installed, i'm attaching
> the build log.

I really appreciate how they make libext2 harder and harder to link into
embedded self-contained things like bootloaders over time.

I just pushed the following fix for this:

--------------------
second: Add dummy posix_memalign stubb for libext2

Reported-by: Raúl Porcel <armin76@gentoo.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 second/fs/ext2.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
Raúl Porcel - Jan. 15, 2011, 12:07 p.m.
On 01/10/2011 08:29 PM, David Miller wrote:
> From: Raúl Porcel <armin76@gentoo.org>
> Date: Mon, 10 Jan 2011 20:10:36 +0100
> 
>> Hi,
>>
>> SILO fails to build here with e2fsprogs-1.41.14 installed, i'm attaching
>> the build log.
> 
> I really appreciate how they make libext2 harder and harder to link into
> embedded self-contained things like bootloaders over time.
> 
> I just pushed the following fix for this:
> <snip>


Hi,

Thanks, it builds, but silo fails to work:

Boot device: disk1  File and args:
SILO Version 1.4.14_git2010228_p1

Unknown ext2 error: 4294967295

Fatal error: Unable to open filesystem

Couldn't load /etc/silo.conf
No config file loaded, you can boot just from this command line
Type [prompath;]part/path_to_image [parameters] on the prompt
E.g. /iommu/sbus/espdma/esp/sd@3,0;4/vmlinux root=/dev/sda4
or 2/vmlinux.live (to load vmlinux.live from 2nd partition of boot disk)
boot:


--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alex Buell - Jan. 15, 2011, 12:57 p.m.
On Sat, 2011-01-15 at 13:07 +0100, Raúl Porcel wrote:
> On 01/10/2011 08:29 PM, David Miller wrote:
> > From: Raúl Porcel <armin76@gentoo.org>
> > Date: Mon, 10 Jan 2011 20:10:36 +0100
> > 
> >> Hi,
> >>
> >> SILO fails to build here with e2fsprogs-1.41.14 installed, i'm attaching
> >> the build log.
> > 
> > I really appreciate how they make libext2 harder and harder to link into
> > embedded self-contained things like bootloaders over time.
> > 
> > I just pushed the following fix for this:
> > <snip>
> 
> 
> Hi,
> 
> Thanks, it builds, but silo fails to work:
> 
> Boot device: disk1  File and args:
> SILO Version 1.4.14_git2010228_p1
> 
> Unknown ext2 error: 4294967295
> 
> Fatal error: Unable to open filesystem
> 
> Couldn't load /etc/silo.conf
> No config file loaded, you can boot just from this command line
> Type [prompath;]part/path_to_image [parameters] on the prompt
> E.g. /iommu/sbus/espdma/esp/sd@3,0;4/vmlinux root=/dev/sda4
> or 2/vmlinux.live (to load vmlinux.live from 2nd partition of boot disk)
> boot:

This problem exists with all versions of silo linked against
e2fsprogs-1.41.14. 

I think there is a bug in e2fsprogs as it doesn't seem to properly
handle error codes returned by the posix_memalign() function. It's
either that or a proper implementation of posix_memalign() function
needs to be detected through the configure scripts.
David Miller - Jan. 16, 2011, 5:06 a.m.
From: Alex Buell <alex.buell@munted.org.uk>
Date: Sat, 15 Jan 2011 12:57:09 +0000

> I think there is a bug in e2fsprogs as it doesn't seem to properly
> handle error codes returned by the posix_memalign() function. It's
> either that or a proper implementation of posix_memalign() function
> needs to be detected through the configure scripts.

I think it requires a real properly functioning posix_memalign().

The issue is that the detection occurs when the e2fsprogs package
is built, and in userland's libc there is in fact a full and
functioning posix_memalign().  So e2fsprogs is doing nothing wrong.

The problem is that SILO is linking e2fsprogs into it's limited
environment, and we have to bolt on hacks over time as e2fsprogs
depends upon newer facilities in userland.

I'll try to fix this.
--
To unsubscribe from this list: send the line "unsubscribe sparclinux" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/second/fs/ext2.c b/second/fs/ext2.c
index 57f5e9a..12d00dc 100644
--- a/second/fs/ext2.c
+++ b/second/fs/ext2.c
@@ -163,3 +163,9 @@  void *realloc(void *p, int size)
 {
         return NULL;
 }
+
+int posix_memalign(void **memptr, size_t alignment, size_t size)
+{
+	*memptr = NULL;
+	return -1;
+}