DLNA Media Server Virtual Appliance

From Yocto Project
(Difference between revisions)
Jump to: navigation, search
 
(13 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__FORCETOC__
 
__FORCETOC__
A [http://en.wikipedia.org/wiki/Digital_Living_Network_Alliance DLNA] Media Server is a device that stores media content that can be accessed by media players and  rederers found in the same local network. The goal of the project was creating a minimal solution to meet theese requirements. This was achieved using the tools provided by the [http://www.yoctoproject.org/ yocto] project through the creation of the meta-dlna layer.
+
[[File:Rygel_Example.png|thumb|upright=1.5|A practical example of how the Media Server using Rygel package is seen by a renderer Media Player.]]
[[File:Rygel_Example.png|thumb|upright=1.5|A practicle example of how the Media Server using Rygel package is seen by a renderer Media Player.]]
+
A [http://en.wikipedia.org/wiki/Digital_Living_Network_Alliance DLNA] Media Server is a device that stores media content that can be accessed by media players and  rederers found in the same local network. It is developed using the [http://en.wikipedia.org/wiki/Universal_Plug_and_Play Universal Plug and Play] protocol which permits devices to see each other in a local network and enables different data sharing services between them.
 +
<br/> The goal of the project was creating a minimal solution to meet theese requirements. This was achieved using the tools provided by the [http://www.yoctoproject.org/ yocto] project through the creation of the meta-dlna layer.
  
  
Line 8: Line 9:
 
Poky is a platform-independant layer that provides useful features and functionalities for embedded solutions. [http://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html A Quick Start Guide] and further information can be found on the main page of the [http://www.yoctoproject.org/projects/poky Poky Project].
 
Poky is a platform-independant layer that provides useful features and functionalities for embedded solutions. [http://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html A Quick Start Guide] and further information can be found on the main page of the [http://www.yoctoproject.org/projects/poky Poky Project].
 
The functionality of the Media Server was implemented as a new layer, the meta-dlna layer, which can easily be integrated over any poky distribution. Stability and reliability was achieved by using the denzil branch of the yocto project.
 
The functionality of the Media Server was implemented as a new layer, the meta-dlna layer, which can easily be integrated over any poky distribution. Stability and reliability was achieved by using the denzil branch of the yocto project.
<br/>
+
<br/>Media Server is built as a virtual appliance, destined to be run under a [http://en.wikipedia.org/wiki/QEMU QEMU] KVM Virtual Machine Manager.
[TODO] - KVM
+
<br/> The linux core of Media Server makes use of the following virtualization acceleration technologies built in the host and guest kernel:
 +
* [http://en.wikipedia.org/wiki/Kernel-based_Virtual_Machine KVM]
 +
* [http://en.wikipedia.org/wiki/Paravirtualization Paravirtualization]
 +
* [http://wiki.libvirt.org/page/Virtio Virtio drivers virtualization]
  
 +
== Arhitecture design ==
 +
[[File:MediaServer Terminal.png|thumb|left|upright=1.1|Media Server with Rygel]]
 +
<br/>
 +
A basic requirement for the application is giving a minimal solution that meets all the tehnical specifications. That is why the Media Server application was designed to be a headless image. This means that after the system boots a console will automatically pop up.
 +
<br/>The operating system image has no WiFi configuration. However, if possible, wired network connections are automatically set up by the init script of the os.
 +
<br/>
 +
 
== Package dependencies ==
 
== Package dependencies ==
 
===== Rygel =====
 
===== Rygel =====
The solution was build around [https://live.gnome.org/Rygel/ rygel], an application used for media content sharing on a home network. Rygel implements its functionality through a plugin mechanism.
+
The solution was build around [https://live.gnome.org/Rygel/ rygel], an application used for media content sharing on a home network. Rygel can act both as a Media Renderer, e.g. an application that plays media content received from the local network and as an Universal Plug and Play Media Server, e.g. and application that makes the media available throughout the network. The project implemented the second solution, that of a UPnP Media Server.
===== Tracker plugin =====
+
===== Tracker plugin for Rygel =====
 
[http://projects.gnome.org/tracker/ Tracker] reprezents a data storage for devices that keeps semantic metadata about files and folders and enables data sharing throughout a local network.
 
[http://projects.gnome.org/tracker/ Tracker] reprezents a data storage for devices that keeps semantic metadata about files and folders and enables data sharing throughout a local network.
===== MediaExport plugin =====
+
===== MediaExport plugin for Rygel =====
 
The [https://live.gnome.org/Rygel/ MediaExport] plugin exports files and folders over the network. This solution was preferred to Tracker because it represents a more lightweight alternative and meets to all project requirements.
 
The [https://live.gnome.org/Rygel/ MediaExport] plugin exports files and folders over the network. This solution was preferred to Tracker because it represents a more lightweight alternative and meets to all project requirements.
<br/>[TODO] - KVM
 
  
== How to integrate DLNA to a poky distribution ==
+
== How to integrate DLNA and KVM into a poky distribution ==
 +
The tutorial assumes that a poky distribution already exists on the local machine. If this is not the case, follow the steps described in the [http://www.yoctoproject.org/docs/current/dev-manual/dev-manual.html#dev-manual-start poky manual].
 +
<br/>
 
The meta-dlna layer was created using the [https://wiki.yoctoproject.org/wiki/Combo-layer combo-layer tool]. To enable it, follow the next steps:
 
The meta-dlna layer was created using the [https://wiki.yoctoproject.org/wiki/Combo-layer combo-layer tool]. To enable it, follow the next steps:
 
* Copy the <tt>meta-dlna</tt> folder into the root directory of a <tt>poky</tt> distribution. <tt>Cd</tt> into the poky folder.
 
* Copy the <tt>meta-dlna</tt> folder into the root directory of a <tt>poky</tt> distribution. <tt>Cd</tt> into the poky folder.
Line 26: Line 38:
 
  [...]
 
  [...]
 
  BBLAYERS="
 
  BBLAYERS="
           $POKY_HOME/meta-dlna/meta-guacamayo
+
           $POKY_HOME/meta-dlna/meta-guacamayo \
 +
          $POKY_HOME/meta-kvm \
 
  [...]
 
  [...]
  
Line 36: Line 49:
 
* source the oe-init-env script
 
* source the oe-init-env script
 
* build the image using the guacamayo-image-mediaserver target
 
* build the image using the guacamayo-image-mediaserver target
  bitbake <tt>guacamayo-image-mediaserver</tt> [TODO]
+
  bitbake <tt>guacamayo-image-mediaserver</tt>  
 
For testing purposes, demo content can be added by inserting the following line into <tt>build/conf/local.conf</tt>:
 
For testing purposes, demo content can be added by inserting the following line into <tt>build/conf/local.conf</tt>:
  
Line 42: Line 55:
 
  IMAGE_FEATURES_append = " guacamayo-demos"
 
  IMAGE_FEATURES_append = " guacamayo-demos"
 
  [...]
 
  [...]
 +
 +
The demo media will be automatically added into the <tt>/usr/share/demos</tt>. You can now start a media player on a renderer device and be able to navigate trough the demo content from the Media Server.
 +
<br/>At boot the system configures <tt>/home/rygel/</tt> as the default home for rygel. Any additional media files that is added in this folder will automatically be shared throughout the local network. If demo content is added, the <tt>/usr/share/demos</tt> will also be appended in the rygel configuration file as one of the media sources.
 +
 +
== How to run MediaServer using QEMU KVM ==
 +
In order to run Media Server under a VM manager with full virtualization acceleration technologies follow this [https://wiki.yoctoproject.org/wiki/Running_an_x86_Yocto_Linux_image_under_QEMU_KVM guide].
 +
<br/>Please note that Media Server is already configured for KVM, paravirtualization and virtio, so Yocto Linux guest OS will not need further configuration (Guest OS preparation section is already integrated).
 +
 +
== Network configurations ==
 +
The DLNA server will only appear in the local LAN. Because of this, testing the dlna image using the qemu tool requires the VM to be in the same network as the host (bridged network configuration).  The standard runqemu script creates a NAT configuration. To create the necessary configuration you first have to run the qemu-bridge script with the start parameter (The script needs the bridge-utils and the uml-utilities packages to be installed on the host system). After this you simply run the qemu command with the following parameters:
 +
 +
sudo /home/ema/ssd/work/poky/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-i386 -kernel \
 +
  ${path_to_build_folder}/poky/tmp/deploy/images/bzImage-qemux86.bin -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=no,downscript=no -hda  \
 +
  ${path_to_build_folder}/tmp/deploy/images/core-image-mediaserver-qemux86.ext3 -show-cursor -usb -usbdevice wacom-tablet \
 +
  -vga vmware -no-reboot -m 128 --append "vga=0 root=/dev/hda rw mem=128M opr[Bofile.timer=1 "
 +
 +
The command supposes that you build the image for a x86 architecture.
 +
<br/>The qemu-bridge script can be found here - [[File:Qemu-bridge-configuration.txt|qemu-bridge.sh]]. After downloading the qemu-bridge script, make sure you have changed its extension to .sh and added execution rights (chmod a+x qemu-bridge.sh).
 +
 +
After you finished all the testing you can run ./qemu-bridge.sh stop to revert the configuration to your initial one.

Latest revision as of 23:08, 10 October 2012

A practical example of how the Media Server using Rygel package is seen by a renderer Media Player.

A DLNA Media Server is a device that stores media content that can be accessed by media players and rederers found in the same local network. It is developed using the Universal Plug and Play protocol which permits devices to see each other in a local network and enables different data sharing services between them.
The goal of the project was creating a minimal solution to meet theese requirements. This was achieved using the tools provided by the yocto project through the creation of the meta-dlna layer.


Contents

[edit] Introduction

Poky is a platform-independant layer that provides useful features and functionalities for embedded solutions. A Quick Start Guide and further information can be found on the main page of the Poky Project. The functionality of the Media Server was implemented as a new layer, the meta-dlna layer, which can easily be integrated over any poky distribution. Stability and reliability was achieved by using the denzil branch of the yocto project.
Media Server is built as a virtual appliance, destined to be run under a QEMU KVM Virtual Machine Manager.
The linux core of Media Server makes use of the following virtualization acceleration technologies built in the host and guest kernel:

[edit] Arhitecture design

Media Server with Rygel


A basic requirement for the application is giving a minimal solution that meets all the tehnical specifications. That is why the Media Server application was designed to be a headless image. This means that after the system boots a console will automatically pop up.
The operating system image has no WiFi configuration. However, if possible, wired network connections are automatically set up by the init script of the os.

[edit] Package dependencies

[edit] Rygel

The solution was build around rygel, an application used for media content sharing on a home network. Rygel can act both as a Media Renderer, e.g. an application that plays media content received from the local network and as an Universal Plug and Play Media Server, e.g. and application that makes the media available throughout the network. The project implemented the second solution, that of a UPnP Media Server.

[edit] Tracker plugin for Rygel

Tracker reprezents a data storage for devices that keeps semantic metadata about files and folders and enables data sharing throughout a local network.

[edit] MediaExport plugin for Rygel

The MediaExport plugin exports files and folders over the network. This solution was preferred to Tracker because it represents a more lightweight alternative and meets to all project requirements.

[edit] How to integrate DLNA and KVM into a poky distribution

The tutorial assumes that a poky distribution already exists on the local machine. If this is not the case, follow the steps described in the poky manual.
The meta-dlna layer was created using the combo-layer tool. To enable it, follow the next steps:

  • Copy the meta-dlna folder into the root directory of a poky distribution. Cd into the poky folder.
  • Add the layer to build/conf/bblayers.conf:
[...]
BBLAYERS="
         $POKY_HOME/meta-dlna/meta-guacamayo \
         $POKY_HOME/meta-kvm \
[...]
  • Add some extra features to build/local.conf:
[...]
DISTRO_FEATURES = "ext2 largefile usbhost xattr nfs zeroconf pci ${DISTRO_FEATURES_LIBC} x11" 
[...]
  • source the oe-init-env script
  • build the image using the guacamayo-image-mediaserver target
bitbake guacamayo-image-mediaserver 

For testing purposes, demo content can be added by inserting the following line into build/conf/local.conf:

[...]
IMAGE_FEATURES_append = " guacamayo-demos"
[...]

The demo media will be automatically added into the /usr/share/demos. You can now start a media player on a renderer device and be able to navigate trough the demo content from the Media Server.
At boot the system configures /home/rygel/ as the default home for rygel. Any additional media files that is added in this folder will automatically be shared throughout the local network. If demo content is added, the /usr/share/demos will also be appended in the rygel configuration file as one of the media sources.

[edit] How to run MediaServer using QEMU KVM

In order to run Media Server under a VM manager with full virtualization acceleration technologies follow this guide.
Please note that Media Server is already configured for KVM, paravirtualization and virtio, so Yocto Linux guest OS will not need further configuration (Guest OS preparation section is already integrated).

[edit] Network configurations

The DLNA server will only appear in the local LAN. Because of this, testing the dlna image using the qemu tool requires the VM to be in the same network as the host (bridged network configuration). The standard runqemu script creates a NAT configuration. To create the necessary configuration you first have to run the qemu-bridge script with the start parameter (The script needs the bridge-utils and the uml-utilities packages to be installed on the host system). After this you simply run the qemu command with the following parameters:

sudo /home/ema/ssd/work/poky/build/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-i386 -kernel \
 ${path_to_build_folder}/poky/tmp/deploy/images/bzImage-qemux86.bin -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=no,downscript=no -hda   \
 ${path_to_build_folder}/tmp/deploy/images/core-image-mediaserver-qemux86.ext3 -show-cursor -usb -usbdevice wacom-tablet \
 -vga vmware -no-reboot -m 128 --append "vga=0 root=/dev/hda rw mem=128M opr[Bofile.timer=1 "

The command supposes that you build the image for a x86 architecture.
The qemu-bridge script can be found here - File:Qemu-bridge-configuration.txt. After downloading the qemu-bridge script, make sure you have changed its extension to .sh and added execution rights (chmod a+x qemu-bridge.sh).

After you finished all the testing you can run ./qemu-bridge.sh stop to revert the configuration to your initial one.

Personal tools