--- lib/ext2fs/ext2fs.h
+++ lib/ext2fs/ext2fs.h
@@ -1205,6 +1205,23 @@
 	return 0;
 }
 
+#if !defined(HAVE_POSIX_MEMALIGN) && defined(HAVE_MEMALIGN)
+#include <malloc.h> /* memalign */
+static int posix_memalign(void **memptr, size_t alignment, size_t size)
+{
+        /* Make sure alignment is correct. */
+        if (alignment % sizeof(void *) != 0)
+            /* Skip these checks because the uClibc' implementation of memalign() func does them for us
+             || !powerof2(alignment / sizeof(void *)) != 0
+             || alignment == 0
+             */
+                return EINVAL;
+        *memptr = memalign(alignment, size);
+
+        return (*memptr != NULL ? 0 : ENOMEM);
+}
+#endif
+
 _INLINE_ errcode_t ext2fs_get_memalign(unsigned long size,
 				       unsigned long align, void *ptr)
 {
