How to build megadl on your Synology DS215j

By on

Optware Bootstrap

Set up ipkg

1
2
3
4
5
6
feed=http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable
ipk_name=`wget -qO- $feed/Packages | awk '/^Filename: ipkg-opt/ {print $2}'`
wget $feed/$ipk_name
tar -xOvzf $ipk_name ./data.tar.gz | tar -C / -xzvf -
mkdir -p /opt/etc/ipkg
echo "src cross $feed" > /opt/etc/ipkg/feeds.conf

Create the optware root directory

1
2
3
4
mkdir /volume1/@optware
mv /opt/* /volume1/@optware/
rm -r /opt
ln -s /volume1/@optware /opt

Add /opt to PATH

Add the following line to /root/.profile or if you are using a user-account to get SSH access /home/username/.bashrc or the ZSH equivalent /home/username/.zshrc.

1
export PATH=/opt/bin:/opt/sbin:$PATH

Set up the init-scripts

Create the folder where the script will be placed.

1
mkdir -p /usr/local/etc/rc.d/

/usr/local/etc/rc.d/optware.sh:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
#
# Optware setup
# Alternatives Optware Startup und Shutdown Script #/usr/local/etc/rc.d/optware.sh
#
case $1 in
start)
       [ ! -h /opt -a ! -d /opt ] && ln -s /volume1/@optware /opt
       for i in /opt/etc/init.d/S??* ;do
#
               # Ignore dangling symlinks (if any).
               [ ! -f "$i" ] && continue
#
               case "$i" in
                  *.sh)
                       # Source shell script for speed.
                       (
                               trap - INT QUIT TSTP
                               set start
                               . $i
                       )
                       ;;
                  *)
                       # No sh extension, so fork subprocess.
                       $i start
                       ;;
               esac
       done
       ;;
#
stop)
#
       for i in /opt/etc/init.d/S??* ;do
#
               # Ignore dangling symlinks (if any).
               [ ! -f "$i" ] && continue
#
               case "$i" in
                  *.sh)
                       # Source shell script for speed.
                       (
                               trap - INT QUIT TSTP
                               set stop
                              . $i
                       )
                       ;;
                  *)
                       # No sh extension, so fork subprocess.
                       $i stop                       ;;
               esac
         done
         ;;
#
*)
         echo "Usage: $0 [start|stop]"
         ;;
esac
#
# End

Make it executable.

1
chmod +x /usr/local/etc/rc.d/optware.sh

Then reboot.

1
reboot

Install packages with ipkg

Update the packages list and install packages that you need (like gawk etc.).

1
2
ipkg update
ipkg install [YOUR PACKAGES] # I forget to take notes

Build megadl

Download toolchains from sourceforge and export correct paths.

Download megatools, unzip, configure, make, and you can build now.

Reference & Thanks to

http://freshest.me/bootstrap-ds215j