diff mbox

yaboot doesn't build against new e2fsprogs-1.42

Message ID 4FA51FA2.1070604@gentoo.org
State New
Headers show

Commit Message

Joseph Jezak May 5, 2012, 12:40 p.m. UTC
Here's a fixed version of the patch which works with e2fsprogs-1.42.x

-Joe

Comments

acrux May 5, 2012, 8:27 p.m. UTC | #1
On Sat, 05 May 2012 08:40:02 -0400
Joseph Jezak <josejx@gentoo.org> wrote:

> Here's a fixed version of the patch which works with e2fsprogs-1.42.x
> 
> -Joe

thanks Joseph,
now yaboot builds fine against e2fsprogs-1.42 .


cheers,
Nico
acrux May 18, 2012, 5:47 p.m. UTC | #2
On Sat, 05 May 2012 08:40:02 -0400
Joseph Jezak <josejx@gentoo.org> wrote:

> Here's a fixed version of the patch which works with e2fsprogs-1.42.x
> 
> -Joe

mmh.. it seems that latest e2fsprogs.1.42.3 changed again somenthing.... and your patch isn't enough.

[...]
gcc -Os -Os -m32 -mcpu=powerpc -pipe -Wall -I/usr/include -Wno-error -fdiagnostics-show-option -o util/addnote util/addnote.c
ln -sf ybin ybin/mkofboot
ld -Ttext 0x100000 -Bstatic -melf32ppclinux second/crt0.o second/yaboot.o second/cache.o second/prom.o second/file.o second/partition.o second/fs.o second/cfg.o second/setjmp.o second/cmdline.o second/fs_of.o second/fs_ext2.o second/fs_iso.o second/fs_swap.o second/iso_util.o lib/nonstd.o lib/nosys.o lib/string.o lib/strtol.o lib/vsprintf.o lib/ctype.o lib/malloc.o lib/strstr.o second/md5.o second/fs_xfs.o second/fs_reiserfs.o -lext2fs `gcc -m32 -print-libgcc-file-name` -o second/yaboot
/usr/lib/libext2fs.a(getsectsize.o): In function `ext2fs_get_device_sectsize':
(.text+0x3c): undefined reference to `ioctl'
/usr/lib/libext2fs.a(getsectsize.o): In function `ext2fs_get_dio_alignment':
(.text+0xc0): undefined reference to `ioctl'
/usr/lib/libext2fs.a(getsectsize.o): In function `ext2fs_get_device_phys_sectsize':
(.text+0x160): undefined reference to `ioctl'
make: *** [yaboot] Error 1



cheers,
--nico
Benjamin Herrenschmidt May 18, 2012, 10:27 p.m. UTC | #3
On Fri, 2012-05-18 at 19:47 +0200, acrux wrote:
> On Sat, 05 May 2012 08:40:02 -0400
> Joseph Jezak <josejx@gentoo.org> wrote:
> 
> > Here's a fixed version of the patch which works with e2fsprogs-1.42.x
> > 
> > -Joe
> 
> mmh.. it seems that latest e2fsprogs.1.42.3 changed again somenthing.... and your patch isn't enough.

Can somebody talk to Ted about that ? It's a problematic trend ...

Cheers,
Ben.

> [...]
> gcc -Os -Os -m32 -mcpu=powerpc -pipe -Wall -I/usr/include -Wno-error -fdiagnostics-show-option -o util/addnote util/addnote.c
> ln -sf ybin ybin/mkofboot
> ld -Ttext 0x100000 -Bstatic -melf32ppclinux second/crt0.o second/yaboot.o second/cache.o second/prom.o second/file.o second/partition.o second/fs.o second/cfg.o second/setjmp.o second/cmdline.o second/fs_of.o second/fs_ext2.o second/fs_iso.o second/fs_swap.o second/iso_util.o lib/nonstd.o lib/nosys.o lib/string.o lib/strtol.o lib/vsprintf.o lib/ctype.o lib/malloc.o lib/strstr.o second/md5.o second/fs_xfs.o second/fs_reiserfs.o -lext2fs `gcc -m32 -print-libgcc-file-name` -o second/yaboot
> /usr/lib/libext2fs.a(getsectsize.o): In function `ext2fs_get_device_sectsize':
> (.text+0x3c): undefined reference to `ioctl'
> /usr/lib/libext2fs.a(getsectsize.o): In function `ext2fs_get_dio_alignment':
> (.text+0xc0): undefined reference to `ioctl'
> /usr/lib/libext2fs.a(getsectsize.o): In function `ext2fs_get_device_phys_sectsize':
> (.text+0x160): undefined reference to `ioctl'
> make: *** [yaboot] Error 1
> 
> 
> 
> cheers,
> --nico
Benjamin Herrenschmidt May 18, 2012, 10:37 p.m. UTC | #4
On Fri, 2012-05-18 at 19:47 +0200, acrux wrote:
> On Sat, 05 May 2012 08:40:02 -0400
> Joseph Jezak <josejx@gentoo.org> wrote:
> 
> > Here's a fixed version of the patch which works with e2fsprogs-1.42.x
> > 
> > -Joe
> mmh.. it seems that latest e2fsprogs.1.42.3 changed again somenthing.... and your patch isn't enough.

Ok, I've been talking to Ted, I'll dig a bit more next week. It might
help to --disable-direct-io when building libext2.

In the end, we might have to make a special flavor of libext2
(different ./configure options) to remove the stuff we don't want, and
have the packager build a specific variant for use statically in
bootloaders.

Cheers,
Ben.

> [...]
> gcc -Os -Os -m32 -mcpu=powerpc -pipe -Wall -I/usr/include -Wno-error -fdiagnostics-show-option -o util/addnote util/addnote.c
> ln -sf ybin ybin/mkofboot
> ld -Ttext 0x100000 -Bstatic -melf32ppclinux second/crt0.o second/yaboot.o second/cache.o second/prom.o second/file.o second/partition.o second/fs.o second/cfg.o second/setjmp.o second/cmdline.o second/fs_of.o second/fs_ext2.o second/fs_iso.o second/fs_swap.o second/iso_util.o lib/nonstd.o lib/nosys.o lib/string.o lib/strtol.o lib/vsprintf.o lib/ctype.o lib/malloc.o lib/strstr.o second/md5.o second/fs_xfs.o second/fs_reiserfs.o -lext2fs `gcc -m32 -print-libgcc-file-name` -o second/yaboot
> /usr/lib/libext2fs.a(getsectsize.o): In function `ext2fs_get_device_sectsize':
> (.text+0x3c): undefined reference to `ioctl'
> /usr/lib/libext2fs.a(getsectsize.o): In function `ext2fs_get_dio_alignment':
> (.text+0xc0): undefined reference to `ioctl'
> /usr/lib/libext2fs.a(getsectsize.o): In function `ext2fs_get_device_phys_sectsize':
> (.text+0x160): undefined reference to `ioctl'
> make: *** [yaboot] Error 1
> 
> 
> 
> cheers,
> --nico
acrux May 20, 2012, 3:28 a.m. UTC | #5
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sat, 19 May 2012 08:37:26 +1000
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:

> On Fri, 2012-05-18 at 19:47 +0200, acrux wrote:
> > On Sat, 05 May 2012 08:40:02 -0400
> > Joseph Jezak <josejx@gentoo.org> wrote:
> > 
> > > Here's a fixed version of the patch which works with
> > > e2fsprogs-1.42.x
> > > 
> > > -Joe
> > mmh.. it seems that latest e2fsprogs.1.42.3 changed again
> > somenthing.... and your patch isn't enough.
> 
> Ok, I've been talking to Ted, I'll dig a bit more next week. It might
> help to --disable-direct-io when building libext2.
> 
> In the end, we might have to make a special flavor of libext2
> (different ./configure options) to remove the stuff we don't want, and
> have the packager build a specific variant for use statically in
> bootloaders.
> 

i agree.. altough there isn't a --disable-direct-io feature switch.
I just submitted, for cruxppc, a port that build directly against
a 1.42.2 version:
http://cruxppc.org/viewvc/opt/branches/2.7/yaboot/

cheers,
- --nico
- -- 
GNU/Linux on Power Architecture
CRUX PPC - http://cruxppc.org/

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (GNU/Linux)

iEYEARECAAYFAk+4ZOIACgkQxq34tDeO7LgTfwCdF5weT9bdF+Zsc5jh65PjHet9
QDYAnjg0C+swn/OO3cAt5a9r4zBWuo+3
=yT29
-----END PGP SIGNATURE-----
diff mbox

Patch

diff --git a/lib/malloc.c b/lib/malloc.c
index 0121112..e6b29c4 100644
--- a/lib/malloc.c
+++ b/lib/malloc.c
@@ -64,6 +64,15 @@  void *malloc (unsigned int size)
     return caddr;
 }
 
+/* Calloc wrapper for malloc */
+void *memset(void *s, int c, size_t n);
+void *calloc(size_t nmemb, size_t size) {
+	void *caddr;
+	caddr = malloc(nmemb * size);
+	memset(caddr, 0, nmemb * 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)
diff --git a/lib/nonstd.c b/lib/nonstd.c
index 5aeb0cb..b536180 100644
--- a/lib/nonstd.c
+++ b/lib/nonstd.c
@@ -65,3 +65,147 @@  char *getenv(const char *name)
 {
 	return NULL;
 }
+
+// I tried to use prom functions for these...
+int open(const char *pathname, int flags) {
+	return (int) prom_open((char *)pathname);
+}
+
+int open64(const char *pathname, int flags) {
+	return (int) prom_open((char *)pathname);
+}
+
+int __open64_2 (__const char *__path, int __oflag) {
+	return (int) prom_open((char *)__path);
+}
+
+int read(int fd, void *buf, size_t count) {
+	return prom_read((void *)fd, buf, count);
+}
+
+int close(int fd) {
+	prom_close((void *)fd);
+	return 0;
+}
+
+void exit(int status) {
+	prom_exit();
+	return;
+}
+
+int __printf_chk(int flag, const char *format, ...) {
+	va_list ap;
+	va_start (ap, format);
+	prom_vfprintf (prom_stdout, format, ap);
+	va_end (ap);
+
+	return 0;
+}
+
+int __sprintf_chk(char * str, int flag, size_t strlen, const char * format, ...) {
+	va_list ap;
+	va_start(ap, format);
+	// No sprintf? :(
+	va_end(ap);
+	return 0;
+
+}
+
+int __fprintf_chk(FILE *stream, int flag, const char *format, ...) {
+	va_list ap;
+	va_start (ap, format);
+	prom_vfprintf (prom_stdout, format, ap);
+	va_end (ap);
+
+	return 0;
+}
+
+void *memcpy(void *dest, const void *src, size_t n);
+void *__memcpy_chk(void *dest, const void *src, size_t n, size_t destlen) {
+	return memcpy(dest, src, n);
+}
+
+// But these are all dummy functions
+int __xstat64 (int __ver, const char *__filename, void *__stat_buf) {
+	return 0;
+}
+
+int stat64(const char *path, void *stat_buf) {
+	return 0;
+}
+
+int fstat64(int fildes, void *stat_buf) {
+	return 0;
+}
+
+int __fxstat64 (int __ver, int __filedesc, void *__stat_buf) {
+	return 0;
+}
+
+signed int random(void) {
+	return 0;
+}
+
+void srandom(unsigned int seed) {
+	return;
+}
+
+int rand(void) {
+	return 0;
+}
+
+void srand(unsigned int seed) {
+	return;
+}
+
+unsigned int sleep(unsigned int seconds) {
+	return 0;
+}
+
+int gettimeofday(void *tv, void *tz) {
+	return 0;
+}
+
+long sysconf(int name) {
+	return 0;
+}
+
+int getpagesize(void) {
+	return 0;
+}
+
+int gethostname(char *name, size_t len) {
+	return 0;
+}
+
+int getpid(void) {
+	return 0;
+}
+
+int getuid(void) {
+	return 0;
+}
+
+void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *)) {
+	return;
+}
+
+int * __errno_location(void) {
+	return 0;
+}
+
+int lseek(int fd, int offset, int whence) {
+	return prom_lseek ((void *)fd, whence + offset);
+}
+
+int lseek64(int fd, int offset, int whence) {
+	return prom_lseek ((void *)fd, whence + offset);
+}
+
+size_t fwrite(const void *ptr, size_t size, size_t nmemb, void *stream) {
+	return 0;
+}
+
+
+int stderr = 0;
+int perror = 0;