Llink:synology: Difference between revisions

From Lundman Wiki
No edit summary
No edit summary
Line 1: Line 1:
== libdvdread.plus ==
export CTARGET=mipsel-linux-uclibc
export ARCH=mips
rm -rf build
mkdir build
cd build
../binutils-2.17/configure \
--target=$CTARGET \
--prefix=/usr/local/$ARCH/ \
--with-sysroot=/usr/local/$ARCH/$CTARGET \
--disable-werror
make
make install
# It installs things we don't want (and will fail later)
rm -rf /usr/local/$ARCH/{info,lib,man,share}
export PATH=/usr/local/$ARCH/bin:$PATH
cd ../linux-2.6.15.7
yes "" | make ARCH=$ARCH oldconfig prepare
#With 2.6.x, this will probably end in an error because you don't have a gcc
#cross-compiler yet, but you can ignore that.  Just copy over the headers:
mkdir -p /usr/local/$ARCH/$CTARGET/usr/include/
rsync -arv include/linux include/asm-generic /usr/local/$ARCH/$CTARGET/usr/include/
rsync -arv include/asm-$ARCH/ /usr/local/$ARCH/$CTARGET/usr/include/asm
 
cd ../uClibc-0.9.28.3/
make menuconfig
#Target Architecture: mips
#Target Architecture Features and Options:
#  Target Process Architecture: MIPS I
#  Target Process Endianness: Little Endian
#  Target CPU has a memory management unit (MMU): YES
#  Enable floating point number support: YES
#  Target CPU has a floating point unit: NO
#  (/usr/local/mips/mipsel-linux-uclibc/usr) Linux kernel header location
#
#Library Installation Options
#  (/usr/local/mips/mipsel-linux-uclibc) uClibc runtime library directory
#  (/usr/local/mips/mipsel-linux-uclibc/usr) uClibc development environment
#
#uClibc development/debugging options
#  (mipsel-linux-uclibc-) Cross-compiling toolchain prefix
# This command should fail.
make CROSS=mipsel-linux-uclibc- 
# Copy the new include files
rsync -arvL include/ /usr/local/$ARCH/$CTARGET/sys-include
cd ../build/
rm -rf *
../gcc-4.0.4/configure \
--target=$CTARGET \
--prefix=/usr/local/mips \
--with-sysroot=/usr/local/mips/$CTARGET \
--enable-languages=c \
--disable-shared \
--disable-checking \
--disable-werror \
        --disable-__cxa_atexit \
        --enable-target-optspace \
        --disable-nls \
        --enable-multilib \
        --with-float=soft \
        --enable-sjlj-exceptions \
        --disable-threads
make
make install
# Remove the temporary headers, and compile it properly.
rm -rf /usr/local/$ARCH/$CTARGET/sys-include
cd ../uClibc-0.9.28.3/
make CROSS=mipsel-linux-uclibc-
make install
# This bit fixes the C++ issue. But should not be required. TODO: Figure out why
cd /usr/local/$ARCH/$CTARGET/lib/
ln -s ../usr/lib/crt* .
# Now recompile gcc fully.
cd ../build/
rm -rf *
../gcc-4.0.4/configure \
        --target=$CTARGET \
        --prefix=/usr/local/mips \
        --with-sysroot=/usr/local/mips/$CTARGET \
        --enable-languages=c,c++ \
        --enable-shared \
        --disable-checking \
        --disable-werror \
        --disable-__cxa_atexit \
        --enable-target-optspace \
        --disable-nls \
        --enable-multilib \
        --with-float=soft \
        --enable-sjlj-exceptions \
        --enable-threads=posix
# It is likely it will fail on '''__ctype_touplow_t*''', this is quite easy to fix.
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14939
# I went with the #ifdef changes of ../gcc-4.0.4/libstdc++-v3/config/locale/generic/c_locale.h
# and ../gcc-4.0.4/libstdc++-v3/config/os/gnu-linux/ctype_base.h
make
make install


I have made some patches to the regular '''libdvdread''' library used by many developers. Alas, I have had no luck in getting them accepted into the upstream repository, which has forced me to maintain a second version myself.


Patches include:
Unfortunately this will use libc dynamic linker, which is incorrect. So at the moment, use the following line to compile your executables.


  * Bring UDF compatibility from base 1.92, to 2.50. This adds Bluray and BD5 ISO format.
  # gcc -Wl,--dynamic-linker,/lib/ld-uClibc.so.0 -o hello hello.c
* Properly handle UDF chains, instead of assuming they are contiguous, and without gap.
* Move filesizes from 32bit to 64bit.
* Add POSIX style '''opendir(3)''', '''readdir(3)''' API to add the ability to retrieve contents of ISO files & input-devices.
* Add POSIX style '''open(3)''' of non-DVD related files. (Reading playlists, certificates etc)
* Allow API call to set IO handlers. Allowing all IO to libdvdread be developer defined. (Adding RAR support, or FTP perhaps)


I will attempt to find out how to make it use the correct dynamic linker by default.


'''Download pre-patched source archive from:'''
Thanks to '''emveepee''' we now know one way to fix this, although the source line mentioned only sets it to libc if it is otherwise not specified. So there should be a proper way to specify with linker we want. If someone has time to research this, that would be appreciated. For now:


  http://lundman.net/ftp/dvdread/libdvdread-4.2.0.plus.tar.bz2
1. To get around the need to specify the dynamic-linker I found you could be able to modify the default
dynamic-linker in gcc-4.0.4/gcc/config/mips/linux.h
I just modified line 118 to the proper setting rather than applying the patch discussed in the following
url and the problem goes away.
  http://www.busybox.net/lists/uclibc/2004-January/007943.html
2. The soft floating-point functions will not be linked in by default without a patch
http://bugs.busybox.net/view.php?id=1069 which I haven't tried yet but linking in -lgcc_s also
solves the problem.








If you wish to patch the original release yourself, the patches are located here:
=== C200 ===


Download the source package from [http://www.codesourcery.com/sgpp/lite/mips/portal/release886]


=== Patch 1: ===  
export CTARGET=mipsel-linux-gnu
export ARCH=mips-4.3
mkdir build
cd build
../binutils-stable/configure --target=$TARGET --prefix=/usr/local/$ARCH/ --with-sysroot=/usr/local/$ARCH/$CTARGET --disable-werror
make
make install
export PATH=/usr/local/$ARCH/bin:$PATH
rm -rf *    # Delete everything in build directory
../gmp-stable/configure --target=$TARGET --prefix=/usr/local/$ARCH/ --with-sysroot=/usr/local/$ARCH/$CTARGET --disable-werror --disable-shared --disable-nls
make
make install


Handle AD chains correctly, skip gaps, and give full end blocks


http://lundman.net/ftp/dvdread/patches/README.patch1
http://lundman.net/ftp/dvdread/patches/patch1


If you use the package, you need to specify that you wish to build little-endian. This is done with the "-EL" flag. You'd have to give it to gcc, g++, ld etc using CFLAGS=-EL, LDFLAGS=-EL etc. Another option is to make little wrapper files to pass the flag automatically, like:


=== Patch 2: ===
-rwxr-xr-x 1 root root      65 Oct 15  2009 mipsel-linux-gnu-cpp
-rwxr-xr-x 1 root root      65 Oct 15  2009 mipsel-linux-gnu-g++
-rwxr-xr-x 1 root root      65 Oct 15  2009 mipsel-linux-gnu-gcc
-rwxr-xr-x 1 root root      65 Oct 15  2009 mipsel-linux-gnu-gcc-4.3.3
-rwxr-xr-x 1 root root  202404 Apr 13  2009 mips-linux-gnu-cpp
-rwxr-xr-x 1 root root  203588 Apr 13  2009 mips-linux-gnu-g++
-rwxr-xr-x 1 root root  201188 Apr 13  2009 mips-linux-gnu-gcc
-rwxr-xr-x 1 root root  201188 Apr 13  2009 mips-linux-gnu-gcc-4.3.3


File sizes from 32 bit to 64 bit, [http://www.supremeessays.com/ buy best essay], [http://exclusivepapers.com buy best essay]. Handle new FileInfoExt.
# cat /usr/local/mips-4.3/bin/mipsel-linux-gnu-gcc
#!/bin/sh
exe=`echo $0 | sed s/mipsel/mips/g`
exec $exe -EL "$@"


http://lundman.net/ftp/dvdread/patches/README.patch2
For, at least, these files:
http://lundman.net/ftp/dvdread/patches/patch2


 
  mipsel-linux-gnu-addr2line mipsel-linux-gnu-ar mipsel-linux-gnu-as mipsel-linux-gnu-c++ mipsel-linux-gnu-c++filt mipsel-linux-gnu-cpp mipsel-linux-gnu-g++ mipsel-linux-gnu-gcc mipsel-linux-gnu-gcc-4.3.3 mipsel-linux-gnu-gcov mipsel-linux-gnu-gdb mipsel-linux-gnu-gdbtui mipsel-linux-gnu-gprof mipsel-linux-gnu-ld mipsel-linux-gnu-nm mipsel-linux-gnu-objcopy mipsel-linux-gnu-objdump mipsel-linux-gnu-ranlib mipsel-linux-gnu-readelf mipsel-linux-gnu-size mipsel-linux-gnu-strings mipsel-linux-gnu-strip
=== Patch 3: ===
 
Add Directory Content access, reading DVD AACS/ Directory.
 
  http://lundman.net/ftp/dvdread/patches/README.patch3
http://lundman.net/ftp/dvdread/patches/patch3
 
 
=== Patch 4: ===
 
Expose dvd_input handlers as API call.  
 
http://lundman.net/ftp/dvdread/patches/README.patch4
http://lundman.net/ftp/dvdread/patches/patch4

Revision as of 01:41, 6 January 2012

export CTARGET=mipsel-linux-uclibc
export ARCH=mips

rm -rf build
mkdir build
cd build
../binutils-2.17/configure \
	--target=$CTARGET \
	--prefix=/usr/local/$ARCH/ \
	--with-sysroot=/usr/local/$ARCH/$CTARGET \
	--disable-werror
make
make install

# It installs things we don't want (and will fail later)
rm -rf /usr/local/$ARCH/{info,lib,man,share}

export PATH=/usr/local/$ARCH/bin:$PATH


cd ../linux-2.6.15.7
yes "" | make ARCH=$ARCH oldconfig prepare

#With 2.6.x, this will probably end in an error because you don't have a gcc 
#cross-compiler yet, but you can ignore that.  Just copy over the headers:

mkdir -p /usr/local/$ARCH/$CTARGET/usr/include/
rsync -arv include/linux include/asm-generic /usr/local/$ARCH/$CTARGET/usr/include/
rsync -arv include/asm-$ARCH/ /usr/local/$ARCH/$CTARGET/usr/include/asm
 
cd ../uClibc-0.9.28.3/

make menuconfig
#Target Architecture: mips
#Target Architecture Features and Options: 
#  Target Process Architecture: MIPS I
#  Target Process Endianness: Little Endian
#  Target CPU has a memory management unit (MMU): YES
#  Enable floating point number support: YES
#  Target CPU has a floating point unit: NO
#  (/usr/local/mips/mipsel-linux-uclibc/usr) Linux kernel header location
#
#Library Installation Options
#  (/usr/local/mips/mipsel-linux-uclibc) uClibc runtime library directory
#  (/usr/local/mips/mipsel-linux-uclibc/usr) uClibc development environment
#
#uClibc development/debugging options
#  (mipsel-linux-uclibc-) Cross-compiling toolchain prefix

# This command should fail.
make CROSS=mipsel-linux-uclibc-  

# Copy the new include files
rsync -arvL include/ /usr/local/$ARCH/$CTARGET/sys-include


cd ../build/
rm -rf *

../gcc-4.0.4/configure \
	--target=$CTARGET \
	--prefix=/usr/local/mips \
	--with-sysroot=/usr/local/mips/$CTARGET \
	--enable-languages=c \
	--disable-shared \
	--disable-checking \
	--disable-werror \
       --disable-__cxa_atexit \
       --enable-target-optspace \
       --disable-nls \
       --enable-multilib \
       --with-float=soft \
       --enable-sjlj-exceptions \
       --disable-threads

make
make install

# Remove the temporary headers, and compile it properly.
rm -rf /usr/local/$ARCH/$CTARGET/sys-include


cd ../uClibc-0.9.28.3/

make CROSS=mipsel-linux-uclibc-
make install

# This bit fixes the C++ issue. But should not be required. TODO: Figure out why
cd /usr/local/$ARCH/$CTARGET/lib/
ln -s ../usr/lib/crt* .

# Now recompile gcc fully.
cd ../build/
rm -rf *
../gcc-4.0.4/configure \
       --target=$CTARGET \
       --prefix=/usr/local/mips \
       --with-sysroot=/usr/local/mips/$CTARGET \
       --enable-languages=c,c++ \
       --enable-shared \
       --disable-checking \
       --disable-werror \
       --disable-__cxa_atexit \
       --enable-target-optspace \
       --disable-nls \
       --enable-multilib \
       --with-float=soft \
       --enable-sjlj-exceptions \
       --enable-threads=posix


# It is likely it will fail on __ctype_touplow_t*, this is quite easy to fix.
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14939
# I went with the #ifdef changes of ../gcc-4.0.4/libstdc++-v3/config/locale/generic/c_locale.h
# and ../gcc-4.0.4/libstdc++-v3/config/os/gnu-linux/ctype_base.h 

make 
make install


Unfortunately this will use libc dynamic linker, which is incorrect. So at the moment, use the following line to compile your executables.

# gcc -Wl,--dynamic-linker,/lib/ld-uClibc.so.0 -o hello hello.c

I will attempt to find out how to make it use the correct dynamic linker by default.

Thanks to emveepee we now know one way to fix this, although the source line mentioned only sets it to libc if it is otherwise not specified. So there should be a proper way to specify with linker we want. If someone has time to research this, that would be appreciated. For now:

1. To get around the need to specify the dynamic-linker I found you could be able to modify the default 
dynamic-linker in gcc-4.0.4/gcc/config/mips/linux.h

I just modified line 118 to the proper setting rather than applying the patch discussed in the following
url and the problem goes away.

http://www.busybox.net/lists/uclibc/2004-January/007943.html

2. The soft floating-point functions will not be linked in by default without a patch
http://bugs.busybox.net/view.php?id=1069 which I haven't tried yet but linking in -lgcc_s also
solves the problem.



C200

Download the source package from [1]

export CTARGET=mipsel-linux-gnu
export ARCH=mips-4.3
mkdir build
cd build
../binutils-stable/configure --target=$TARGET --prefix=/usr/local/$ARCH/ --with-sysroot=/usr/local/$ARCH/$CTARGET --disable-werror
make
make install
export PATH=/usr/local/$ARCH/bin:$PATH
rm -rf *    # Delete everything in build directory

../gmp-stable/configure --target=$TARGET --prefix=/usr/local/$ARCH/ --with-sysroot=/usr/local/$ARCH/$CTARGET --disable-werror --disable-shared --disable-nls
make
make install


If you use the package, you need to specify that you wish to build little-endian. This is done with the "-EL" flag. You'd have to give it to gcc, g++, ld etc using CFLAGS=-EL, LDFLAGS=-EL etc. Another option is to make little wrapper files to pass the flag automatically, like:

-rwxr-xr-x 1 root root      65 Oct 15  2009 mipsel-linux-gnu-cpp
-rwxr-xr-x 1 root root      65 Oct 15  2009 mipsel-linux-gnu-g++
-rwxr-xr-x 1 root root      65 Oct 15  2009 mipsel-linux-gnu-gcc
-rwxr-xr-x 1 root root      65 Oct 15  2009 mipsel-linux-gnu-gcc-4.3.3

-rwxr-xr-x 1 root root  202404 Apr 13  2009 mips-linux-gnu-cpp
-rwxr-xr-x 1 root root  203588 Apr 13  2009 mips-linux-gnu-g++
-rwxr-xr-x 1 root root  201188 Apr 13  2009 mips-linux-gnu-gcc
-rwxr-xr-x 1 root root  201188 Apr 13  2009 mips-linux-gnu-gcc-4.3.3
# cat /usr/local/mips-4.3/bin/mipsel-linux-gnu-gcc
#!/bin/sh
exe=`echo $0 | sed s/mipsel/mips/g`
exec $exe -EL "$@"

For, at least, these files:

mipsel-linux-gnu-addr2line mipsel-linux-gnu-ar mipsel-linux-gnu-as mipsel-linux-gnu-c++ mipsel-linux-gnu-c++filt mipsel-linux-gnu-cpp mipsel-linux-gnu-g++ mipsel-linux-gnu-gcc mipsel-linux-gnu-gcc-4.3.3 mipsel-linux-gnu-gcov mipsel-linux-gnu-gdb mipsel-linux-gnu-gdbtui mipsel-linux-gnu-gprof mipsel-linux-gnu-ld mipsel-linux-gnu-nm mipsel-linux-gnu-objcopy mipsel-linux-gnu-objdump mipsel-linux-gnu-ranlib mipsel-linux-gnu-readelf mipsel-linux-gnu-size mipsel-linux-gnu-strings mipsel-linux-gnu-strip