Compile and install Minidlna

In this days i tested my compiled version of minidlna for my cloud ex2.
Everything seems ok: sleep mode ok, no conflict with others packages etc.

During first days of compiling i had some problem with make options (include libs etc…) , so after intense research on google i found this link that contains a lot of useful information:

https://github.com/droboports/minidlna

I think it’s fair to cite sources…

So these are the instructions to compile and install minidlna on my cloud ex2 device.

For compiling i used a virtual machine with debian jessie 8.2:

Linux debian 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u4 (2015-09-19) x86_64 GNU/Linux

1 cpu
512mb ram
50 gb hd

I installed the vmware tools then i started the crosscompiling procedure.

download the latest  firmware version here:
http://download.wdc.com/gpl/WDMyCloud_EX2_GPL_v2.10.302_20150907.tar.zip

Then extract the crosscompile tools from toolchain directory:
armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002.tar.gz

and then from Open_Source_packages directory extract the file:

source.me

ok now let’s begin the procedure:

PART ONE PREPARE THE ENVIRONMENT

0 Install utilities package

apt-get install lib32z1 lib32ncurses5 gettext

1 Install toolchain

mkdir /toolchain
cp zxvf armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002.tar.gz /toolchain

cd /toolchain

tar zxvf armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002.tar.gz

2 Create folder structure
mkdir /minidlna
mkdir /minidlna/target/
mkdir /minidlna/target/install
mkdir /minidlna/build

2a  Download all this packages in /minidlna director y

e2fsprogs-libs-1.42.13.tar.gz
ffmpeg-2.8.tar.gz
jpegsrc.v9a.tar.gz
libexif-0.6.21.tar.gz
libid3tag-0.15.1b.tar.gz
libogg-1.3.1.tar.gz
libvorbis-1.3.5.tar.gz
minidlna-1.1.5.tar.gz
sqlite-autoconf-3081101.tar.gz
zlib-1.2.8.tar.gz

3.Set Variables - ** Edit source.me files and insert the following lines**

cd /minidlna

vi source.me

Insert this lines:

export HOST=“arm-marvell-linux-gnueabi”
export DEPS=“/minidlna/target/install”
export DEST=“/minidlna/build”

export CPPFLAGS=“-I${DEPS}/include”
export LDFLAGS=“${LDFLAGS:-} -Wl,-rpath,${DEST}/lib -L${DEST}/lib”

Search this lines:

PATH=${WORKDIR}/…/toolchain/armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002/bin/:$PATH

And modify like this:
PATH=/toolchain/armv7-marvell-linux-gnueabi-softfp_i686_64K_Dev_20131002/bin/:$PATH

then set the variables:

source source.me

PART TWO COMPILING - in /minidlna folder:

1. ### Compile zlib ###
tar zxvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=“${DEPS}” --libdir=“${DEST}/lib” --shared
make
make install
cd …

2. ### Compile Libuuid ###
tar zxvf e2fsprogs-libs-1.42.13.tar.gzcd
cd e2fsprogs-libs-1.42.13/
./configure --host=“${HOST}” --prefix=“${DEPS}” --libdir=“${DEST}/lib” --enable-elf-shlibs --disable-quota
cd lib/uuid
make -j1
make install
cd /minidlna/

3. ### Compile SqlLite ###
tar zxvf sqlite-autoconf-3081101.tar.gz
cd sqlite-autoconf-3081101/
./configure --host=“${HOST}” --prefix=“${DEPS}” --libdir=“${DEST}/lib” --disable-static
make
make install
cd …

4. ### Compile LIBEXIF ###
tar zxvf libexif-0.6.21.tar.gz
cd libexif-0.6.21/
./configure --host=“${HOST}” --prefix=“${DEPS}” --libdir=“${DEST}/lib” --disable-static
make
make install

5. ### Compile LIBJPEG ###
tar zxvf jpegsrc.v9a.tar.gz
cd jpeg-9a/
./configure --host=“${HOST}” --prefix=“${DEPS}” --libdir=“${DEST}/lib” --disable-static --enable-maxmem=8
make
make install
cd …

6. ### Compile LIBID3TAG ###
tar zxvf libid3tag-0.15.1b.tar.gz
./configure --host=“${HOST}” --prefix=“${DEPS}” --libdir=“${DEST}/lib” --disable-static --enable-maxmem=8
make
make install
cd …

7. ### Compile LIBOGG ###
tar zxvf libogg-1.3.1.tar.gz
cd libogg-1.3.1/
./configure --host=“${HOST}” --prefix=“${DEPS}” --libdir=“${DEST}/lib” --disable-static
make
make install
cd …

8. ### Compile LIBVORBIS ###
tar zxvf libvorbis-1.3.5.tar.gz
cd libvorbis-1.3.5/
./configure --host=“${HOST}” --prefix=“${DEPS}” --libdir=“${DEST}/lib” --disable-static
make
make install
cd …

9. ### Compile FLAC ###
tar xf flac-1.3.1.tar.xz
cd flac-1.3.1/
./configure --host=“${HOST}” --prefix=“${DEPS}” --libdir=“${DEST}/lib” --disable-static
make
make install
cd …

10. ### Compile FFFMPEG ###
tar zxvf ffmpeg-2.8.tar.gz
cd ffmpeg-2.8/
./configure --enable-cross-compile --cross-prefix=“${HOST}-” --prefix=“${DEPS}” --libdir=“${DEST}/lib” --shlibdir=“${DEST}/lib” --arch=“arm” --target-os=linux --enable-shared --disable-static --enable-rpath --enable-small --enable-zlib --disable-debug --disable-programs
make
make install
cd …

11. ### Compile Minidlna ###
tar zxvf minidlna-1.1.5.tar.gz
cd minidlna-1.1.5/
./configure --host=“${HOST}” --prefix=“${DEST}”
make -j1
make install

ok now all packages are compiled.

PARTE THREE INSTALL MINIDLNA ON MYCLOUD EX2 (temporary version, i need assistance…)

Now it’s time to move the compiled files into the wd my cloud ex2…  
mycloduex2 = your device

  1. Move /minidlna/build/sbin/minidlnad in mycloudex2 /usr/sbin/

  2. Move /minidlna/lib/

libavcodec.so.56
libavformat.so.56
libavutil.so.54
libjpeg.so.9
libogg.so.0
libswresample.so.1
libvorbis.so.0
libz.so.1

in mycloudex2 /lib

for libz.so.1 there is a problem… you can’t overwrite this file… and you can’t use this original file… 

so rename it…

in myclodex2 /lib 

mv libz.so.1 libz.so.1.orig

then copy libz.so.1

  1. Move /minidlna/minidlna-1.1.5/minidlna.conf in mycloduex2 /etc

Configuration of minidlna is another argument… but basically you can add this line to share content in minidlna.conf:

media_dir=PVA,/shares/Public/

PART FOUR ACTIVATE MINIDLNA

On your wdmycloud ex2 device execute:

/usr/sbin/minidlnad -f /etc/minidlna.conf

The the minidlna daemon start and you can see the evidence in the log file in /var/log/minidlna.log…

root@WDMyCloudEX2 log # cat minidlna.log
[2015/10/04 15:54:51] minidlna.c:1030: warn: Starting MiniDLNA version 1.1.5.
[2015/10/04 15:54:51] minidlna.c:355: warn: Creating new database at /var/cache/minidlna/files.db
[2015/10/04 15:54:51] minidlna.c:1070: warn: HTTP listening on port 8200
[2015/10/04 16:01:29] playlist.c:125: warn: Parsing playlists…
[2015/10/04 16:01:29] playlist.c:259: warn: Finished parsing playlists.

Ok, now questions time… i need help…

1  how can i install minidlna?

When i reboot the device i lost every change i made… and i need to repeat the installation part…
So the question is… how can i install minidlna permanently?

2 how can I automatically start at boot minidlna?

If i can make permanent changes on my cloud ex2 then i can modify the boot chain…

I tried some standard scripts to start/stop minidlnad but they seems doesn’t work…

ok thank you all, when I have solved these problems thought to develop a web page for managing minidlna and of the edit the configuration file.

Any kind of cooperation is welcome :slight_smile:

Greetings

ps: i compiled and use minidlna because with twonky server i had a lot of disconnects problem with my samsung tv (D5000) and i tried everything with no results…