Installing MacOS X on P7P55D-E, Core i7-870, Radeon HD 8670 0

I mainly followed the iBoot + MultiBeast: Install Mac OS X on any Intel-based PC tutorial.

  • I upgraded the BIOS of the P7P55D-E board to the latest version 1504. This is because I wanted to try the “UserDSDT” Installation method in MultiBeast, and a DSDT exists for this version. Not that I have any idea what exactly the difference is between the “UserDSDT” and “EasyBeast” modes of MultiBeast; Sleep mode was supposed to work with UserDSDT, so I went with that.
  • I reduced the installed RAM to a max of 4GB, as instructed. I cannot confirm whether this is really required or not.
  • In the BIOS, I switched from IDE to AHCI under “Configure SATA”, as instructed. Indeed, MacOS X refuses to boot without it.
  • I followed the normal iBoot/MultiBeast install process. I also had to use the PCIRootUID=1 flag; the initial boot of the installation CD took quite a long time; using the -v boot option, it appeared to hang at “Bug: launchctl.c ….”, and “systemShutdown false” for a while, but ultimately moved on after some minutes.
  • After the installation, I applied to 10.6.7 combo update, also as des cribed, and then ran MultiBeast, using the UserDSDT method, and making sure to apply the PCIRootUID fix permanently.
  • After a reboot, Ethernet no longer worked (even though it worked fine after the install; and it also worked fine in my tests using the EasyBeast method). The problem seems to only occu r with UserDSDT. What worked for me was installing the Lnx2Mac Realtek RTL81xx Driver (even though the 8112 chipset on the board is not listed as supported). The driver can be downloaded manually at the link given, I used the version included in MultiBeast.
  • The graphics didn’t work properly. This is because current versions of Snow Leopard do not include a driver for ATI 6000 series cards; the key seems to be kernel extension named ATI6000Controller.kext. The file is specifically only included in Snow Leopard versions and updates intended for the 2011 Macbook Pro. Those files can be ripped from the Macbook Pro install CDs. This is discussed extensively in this thread, with instructions and downloads. Someone also posted a self-installable package, which I used and which worked well.
  • I subsequently installed Ubuntu on the same disk, and was unsure whether to have it install Grub on the main disk (overwriting Chameleon), or just in the Ubuntu partition. I can confirm that the former works just fine – Grub seems to be able to boot into MacOS X without any trouble.

Charting Libraries/Components 0

Multiple subtitle tracks 0

On showing two or more subtitle tracks:

  • KMPlayer (Windows): Allows you to load multiple tracks loaded from external subtitle files, but does not seem to allow showing more than one of the tracks included in a DVD.
  • On Windows, one can let the ffdshow filter display one track, and have the Media Player display another. This is essentially what this article suggests. This does’t work with DVDs either, they never seem to play via ffdshow.
  • PowerDVD allows choosing a secondary subtitle track, though apparently this is only supported when playing DVDs, not for Blurays.
  • 2srt2ass – webservice that makes it easy to merge two .srt files.
  • VLC Ticket: Ticket in VLC tracker to support this feature.

Shairport on Synology NAS 7

Shairport simulates an Airport Express. A Synology NAS box can output through use of a USB audio adapter (I am using a TerraTec AureonDualUSB stick). Since a NAS tends to be running 24/7 anyway, using it as an AirPlay bridge is an obvious choice.

Fair warning though: This is indeed not for the faint-hearted. It turned out to require quite a bit more fiddling and I had expected it to be.

First, you need to get Perl 5.10 running on the NAS. I’ve put up a separate entry on how I did this. Alternatively, you can try to fix the C version for shairport, or try to get my attempted 5.8 port to work).

shairport may require a number of libraries via optware – for example libao. I don’t remember what exactly I had to install.

The next problem is avahi. Synology includes avahi-daemon and uses it internally, but it doesn’t include the avahi-publish client, which shairport uses to announce itself. Further, the included avahi-daemon is compiled without dbus support, so we can’t send commands to it anyway. There are two options at this junction:

  • Statically define a service for shairport in /usr/syno/avahi/services/
  • Replace the builtin avahi-daemon with the optware package.

Both of those are imperfect solutions and both will probably need to be re-applied after a DSM upgrade. The first will not involve any editing of system scripts, but would then announce shairport even if it isn’t running, so I went with the second solution.

First, let’s install avahi and dbus. If we create the groups and users that are required up-front, we will have less problems later:

$ addgroup netdev
$ adduser avahi (errors can be ignored)
$ ipkg install avahi
$ ipkg install dbus

Possible error messages by adduser about lack of a home directory may be ignored. To test, shutdown the builtin avahi-daemon (/usr/syno/etc/rc.d/S99avahi.sh stop), and start the optware one: /opt/sbin/avahi-daemon . “avahi-browse -a” should show sensible information now. If it doesn’t, make sure dbus is running. Possibly, you need to delete the pid file (rm /opt/var/run/dbus/pid), then try starting it again (/opt/etc/init.d/S20dbus start).

To replace the builtin avahi-daemon, what I did was edit the file /usr/syno/etc/rc.d/S99avahi.sh to make the DAEMON variable point to /opt/sbin/avahi-daemon, and then I symlinked /opt/etc/init.d/S20dbus into /usr/syno/etc/rc.d/, so that dbus will start before avahi.

Another problem: shairport, at the time of this writing, uses 5000 as a default port, which will already be in use on your Synology NAS. You need to edit shairport.pl and choose a different port.

At this point, you should be able to run shairport, and see it appear as an AirPlay target in iTunes. (As an aside, the command line I have to use is: $ LD_LIBRARY_PATH=/opt/lib /usr/local/bin/perl /path/to/shairport.pl
the full path to perl ensures that the right version is used, and /opt/lib contains required libraries and is not searched by the default).

Actually playing any audio probably doesn’t work yet. shairport is going to complain “could not open ao device”. On my device, I can play audio via /dev/dsp4. I identified that device by using “lsof | grep mplayer | grep dev” (lsof shows open files and can be installed via optware). You can also use the preinstalled /usr/syno/bin/mplayer to test your audio out from the console. Using “mplayer -v” will make mplayer show the device is is using.

We can tell shairport this by calling it like so:

$ LD_LIBRARY_PATH=/opt/lib /usr/local/bin/perl /path/to/shairport.pl --ao_driver=oss --ao_devicename=/dev/dsp4

It shairport still complains about not being able to open the device, the problem might be that have an older version of libao. You then need to edit shairport’s hairtunes.c and modify one of the calls to ao_append_option() so that the –ao_devicename option is applied using the key “dsp”, rather than “dev”.

To start shairport at boot, I’m using the following the following script, saved as /opt/etc/init.de/S90shairport:

#!/bin/sh
APNAME="Sonos: Bei Michael"
PIDFILE=/opt/var/run/shairport.pid
SHAIRPORT="/usr/local/bin/perl /opt/local/shairport/shairport.pl"

shairport_start() {
        if [ "$(ps | grep shairport\.pl |grep -v grep)" > /dev/null ]; then
                echo "shairport already running, use restart instead"
        else
           echo "Starting shairport..."
           export PATH=/opt/bin:$PATH   # for shairport to find the avahi-publish-service executable
           echo LD_LIBRARY_PATH=/opt/lib $SHAIRPORT --ao_driver=oss --ao_devicename=/dev/dsp4 --apname=\"$APNAME\" -d --writepid=\"$PIDFILE\" | at now + 1 minutes
        fi
}

shairport_stop() {
        echo "Stopping shairport..."
        kill `cat $PIDFILE`
        rm $PIDFILE

}

shairport_restart() {
        shairport_stop
        sleep 1
        shairport_start
        }

case "$1" in
'start')
        shairport_start
        ;;
'stop')
        shairport_stop
        ;;
'restart')
        shairport_restart
        ;;
*)
        echo "Usage: start, stop, restart"
esac

Unfortunately, this script is full of hacks and problems. When running the script from a SSH session, when you exit, the audio stops playing (even thought the shairplay.pl process continues to run). I’m not sure why. If shairport is run as part of the boot process, this is not a problem.

Also note that I am piping the command into the at-daemon, to delay the start by a minute. Unfortunately, optware’s /opt/etc/init.d/* scripts seem to run *before* the stuff in /usr/syno/etc/rc.d/, so this is to ensure that avahi-daemon is already running by the time shairport starts.

Also, dbus makes trouble: Because it never clears out it’s pidfile on shutdown, after a reboot, dbus will not come up. I fixed this by strategically placing a rm -f $PIDFILE in /opt/etc/init.d/S20dbus. The correct way of course would be check whether the pidfile is stale before deleting it, but I fail at shell.

So there it is. You may just want to go and buy an Airport Express.

Perl 5.10.1 on Synology NAS 1

Synology’s NAS come with Perl 5.8, and optware does not have a 5.10 build either. To compile 5.10.1, here’s what I had to do:

  • Make sure the optware lib directory is used, to avoid errors like “undefined reference to `floor’”:
    $ sh Configure -Dplibpth=/opt/powerpc-linux-gnuspe/lib /lib /usr/lib -de
  • As a hack to avoid the “No error definitions found at Errno_pm.PL, Iine 228″ error, I simply commented the “die” statement on that line. As a result, the Errno module is presumably not going to work.

To install packages from CPAN, I’m using the cpanm client. However, it has currently a bug where it calls “tar” with a syntax not supported by the tar version you find on your Synology NAS, so to install it, we actually need to do:

$ wget http://cpan.cpantesters.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.4004.tar.gz
$ tar xzf App-cpanminus-1.4004.tar.gz
$ cd App-cpanminus-1.4004/
$ /usr/local/bin/perl Makefile.PL
$ make && make install

Then, open /usr/local/bin/cpanm, and make the following changes, in sub init_tools:

  • line 1944, my($root, @others) = `$tar tf$ar $tarfile` to my($root, @others) = `$tar ${ar}tf $tarfile`
  • line 1951, system “$tar $xf$ar $tarfile”; to system “$tar $ar$xf $tarfile”;

Now we can install packages:
$ /usr/local/bin/perl /usr/local/bin/cpanm HTTP::Request

Occasionally, to install certain modules or use Perl scripts that use those modules, you need to include the optware lib directory:

$ LD_LIBRARY_PATH=/opt/lib /usr/local/bin/perl /usr/local/bin/cpanm Crypt::OpenSSL::RSA

Cannot SYNOEARename 0

I’m recently seeing a strange behavior when renaming files on a Synology NAS box through am SMB mounted share on Ubuntu: Nautilus shows an error message, saying the file cannot be renamed, but after refreshing the folder, it turns out it has successfully been renamed.

/var/log/messages says:

May 7 16:36:15 smbd: modules/vfs_default.c:1230 Cannot SYNOEARename [Foo] to [Bar], SynoErr=[0x3900]

The problem started appearing after rsync’ing a share from another NAS to this one.

This has to do with the @eaDir directories you’ll find on your volume when looking at them in a shell. I can fix the problem by setting the permissions of these directories recursively to 777. Looking at the source of the Synology Samba extensions, that is supposed to be the default (synoea.c).

The strange thing is, though, that for some reason, I’ve found them set to 007, which should be good enough we all. What’s more, I have a sneaking suspicion that I’ve fixed permissions on the same @eaDir more than once now – which would mean they reset. I’ll have to keep an eye on this.

AirPlay/AirTunes Code 0

  • AP4J-Player – Java client to send videos to AirPlay devices
  • shairport – emulate an AirPort Express to receive audio, written in Perl and C.
  • airstream-media-player – receive video on Windows.
  • AirPlayer/AirFlick – Receive and send video, but Mac-specific.
  • RaopX – stream music to an AirPort Express, Mac-specific, functions as a virtual output device.
  • raop-play – stream music to an AirPort Express. I couldn’t get this to work though (error 453, which apparently means the APX is already in use, which it wasn’t; nor was it able to connect to shairport).
  • The original JustePort – also gives me error 453.
  • pulseaudio-module-raop – Ubuntu module; virtual PulseAudio device to stream to an AirPort Express (stutters like crazy, although it appears to depend on the application. Youtube in the Browser works fine).
  • pulseaudio-raop2 – there apparently exist two vesions of the AirTunes protocol, and this might work better (not tried).
  • Airtunes2 Specification
  • raopd – attempt to provide an audio output device on Linux, abandoned.
  • AirTunes protocol discussion

Installing ddar on a Synology NAS 0

This is how I installed ddar on a Synology NAS. The source distribution of ddar installs just fine with gcc and make available from optware. The problem is the protobuf dependency. It can’t be installed via PyPI due to seemingly a variety of unfixed issues, and I failed to compile it on the NAS itself, due to this error:


make[2]: Entering directory `/tmp/protobuf-2.4.0a/src'
/bin/ash ../libtool --tag=CXX --mode=link g++ -pthread -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -O2 -g -DNDEBUG -pthread -o protoc main.o -lpthread libprotobuf.la libprotoc.la -lz
libtool: link: g++ -pthread -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -O2 -g -DNDEBUG -pthread -o .libs/protoc main.o -lpthread ./.libs/libprotobuf.so ./.libs/libprotoc.so -lz -pthread -Wl,-rpath -Wl,/usr/local/lib
main.o: In function `__exchange_and_add':
/opt/lib/gcc/i686-linux-gnu/4.2.1/../../../../include/c++/4.2.1/ext/atomicity.h:51: undefined reference to `__sync_fetch_and_add_4'
main.o: In function `__exchange_and_add':
/tmp/protobuf-2.4.0a/src/google/protobuf/compiler/main.cc:60: undefined reference to `__sync_fetch_and_add_4'
/tmp/protobuf-2.4.0a/src/google/protobuf/compiler/main.cc:60: undefined reference to `__sync_fetch_and_add_4'
/tmp/protobuf-2.4.0a/src/google/protobuf/compiler/main.cc:60: undefined reference to `__sync_fetch_and_add_4'
/tmp/protobuf-2.4.0a/src/google/protobuf/compiler/main.cc:60: undefined reference to `__sync_fetch_and_add_4'
main.o:/tmp/protobuf-2.4.0a/src/google/protobuf/compiler/main.cc:60: more undefined references to `__sync_fetch_and_add_4' follow
collect2: ld returned 1 exit status

I always have a hard time understanding C/C++ errors. Varies fiddling with -march flags, as suggested in various places, didn’t help.

However, copying the required files from my Ubuntu machine did. While I’m fortunate that my Synology box is using an x86 processor, I really only copied Python files, so this should be architecture independent. I’m also using Python 2.6 here, on both sides. So, with ddar and protobuf 2.3.0 installed on the Desktop, I did:

  1. On the NAS, extracted the ddar source package into $DDAR.
  2. Copied the protobuf Python package to the NAS (/usr/lib/pymodules/python2.6/google for me), into /opt/local/lib/python2.6/site-packages.
  3. Copied the ddar_pb2.py file to the NAS ( /usr/lib/pymodules/python2.6/synctus/ddar_pb2.py on my machine), into the $DDAR/synctus directory, alongside ddar.proto.
  4. On the NAS, edited $DDAR/setup.py and removed install_requires option that declares the protobuf dependency.
  5. On the NAS, python2.6 setup.py install installs a working ddar copy.

Music Streaming Servers 0

  • SubSonic: Java; Mobile clients available.
  • Ampache: PHP, requires MySQL database; Mobile clients available.
  • Sockso; Java, no mobile clients.

Wireshark: capturing in monitor mode from rt2800usb chipset 0

Wireshark would not allow me tick the box for “Monitor mode” (it auto-disabled itself again), and “sudo iwconfig wlan0 mode Monitor” says “device busy”. However, using airmon-ng to enable monitor mode worked: sudo airmon-ng start wlan0 {channelnum} (the channel number might be optional) gives a second mon0 interface which allows capturing in monitor mode just fine – at least if I disabled the use of encryption for the wireless network. I didn’t manage to convince Wireshark to decyrypt WPA2.

-->