Some time ago I build the uClibc-or1k tool chain. I checked my notes and Iâve found the following differences with official guide from OpenCores:
1) Just after cloning linux kernel it is useful to replace any obsolete occurrences of or32 by or1k:
$ cd linux
$ find ./ -type f -name '*' -print | xargs sed -i 's/or32/or1k/'
2) Just after cloning uClibc-or1k check simlink âConfigâ in the root folder of uClibc-or1k. Git often replaces simlinks by text files (the file contains link point). Perhaps you have to restore the simlink by hand in your working copy.
Alternatively. Iâve attached my configuration file for uClibc-or1k. You can try to copy the file into root folder of uClibc-or1k, rename it to â.configâ and run make. The configuration was successfully for me.
PS. Patrick, did you receive my e-mal with Whetstone port I sent you on 16 January?
From: Ziqiang Patrick Huang
Sent: Tuesday, January 20, 2015 9:07 PM
To: Stefan Kristiansson
Cc: openrisc ; ***@lists.opencores.org
Subject: Re: [OpenRISC] Building uClibc-or1k failed: storage size unknown
Stefan,
I did installed with ARCH=openrisc make INSTALL_HDR_PATH=${SYSROOT}/usr headers_install
and have $SYSROOT set to /opt/or1k-toolchain/or1k-linux-uclibc/sys-root as suggested by the instruction.
And I did installed the headers from git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
I double checked everything again, and rebuild after make distclean, sill getting the same error. Is it possible that the upstream linux version is not compatible with the upstream uclibc version ? Or is there anything else I can check to know if I did anything wrong ?
Thanks
Patrick
2015-01-20 10:42 GMT-05:00 Stefan Kristiansson <***@saunalahti.fi>:
On Tue, Jan 20, 2015 at 4:59 PM, Ziqiang Patrick Huang <***@gmail.com> wrote:
Stefan,
I'm not sure where went wrong, I just tried again, start from beginning, following the exact instruction from the website, still ends up in the same place.
Here is the libc/sysdeps/linux/common/posix_fadvise.c where it failed,
#ifdef __NR_arm_fadvise64_64
/* We handle the 64bit alignment issue which is why the arm guys renamed their
* syscall in the first place. So rename it back.
*/
# define __NR_fadvise64_64 __NR_arm_fadvise64_64
#endif
#if defined(__NR_fadvise64) || defined(__NR_fadvise64_64)
# include <fcntl.h>
# include <endian.h>
# include <bits/wordsize.h>
# ifdef __NR_fadvise64_64
int posix_fadvise64(int fd, off64_t offset, off64_t len, int advice);
# endif
int posix_fadvise(int fd, off_t offset, off_t len, int advice)
{
# ifdef __NR_fadvise64_64
return posix_fadvise64(fd, offset, len, advice);
# else
int ret;
INTERNAL_SYSCALL_DECL(err);
# if __WORDSIZE == 64
ret = INTERNAL_SYSCALL(fadvise64, err, 4, fd, offset, len, advice);
# else
# if defined(__UCLIBC_SYSCALL_ALIGN_64BIT__)
ret = INTERNAL_SYSCALL(fadvise64, err, 6, fd, /*unused*/0,
# else
ret = INTERNAL_SYSCALL(fadvise64, err, 5, fd,
# endif
OFF_HI_LO (offset), len, advice);
# endif
if (INTERNAL_SYSCALL_ERROR_P (ret, err))
return INTERNAL_SYSCALL_ERRNO (ret, err);
return 0;
# endif
}
# if defined __UCLIBC_HAS_LFS__ && (!defined __NR_fadvise64_64 || __WORDSIZE == 64)
strong_alias(posix_fadvise,posix_fadvise64)
# endif
#endif
I don't know where it goes wrong for you, but you definitely end up with the wrong kernel headers.
The code path with the 'strong_alias(posix_fadvise,posix_fadvise64)' shouldn't be reached with the upstrean openrisc ones,
since we do define __NR_fadvise64_64 (and __WORDSIZE should not be 64).
Some sanity checks, you are installing the headers with:
ARCH=openrisc make INSTALL_HDR_PATH=${SYSROOT}/usr headers_install
right?
And you do have $SYSROOT set to something?
After you've made sure of that, try doing a 'make distclean' and then try to build again.
Stefan
--
Ziqiang Huang
Electrical and Computer Engineering
Hudson 213c, Duke University
Tel: 919-491-3677
Email: ***@duke.edu
--------------------------------------------------------------------------------