Compile and install Minidlna

Hello to all,
few days ago I tried to install minidlna on my cloud ex2 with 2.10.302 firmware by following the instructions found on this page :

http://community.wd.com/t5/My-Cloud/APP-MiniDLNA-original-patched-for-firmware-V4-09-2015/td-p/820103/highlight/false

Unfortunately, the script is blocked immediately …

So I tried to compile from scratch minidlna and all the various libraries on my debian jessie environment.
After a few days of testing the compilation is successful.
Right now I’m testing the package and it seems to work properly.

In the next few days i will try to create an auto install package and i will publish the detailed instruction to compile from scratch all.

I’d like insert a web administration page like this:
http://sourceforge.net/projects/minidlnawebmin/

someone has already tried or have experience on this?

Any kind of cooperation is welcome :slight_smile:

Greetings

Hopefully an experienced User will be able to assist. You can also try the thread you linked since it’s constantly updated by the original poster.

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…

Many thanks for this great tutorial. It worked perfectly for me. For what I have seen EXT2 uses docker for running custom applications. I will work on that soon.

A simple and quick solution to prevent binaries and config files to be overwritten every time the nas reboots is to put the files in some public folder e.g.

/mnt/HD/HD_a2/Public/Shared\ Pictures/lib
/mnt/HD/HD_a2/Public/Shared\ Pictures/sbin
/mnt/HD/HD_a2/Public/Shared\ Pictures/conf

and then

export LD_LIBRARY_PATH=/mnt/HD/HD_a2/Public/Shared\ Pictures/lib
cd /mnt/HD/HD_a2/Public/Shared\ Pictures/sbin
./minidlnad -f ../conf/minidlna.conf

The last lines must be executed after every reboot however.

Well, I know that this thread is really old but the issue is not out of date and minidlna is a really nice DLNA server. So it is worth to continue the discussion.

WD MyCloud EX2 Ultra offers the possibility to install docker images for custom applications. They are stored in a folder

/var/lib/docker -> /mnt/HD/HD_a2/Nas_Prog/_docker

which points on my NAS to a persistend directory which survives reboots.

WARNING: Please take a backup of your media library before playing with docker. It happened to me that I had to restore a backup of my media because I ran into problems with iscsi targets on my NAS.

To install mindlna there are two possibilities:

  1. Build your own docker image
  2. Pick up one of several precompiled ARM images for minidlna from the repository

I have chosen the second way and executed the following commands on My Cloud

root@MyCloudEX2Ultra root # docker search minidlna

I have successfully tried two of these images:

forumi0721alpinearmhf/alpine-armhf-minidlna:latest
robertbeal/minidlna

So these are the commands to get minidlna working with the first image (forumi0721alpinearmhf/alpine-armhf-minidlna:latest https://hub.docker.com/r/forumi0721alpinearmhf/alpine-armhf-minidlna/):

docker pull forumi0721alpinearmhf/alpine-armhf-minidlna

Now the syntax to run this image is

docker run -d \
           --net=host \
           -p 8200:8200/tcp \
           -v /data:/data \
           -e FRIENDLY_NAME="DLNA Server" \
           -e MEDIA_DIR=/data \
           forumi0721alpinearmhf/alpine-armhf-minidlna:latest

which I substituted on my NAS to

docker run -d \
           --net=host \
           -p 8200:8200/tcp \
           -v /mnt/HD/HD_a2/media/music:/data \
           -e FRIENDLY_NAME="MiniDLNA ARM Server" \
           -e MEDIA_DIR=/data \
           --restart=always \
           forumi0721alpinearmhf/alpine-armhf-minidlna:latest

Yout must replace the left part of

-v /data:/data \

with your actual media library on your MyCloud.

The option "–restart=always " tells docker to restart the image on every failure or reboot. Note that the docker version of MyCloud is pretty old so not all the options of docker in recent releases are available on MyCloud.

That’s all, a DLNA-Server called “MiniDLNA ARM Server” should appear on your DLNA client. Good luck!

Thanks dude but how can i change the minidlna.config file?

The only thing i want to change is the container format in the root of the directory.
(tree presented to “B” - standard container)

THX

Edit;

i fixed it, i changed the minidlna.config in the volume folder in dockers and restart the cloud :wink: