home( Japanese,  English)  articles  categories  archives (Japanese,  English)  profile (Japanese,  English)  bulletin_board  

Search powered by unicode msearch
>> search options
Index of this page

Voyage MPD —-Linux Music Environment For The Best Audio Performance—-

How to install and setup Voyage MPD

Operational Tips for Voyage MPD

Update Voyage MPD for the best audio performance

Tuning Patches for MPD by yan

Best Tuning Tips for Voyage MPD

Extra Tips for Voyage MPD


All contents are based on the Voyage MPD v0.7 20110208 version.

Extra edition


Comments

How to install and setup Voyage MPD

“Voyage MPD” is an audio dedicated system in Linux environment. Followings are links about “Voyage MPD”.

What you need to install "Voyage MPD"

Full description of the installation operation for Voyage MPD

To clarify the operation(reply or command), quote portion color is red.
Boot from CDROM(Live CD).

Login

login as: root   #[reply]
root@192.168.0.13's password:  #[reply]

Login name is “root” and password is “voyage”.

Linux voyage 2.6.33.7-rt29-voyage #1 SMP PREEMPT RT Sun Dec 26 04:17:30 GMT 2010 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
 __  __
 \ \/ /___ __  __ ___  ___  ___    Useful Commands:
  \  // _ \\ \/ /,-_ |/ _ |/ -_)     remountrw - mount disk as read-write
   \/ \___/ \  / \___,\_  |\___|     remountro - mount disk as read-only
           _/_/        _'_|          remove.docs - remove all docs and manpages
     { V o y a g e } - L i n u x
      < http://linux.voyage.hk >   Version: 0.7 (Build Date 20110208)


Set up install directory

root@voyage:~# mkdir /tmp/root /tmp/cf   #[command]
root@voyage:~# mount -o loop /live/image/live/filesystem.squashfs /tmp/root   #[command]
root@voyage:~# cd /tmp/root   #[command]

Make directories for temporary root, mount point and mount loop.
When you operate properly, “Run silent” that is UNIX-like fashion.
It looks a little difficult to type “/live/image/live/filesystem.squashfs” but it is easy by using completion of the input such as “/liv[tab]i[tab]l[tab]f[tab]s[tab]”.

Confirm the condition of install disk

To confirm install disk, “fdisk -l”.

root@voyage:/tmp/root# fdisk -l   #[command]

Disk /dev/sda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x61dc4b11

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        5099    40957189   83  Linux
/dev/sda2            5100        9730    37192705    5  Extended
/dev/sda5            5100        9534    35619840   83  Linux
/dev/sda6            9534        9730     1571840   82  Linux swap / Solaris

Disk /dev/sdb: 1500.3 GB, 1500301910016 bytes
255 heads, 63 sectors/track, 182401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xe52229e8

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1   *           1      182401  1465136032   83  Linux

“/dev/sda1” is the target partion to install Voyage MPD. “/dev/sdb1” is the music disk connected with USB. In this case there is no need to create a partion. Here is a reference to create a partion.

Create a partion

root@voyage:/tmp/root# fdisk /dev/sda   #[command]

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Command (m for help): d   #[reply]
Partition number (1-6): 1   #[reply]

Command (m for help): w   #[reply]
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

”d” is to delete the 1st partion. “w” is a running command to delete. Please be careful, because if you mistake here, all contents in your disk will be lost.

root@voyage:/tmp/root# fdisk /dev/sda   #[command]

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').

Again run “fdisk” to create a new partion.
You can do this easy bt history function of bash. Use upper arrow key.

Command (m for help): n   #[reply]
Command action
   l   logical (5 or over)
   p   primary partition (1-4)
p   #[reply]
Partition number (1-4): 1   #[reply]
First cylinder (1-9729, default 1):    #[reply]
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-5099, default 5099):    #[reply]
Using default value 5099

Command (m for help): w   #[reply]
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

”n” is to create a new partion. “w” is a running command to create.

Format(create File system)

“mkfs.ext2” is a command to dormat for ext2 file system.

root@voyage:/tmp/root# mkfs.ext2 /dev/sda1   #[command]
mke2fs 1.41.12 (17-May-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
2564096 inodes, 10239421 blocks
511971 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=0
313 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 
....7962624

Writing inode tables:   ...0/313
done                            
Writing superblocks and filesystem accounting information:    #[reply]

Maybe it will proceed next automatically when time is over.

done

This filesystem will be automatically checked every 25 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

“tune2fs” is a command to setup parmeters for ext2 file system.

root@voyage:/tmp/root# tune2fs -c 0 /dev/sda1   #[command]
tune2fs 1.41.12 (17-May-2010)
Setting maximal mount count to -1

Set 0 which means “checkless”.
Preparation for installation has been completed. Let’s start instalation.

Set Conditions for Installation

root@voyage:/tmp/root# /usr/local/sbin/voyage.update   #[command]
What would you like to do?
  1 - Create new Voyage Linux disk
  2 - Update existing Voyage configuration
  3 - Exit
      (default=1 [Create new Voyage Linux disk]):    #[reply]

OK by default, “enter”.

some mandatory options are unset, please enter them interactively
Where is the Voyage Linux distribution directory?
  (default=/tmp/root):    #[reply]

You may be confused as suddenly prompt appear. This is “1 - Specify Distribution Directory” in the menu following.
OK by default, “enter”.

What would you like to do?
  1 - Specify Distribution Directory
  2 - Select Target Profile
  3 - Select Target Disk
  4 - Select Target Bootstrap Loader
  5 - Configure Target Console
  6 - Partition and Create Filesystem
      (default=2 [Select Target Profile]):    #[reply]

Move next menu(Select Target Profile). OK by default, “enter”.

Please select Voyage profile:
  1 - 4501
  2 - 4511/4521
  3 - 4801
  4 - 5501
  5 - ALIX
  6 - Generic PC
  7 - Notebook (pcmcia)
  8 - WRAP
      (default=5 [ALIX]): 6   #[reply]

Select 6. Menu No.7(Notebook) means to use pcmcia, therefore if you do not use pcmcia select 6(Generic PC).

What would you like to do?
  1 - Specify Distribution Directory
  2 - Select Target Profile
  3 - Select Target Disk
  4 - Select Target Bootstrap Loader
  5 - Configure Target Console
  6 - Partition and Create Filesystem
      (default=3 [Select Target Disk]):    #[reply]

Move menu No.3. OK by default, “enter”.

Partitions information
major minor  #blocks  name

   8        0   78150744 sda
   8        1   40957686 sda1
   8        2          1 sda2
   8        5   35619840 sda5
   8        6    1571840 sda6
   7        0      63712 loop0
   7        1      63712 loop1
   8       16 1465138584 sdb
   8       17 1465136032 sdb1

Which device accesses the target disk [/dev/hde]? /dev/sda   #[reply]

This is very important. you must be careful. If you mistake, it will be disastrous.
Select “/dev/sda”.


Which partition should I use on /dev/sdc for the Voyage system [1]?    #[reply]

Partion No. is “1”.


Where can I mount the target disk [/tmp/cf]?    #[reply]

Mount point is “/tmp/cf” which you have already created. Therefore OK by default, “enter”.

What would you like to do?
  1 - Specify Distribution Directory
  2 - Select Target Profile
  3 - Select Target Disk
  4 - Select Target Bootstrap Loader
  5 - Configure Target Console
  6 - Partition and Create Filesystem
      (default=4 [Select Target Bootstrap Loader]):    #[reply]

Move menu No.4. OK by default, “enter”.

Which loader do you want (grub or lilo) [grub]?    #[reply]

Which partition is used for bootstrap [1]?    #[reply]

OK by default, “enter”.
You must know Linux boot loader’s detail to select except “1” partition.
It is safe slecting “1” here.
If there is inconvenience to select “1”, you can change it later.

What would you like to do?
  1 - Specify Distribution Directory
  2 - Select Target Profile
  3 - Select Target Disk
  4 - Select Target Bootstrap Loader
  5 - Configure Target Console
  6 - Partition and Create Filesystem
      (default=5 [Configure Target Console]):    #[reply]

Move menu No.5. OK by default, “enter”.

Select terminal type:
  1 - Serial Terminal
  2 - Console Interface
      (default=2 [Console Interface]):    #[reply]

OK by default, “enter”.
“1 - Serial Terminal” is for Embedded Hardware such as alix machine.

What would you like to do?
  1 - Specify Distribution Directory
  2 - Select Target Profile
  3 - Select Target Disk
  4 - Select Target Bootstrap Loader
  5 - Configure Target Console
  6 - Partition and Create Filesystem
      (default=6 [Partition and Create Filesystem]):    #[reply]

Move menu No.5. OK by default, only “enter” operation.

What shall I do with your Flash Media?
  1 - Partition Flash Media and Create Filesystem
  2 - Use Flash Media as-is
      (default=1 [Partition Flash Media and Create Filesystem]): 2   #[reply]

You had better to select “2 - Use Flash Media as-is” because “1 - Partition Flash Media and Create Filesystem” is a little unstable.
You have created file system already by “ext2fs”and “tune2fs” copmmands. Therefore Ok by selecting 2.

What would you like to do?
  1 - Specify Distribution Directory
  2 - Select Target Profile
  3 - Select Target Disk
  4 - Select Target Bootstrap Loader
  5 - Configure Target Console
  6 - Partition and Create Filesystem
      (default=7 [Copy Distribution to Target]):    #[reply]

You have completed to select install parameters. Move to menu No.7(not exists), OK by default, “enter”.

Configuration details:
----------------------

Distribution directory:   /tmp/root

Disk/Flash Device:        /dev/sda
Installation Partition:   /dev/sda1
Bootstrap Partition:      /dev/sda1

Will be mounted on:       /tmp/cf

Target system profile:    Generic PC
Target console:           standard

Bootstrap installer:      grub
Bootstrap partition:      /dev/sda1

OK to continue (y/n)? y   #[reply]

Final confirmatiom. “y” to run.

Run installation

Ready to go ....
Copying files .... done

Removing pcmcia from update-rc.d
update-rc.d: using dependency based boot sequencing
Removing dnsmasq.pxe.conf in /etc/dnsmasq.more.conf
Reconfiguring resolvconf
Installing grub
Copy grub files from /tmp/cf to /tmp/cf/boot/grub
Setting up grub under chroot /tmp/cf
copyfiles.sh script completed
What would you like to do?
  1 - Specify Distribution Directory
  2 - Select Target Profile
  3 - Select Target Disk
  4 - Select Target Bootstrap Loader
  5 - Configure Target Console
  6 - Partition and Create Filesystem
      (default=8 [Exit]):    #[reply]

Installation has been completed. Enter to finish script.

/usr/local/sbin/voyage-install.sh: .voyage-install.conf: Read-only file system
/usr/local/sbin/voyage-install.sh: test.conf: Read-only file system
root@voyage:/tmp/root# reboot   #[command]

Reboot system. You must change PC Bios to reboot from hard disk.


Initial setup for Voyage MPD

You had better setup Voyage Mpd here to use and tune it smoothly.

root@voyage:~# remountrw   #[command]

“remountrw” is a Voyage’s shell command to change disk drive writtable.
It is a little troublesome to run it every time you start Voyage, therefore you had better set it in .bashrc.

Change password

Change password as soon as possible to ensure your security.

root@voyage:~# passwd   #[command]
Enter new UNIX password:     #[reply]
Retype new UNIX password:     #[reply]
passwd: password updated successfully

Update and Upgrade

These are established tactics in Linux. You should update and upgrade Voyage MPD.
Use apt-get(Debian package management tool).

root@voyage:~# apt-get update   #[command]
0% [Working]
Get:11 http://ftp.jp.debian.org squeeze/contrib i386 Packages [54.8 kB]
root@voyage:~# apt-get upgrade   #[command]
Reading package lists... 0%......
Reading state information... Done

The following packages will be upgraded:
  apt apt-utils cron dash initramfs-tools libdbus-1-3 libgssapi-krb5-2 libk5crypto3
  libkrb5-3 libkrb5support0 libxi6 lilo netbase
13 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 3928 kB of archives.
After this operation, 16.4 kB of additional disk space will be used.
Do you want to continue [Y/n]? y   #[reply]

Reply “yes”.

0% [Working]......

lilo

Reply “OK” to the GUI of LILO configuration.

Set Japanese Time

root@voyage:~# dpkg-reconfigure tzdata   #[command]

tzdata0

Set Japanese time if you live in Japan. Following GUI guidance, Specify Asia and Tokyo.

tzdata1

Current default time zone: 'Asia/Tokyo'
Local time is now:      Sun Jan  2 09:50:20 JST 2011.
Universal Time is now:  Sun Jan  2 00:50:20 UTC 2011.

Edit .bashrc

“.bashrc” is a shell script file that runs when you login.
You had better edit it to run remountrw and alias.

root@voyage:~# vi ./.bashrc    #[command]

vi030

This is initial contents of .bashrc.

vi031

remountrw
alias mpdr='/etc/init.d/mpd stop;/etc/init.d/mpd start-create-db'
alias mpcs='mpc update;mpc listall|mpc add;mpc play'

Edit like this.
You can edit this easy by using ssh(such as PuTTy) and copy&paste function in Windows.

Fix IP address

root@voyage:~# vi /etc/network/interfaces   #[command]

Next fix your IP address. “/etc/network/interfaces” will be able to type “e[tab]ne[tab]/in[tab]”.

vi1

Edit as following.

vi2

iface eth0 inet static
        address 192.168.0.31
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        dns-nameservers 192.168.0.1

You can edit this easy by copy&paste function.

Power off by PC’s power off buttom

Install acpid and edit new file named power.

root@voyage:~# apt-get install acpid   #[command]
・・・
root@voyage:~# emacs /etc/acpi/events/power   #[command]
event=button/power (PWR.||PBTN)
action=/sbin/poweroff


Edit grub information

To use Japanese console, flame buffer should be effective.
Recent Voyage MPD decides display size automatically. It is a little inconvenient in a large size display because character are too small.
This is a modification corresponding to this.

root@voyage:~# vi /boot/grub/menu.lst   #[command]

vi9

Change as following.

vi10

Add “nomodeset vga=788” to the kernel line.


Setup Japanese environment

Setup Japanese keyboads

You had better install this if you disk space affords because this setting will help keymap.
You must add Japanese Debian server to “/etc/apt/sources.list”.

root@voyage:~# vi /etc/apt/sources.list   #[command]

vi032

Add Japanese Debian server.

vi032

root@voyage:~# apt-get install dialog   #[command]

Install “dialog”.

Reading package lists... 0%.....
Unpacking dialog (from .../dialog_1.1-20100428-1_i386.deb) ...
Setting up dialog (1.1-20100428-1) ...

Finally install Japanese keyboard.

root@voyage:~# apt-get install console-common console-data   #[command]

Reading package lists... 0%.....
Suggested packages:
  unicode-data
The following NEW packages will be installed:
  console-common console-data kbd
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 1712 kB of archives.
After this operation, 6142 kB of additional disk space will be used.
Do you want to continue [Y/n]? y   #[reply]

Reply “yes”

0% [Working]....

console0

Select keymap from arch list (Note default is "don't touch keymap")    #[reply]

console1

qwerty (default)    #[reply]

console2

Japanese     #[reply]

Of course if you are none Japanese, select appropriate keyboard.

Unpacking console-data (from .../console-data_2%3a1.10-8_all.deb) ...
Selecting previously deselected package kbd.
Unpacking kbd (from .../archives/kbd_1.15.2-2_i386.deb) ...
update-rc.d: using dependency based boot sequencing
Selecting previously deselected package console-common.
Unpacking console-common (from .../console-common_0.7.85_all.deb) ...
Setting up console-data (2:1.10-8) ...
Looking for keymap to install:
pc110
Setting up kbd (1.15.2-2) ...
Setting console screen modes and fonts.
Setting up console-common (0.7.85) ...
Looking for keymap to install:
pc110
unicode_stop skipped on not a tty
root@voyage:~#

Installation ha been completed.

Install emacs

Install emacs here if you want to “adios muchachos vi”. It take a little time but you will be happy after this.

root@voyage:~# apt-get install emacs   #[command]
・・・・
Unpacking emacs (from .../emacs_23.2+1-7_all.deb) ...
Setting up emacs (23.2+1-7) ...

Install locale

Install locale to complete Japanese environment.

root@voyage:~# apt-get install locales   #[command]
・・・
Setting up locales (2.11.2-7) ...
Generating locales (this might take a while)...
Generation complete.

Setup locale.

root@voyage:~# dpkg-reconfigure locales   #[command]

vi8

Select ja_JP.UTF-8 UTF-8 by space key. Move to OK by using Tab and Enter. Of course you must select an adequate languege depending to your environment.

vi1

This guidance message is in Jpanese. Of course it must be in English for the first time.

Generating locales (this might take a while)...
  ja_JP.UTF-8... done
Generation complete.

Install Mule-UCS to use Unicode(UTF-8) in Emacs.

root@voyage:~# apt-get install mule-usc   #[command]
・・・
E: Unable to locate package mule-usc

Mule-UCS has been already installed.

Install Japanese console(jfbterm)

root@voyage:~# apt-get install jfbterm   #[command]

Reboot to activate Japanese Environment.

root@voyage:~# reboot   #[command]


Setup MPD

From here it is assumed that the music data are in Windows server(ntfs format, IP address 192.168.0.3).

Mount Windows server

Add the following line to /etc/fstab.

root@voyage:~# emacs /etc/fstab    #[command]
//192.168.0.3/cd2 /music1 cifs username=yo,password=,uid=root,file_mode=0644,dir_mode=0755,iocharset=utf8 0 0

“iocharset=utf8” is needed for Japanese title in music files and directories.

Mount it.

root@voyage:~# mount -a     #[command]


Setup music directory

root@voyage:~# mkdir /music /music1     #[command]
root@voyage:~# chmod -R 777 /music      #[command]
root@voyage:~# mkdir /music/playlists   #[command]
root@voyage:~# ln -s /music1 /musicic   #[command]


Confirm music devices

root@voyage:~#  cat /proc/asound/cards   #[command]
 0 [IXP            ]: ATIIXP - ATI IXP
                      ATI IXP rev 1 with AD1981B at 0xe8004400, irq 11
 1 [default        ]: USB-Audio - USB Audio CODEC 
                      Burr-Brown from TI               USB Audio CODEC  at usb-0000:00:13.0-3, full s
 2 [Modem          ]: ATIIXP-MODEM - ATI IXP Modem
                      ATI IXP Modem rev 1 at 0xe8004800, irq 11

Two Audio devices are found except USB-Audio devise. You must fix the USB-Audio devise number.
I will explain later how to fix alsa’s audio device number.
Here edit /etc/mpd.conf to adjust it.

Edit mpd.conf

root@voyage:~# emacs /etc/mpd.conf   #[command]

Lines to edit are little. Only snap shots.

vi4

Change music directory to /music and playlists directory to /music/playlists.

vi5

Comment out localhost.

vi6

Adjust device number of Alsa to “1”.

root@voyage:~# /etc/init.d/mpd restart   #[command]
Stopping Music Player Daemon: mpd.
Starting Music Player Daemon: mpdlisten: bind to '0.0.0.0:6600' failed: Address already in use
 (continuing anyway, because binding to '[::]:6600' succeeded).

Warning means IPV6 error. Neglect it.
Run mpc.

root@voyage:~# mpc update   #[command]
Updating DB (#1) ...
volume:100%   repeat: off   random: off   single: off   consume: off
root@voyage:~# mpc listall|mpc add   #[command]

mpc play.

root@voyage:~# mpc play   #[command]
BIS Sampler 1992/01__Malmo_Symphony_Orchestra_&_Chorus,_James_DePreist,_Inger_Blom_-_Es_geschah..._Faust_Cantata_(Seid_nuchtern_und_wachet).wav
[playing] #1/17   0:00/5:19 (0%)
volume:100%   repeat: off   random: off   single: off   consume: off

Stop music.

root@voyage:~# mpc stop   #[command]
volume:100%   repeat: off   random: off   single: off   consume: off


Fix Alsa’s device number

I am not sure the following opration is correct. But it works well in my environment.

root@voyage:~# emacs /etc/modprobe.d/alsa-base.conf   #[command]

vi40

options snd-atiixp-modem index=2
options snd-usb-audio index=1

Change index value to 2 and 1.

vi41


(PC_Audio)   Comments

Operational Tips for Voyage MPD

How to create bootable USB memory of Voyage MPD

Use boot loader “SYSLINUX”, write it to MBR of USB memory stick and make it bootable.
Copy necessary files for boot to USB memory from Voyage MPD ISO image

The concrete steps are as follows:

Format USB memory to FAT32
You can do it in Windows explorer.
Download SYSLINUX
From the site SYSLINUX -> Download -> kernel.org. Download syslinux-4.03.zip.
Write boot loader(SYSLINUX) to USB memory
“syslinux -ma i” in Windows command prompt
Copy files from Voyage MPD ISO image to USB memory
Copy whole contents in \isolinux to root in USB memory. Directory-copy \live to root in USB memory.
Change Settings(isolinux.cfg) to be able to boot as SYSLINUX
Rename isolinux.cfg in root to syslinux.cfg(config of SYSLINUX). Open renamed syslinux.cfg with the editor that can handle UNIX file format. There is a line “default /isolinux/vesamenu.c32”. Edit it “default vesamenu.c32” (for matching directory structure).
Boot from USB memory
Change your bios to boot from USB drive and reboot.

To be exact you must edit exthelp.cfg. But if you do not use help at all, so omit it.
About SYSLINUX, this page is very useful.

Control MPD by Keypad board

016

This is a picture of Keypad board I use. Don’t you think it can be used as remote controller.


Followings are the commands of mpc(program to control Voyage MPD) related with playing music.

mpc play
mpc next
mpc prev
mpc toggle(mpc pause)
mpc stop
mpc play nn(number)

Edit mykey.

root@voyage:~# emacs /etc/mykey
string F78 = "mpc toggle\n"
keycode 78 = F78
string F74 = "mpc stop\n"
keycode 74 = F74
string F98 = "mpc prev\n"
keycode 98 = F98
string F55 = "mpc next\n"
keycode 55 = F55
string F83 = "mpc play "
keycode 83 = F83

If mykey is a new file, edit rc.local to run it for next boot.

root@voyage:~# emacs /etc/rc.local

add next line before “exit 0”.

/usr/bin/loadkeys /etc/mykey


Auto Login method

To use Keypad board, you must login Voyage MPD. Here is a method to login automatically.

root@voyage:~# adduser hoge

Regist new user name and password.
Delete password.

root@voyage:~# emacs /etc/shadow

In the last line

hoge:$6$imU2OaTj$dxDNTiaPFFF2sbvjpNS99MJk1CbSOcf2cf2pJbRxi3wTiE5kytHQXYRdnGm0.p0zAnUcxJSkZXgHQgM\WhTFX0:14995:0:99999:7:::

edit it like this.

hoge::14995:0:99999:7:::

save the file.

root@voyage:~# emacs /etc/inittab 

For automatic login tty1, edit inittab. Toward the end part

1:2345:respawn:/sbin/getty 38400 tty1

Search the line above. Comment out. Add the following lineand save.

#1:2345:respawn:/sbin/getty 38400 tty1
1:2345:respawn:/bin/login hoge /dev/tty1 2>/dev/tty1

Of course “hoge” is secret language of hackers, change it appropriate name.
“reboot” or “loadkeys /etc/mykey”. You can use Keypad board to control MPD.

Multi Boot(GRUB2)

This is a little risky. If you fail, you will lost valuable data and your system can not boot. Try it at your own risk.

Most of recent Linux distribution use GRUB2(v1.98 or later). But Voyage use legacy GRUB(grub-legacy v0.97). The reason why Voyage One apply grub-legacy is that they are used for embedded system.
Therefore if you want to multiboot, it cannot work well. You must edit menu.lst directly.

But recent Voyage MPD version can install GRUB2.

root@voyage:~# apt-get update   #[command]
・・・
root@voyage:~# apt-get upgrade   #[command]
・・・

Start install GRUB2.

root@voyage:~# apt-get install grub
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  grub-pc
Suggested packages:
  desktop-base
The following packages will be REMOVED:
  grub-legacy
The following NEW packages will be installed:
  grub grub-pc
0 upgraded, 2 newly installed, 1 to remove and 0 not upgraded.
Need to get 1139 kB of archives.
After this operation, 1896 kB of additional disk space will be used.
Do you want to continue [Y/n]? y    #[reply]

Reply “y(yes)”

Get:1 http://ftp.tw.debian.org/debian/ squeeze/main grub-pc i386 1.98+20100804-13 [1021 kB]
Get:2 http://ftp.tw.debian.org/debian/ squeeze/main grub i386 0.97-64 [118 kB]
Fetched 1139 kB in 1s (578 kB/s)
Preconfiguring packages ...

grub0

Reply “OK”

grub1

As /etc/default/grub does not exits, there is no message.
Reply “OK”.

grub2

Reply “OK”.

grub

You can view this dialog only when you have over 2 active hard disks.
GRUB2 ask you which hard disk you use to boot. Select your choice.

(Reading database ... 12823 files and directories currently installed.)
Removing grub-legacy ...
Selecting previously deselected package grub-pc.
(Reading database ... 12777 files and directories currently installed.)
Unpacking grub-pc (from .../grub-pc_1.98+20100804-13_i386.deb) ...
Selecting previously deselected package grub.
Unpacking grub (from .../archives/grub_0.97-64_i386.deb) ...
Setting up grub-pc (1.98+20100804-13) ...
Creating config file /etc/default/grub with new version
Installation finished. No error reported.

Installation has finished.

Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.33.7-rt29-voyage
Found initrd image: /boot/initrd.img-2.6.33.7-rt29-voyage
done
Setting up grub (0.97-64) ...

Maybe it means old settings are transfered to grub.cfg. But I am not sure.
If you are an Alix user you must setup GRUB_DEFAULT. Please refer to Mr. Shin blog more.

root@voyage:~# reboot

Reboot to confirm GRUB2 update.

You must install os-prober for multiboot. “os-prober” is a program to seach installed system and tell them to grub.

root@voyage:~# apt-get install os-prober   #[command]
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  os-prober
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 23.8 kB of archives.
After this operation, 188 kB of additional disk space will be used.
Get:1 http://ftp.tw.debian.org/debian/ squeeze/main os-prober i386 1.42 [23.8 kB]
100% [Working]
Fetched 23.8 kB in 0s (58.5 kB/s)
Selecting previously deselected package os-prober.
・・・
(Reading database ... 13009 files and directories currently installed.)
Unpacking os-prober (from .../os-prober_1.42_i386.deb) ...
Setting up os-prober (1.42) ...

Search

root@voyage:~# os-prober   #[command]
/dev/sda1:Windows 7 (loader):Windows:chain
/dev/sdb1:Debian GNU/Linux (squeeze/sid):Debian:linux
/dev/sdb5:Ubuntu 10.10 (10.10):Ubuntu:linux

“os-prober” displays Installed OS and updates GRUB information(grub.cfg).

root@voyage:~# update-grub   #[command]
Generating grub.cfg ...
Found linux image: /boot/vmlinuz-2.6.33.7-rt29-voyage
Found initrd image: /boot/initrd.img-2.6.33.7-rt29-voyage
Found Windows 7 (loader) on /dev/sda1
Found Debian GNU/Linux (squeeze/sid) on /dev/sdb1
Found Ubuntu 10.10 (10.10) on /dev/sdb5
done

Reboot your sytem. Confirm multiple boot.

(PC_Audio)   Comments

Update Voyage MPD for the best audio performance

013


build OSS from source code

This is very effective to tune up MPD’s audio performance.
You must prepare packages, download source code and build for yourself, therefore it is a bit difficult, but is recommended.
Reference Link is here.

Install packages necessary to build OSS

root@voyage:~# apt-get install -y binutils libgtk2.0-0 sed gcc libc6
root@voyage:~# apt-get install -y build-essential linux-headers-`uname -r` gawk libtool libgtk2.0-dev
root@voyage:~# apt-get install -y libesd0 libsdl1.2debian-oss

1st and 2nd line is required. I am not sure 3rd line is requisite but I think they do not disturb.
“/etc/apt/sources.list” is as following.

# /etc/apt/sources.list

deb http://ftp.tw.debian.org/debian/ squeeze main contrib
deb http://ftp.jp.debian.org/debian/ squeeze main contrib
deb http://security.debian.org/ squeeze/updates main contrib

deb http://www.voyage.hk/dists/experimental/ ./

I think last line is not needed(not confirmed).

Download OSS source code

root@voyage:~# apt-get install -y mercurial
root@voyage:~# cd /opt
root@voyage:/opt# hg clone http://opensound.hg.sourceforge.net:8000/hgroot/opensound/opensound oss-devel

In the referremce Link there is a description about recent testing tar bar but I neglect it because experimental version is not needed.

Make a directory to build

root@voyage:~# cd ~/
root@voyage:~# rm -rf oss42build
root@voyage:~# mkdir oss42build
root@voyage:~# cd oss42build/

“rm -rf” is not needed for the first time.

Build OSS (configure and make)

root@voyage:~/oss42build# NO_WARNING_CHECKS=yes /opt/oss-devel/configure --enable-libsalsa=NO
root@voyage:~/oss42build# make
root@voyage:~/oss42build# make deb

Quite time consuming. Especially, “make” takes 10 minutes in my environment.

Install OSS

root@voyage:~/oss42build# ls -l ./
root@voyage:~/oss42build# mv ./oss-linux-4.2-2004_i386.deb ../
root@voyage:~/oss42build# cd ..
root@voyage:~# ln -s /usr/src/linux-headers-`uname -r` /lib/modules/`uname -r`/build
root@voyage:~# dpkg -i oss-linux-4.2-2004_i386.deb
root@voyage:~# dpkg-reconfigure linux-sound-base

“ls” command is to confirm oss-linux-4.2-2004_i386.deb is build. “cd”s command are not necessary to install but you had better do them if you change OSS and Alsa frequently.
Finally following dialog will appear

oss

Select OSS and move OK by using “tab” and enter.

Confirm OSS operation, Setup MPD and reboot

root@voyage:~# ossinfo
root@voyage:~# osstest
root@voyage:~# emacs /etc/mpd.conf
audio_output {
       type            "oss"
       name            "My OSS Device"
       device          "/dev/dsp0"      # optional
#       format          "44100:16:2"    # optional
#       mixer_device    "/dev/mixer"    # optional
#       mixer_control   "PCM"           # optional
}
root@voyage:~# reboot

If osstest end after an error, surely there is no sound.
The information to fix this problem is here and here(These articles are in 4Front forum).
The method in the information means to end normal when device doed not accept sample rate assignment.

About how to change source code of ossusb_audio.c, descriptions are in the 2nd Link. “return 1;” must be added immediately after function definition of “write_control_value”. And ossusb_audio.c is in /opt/oss-devel/kernel/drv/oss_usb/ossusb_audio.c.

Of cource you should edit this change before configure.

You had better comment out Alsa’s “audio_output” in mpd.conf.
[device “/dev/dsp0”] must match ossinfo information.

Back to Alas

Comment in Alsa’s “audio_output” and comment out OSS’s “audio_output” in mpd.conf.

root@voyage:~# apt-get remove oss-linux
root@voyage:~# dpkg-reconfigure linux-sound-base
root@voyage:~# reboot



In my Atom environment package size become such as below.

-rw-r--r--  1 root root 2182980 2011-02-07 21:23 oss-linux-4.2-2004_i386.deb  build version
-rw-r--r--  1 root root 2460804 2011-01-06 03:10 oss-linux-4.2-2004_i386.deb  download version

Build version is smaller than download version by 270KB. I think this means much for audio performance.

Build the latest version of Alsa (1.24)

I referred to the following links.

Install basic libraries for Alsa

root@voyage:~# apt-get install aptitude wget
root@voyage:~# aptitude install build-essential libncurses-dev gettext xmlto xmltoman linux-headers-`uname -r`


Download driver source and expand

root@voyage:~# mkdir -p Alsa
root@voyage:~# cd ./Alsa/
root@voyage:~/Alsa# wget ftp://ftp.alsa-project.org/pub/driver/alsa-driver-1.0.24.tar.bz2
root@voyage:~/Alsa# cd alsa-driver-1.0.24/
root@voyage:~/Alsa# tar xjvf alsa-driver-1.0.24.tar.bz2


Advance preparation to build driver

root@voyage:~/Alsa/alsa-driver-1.0.24# pkill mpd
root@voyage:~/Alsa/alsa-driver-1.0.24# apt-get remove alsa-base


Build driver

Build usb-audio only and not include unnecessary features.

root@voyage:~/Alsa/alsa-driver-1.0.24# CFLAGS="-O2 -mtune=`uname -m`" ./configure --with-cards=usb-audio --with-sequencer=no --with-isapnp=no --with-kernel=/usr/src/linux-headers-$(uname -r)
root@voyage:~/Alsa/alsa-driver-1.0.24# make
root@voyage:~/Alsa/alsa-driver-1.0.24# make install
root@voyage:~/Alsa/alsa-driver-1.0.24# reboot


Confirm Alsa is updated

root@voyage:~# cat /proc/asound/version 
Advanced Linux Sound Architecture Driver Version 1.0.24.
Compiled on May  7 2011 for kernel 2.6.33.7-rt29-voyage (SMP).


If you want to build libraries and utilities.

Download driver source code and expand
root@voyage:~# cd Alsa/
root@voyage:~/Alsa# wget ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.24.1.tar.bz2
root@voyage:~/Alsa# wget ftp://ftp.alsa-project.org/pub/utils/alsa-utils-1.0.24.2.tar.bz2
root@voyage:~/Alsa# tar xjvf alsa-lib-1.0.24.1.tar.bz2
root@voyage:~/Alsa# tar xjvf alsa-utils-1.0.24.2.tar.bz2

Build libraries
root@voyage:~/Alsa# cd ./alsa-lib-1.0.24.1/
root@voyage:~/Alsa/alsa-lib-1.0.24.1# ./configure 
root@voyage:~/Alsa/alsa-lib-1.0.24.1# make
root@voyage:~/Alsa/alsa-lib-1.0.24.1# make install

Build utilities
root@voyage:~/Alsa/alsa-lib-1.0.24.1# cd ../alsa-utils-1.0.24.2
root@voyage:~/Alsa/alsa-utils-1.0.24.2# ln -s libpanelw.so.5 /usr/lib/libpanelw.so
root@voyage:~/Alsa/alsa-utils-1.0.24.2# ln -s libformw.so.5 /usr/lib/libformw.so
root@voyage:~/Alsa/alsa-utils-1.0.24.2# ln -s libmenuw.so.5 /usr/lib/libmenuw.so
root@voyage:~/Alsa/alsa-utils-1.0.24.2# ln -s libncursesw.so.5 /lib/libncursesw.so
root@voyage:~/Alsa/alsa-utils-1.0.24.2# ./configure 
root@voyage:~/Alsa/alsa-utils-1.0.24.2# make
root@voyage:~/Alsa/alsa-utils-1.0.24.2# make install

Refer to the links about the meaning of “ln -s”.


Build the MPD latest version (0.17.0)

This tip has great effect but it is a little risky. Please try it at your own risk.

stop mpd

pkill mpd

Install basic libraries for MPD

apt-get install aptitude wget
apt-get install git binutils gcc make subversion autoconf automake autotools-dev libtool pkg-config
apt-get install build-essential libncurses5-dev libncursesw5-dev linux-headers-`uname -r` libglib2.0-dev


Install individual functional libraries for MPD

Select individual functional libraries that you need. Comment in necessary, comment out unnecessary line. Edit them as shell script and run it.

#apt-get install libmikmod2 libmikmod2-dev                  # disable modplug decoder plugin
#apt-get install libfaad2 libfaad-dev                       # disable AAC(MP4/AAC) support (default: enable)
apt-get install libflac8 libflac-dev                       # enable flac support (default: enable)
apt-get install libogg0 libogg-dev  libvorbis0a libvorbis-dev  # enable Ogg Vorbis support (default: enable)
apt-get install libid3tag0 libid3tag0-dev libmad0 libmad0-dev  # enable id3 support (default: enable)
apt-get install libcue-dev libcue1                         # enable support for libcue(cue sheet) support
apt-get install libasound2 libasound-dev libasound2-dev    # enable ALSA support
#aptitude install libpulse-dev libpulse0 libpulse-ocaml libpulse-browse0 libpulse-mainloop-glib0  # disable pulse support
#aptitude install libjack-0.116 libjack-dev libjackson-json-java   # disable jack support
#aptitude install libgme0 libgme-dev                        # disable Blargg's game music emulator plugin(gme)
#aptitude install sqlite3 libsqlite3-dev                    # disable sqlite
#aptitude install libao-dev                                 # disable ao
#apt-get install libwavpack-dev libwavpack1                 # disable WavPack support
#apt-get install libmikmod2-dev libmikmod2 libmikmod-dev    # disable the mikmod decoder (default: disable)
apt-get install libsamplerate0 libsamplerate-dev           # enable libsamplerate(sample rate) support
apt-get install libshout-dev                               # enables the shoutcast streaming output
apt-get install libavformat52 libavformat-dev libavcodec-dev libavcodec52 libavutil49 libavutil-dev  # enable FFMPEG(mp3,ape etc) support
apt-get install libaudiofile0 libaudiofile-dev             # enable audiofile support (WAV and others)
# apt-get install libsndfile-dev libsndfile1                # disable sndfile support
#apt-get install libcdio-cdda0 libcdio-dev libcdio-paranoia0 libcdio10 libcdio-paranoia-dev  # CDIO_PARANOIA
aptitude install libcurl-dev libcurl4-openssl-dev          # enable support for libcurl(CURL) HTTP streaming (default:auto)
apt-get install libmms-dev libmms0                         # enable the MMS protocol with libmms
#apt-get install libtwolame-dev libtwolame0                 # disable the TwoLAME mp2 encoder
# LAME: http://debian-multimedia.org/pool/main/l/lame/lame.php   disable libmad mp3 decoder plugin
#wget http://debian-multimedia.org/pool/main/l/lame/libmp3lame0_3.98.4-0.0_i386.deb
#wget http://debian-multimedia.org/pool/main/l/lame/libmp3lame-dev_3.98.4-0.0_i386.deb
#dpkg -i libmp3lame0_3.98.4-0.0_i386.deb libmp3lame-dev_3.98.4-0.0_i386.deb
apt-get install libavahi-client-dev libavahi-glib-dev      # enable avahi, this line is required  after voyage mpd v0.75


git latest version of MPD

git clone git://git.musicpd.org/master/mpd.git
cd ./mpd


Create configure and configure and build

Automatically generate configure script

./autogen.sh

Edit following lines as shell script and run it.

emacs ./my-config
#!/bin/sh
./configure \
--disable-bzip2 \
--disable-iso9660 \
--disable-zzip \
--enable-id3 \
--disable-sqlite \
--enable-ffmpeg \
--enable-alsa \
--disable-wave-encoder \
--enable-pipe-output \
--enable-httpd-output \
--disable-recorder-output \
--enable-sndfile \
--enable-oss \
--enable-shout \
--disable-pulse \
--disable-ao \
--disable-mad \
--disable-inotify \
--disable-ipv6 \
--enable-curl \
--disable-mms \
--disable-wavpack \
--disable-lame-encoder \
--disable-twolame-encoder \
--enable-vorbis \
--enable-lsr \
--enable-rtopt \  <--  This line is necessary for Tuning patches. Refer to the next article
--with-zeroconf=auto \
CFLAGS="-O2 -mtune=`uname -m`"
sh ./my-config

Minimize enable options. Disable ipv6 and sndfile.
Disable sndfile is very important if you use 24bit USB DAC or DDC because “enable” means no sound. Optimise option is O2.

Run make and make install.

make
make install

Change MPD directory and start MPD

Change MPD directory

echo DAEMON=/usr/local/bin/mpd >>/etc/default/mpd
/etc/init.d/mpd start

Confirm MPD 0.17.0 is running

mpc version

“mpc version” shows running MPD version.

If you want to build again another condition, run

make clean 
./autogen.sh
sh ./my-config
make
make install

You can confirm configure’s default “./mpd/configure –help”.

Back to the original

root@voyage:~# pkill mpd
root@voyage:~# emacs /etc/default/mpd
#DAEMON=/usr/local/bin/mpd
root@voyage:~# /etc/init.d/mpd start



(PC_Audio)   Comments

Tuning Patches for MPD by yan


Tuning Patches for MPD by yan


If you try the following patch, please do it all at your own risk. There are no warranties about the following patches.
Copyright policy of this patch is same as MPD.

Download Tuning Patch for MPD (mpd-rtopt-110605.tgz) by yan

Download Tuning Patch update for MPD (mpd-0.17-1123-rtopt.diff.gz) by yan

This parch is for git from 201111 to 201202.

Download Tuning Patch update for MPD (mpd-0.17git-20120226rtopt.diff.gz) by yan

This parch is for mpd-0.17.1(stable) and git from 201202 to 201207.

Download Tuning Patch update for MPD (mpd-0.17git-20120819rtopt.diff.gz) by yan

This parch is for git(0.18) from 201208.



Tuning Patches for MPD
These patches are to add realtime_option for MPD-0.17git or MPD-0.16.2. To improve MPD audio quality, these patches are intended to manage per-thread priority in RT(realtime) kernel and to allocate real memory to MPD’s virtual space. You can configure MPD’s thread scheduling priority and real memory allocation by editing /etc/mpd.conf.
Tuning Patch update is for current(november 2011) git version.

These patches are for MPD version 0.17.0 or 0.16.2 and for Linux RT kernel (major taget is Voyage MPD). The latest MPD’s version of Voyage MPD is 0.16.0. Therefore, applying these patches, you must update MPD to version 0.17.0 or 0.16.2.
Refer to the article before Build MPD latest version (0.17.0) how to build MPD.

You must do

before you patch mpd.

Run following commands in the MPD’s expanding directory before “Create configure and configure and build”.
Assuming the tar ball (and mpd-0.17-1123-rtopt.diff.gz) is on USB memory stick.

tar zxvf /media/usb0/mpd-rtopt-110605.tgz
cp /media/usb0/mpd-0.17-1123-rtopt.diff.gz ./ <- if necessary
gzip -d mpd-0.17-1123-rtopt.diff.gz           <- if necessary
patch -p1 < mpd-0.17git-rtopt.diff       <- 0.17git June 2011 version
or
patch -p1 < mpd-0.17-1123-rtopt.diff     <- 0.17git November 2011 version
or
patch -p1 < mpd-0.16.2-rtopt.diff        <- 0.16.2
patch -p1 < buffer.c.diff

And you must edit /etc/mpd.conf to make Yan’s patches effective before “Change MPD directory and start MPD”.

add realtime_option section.
realtime_option {
    memlock              "yes"
    stack_reserve        "1024"
    heap_reserve         "0"
    
    main_priority        "OTHER:0"
    player_priority      "FIFO:49"
    decoder_priority     "FIFO:48"
    update_priority      "OTHER:0"
}
add priority to audio_output
audio_output {
        type            "alsa"
        name            "alsa-xmos"
        device          "x20"
        priority        "FIFO:99"  <-- add this line
}


Compiled binaries of MPD appling Tuning Patches by yan

Here are compiled binaries of MPD 0.17git and 0.16.2 appling Tuning Patches by yan. About what they are, refer to the article before.

Download compiled binaries of MPD 0.17git appling Tuning Patch

Download compiled binaries of MPD 0.16.2 appling Tuning Patch

MPD setting is below.

########### MPD CONFIGURATION ############

Archive support:
        (-bzip2) (-ISO9660) (-ZIP)
Client support:
        (-IPv6) (+TCP) (+UNIX Domain Sockets)
File format support:
        (-AAC) (-C64 SID) (+FFMPEG) (+FLAC) (-FluidSynth) (-GME) (-libsndfile)
        (-MikMod) (-MODPLUG) (-MAD) (-MPG123) (-MP4) (-Musepack) (-OggFLAC)
        (-OggTremor) (+OggVorbis) (+WAVE) (-WavPack) (-WildMidi)
Other features:
        (+libsamplerate) (-inotify) (+SQLite)
Metadata support:
        (-cue) (+ID3)
Playback support:
        (+ALSA) (-ROAR) (+FFADO) (+FIFO) (-File Recorder) (-HTTP Daemon) (-RAOP) (+JACK) (-libao) (+OSS)
        (-OpenAL) (-OS X) (+Pipeline) (-PulseAudio) (-Media MVP) (-SHOUTcast)
        (-Solaris) (-WinMM)
Streaming support:
        (-CURL) (-Last.FM) (-MMS) (-CDIO_PARANOIA) (-Despotify)

##########################################

How to install.

login as root
tar zxvf mpd????.tgz
cd mpd????
run mpdinstall.sh(sh mpdinstall.sh)


The contents of the installation shell script is as follows.

#!/bin/bash
# mpdinstall.sh  Script to install MPD with tunig patches
/etc/init.d/mpd stop
cp ./mpd /usr/local/bin
echo DAEMON=/usr/local/bin/mpd >>/etc/default/mpd
sed -i "s/^\([\t ]\+device[\t ]\+\"hw:[0-9]\+,[0-9]\+\".*\)$/\1\n\tpriority\t\"FIFO:52\"/" /etc/mpd.conf
cat <<EOF>>/etc/mpd.conf
# realtime option
realtime_option {
    memlock              "yes"
    stack_reserve        "1024"
    heap_reserve         "10240"

    main_priority        "OTHER:0"
    player_priority      "FIFO:47"
    decoder_priority     "FIFO:48"
    update_priority      "OTHER:0"
}
EOF
/etc/init.d/mpd start

Here is Yan’s readme.txt.
You can understand details of the patches if you read it.

Latest (Dec 2011) compiled binaries of MPD appling Tuning Patches by yan

Here are latest compiled binaries of MPD 0.17git and 0.16.5 appling Tuning Patches by yan.
About how to install them, please refer to the article before.

Download compiled binaries of MPD 0.17git appling Tuning Patch

Download compiled binaries of MPD 0.16.5 appling Tuning Patch

The shell script to assign compile-options is below.

#!/bin/sh
./configure \
    --disable-bzip2 \
    --disable-iso9660 \
    --disable-zzip \
    --disable-cue \
    --enable-id3 \
    --enable-sqlite \
    --enable-ffmpeg \
    --enable-alsa \
    --enable-pipe-output \
    --enable-httpd-output \
    --disable-recorder-output \
    --disable-oss \
    --enable-shout \
    --disable-pulse \
    --disable-ao \
    --disable-mad \
    --disable-oggflac \
    --disable-inotify \
    --disable-ipv6 \
    --enable-curl \
    --enable-mms \
    --disable-wavpack \
    --disable-sndfile \
    --enable-rtopt \
    --with-zeroconf=auto \
    CFLAGS="-O2 -mtune=`uname -m`"


Readme.txt of Tuning Patches for MPD by yan


Introduction

These patches are for Mpd-0.17git and MPD-0.16.2 to add realtime_option to MPD.
Realtime_option means

by editing mpd.conf.

MPD applying these patches may cause abnormal system operation operation by incorrect use. Please be careful about setting parameters.
Please refer to “Starting-up Note” below.

Operating environment

These patches are only for Linux. You cannot use them without Linux.
I confirmed them in the following operating systems.

Archive Contents

You can get the following files from the archive.

mpd-0.17git-rtopt.diff

patches for mpd-0.17git

mpd-0.16.2-rtopt.diff

patches for mpd-0.16.2

buffer.c.diff

This is a complementary patch to rtopt.diff.
With this patch, you can choose higher priority of player than decoder.
It solve the problem about the opening of song and is effective in stable fast-forward.
It can work both in MPD 0.17git and 0.16.2.

config-sample.sh
A sample of confifure(shell script).

memory.txt(in Japanese)

Documents on memory-related settings.

readme.txt(in Japanese)

This file.

Reference sites

Following sites have published documents on various settings and parameters about this patches.
Please refer to them.

How to apply patches

mpd-0.16.2

Move the directory where MPD source is expanded.

       patch -p1 < mpd-0.16.2-rtopt.diff
       patch -p1 < buffer.c.diff


mpd-0.17git

Move the directory where MPD source is expanded.

       patch -p1 < mpd-0.17git-rtopt.diff
       patch -p1 < buffer.c.diff


MPD-0.17 version is under development, so these patches would not work if mpd’s version is different from the patch’s version.
Please check the reject file does not exist.

    find . -name "*.rej" -print

If exists, please contact us (yo’s mail_address is bottom in this page or comment yo’s bulletin board).

How to compile

After patch MPD, run “autogen.sh” to create “configure”.
Run “configure”.
If the parameter “- enable-rtopt” is set in configure’s option, you can make realtime_option effective.
You can confirm by the MPD CONFIGURATION message “(+rtopt)” if rtopt is valid.
After configure, run “make” and “make install”.

–Supplement–
The file named “config-sample.sh” is an example file that specifies configure parameters. You can create always same MPD regardless the state of libraries installed in your system.
If “make” ends error, because library needed do not exist, then install it and run “sh config-sample.sh”.

How to set parameters

Added the following parameters to mpd.conf.

realtime_option (new block parameters)
memlock, and how to schedule threads(main, player, decoder, update), specify the priority
audio_output (add priority parameter)
how to schedule output thread, specify the priority

Realtime_option

realtime_option works when you add the block parameters enabling realtime_option to mpd.conf.

realtime_option parameters are as follows.

  realtime_option {
    memlock              "yes"
    stack_reserve        "1024"
    heap_reserve         "0"
    
    main_priority        "OTHER:0"
    player_priority      "FIFO:49"
    decoder_priority     "FIFO:48"
    update_priority      "OTHER:0"
  }
memlock
If you specify “yes”, memory used by mpd is locked(real memory space allocated for virtual).
Although Linux processes memory space at startup, real memory is not assigned to this area. Access to the area that is not allocated to memory, page fault signal is generated and kernel allocates memory to the running program.
Kernel locks into memory for real-time applications if you do not want them to intervene.
Also, the locked region will not swap out. (Voyage has no Swap area therefore it will not affect)
If your system has a small amount of memory, you specify “no” to avoid hang-up.
stack_reserve
Specifies the size of real memory allocated to use pre-stack area.
Unit is “kb”. Please set the value in the range of 0 to 1024 maximum.
heap_reserve
Specifies the size of real memory allocated to you to use at run-time memory in advance. Unit is “kb”.
If you specify memlock “no”, you may keep amount of real memory allocated by this parameter. However, the area you specify has possibly be swaped outed.
main_priority, player_priority, decoder_priority, update_priority
Specify thread priority and scheduling.
Specify “scheduling : priority”

Scheduling method can be specified as follows.
About linux scheduling, refer to the man of sched_setscheduler(2).

OTHER
To schedule a regular Linux process. In this case, specify the priority 0.
FIFO
Accord to schedule priority.
If process/thread gets the right to run, it will continue to run until one of the following conditions are met
– runnable process/thread with higher priority appears
– it waives its right to run (yield)
– it sleeps (wait until the execution condition is satisfied)
When multiple processes/threads are running under the same priority order, kernel decide a process/thread to run with “first in first out(FIFO)” order. If process/thread sleeps. it is queued to the end of the queue.
RR
Accord to schedule priority.
If process/thread gets the right to run, it will continue to run until one of the following conditions are met
– runnable process/thread with higher priority appears
– it waive its right to run (yield) – it sleep (wait until the execution condition is satisfied)
– conditions above are not met even within a period of time
When multiple processes/threads are running under the same priority order, kernel decide a process/thread to run with “first in first out(FIFO)” order. If process/thread sleep to wakeup it is queued to the end of the queue.
BATCH
I do not know.

Typically, use FIFO.
Priority FIFO and RR is in the range of 1-99. The larger the priority number is higher. (Note “top” command is opposite).

Priority of Output

Specify priority by describing the parameters in the scheduling block “audio_output”.

Example:

      audio_output {
        type            "alsa"
        name            "alsa-xmos"
        device          "x20"
        priority        "FIFO:81"
      }

If you have more than one audio_output, specified priority in each audio_output.

Starting-up Note

If you specify realtime_option, limit values are cleared. A non-root can not execute this system calls, therefore please start MPD at the root.
Also, /etc/security/limits.conf is not referenced. (It may be a security hole)

Extra Starting-up Note 1 — About memorylock and heap_reserve memory value
if you use memlock, large value of heap_reserve and stack_reaserve may cause swap because the amount of memory other processes can use decrease. In this case a system as voyage MPD that do not use swap method cannot activate process.
heap_reserve could be 0 if you set memolock no. When you set memlock yes and heap_reserve not 0, you should determine the value of heap_reserve very carefully.
Extra Starting-up Note 2 — About busy hang by inappropriate scheduling
There is no method to stop a system that loops and hangs by inappropriate scheduling. In this case you must reset a system by reset button.
Therefore it is recommended that you use a dedicated system such as Voyage MPD for these patches.
Fortunately, I didn’t encountere the situation like this busy loop. But please be careful about the system such as MPD 0.17 which is now in development.


From here is a technical note.

MPD thread

MPD consists of the following threads.

main thread
starts each thread and communicates with client programs.
player thread
controls player’s commands (play, stop etc.) and monitors buffers betweend ecoder and output to manage that decoder thread and the output thread work properly.
decoder thread
load audio files, convert them to pcm, pass them through buffers to output thread.
output thread
get pcm data from decoder thread and pass them to the pcm output driver.
update thread
update tag_cache(DB).

Setting policy of the priority of each thread

main and update thread
they seems to be not directly involved in playing music, therefore “OTHER:0” to them.
decoder thread
when it deals with compressed files such as alac or flac, it consumes relatively large CPU time. In this conditions if it is assigned high priority, other threads can not work properly. Therefore I assume it is assigned relatively low priority.
output thread
Decoder operates as a producer and output operates as a consumer in synchronization with the output sampling rate of music files. Output does not consume CPU. (*1)
It seems that if the operation of output is distorted, the sound operation of the thread affected very much (no evidence, just my assumption). Therefore I think output thread must have relatively high priority.
*1 Like Alsa if the sampling rate conversion is carried out in the library, this is not yhe case.
player thread
higher priority than the decoder is recommended.

In summary

main = update <<< decoder < player < output


Processes related in audio playback are

If decoder uses CPU for a long time, the operation of the interrupt handler could be disturbed. Therefore decoder priority should be lower than interrupt handlers priority.
Also, when you use USB audio devices, USB interrupt handlers do not want to upset any action.
Timer interrupts do not want to be disturbed too much when it is used to adjust the timing of the program. However, sirq-timer consume CPU highly, so too much high priority of sirq-timer is not desirable to control whole ballance.
I think that is a good set as follows to consider these factor.

    decoder < player < sirq-**, irq-** < output = usb interrupt handlers = sirq-hrtimer
or
    decoder < player < sirq-**, irq-** < usb interrupt handlers = sirq-hrtimer < output

Priority of the process must be tuned in coordination between processes. It might be related to a relative thing, so other combinations could be considered.

The priority value itself does not make much sense. Correlation of the value is important.
For exsample, if there is no process running priority level 80-89, there is no operational change by setting a process priority level 80 and 89. But if there is a process running priority level 85, setting a process priority level 80 and 89 means changing the operation of process.

— Memo —

On audio_buffer_size, buffer_before_play

Between decoder and output, there are FIFO buffers through which decoder deliver PCM data to output. Player thread is monitoring buffer condition(free or not) of decoder. This buffer is known as music_buffer.

“music_buffer” will be managed by the unit of 4kb chunks.
The number of chunks is determined by “audio_buffer_size” / 4kb. –> Chunks
“before_play” will be replaced by the number of chunks. (Chunks * buffer_before_play) / 100

Player thread which monitors the extent of free space in music_buffer and directs the transfer of data to decoder.
It decide free space in music_buffer by the following formula.

The number of buffers in the current chunk < (before_play + (chunks * 3) / 4)
If before_play is 0 (buffer_before_play 100 percent if you set) and 1/4 in the music_buffer is available, then data could be transferred to decoder.
And if befor_play is over 25%, available, data could be transferred to decoder.

On the other hand, decoder have internal buffers for conversion when it receives a request from player thread, it add music_buffer until full. When buffer is emptied for the conversion between them, it read file data from the conversion.

From above, if buffer_before_play over 25 percent, the operational result should be the same.
At this time the cpu load of decoder is distributed because it is often invoked.
When buffer_befor_play become to 0, the amount conversion of decoder become large. Therefore data may be lost as buffer_size is insufficient.
When you play high-bit data samples, the condition is more severe.

As audio_buffer_size is known to change sound expression, it is caused by this thread interference. Therefore decoder priority is lower than output priority, it will be no longer affected.
“audio_buffer_size” change comes out not to affect sound.

Configuration example

My currentl configuration is the following settings.

 -------- Mpd.conf --------
 realtime_option {
     memlock "yes"
     stack_reserve "1024"
     heap_reserve "0"
    
     main_priority "OTHER: 0"
     player_priority "FIFO: 49"
     decoder_priority "FIFO: 48"
     update_priority "OTHER: 0"
 }

 audio_output {
         type "alsa"
         name "alsa-xmos"
         device "x20"

         priority "FIFO: 99"
 }
 -------------------------------
 --------- / Etc / rc.local --------

 chrt-p-f 98 `pgrep sirq-hrtimer`
 # Chrt-p-f 97 `pgrep sirq-timer`
 chrt-p-f 98 `pgrep irq/12-ehci_hcd`
 chrt-p-f 98 `pgrep irq/12-ohci_hcd`
 ---------------------------------------


How to confirm a setting

Confirm command priority.

ps-eLo pid, lwp, rtprio, priority, cmd

“pid + lwp” can identify threads.

lwp priority is

 main < decoder < player < output

in turn.
If there are multiple outputs, you can not specify threads.

rtprio is realtime priority.
TOP priority is same as PR. “RT” in TOP means rtprio = 99, .

About rtprio and priority, refer to http://www.mazn.net/blog/2010/09/18/311.html
This site would be helpful.

memory status

You can confirm your memory ussage by the following command. (Process ID is pid).

# cat /proc/pid/status

Example
If you start MPD by the mpd.conf in the configuration example above,

# cat /proc/1726/status

Name:   mpd
State:  S (sleeping)
Tgid:   1726
Pid:    1726
PPid:   1
TracerPid:      0
Uid:    103     103     103     103
Gid:    29      29      29      29
FDSize: 32
Groups: 29 
VmPeak:    60152 kB
VmSize:    60148 kB
VmLck:     60148 kB
VmHWM:     60136 kB
VmRSS:     60132 kB
VmData:    40836 kB
VmStk:      1032 kB
VmExe:       268 kB
VmLib:     17664 kB
VmPTE:        72 kB
.....


VmSize is the size of virtual space.
VmLck is the size of virtual space locked.
VmRss is the size of physical memory allocated.
VmData is the size of uninitialized data.
VmStk is the stack size.

VmSize = VmLck means locking the entire virtual space (which is fixed in physical memory).

If you start MPD without realtime_option specified

VmPeak:    51920 kB
VmSize:    51920 kB
VmLck:         0 kB
VmHWM:     14160 kB
VmRSS:     14160 kB
VmData:    30596 kB --- heap_reserve minutes is smaller
VmStk:        84 kB --- stack is also reduced
VmExe:       268 kB
VmLib:     20624 kB
VmPTE:        52 kB

As VmRss is smaller than VmData, there is still physical memory not allocated in the uninitialized data section of program.

If you set memlock set “no”, following is the result.

VmPeak:    63108 kB
VmSize:    63108 kB
VmLck:         0 kB
VmHWM:     25416 kB
VmRSS:     25416 kB --- heap_reserve be increased by
VmData:    40836 kB --- heap_reserve be increased by
VmStk:      1032 kB
VmExe:       268 kB
VmLib:     20624 kB
VmPTE:        60 kB

heap_reserve is allocated in the physical memory but there are places not yet allocated.
Thus, memlock seems to be better.

If you set heap_reserve size more than the difference between VmData and VmSize, you can increase the VmSize.
heap_reserve to “102400”

VmPeak:   155272 kB
VmSize:   155272 kB
VmLck:    155272 kB
VmHWM:    155256 kB
VmRSS:    155256 kB
VmData:   132996 kB
VmStk:      1036 kB
VmExe:       268 kB
VmLib:     20624 kB
VmPTE:       164 kB

If VmSize and VmPeak is increaseing during MPD works, it is a good idea to increase heap_reserve in advance.


(PC_Audio)   Comments

Best Tuning Tips for Voyage MPD

x27

Play MPD from memory file

You shoud have enough memory to try this tip. If you want to play a whole CD at once, 2MB memory will be necessary.
Voyage MPD has mount point(/dev/shm) for tmpfs(you can confirm it by df command).

root@voyage:~# mkdir /dev/shm/music_mem
root@voyage:~# ln -s /dev/shm/meusic_mem/ /music
root@voyage:~# cp -r /music/BIS\ Sampler\ 1992 /dev/shm/music_mem
root@voyage:~# sync;echo 3 > /proc/sys/vm/drop_caches

“/music” is music directory.
“sync;echo 3 > /proc/sys/vm/drop_caches” clear cache.
Note that Linux limits tmpfs capacity to the half size of real memory. You can change the value by mount command or fstab. Anyway real memory size is very important for this tip.

There are two problems for this Tip. Processing time and Time-consuming. About processing time faster hard is needed. About time-consuming following setup of emacs dried, lisp and shell script is effective.
Edit shell script in home directory as following.

#!/bin/bash
# Clear cache, start to play
#     mpc_start.sh
#
sync;echo 3 > /proc/sys/vm/drop_caches
mpc clear
mpc update music_mem
sleep 1
mpc ls music_mem | mpc add
sleep 1
mpc play

Sleep timer values must be adjusted according to your environment.

Add .emacs following lines.

; Assigh z-key to music-file-copy
(add-hook 'dired-mode-hook
  (lambda ()
     (define-key dired-mode-map "z" 'dired-cp-music)))
; Copy music file
(defun dired-cp-music ()
  (interactive)
  (let ((file (dired-get-filename)))
    (message "file copy start")
    (setq buf (get-buffer-create "copy_music_file"))
    (with-current-buffer buf
    (erase-buffer))
    (call-process "rm" nil buf nil "-r" "/dev/shm/music_mem")
    (call-process "cp" nil buf nil file "-r" "/dev/shm/music_mem")
    (call-process "ls" nil buf nil "-l" "/dev/shm/music_mem")
    (call-process "/root/mpc_start.sh" nil buf nil)
    (display-buffer buf)))

Run “emacs /music” dried. Select music directory. Push “z” key to start playing music.

You should edit and add following lines to “/etc/rc.local” to make this tip effective automatically after reboot.

mkdir /dev/shm/music_mem
mpc clear
mpc update music_mem


Setup grub parameters for tuning

A file you must edit will be changed whether you have updated grub.

“grub.cfg” is a read-only file by default therefore you should chmod it 744 as root.

Add “clocksource=hpet” and “maxcpus=1” to kernel line(s) for grub tuning.
Edit kernel line(s) like this.

root@voyage:~# emacs /boot/grub/menu.lst or /boot/grub/grub.cfg
(from) 
kernel /vmlinuz root=LABEL=ROOT_FS 
( to ) 
kernel /vmlinuz root=LABEL=ROOT_FS clocksource=hpet maxcpus=1


Note both tuning parameters are environment dependent.

hpet(high precision timer)

Your H/W should support a high precision timer for “hpet”.
You can check whether your H/W support a high precision timer for excellent timer performance or not by followig comands.

root@voyage:~# cat /sys/devices/system/clocksource/clocksource0/available_clocksource  # confirm available_clocksource
root@voyage:~# cat /sys/devices/system/clocksource/clocksource0/current_clocksource    # confirm current_clocksource

maxcpus(Multi CPU support)

Refer to this link.
You can check your CPU type by the following command.

root@voyage:~# cat /proc/cpuinfo


NAS tuning setup

To improve audio quality it is recommended that music data are placed on NAS. Therefore NAS tuning setup is very important.

cifs buffer tuning

Refer to this page about the detail of parameters.
Maximize read buffer size and optimize write buffer size. Edit /etc/fstab and “mount -a”.

root@voyage:~# emacs /etc/fstab
//192.168.0.3/cd2 /music1 cifs  username=hoge,password=,uid=mpd,file_mode=0644,dir_mode=0755,iocharset=utf8,rsize=130048,wsize=4096 0 0
mount -a


Tune LAN buffers size

Refer to this link and this page.
Add following lines to /etc/sysctl.conf.

root@voyage:~# emacs /etc/sysctl.conf

net.core.rmem_max=12582912
net.core.wmem_max=12582912
net.ipv4.tcp_rmem= 10240 87380 12582912
net.ipv4.tcp_wmem= 10240 87380 12582912
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_no_metrics_save = 1
net.core.netdev_max_backlog = 5000

vm.overcommit_memory = 2
vm.overcommit_ratio = 50

root@voyage:~# sysctl -p

Best size depend on your physical memory size and LAN speed. Tune them as you like.


Setup tuning parameters of Linux

Adjust control values.

root@voyage:~# emacs /etc/sysctl.conf            # adjust control values
fs.inotify.max_user_watches = 524288
vm.swappiness = 10

Adjust limit values

root@voyage:~# emacs /etc/security/limits.conf   # adjust limit values
@audio - rtprio 99
@audio - memlock unlimited
@audio - nice -19

Selct services to stop by using sysv-rc-conf. You must install sysv-rc-conf first.
“cron, dnsmasq, hostpapd, klogd, lirc, lighttpd, nfs-common, pptpd, portmap, sysklogd, watchdog, wd_keepalive” are candidates to remove.

root@voyage:~# apt-get remove pptpd              # Memory leak
root@voyage:~# apt-get install sysv-rc-conf      # Stop daemon services
root@voyage:~# sysv-rc-conf                      #

Adjust latency timer values Latency timer channel number depend on your environment.

root@voyage:~# lspci -nn                         # adjust latency timer values
root@voyage:~# lspci -v                          #
root@voyage:~# emacs /etc/rc.local               #
setpci -v -d 8086:27cb latency_timer=ff
setpci -v -d 8086:27cc latency_timer=ff

Adjust priority values. Interrrupt handler names depend on your system.

root@voyage:~# lsusb                             # adjust priority values
root@voyage:~# cat /proc/interrupts              #
root@voyage:~# ps aux                            #
root@voyage:~# emacs /etc/rc.local               #
chrt -f -p 53 `pgrep sirq-timer/0`
chrt -f -p 53 `pgrep sirq-timer/1`
chrt -f -p 51 `pgrep irq/23-ehci_hcd`
chrt -f -p 52 `pgrep irq/16-uhci_hcd`

You will find more information about priority tuning next chapter.


How to setup priority for Voyage MPD

In this chapter I will explain how to use Yan’s tuning patch and setup priority for Voyage MPD.
Yan’s tuning patch is intended for the best tuning of Voyge MPD. I think Voyage MPD as a RT Linux works best by Yan’s tuning patch.

Find process and thread working when you play music

From here I will explain on condition that music data is read from NAS and play music using USB audio devices.

First check interrupt processes.

root@voyage:~# cat /proc/interrupts
           CPU0
  0:        136   IO-APIC-edge      timer
  1:          8   IO-APIC-edge      i8042
  9:          0   IO-APIC-fasteoi   acpi
 14:          0   IO-APIC-edge      ide0
 16:     168578   IO-APIC-fasteoi   uhci_hcd:usb5, eth0
 18:          0   IO-APIC-fasteoi   uhci_hcd:usb4
 19:       2261   IO-APIC-fasteoi   ata_piix, uhci_hcd:usb3
 23:     152168   IO-APIC-fasteoi   ehci_hcd:usb1, uhci_hcd:usb2
NMI:          0   Non-maskable interrupts
LOC:      43427   Local timer interrupts
SPU:          0   Spurious interrupts
PMI:          0   Performance monitoring interrupts
PND:          0   Performance pending work
RES:          0   Rescheduling interrupts
CAL:          0   Function call interrupts
TLB:          0   TLB shootdowns
ERR:          0
MIS:          0

Numbers under “CPU0” are interrrupt number. Therefore only “13:IO-APIC uhci_hcd:usb5, eth0(is NAS connection), 23:IO-APIC ehci_hcd:usb1, uhci_hcd:usb2(is USB audio), LOC:Local timer interrupts” are working during the play.
Check interrrupt process numbers snd names and interrrupt levels.

root@voyage:~# ps -eLo pid,rtprio,priority,cmd | grep irq
    4     49 -50 [sirq-high/0]
    5     49 -50 [sirq-timer/0]
    6     49 -50 [sirq-net-tx/0]
    7     49 -50 [sirq-net-rx/0]
    8     49 -50 [sirq-block/0]
    9     49 -50 [sirq-block-iopo]
   10     49 -50 [sirq-tasklet/0]
   11     49 -50 [sirq-sched/0]
   12     49 -50 [sirq-hrtimer/0]
   13     49 -50 [sirq-rcu/0]
  120     50 -51 [irq/9-acpi]
  942     50 -51 [irq/1-i8042]
 1147     50 -51 [irq/14-ide0]
 1148     50 -51 [irq/23-ehci_hcd]
 1149     50 -51 [irq/19-ata_piix]
 1156     50 -51 [irq/23-uhci_hcd]
 1157     50 -51 [irq/19-uhci_hcd]
 1158     50 -51 [irq/18-uhci_hcd]
 1159     50 -51 [irq/16-uhci_hcd]
 1831     50 -51 [irq/16-eth0]

As you can see, realtime S/W interrupt level is 49 and H/W interrupt level is 50 by default.
Check “top” display.

1st time
root@voyage:~# top
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 2681 mpd       20   0 58996  56m  14m S    1  2.8   0:04.37 mpd
 1148 root     -51   0     0    0    0 S    1  0.0   1:15.33 irq/23-ehci_hcd
    5 root     -50   0     0    0    0 S    0  0.0   0:02.37 sirq-timer/0
 1228 root     -51   0     0    0    0 S    0  0.0   0:05.63 irq/23-uhci_hcd
 1242 root     -51   0     0    0    0 S    0  0.0   0:06.06 irq/16-uhci_hcd
 1949 root     -51   0     0    0    0 S    0  0.0   0:07.30 irq/16-eth0
2nd time
root@voyage:~# top
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
 2681 mpd       20   0 58996  56m  14m S    1  2.8   0:12.37 mpd
 1148 root     -51   0     0    0    0 S    1  0.0   1:19.72 irq/23-ehci_hcd
    5 root     -50   0     0    0    0 S    0  0.0   0:02.49 sirq-timer/0
   13 root     -50   0     0    0    0 S    0  0.0   0:02.60 sirq-rcu/0
 1831 root     -51   0     0    0    0 S    0  0.0   0:07.69 irq/16-eth0
 2065 root      20   0     0    0    0 S    0  0.0   0:10.52 cifsd

“TIME+” is cumulative operating time.
You can know that “mpd” and “cifsd” are major working task.
Check those processes name.

root@voyage:~# ps -eLo pid,lwp,rtprio,priority,cmd | egrep "mpd|cifsd"
  PID   LWP RTPRIO PRI CMD
 2065  2065      -  20 [cifsd]
 2681  2681      -  20 /usr/local/bin/mpd /etc/mpd.conf
 2681  2682      -  20 /usr/local/bin/mpd /etc/mpd.conf
 2681  2684      -  20 /usr/local/bin/mpd /etc/mpd.conf
 2681  2687      -  20 /usr/local/bin/mpd /etc/mpd.conf

MPD runs as 4 threads. From the information of yan’s readme.txt, These 4 threads are main, player, decoder and output.
Now you can know all related processes and threads.

S/W interrupt process
sirq-timer/0
H/W interrupt process
irq/23-ehci_hcd —> USB 2.0 interrupt irq/23-uhci_hcd —> USB 1.1 interrupt irq/16-eth0 —> LAN interrupt irq/16-uhci_hcd —> USB 1.1 interrupt
LAN process
cifsd

You can change priority of these processes by using “chrt” command.

MPD process
main thread player thread decoder thread update thread output thread

You can chage priority of these threads by using yan’s patch(This is what yan’s patch is great).

Change priority of process by using “chrt” command

“chrt” is a command to manipulate real-time attributes of a process. Usage is folloeing.

chrt -f -p priority process-number

You can get process-number from process name by using “pgrep” like this.

chrt -f -p 52 `pgrep irq/23-uhci_hcd`

You had better make them a shell script like this.

#!/bin/bash
# chrtset.sh    setup realtime priority for Voyage MPD
chrt -f -p 50 `pgrep sirq-timer/0`
chrt -f -p 52 `pgrep irq/23-uhci_hcd`
chrt -f -p 52 `pgrep irq/23-ehci_hcd`
chrt -f -p 52 `pgrep irq/16-uhci_hcd`
chrt -f -p 52 `pgrep irq/16-eth0`
chrt -f -p 48 `pgrep cifsd`

Edit /etc/rc.local to run this script when you boot.

root@voyage:~# emacs ./chrtset.sh
edit and save chrtset.sh
root@voyage:~# emacs /etc/rc.local
add the following line and save rc.local
sh /root/chrtset.sh


Change priority of threads of MPD by using yan’s patch

Refer yan’s readme.txt about how to edit tunings parameters of “mpd.conf”.
For convenience, I collected these parameters at the beginning of mpd.conf.

# An example configuration file for MPD
# realtime option
realtime_option {
    memlock              "yes"
    stack_reserve        "1024"
    heap_reserve         "0"

    main_priority        "OTHER:0"
    player_priority      "FIFO:50"
    decoder_priority     "FIFO:47"
    update_priority      "OTHER:0"
}
audio_output {
        type            "alsa"
        name            "My ALSA Device"
        device          "hw:0,0"        # optional
        priority        "FIFO:52"
#       format          "44100:16:2"    # optional
#       mixer_device    "default"       # optional
#       mixer_control   "PCM"           # optional
#       mixer_index     "0"             # optional
}
audio_buffer_size               "1024"
buffer_before_play              "30%"



(PC_Audio)   Comments

Extra Tips for Voyage MPD


How to use firewire audio devices

Voyage MPD kernel has built in support for firewire devices. Therefore you can run them by building FFADO and installing Jack.

Confirm firewire devices connection

root@voyage:~# lsmod | grep -e 1394 -e firewire
firewire_ohci          17362  0 
firewire_core          31344  1 firewire_ohci
crc_itu_t                981  1 firewire_core
root@voyage:~# ls -l /dev/fw*
crw------- 1 root root  253, 0 2011-06-06 02:14 /dev/fw0
crw-rw---- 1 root audio 253, 1 2011-06-06 02:14 /dev/fw1
root@voyage:~# grep . /sys/bus/firewire/devices/fw*/*_name
/sys/bus/firewire/devices/fw0/model_name:Juju
/sys/bus/firewire/devices/fw0/vendor_name:Linux Firewire
/sys/bus/firewire/devices/fw1.0/model_name:Konnekt8
/sys/bus/firewire/devices/fw1/model_name:Konnekt8
/sys/bus/firewire/devices/fw1/vendor_name:TC Electronic

About the meaning of each command, refer to Check your kernel modules and device permissions.


Advanced preparation(setup compilation environment and install the necessary modules)

Setup compilation environment
Add source info to /etc/apt/sources.list.

root@voyage:~# emacs /etc/apt/sources.list
deb-src http://ftp.jp.debian.org/debian/ squeeze main contrib

Add source info to /etc/apt/sources.list.d/voyage.list.

root@voyage:~# emacs /etc/apt/sources.list.d/voyage.list 
deb-src http://www.voyage.hk/dists/0.7 ./

Install required modules.

root@voyage:~# svn co http://subversion.ffado.org/ffado/trunk/libffado ffado-svn 
root@voyage:~# apt-get build-dep libffado

Download FFADO sources. Install libraries and header files.

root@voyage:~# svn co http://subversion.ffado.org/ffado/trunk/libffado ffado-svn 
root@voyage:~# apt-get build-dep libffado


Buid FFADO

Compile and install.

root@voyage:~# cd ffado-svn/
root@voyage:~/ffado-svn# scons PREFIX=/usr DEBUG=False ENABLE_OPTIMIZATIONS=True ENABLLE_FIREWORKS=False ENABLE_MOTU=False ENABLE_DICE=True BUILD_TESTS=True
root@voyage:~/ffado-svn# scons install

About parameters of compile, refer to Compile and install FFADO from source.
Why “REFIX=/usr”, refer to Why and how to avoid multiple parallel installations of jackd and FFADO.

Confirm the installation of FFADO.

root@voyage:~/ffado-svn# ffado-test ListDevices
-----------------------------------------------
FFADO test and diagnostic utility
Part of the FFADO project -- www.ffado.org
Version: 2.999.0-1985
(C) 2008, Daniel Wagner, Pieter Palmers
This program comes with ABSOLUTELY NO WARRANTY.
-----------------------------------------------

=== 1394 PORT 0 ===
  Node id  GUID                  VendorId     ModelId   Vendor - Model
   0       0x00016604084009bf  0x00000166  0x00000021   TC Electronic - Konnekt8 
   1       0x0011d800011e2d2d  0x000011D8  0x00000000   Linux Firewire - 
no message buffer overruns

You can found your firewire audio device.

Install JACK

root@voyage:~/ffado-svn# aptitude install libjack-0.116 libjack-dev libjackson-json-java
root@voyage:~/ffado-svn# aptitude install jackd2-firewire

Upper stage operation is for MPD and lower stage operation is for firewire Jack daemon.

Setup MPD environment

Start Jack server.

root@voyage:~/ffado-svn# jackd -dfirewire -r44100 &

Display firewire ports.

root@voyage:~/ffado-svn# jack_lsp
firewire_pcm:00016604084009bf_mic | inst | line 1_in
firewire_pcm:00016604084009bf_mic | inst | line 2_in
firewire_pcm:00016604084009bf_coaxial L_in
firewire_pcm:00016604084009bf_coaxial R_in
firewire_pcm:00016604084009bf_midi 0_in
firewire_pcm:00016604084009bf_line 1 | main L_out
firewire_pcm:00016604084009bf_line 2 | main R_out
firewire_pcm:00016604084009bf_coaxial L_out
firewire_pcm:00016604084009bf_coaxial R_out
firewire_pcm:00016604084009bf_midi 0_out

Use coaxial L_out and coaxial R_out.
Add audio_output for Jack to /etc/mpd.conf.

root@voyage:~/ffado-svn# emacs /etc/mpd.conf 
audio_output {
        type            "jack"
        name            "mpd"
        ports  "firewire_pcm:00016604084009bf_coaxial L_out,firewire_pcm:00016604084009bf_coaxial R_out"
}


Change mpd passward and setup shell

root@voyage:~# passwd mpd
Enter new UNIX password: 
Retype new UNIX password: 
root@voyage:~# chsh mpd
Changing the login shell for mpd
Enter the new value, or press ENTER for the default
        Login Shell [/bin/false]: /bin/bash


login as mpd user

Restart MPD. Kill jackd. Exit root. login mpd. Start jackd.

root@voyage:~/ffado-svn# /etc/init.d/mpd restart
root@voyage:~# pkill jackd
root@voyage:~/ffado-svn# exit
login as mpd user
mpd@voyage:~$ jackd -dfirewire -r44100 &

About jackd options, refer to Using JACK with FFADO.

(PC_Audio)   Comments

Extra edition

MPD on SheevaPlug

What you need to build “MPD on SheevaPlug”

Before building “MPD on SheevaPlug”

At first you must prepare your host PC can access the serial console to connect SheevaPlug. Also you had better install TFPT in your host PC. The way to access the serial console and to install TFPT is different from the OS you use, please find the guides in internet.

Depending on the device you have, you may have to upgrade the u-boot. In this case refer to this page.

Your SheevaPlug must be connected to an Ethernet cable because many files should be downloaded from the Internet for building “MPD on SheevaPlug”.

Install stable Debian to your SheevaPlug

TFPT

Much of the information of this chapter depends on this page. Many thanks to the auther.

Before you start the installation, you have to download the uImage and uInitrd from the link and place them in your TFPT program’s directory. Then start TFPT.

Connect SD card(upsidedown) to your SheevaPlug and start SheevaPlug and press a key to interrupt the boot process from your host serial console.
You must change a setting from the boot command line as your SheevaPlug will boot Debian kernel on SD card and can access to your host TFPT program.

Hit any key to stop autoboot:  3  0
Marvell>> setenv mainlineLinux yes
Marvell>> setenv arcNumber 2678
Marvell>> setenv serverip 192.168.0.3  <- your host IP address
Marvell>> setenv ipaddr 192.168.0.35
Marvell>> setenv netmask 255.255.255.0
Marvell>> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
Marvell>> reset

Now you can load and start the installer.

Marvell>> tftpboot 0x01100000 uInitrd
Marvell>> tftpboot 0x00800000 uImage
Marvell>> setenv bootargs console=ttyS0,115200n8 base-installer/initramfs-tools/driver-policy=most
Marvell>> bootm 0x00800000 0x01100000

The installation itself is standard and you can follow the installation guide.

DEBIAN

The followins are my choice(in red).

Select a language ->  C
Select your location ->  Asia ->  Japan
Detecting network hardware
Configuring the network ->  debian
Domain name ->  ddo.org
Choose a mirror of the Debian archive ->  Japan ->  ftp.jp.debian.org
HTTP proxy information (blank for none) ->  (none)
Loading additional components
Set up users and passwords
root password ->  ********
Full name for the new user ->  xxxxx
Choose a password for the new user ->  ********
Getting the time from a network time server
Detecting disks and all other hardware
Starting up the partitioner
Partition disks
Partitioning method ->  Guided - use entire disk
Selected for partitioning ->  MMC/SD card #1 (mmcblk0) - 2.0 GB SD 00000
Partitioning scheme ->  All files in one partition (recommended for new users)
 ->  Finish partitioning and write changes to disk
Write the changes to disks? ->  Yes
Partitions formatting
Installing the base system
Select and install software
Configuring popularity-contest -> Yes
Software selection ->  SSH server

DEBIAN

Making the system bootable
Installation complete -> Continue

The installation has been done.
You must configure u-boot so that it will automatically boot Debian. Interrupt the boot process of u-boot and enter the following commands.

Hit any key to stop autoboot:  3  0
Marvell>> setenv bootargs_console console=ttyS0,115200
Marvell>> setenv bootcmd_mmc 'mmcinit; ext2load mmc 0:1 0x00800000 /uImage; ext2load mmc 0:1 0x01100000 /uInitrd'
Marvell>> setenv bootcmd 'setenv bootargs $(bootargs_console); run bootcmd_mmc; bootm 0x00800000 0x01100000'
Marvell>> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
Marvell>> reset


Initial settings and install Japanese environment

Now yon can login Debian(Stable version) on ARM. Password is the password which you enter in the installation.

Debian GNU/Linux 6.0 debian ttyS0

debian2 login: root
Password: ********

Linux debian2 2.6.32-5-kirkwood #1 Tue Jun 14 23:05:32 UTC 2011 armv5tel

First you had better fix your IP address and update&upgrade.

root@debian2:~# nano /etc/network/interfaces
#iface eth0 inet dhcp
iface eth0 inet static
        address 192.168.0.36
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        dns-nameservers 192.168.0.1

root@debian2:~# apt-get update
root@debian2:~# apt-get upgrade

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Nano is a compact editor builded in Debian. If you like emacs, install it. Please note it consumes some space of SD card.

root@debian2:~# apt-get install emacs

Updating category cid..
Updating category cmap..

I am a Japanese so install Japanese environment(fonts and locales).

root@debian2:~# apt-get install ttf-kochi-gothic ttf-kochi-mincho ttf-kochi-gothic-naga10 ttf-sazanami-gothic ttf-sazanami-mincho

Setting up ttf-kochi-gothic (20030809-9) ...
Setting up ttf-kochi-mincho (20030809-9) ...
root@debian2:~# apt-get install language-env manpages-ja

(x-terminal-emulator) in auto mode.
root@debian2:~# dpkg-reconfigure -plow locales

Configuring locales ->  ja_JP.UTF-8 ->  Ok
Generating locales (this might take a while)...
  ja_JP.UTF-8... done
Generation complete.

Then setup Japanese environment.

root@debian2:~# set-language-env -R
Setting up users' native language environment
8 : ja  (Nihongo,Japanese)
Input number > 8
network NO DOKOKA BETSUNO computer DE Canna server GA UGOITE IMASUKA [y/N] 
Wnn server GA UGOITE IMASEN.
network NO DOKOKA BETSUNO computer DE Wnn server GA UGOITE IMASUKA [y/N] 
SKK server GA UGOITE IMASEN.
network NO DOKOKA BETSUNO computer DE SKK server GA UGOITE IMASUKA [y/N] 
KANJI HENKAN NIHA DORE WO TSUKAI MASUKA 1=Canna 2=Wnn 3=SKK 4=Anthy 5=PRIME 6=none  (1..6, [Enter]=1) 6

NIHONGO NIHA KANKEINO NAI SAMAZAMANA SETTEIWO OKONAI MASUKA [Y/n] 
X Window System DE UGOKU program NO SETTEI DESU.
SETTEI WO OKONAI MASUKA  [Y/n] n
SETTEI SHIMASEN.

bash SHIYOU JI NI, login JI NI JIKKOU SAREMASU.
TAN-NI, .bashrc WO JIKKOU SURU DAKENO NAIYOU DESU.
SETTEI WO OKONAI MASUKA  [Y/n] 
SETTEI SHIMASU ...

bash GA KIDOU SURU TOKI NI JIKKOU SAREMASU.
SAMAZAMA NA SETTEI WO SHITEIRU NODE, MEWO TOOSHITE OITE KUDASAI.
SETTEI WO OKONAI MASUKA  [Y/n] 
SETTEI SHIMASU ...

Canna NO SETTEI DESU.
SETTEI WO OKONAI MASUKA  [Y/n] n
SETTEI SHIMASEN.

csh NO KIDOU JI NI JIKKOU SAREMASU.
SETTEI WO OKONAI MASUKA  [Y/n] n
SETTEI SHIMASEN.

emacs NO SETTEI DESU.
SETTEI WO OKONAI MASUKA  [Y/n] 
SETTEI SHIMASU ...

emacs DEHA, KANJI HENKAN NIHA DORE WO TSUKAI MASUKA? 1=Canna 2=Wnn 3=SKK 4=Anthy 5=PRIME 6=none  (1..6, [Enter]=6) 6
ATARASHII file "/root/.emacs" WO TSUKURIMASU...

bash NADO, readline library WO MOCHIITA program NO SETTEI DESU.
SETTEI WO OKONAI MASUKA  [Y/n] n
SETTEI SHIMASEN.

xdm WO TSUKATTE X Window System NI login SHITA TOKI NI JIKKOU SAREMASU.
MATA, startx YA xinit WO TSUKATTE X WO KIDOU SHITA TOKI NIMO JIKKOU SAREMASU.
SETTEI WO OKONAI MASUKA  [Y/n] n
SETTEI SHIMASEN.

xemacs21 NO SETTEI DESU.
SETTEI WO OKONAI MASUKA  [Y/n] n
SETTEI SHIMASEN.

[Enter] key WO OSUTO KONO set-language-env HA SYUURYOU SHIMASU.

root@debian2:~# emacs ./.bashrc
LANG=ja_JP.UTF-8


Install Alsa and MPD

These take a little time but these are package installations. Therefore very easy.

root@debian2:~# apt-get install alsa-base alsa-utils
root@debian2:~# apt-get install mpd mpc ncmpc


SHEEVA

Update Debian to the latest version(unstable)

Compiled binaries are in sheeva.with-linux.com.
You can update Debian to the latest version automatically to use the installer(README-PLUG-UPDATE.sh) in this site.

First, download the installer(README-PLUG-UPDATE.sh)

root@debian2:~# wget http://sheeva.with-linux.com/sheeva/README-PLUG-UPDATE.sh
root@debian2:~# chmod a+x README-PLUG-UPDATE.sh

You must specify Linux versionsnd SD card to start the installer.
At the moment recommended version is 2.6.38.8. Version 2.6.39.2 has a trouble that there is no sound in USB 2.0 supprt of Alsa 2.04.

root@debian2:~# ./README-PLUG-UPDATE.sh 2.6.38.8 --rootkernel 
.....
Extracting modules
Writing kernel to /boot
****************************************************************
 update your bootcmd to load sheeva-2.6.38.8-uImage
 or create a link from /boot/sheeva-2.6.38.8-uImage to /boot/uImage
****************************************************************

You must make initrd by using sheeva-2.6.38.8.config.

root@debian2:~# wget http://sheeva.with-linux.com/sheeva/2.6.38/2.6.38.8/sheeva-2.6.38.8.config
root@debian2:~# mv sheeva-2.6.38.8.config .config
root@debian2:~# cp ./.config /boot/config-2.6.38.8
root@debian2:~# mkinitramfs -o ./initrd 2.6.38.8
root@debian2:~# mkimage -A arm -O linux -T ramdisk -C gzip -a 0x0 -e 0x0 -n "2.6.38.8 ramdisk" -d ./initrd /boot/uInitrd-2.6.38.8
Image Name:   2.6.38.8 ramdisk
Created:      Wed Jun 29 08:20:05 2011
Image Type:   ARM Linux RAMDisk Image (gzip compressed)
Data Size:    3096894 Bytes = 3024.31 kB = 2.95 MB
Load Address: 0x00000000
Entry Point:  0x00000000

You shoud move directory to /boot and change links to uImage and uInitrd 2.6.38.8.

root@debian2:~# cd /boot
root@debian2:/boot# mv uImage{,-2.6.32-5-kirkwood}
root@debian2:/boot# mv uInitrd{,-2.6.32-5-kirkwood}
root@debian2:/boot# mv ./sheeva-2.6.38.8-uImage ./uImage-2.6.38.8
root@debian2:/boot# ln -s uImage-2.6.38.8 uImage
root@debian2:/boot# ln -s uInitrd-2.6.38.8 uInitrd

You can confirm the result. Then reboot.

root@debian2:/boot# ls -la
total 21700
drwxr-xr-x  3 root root    1024 Jun 29 08:26 .
drwxr-xr-x 22 root root    4096 Jun 14 16:46 ..
-rw-r--r--  1 root root 1003185 Jun 15 17:00 System.map-2.6.32-5-kirkwood
-rw-r--r--  1 root root   84134 Jun 15 17:00 config-2.6.32-5-kirkwood
-rw-r--r--  1 root root   81778 Jun 29 08:18 config-2.6.38.8
lrwxrwxrwx  1 root root      28 Jun 28 22:55 initrd.img -> initrd.img-2.6.32-5-kirkwood
-rw-r--r--  1 root root 5474545 Jun 28 23:18 initrd.img-2.6.32-5-kirkwood
drwxr-xr-x  2 root root   12288 Jun 28 22:31 lost+found
-rw-r--r--  1 root root 1217590 Jun 29 08:15 sheeva-2.6.38.8-System.map
lrwxrwxrwx  1 root root      15 Jun 29 08:26 uImage -> uImage-2.6.38.8
-rw-r--r--  1 root root 1433612 Jun 28 23:19 uImage-2.6.32-5-kirkwood
-rw-r--r--  1 root root 2798800 Jun 29 08:15 uImage-2.6.38.8
lrwxrwxrwx  1 root root      16 Jun 29 08:26 uInitrd -> uInitrd-2.6.38.8
-rw-r--r--  1 root root 5474609 Jun 28 23:19 uInitrd-2.6.32-5-kirkwood
-rw-r--r--  1 root root 3096958 Jun 29 08:20 uInitrd-2.6.38.8
lrwxrwxrwx  1 root root      25 Jun 28 22:55 vmlinuz -> vmlinuz-2.6.32-5-kirkwood
-rw-r--r--  1 root root 1433548 Jun 15 16:59 vmlinuz-2.6.32-5-kirkwood
root@debian2:/boot# reboot


SHEEVA

Update MPD to the latest version

Before you start building MPD, you must install the required tools and kernelheaders.

~# apt-get install git binutils gcc make subversion autoconf automake autotools-dev libtool pkg-config
~# apt-get install build-essential libncurses5-dev libncursesw5-dev libglib2.0
~# wget http://sheeva.with-linux.com/sheeva/2.6.38/2.6.38.8/sheeva-2.6.38.8-KernelHeaders.tar.gz
~# tar x -C / --overwrite -zf ./sheeva-2.6.38.8-KernelHeaders.tar.gz

Install required packages.

~# apt-get install libogg0 libogg-dev  libvorbis0a libvorbis-dev
~# apt-get install libavformat52 libavformat-dev libavcodec-dev libavcodec52 libavutil49 libavutil-dev
~# apt-get install libflac8 libflac-dev
~# apt-get install libasound2 libasound-dev libasound2-dev
~# apt-get install libsndfile-dev libsndfile1 libaudiofile0 libaudiofile-dev

git latest version of MPD

~# git clone git://git.musicpd.org/master/mpd.git

Automatically generate configure script.

~# cd mpd/
~/mpd# ./autogen.sh

configure and build MPD.

~/mpd# pkill mpd
~/mpd# CFLAGS="-O2" ./configure --disable-ipv6
~/mpd# make
~/mpd# make install

Change MPD directory, setup music directory, edit mpd.conf and start MPD.

~/mpd# emacs /etc/default/mpd
DAEMON=/usr/local/bin/mpd
~/mpd# emacs /etc/fstab
//192.168.0.3/cd2 /music1 cifs username=yo,password=,uid=root,file_mode=0644,dir_mode=0755,iocharset=utf8 0 0
~/mpd# mount -a
~/mpd# ln -s /music1/ /var/lib/mpd/music
~/mpd# emacs /etc/mpd.conf
#bind_to_address                "localhost"
follow_outside_symlinks "yes"
follow_inside_symlinks          "yes"
        device          "hw:1,0"        # optional
~/mpd# /etc/init.d/mpd start


mpodjacket.rb by yan for MPoD and MPaD

This ruby script is developed by yan.
I think it may be very useful for MPoD and MPaD users.
You can download it from the following link.

mpodjacket.rb by yan – A server to deliver cover art to MPoD and MPaD

# mpodjacket.rb
#
# NAME
#      mpodjacket.rb - extracts cover art from music-file(FLAC,ALAC,MP3,OGG) and deliver it to MPoD
#
# SYNOPSIS
#      mpodjacket.rb [-r document_root] [-m music_holder] [-p port] [-s save_file]
#
# DESCRIPTION
#     mpodjacket.rb is ruby-script that delivers the cover art to MPoD.
#     mpodjacket.rb looks for cover art in the following order,to deliver the cover art found.
#
#       1. The requested files from MPoD.
#       2. Folder.jpg, folder.jpg, Folder.jpeg, folder.jpeg.
#       3. Cover art(jpeg only) extracted from music-files(FLAC,ALAC,MP3,OGG).
#          It is also saved to a file.
#
# OPTION
#      -r document_root 
#         set document root, the default is /var/www.
#
#      -m music_folder
#         set music folder,  the default is /Music.
#
#      -p port
#         set port, the default is 8888.
#
#      -s set cover art's file name, default does not save.
#
#   ex:
#       if music_folder is /home/mpd/Music
#
#       ./mpodjacket.rb -r /home/mpd -m /Music -p 8888 -s Folder.jpg
#
#      MPoD Local Cover art setting
#
#          URL          http://host:8888/Music
#          Filename     Folder.jpg
#
#
# INSTALLATION
#
#  1.  install ruby (at least 1.8, or more if you use ogg 1.9)
#  2.  install ruby-audioinfo package
#        gem install ruby-audioinfo

You can get yan’s MPD tuning up Patches and Readme from this page. The link is here.

Voyage MPD v0.75 with latest Linux Kernel

Voyage MPD v0.75 is great. It is tuned best for audio performance with kernel 2.6.38.
But I think it is a little regrettable that yan’s tuning patches for MPD in this site can not be fully effectable in v0.75 because RT function is not applied to this version.
RT function is included in linux-2.6.39-after as force threaded irq-handlers. Therefore you could make Voyage MPD v0.75 with RT function by updating Voyage MPD v0.75 kernel to 2.6.39-after.
Kernel update is easy but you must care following two points.

## update grub 2.0
apt-get install grub
upgrade-from-grub-legacy
# apt-get install os-prober if you need
# os-prober if you need
# update-grub2 if you need

If you are an Alix user you must setup GRUB_DEFAULT. Please refer to Mr. Shin blog more.

## install required packages
# apt-get install aptitude libncurses5-dev if you need
# aptitude install kernel-package fakeroot lzma if you need
cd /usr/src/
## get kernel sources and voyage 0.75 config
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.39.2.tar.bz2
wget http://mirror.voyage.hk/download/kernel_config/config-2.6.38-voyage_9.0-1
tar xjf linux-2.6.39.2.tar.bz2
cd linux-2.6.39.2
cp ../config-2.6.38-voyage_9.0-1 ./.config
## Whether this is necessary or not, I am not sure.
make oldconfig  <-- reply to all quetions by default
make menuconfig
 Device Drivers  --->
   < M > Sound card support  --->
      < M >   Advanced Linux Sound Architecture  --->
         [ * ]   USB sound devices  --->
            < M >   USB Audio/MIDI driver

make-kpkg clean
make-kpkg --initrd --revision=voyage.2.6.39.2 kernel_image kernel_headers
cd ..
dpkg -i *.deb
## or not change direcrory and dpkg -i ../linux-headers-2.6.39.2_voyage.2.6.39.2_i386.deb ../linux-image-2.6.39.2_voyage.2.6.39.2_i386.deb
reboot

Choose kernel 2.6.39.2 from boot menu.
Now you must install alsa and MPD if necessary.

# apt-get install alsa-base alsa-utils
# apt-get install mpd mpc ncmpc

After this you must setup MPD to work. This is same as a normal setup. So refer to the previous chapters of this page.
You must add linux kernel boot parameter “threadirqs” to effect force threaded irq-handlers.

emacs /etc/default/grub

# seach following line and add "threadirqs". 
GRUB_CMDLINE_LINUX_DEFAULT="quiet threadirqs"

update-grub2
reboot


Voyage MPD v0.75 with Linux 3.0 + RT patches

Recently Linux Kernel 3.0 was released. RT patches are again separated as patches-3.0-rtN. Here is the information about these patches.

You could build Kernel 3.0 for Voyage MPD 0.75 as following (assuming that you had installed grub2 and required packages. Refer to the previous chapter).

cd /usr/src/
## get kernel sources and voyage 0.75 config
wget http://www.kernel.org/pub/linux/kernel/v3.0/linux-3.0.tar.bz2
wget http://www.kernel.org/pub/linux/kernel/projects/rt/patches-3.0-rt3.tar.bz2
wget http://mirror.voyage.hk/download/kernel_config/config-2.6.38-voyage_9.0-1
tar xjf linux-3.0.tar.bz2
cd linux-3.0
cp ../config-2.6.38-voyage_9.0-1 ./.config
bzcat ../patches-3.0-rt3.tar.bz2 | patch -p1
make menuconfig
## Processor type and features -> Preemption Model -> Fully Preemptible Kernel (RT) 
## Select USB Audio/MIDI driver (refer to previous chater)

make-kpkg clean
make-kpkg --initrd --revision=voyage.3.0 kernel_image kernel_headers

About what you must do after make-kpkg, refer to the previous chapter.

Download Linux 3.0.9 Kernel with rt25 patches for Voyage MPD

You can download deb-files of Linux 3.0.9 Kernel with rt25 patches for Voyage MPD here.
About how to compile Linux Kernel with rt patches, please refer to previous chapters.

linux-image-3.0.9-rt25_voyage.3.0_i386.deb

I use Voyage 0.8 config(config-3.0-voyage_10.0-1) and change only “Processor type and features” in menuconfig “Preemption Model” -> “Fully Preemptible Kernel (RT)”.

How to install.

# Login as root. Place linux-image-3.0.9-rt25_voyage.3.0_i386.deb in your current direcrory. 
apt-get install grub
upgrade-from-grub-legacy

If you are an Alix user you must setup GRUB_DEFAULT. Please refer to Mr. Shin blog more.

dpkg -i linux-image-3.0.9-rt25_voyage.3.0_i386.deb
reboot


linux-headers-3.0.9-rt25_voyage.3.0_i386.deb

This is the header files of the kernel above.

dpkg -i linux-headers-3.0.9-rt27_voyage.3.0_i386.deb

to install it.

Voyage MPD v0.75 Kernel config tuned for Atom

You could download config file of tuned for Atom from the following links.

config_voyage_atom_smp_tune.tar.gz

Followings are the differences from the original config(config-2.6.38-voyage_9.0-1).

General setup
(-atom) Local version - append to kernel release 
[ ] Enable VM event counters for /proc/vmstat( -> off)
There are no changes of other parms in this layer.

Enable the block layer
[ ]   Support for large (2TB+) block devices and files 
There are no changes of other parms in this layer.

Processor type and features
[*] Symmetric multi-processing support
[ ] Enable MPS table 
(2) Maximum number of CPUs 
[ ] Support for extended (non-PC) x86 platforms 
[ ] Single-depth WCHAN output 
Processor family (586/K5/5x86/6x86/6x86MX) 
[*] Supported processor vendors  ---> check only intel
[ ] Enable DMI scanning( -> off)
Preemption Model (Fully Preemptible Kernel (RT))
[ ] SMT (Hyperthreading) scheduler support  
[ ] Multi-core scheduler support 
[ ] Enable VM86 support
[ ]   AMD microcode patch loading support
< > /dev/cpu/*/msr - Model-specific register support
[ ] Support for hot-pluggable CPUs 
There are no changes of other parms in this layer.

Power management and ACPI options
[*] ACPI (Advanced Configuration and Power Interface) Support  --->
   <*>   Button
   (0)   Disable ACPI for systems before Jan 1st this year
   Other params in this layer are all off
Other params in this layer are all off

Bus options (PCI etc.)
[*] PCI support 
[*] Interrupts on hypertransport devices
Other params in this layer are all off

Networking support
[*]   Wireless  ---> 
   <M>   Common routines for IEEE802.11 drivers
   Other params in this layer are all off
Other params in this layer are all off

Device Drivers
<*> ATA/ATAPI/MFM/RLL support (DEPRECATED)  --->
   <*>   generic ATA/ATAPI disk support
   [*]     ATA disk support
   [*]   IDE ACPI support
   [*]   legacy /proc/ide/ support
      generic/default IDE chipset support
      Platform driver for IDE interfaces
   [*]   Probe IDE PCI devices in the PCI bus order (DEPRECATED)
      Generic PCI IDE Chipset Support
      Intel PIIX/ICH chipsets support
   Other params in this layer are all off
SCSI device support  --->
   {*} SCSI device support 
   <*> SCSI disk support 
   <M> SCSI generic support
   Other params in this layer are all off
<M> Serial ATA and Parallel ATA drivers  ---> 
   [*]   Verbose ATA error reporting
   [*]   ATA ACPI Support 
   [*]   SATA Port Multiplier support
      AHCI SATA support
   [*]   ATA SFF support
   [*]     ATA BMDMA support 
          Intel ESB, ICH, PIIX3, PIIX4 PATA/SATA support
          CS5535 PATA support (Experimental)
          CS5536 PATA support 
        Generic platform device PATA support 
        Generic ATA support 
        Legacy ISA PATA support (Experimental) 
   Other params in this layer are all off
[ ] Multiple devices driver support (RAID and LVM) 
[ ] Fusion MPT device support
IEEE 1394 (FireWire) support  --->  all off 
[ ] ISDN support 
Input device support  ---> 
   <M> Event interface
   [*]   Keyboards  --->
   Other params in this layer are all off
Character devices  ---> 
   [ ] Legacy (BSD) PTY support
   [ ] /dev/kmem virtual device support
   There are no changes of other parms in this layer.
[*] Network device support  ---> 
   [ ]   Wireless LAN 
   < >   PPP (point-to-point protocol) support
   There are no changes of other parms in this layer.
{M} I2C support  --->  all off 
[ ] GPIO Support 
< > Dallas's 1-wire support 
< > Power supply class support 
< > Hardware Monitoring support 
< > Generic Thermal sysfs driver 
[*] Watchdog Timer Support  ---> 
  <M>   Software watchdog
  <M>   Intel TCO Timer/Watchdog
  [*]     Intel TCO Timer/Watchdog Specific Vendor Support
  Other params in this layer are all off
< > Multimedia support  ---> 
Graphics support  ---> 
  < > /dev/agpgart (AGP Support)  --->
  (2)   Maximum number of GPUs 
  < > Direct Rendering Manager (XFree86 4.1.0 and higher DRI support)  ---> 
  [ ] Bootup logo  --->
  There are no changes of other parms in this layer.
<M> Sound card support  ---> 
  <M>   Advanced Linux Sound Architecture 
    [*]   Support old ALSA API
    [*]   Verbose procfs contents 
    [*]   USB sound devices  --->
       <M>   USB Audio/MIDI driver
  <M>   Open Sound System (DEPRECATED)  ---> 
    <M>   OSS sound modules  ---> 
       [*]   Persistent DMA buffers
[*] USB support  --->  
  < >   USB Monitor 
  < >   xHCI HCD (USB 3.0) support (EXPERIMENTAL)
  < >   USB Modem (CDC ACM) support 
  < >   USB Wireless Device Management support  
  < >   USB Serial Converter support  --->   
  < >   USB LED driver support      
  < >   Cypress USB thermometer driver support 
  < >   USB Gadget Support  --->
  There are no chanes of other parms in this layer.
[ ] X86 Platform Specific Device Drivers 
There are no changes of other parms in this layer.


Download Linux 3.0.9 Kernel tuned for Atom

You could download deb files of 3.0.10 kernel + rt27 patches build by this config.

linux-image-3.0.9-rt25-atom-smp-tune_voyage.3.0_i386.deb

linux-headers-3.0.9-rt25-atom-smp-tune_voyage.3.0_i386.deb

About how to install these deb files, refer to the previous chapter.


MPD on Cubox

CuBox is a small, fanless computer manufactured by the Israeli company SolidRun Ltd, available as an open source development platform.
I think it is best suitable for PC-audio purpose and have tried it.

shuttle

Here I will publish my two images which I have built. They are same in content only filesytems are different.

What you need to install “MPD on Cubox”

The reason is not sure but there are unbootable micro SD cards. From my experience, KINGMAX and SiliconPower’s cards are not bootable. Please change yor card when it cannot boot.

Download Ubuntu-Core images for Cubox

ubuntu-core xfs version

ubuntu-core ext3 version


Make Ubuntu-Core/Debian system for Cubox to a micro SD Card

In Windows you can choose appropriat application to expand gzip and write image. I use alzip for expansin and ddwin to write image.

In linux set your micro SD card to your Linux PC.
Place a system-backup to your current directory.
Confirm your SD card device name and the device is unmounted.

zcat CuboxAudioRTuned_ubuntu-core-[xfs|ext3]-20121108.img.gz | dd of=/dev/sdb


Remove your card and insert it into cubox, try turning on the power.

How to login

cubox login: root
Password: cubox

network configration

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp

ssh, avahi daemon and winbind are available. Host name is “cubox”.

mpd

Three mpd packages with RTopt and buffer patch by yan are available.

You can change them from a terminal with the following script(command).

select-mpd [18g|17s|jk]

/etc/mpd.conf is set to play DSD native mode. If you want to play DSD-PCM convert mode, please edit select-mpd script in /usr/local/bin.

System Configuratin

Kernel configuration

Please refer to .confing in /boot of 1st partion.

installed packages

apt-get install openssh-server
apt-get install ubuntu-minimal
apt-get install avahi-daemon winbind sysv-rc-conf nano usbutils
apt-get install cifs-utils alsa-base alsa-utils
apt-get install mpd mpc ncmpc
apt-get install aptitude
apt-get install libflac-dev libogg-dev libvorbis-dev libid3tag0-dev libmad0-dev libcue-dev libasound2-dev
apt-get install libsamplerate0-dev libshout3-dev libaudiofile-dev libresample1-dev libsamplerate0-dev
apt-get install libavformat53 libavcodec53 libavutil51 libavformat-dev libavcodec-dev libavutil-dev
apt-get install libsndfile1-dev libmms-dev libavahi-client-dev libavahi-glib-dev
aptitude install libcurl-dev libcurl4-openssl-dev

locales

apt-get install language-pack-ja
export LANG=ja_JP.UTF-8
update-locale LANG=ja_JP.UTF-8

On system tuning

nano /etc/security/limits.conf

add following

@audio - rtprio 99
@audio - memlock unlimited
@audio - nice -19

nano /etc/sysctl.conf

add following

net.core.rmem_max=12582912
net.core.wmem_max=12582912
net.ipv4.tcp_rmem= 10240 87380 12582912
net.ipv4.tcp_wmem= 10240 87380 12582912
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_no_metrics_save = 1
net.core.netdev_max_backlog = 5000
vm.overcommit_memory = 2
vm.overcommit_ratio = 50 

nano /etc/mpd.conf

add realtime_option

realtime_option {
        memlock                 "yes"
        stack_reserve           "2048"
        heap_reserve            "10240"

        main_priority           "OTHER:0"
        player_priority         "FIFO:52"
        decoder_priority        "FIFO:51"
        update_priority         "OTHER:0"
}

add audio_output

        priority        "FIFO:52"

make a script to set priorities

nano /etc/init.d/rtset.conf

creat a new file 

#!/bin/sh
chrt -f -p 53 `pgrep irq/24-ehci_hcd`
chrt -f -p 53 `pgrep irq/29-eth0`
chrt -f -p 53 `pgrep cifsd`




top page          page top

(PC_Audio)   Comments
mail