RuneAudio and OpenElec on one SD card

Raspberry Pi related support

RuneAudio and OpenElec on one SD card

Postby hansh64 » 09 Feb 2016, 13:34

Hi all,

I got a bit tired of constantly swapping SD cards in order to run either RuneAudio and OpenElec. Googling around I only came across solutions like Berryboot and similar which support OpenElec but fail to support RuneAudio. However the solution is simpler than I have ever thought!

I have been able to create a single SD card containing both RuneAudio and OpenElec using RPi2 based on existing installations of both systems. To do this I use one SD card (8 GB minimum) and create three partitions using gparted:

part1: 256 MB FAT16 (flags: boot, lba)
part2: appr. 3.5 GB ext4
part3: appr. 3.5 GB ext4

In this example I will be using an USB SD card reader which propagates itself as /dev/sdb on my system when connected (Note: could be /dev/sdc or /dev/sdd if you have more than one physical disk in your system! Use sudo fdisk -l to check). I also assume you started the terminal logged in into your own home directory. Do not change (cd) directories while in the process below. Also do not type in the "$" and "#" in the command lines.

1. Log in as root
Code: Select all
$ sudo su

2. Create 4 directories for mounting the SD card partitions and 4 directories to retain the copied contents of these partitions
Code: Select all
# mkdir oeboot runeboot oeroot runeroot
# mkdir oebootnew runebootnew oerootnew runerootnew

3. Insert the OpenElec SD card in the USB SD card reader and place it in one of your USB ports
4. Mount both partitions
Code: Select all
# mount /dev/sdb1 oeboot
# mount /dev/sdb2 oeroot

5. Copy the contents of the OpenElec SD card partitions to your computer (dont forget the "." after the "/" !)
Code: Select all
# cp -a oeboot/. oebootnew/
# cp -a oeroot/. oerootnew/

6. Unmount the OpenElec SD card
Code: Select all
# umount oeroot oeboot

7. Remove the USB SD card reader, replace the OpenElec SD card with the RuneAudio SD card and put it back in the USB port of your computer
8. Mount both partitions
Code: Select all
# mount /dev/sdb1 runeboot
# mount /dev/sdb2 runeroot

9. Copy the contents of the RuneAudio SD card partitions to your computer
Code: Select all
# cp -a runeboot/. runebootnew/
# cp -a runeroot/. runerootnew/

10. Unmount the RuneAudio SD card
Code: Select all
# umount runeboot runeroot

11. Remove the USB SD card reader, replace the RuneAudio SD card with the newly partitioned empty SD card and put it back in the USB port of your computer
12. Create 2 directories in the oeboot directory
Code: Select all
# mkdir oebootnew/openelec oebootnew/runeaudio

13. Copy the contents of the runebootnew directory to the newly created runeaudio directory
Code: Select all
# cp -a runebootnew/. oebootnew/runeaudio/

14. Edit the contents of the RuneAudio cmdline.txt file with the editor of your choice (nano or gedit)
Code: Select all
# nano oebootnew/runeaudio/cmdline.txt

and replace root=/dev/mmcblk0p2 with root=/dev/mmcblk0p3 and leave the rest of the file as it is
15. Save the file
16. Mount the new SD card
Code: Select all
# mount /dev/sdb1 oeboot
# mount /dev/sdb2 oeroot
# mount /dev/sdb3 runeroot

17. Copy the contents of three directories back to the SD card
Code: Select all
# cp -a oebootnew/. oeboot/
# cp -a oerootnew/. oeroot/
# cp -a runerootnew/. runeroot/

18. Umount the new SD card
Code: Select all
# umount oeboot oeroot runeroot


Now the new SD card is ready to be placed in the Raspberry Pi's SD slot. Put it there and reconnect power. If all is well the RPi should start in OpenElec's kodi. Please check if kodi works as it should.

Now we have to create two scripts to be able to switch between OpenElec and RuneAudio. In order to switch you should use SSH to log in into either system.

19. Log into OpenElec using SSH (e.g. ssh root@openelec.local or ssh root@<ip address of OpenElec system>)
20. Your current directory should be .storage as seen in the prompt
21. Create a script called "rune" using nano
Code: Select all
# nano rune

22. Insert the following code (make sure to scroll down completely as the code window might not show all)
Code: Select all
#!/bin/sh

mount -o remount,rw /flash           #OpenElec mount its boot partition read-only
                                                      #so needs to be remounted

cd /flash

find . -path './*' -prune -type f -exec mv -f {} openelec \;
mv overlays openelec/                                                         

sync     

mv runeaudio/* /flash/

sync     

reboot

23. Save the script with Ctrl-X and make it executable
Code: Select all
# chmod +x rune


Some explanation: the "find..." command moves all files except directories (to prevent the runeaudio directory to be moved as well), just in case I move overlays also as there might be different overlay versions...?. I also use "sync" a lot to prevent file corruption (maybe I could skip the first sync, paranoia?). I use move instead of copy to prevent SD card wear out
24. Run the "rune" script
Code: Select all
# ./rune


The RPi should boot up with RuneAudio this time. Please check if everything works as it should.

Now we need to create the script to be able to switch back to OpenElec.

25. Log into RuneAudio using SSH (e.g. ssh root@runeaudio.local or ssh root@<ip address of RuneAudio system>)
26. Your current directory should be root as seen in the prompt
27. Create a script called "openelec" using nano. Insert the following code (make sure to scroll down completely as the code window might not show all)
Code: Select all
#!/bin/sh

cd /boot

find . -path './*' -prune -type f -exec mv -f {} runeaudio \;
mv overlays runeaudio/

sync

mv openelec/* /boot/

sync

mpc stop
umount -f /mnt/MPD/NAS/Music   #this is just an example, see below

reboot

28. Save the script with Ctrl-X and make it executable
Code: Select all
# chmod +x openelec


To prevent "stop jobs" during reboot which take appr. 1 minute and 30 seconds I used the "umount" command in this script. This command may be omitted or changed to unmount any music directory configured in the Sources page of the RuneAudio web interface

29. Test the script by running it
Code: Select all
# ./openelec


The Raspberry Pi should now reboot into OpenElec again.

Run ./rune to go back to RuneAudio etc. etc. etc.

I am not a noob regarding Linux but I am not an absolute expert as well. If there are any Linux experts among you please feel free to comment and make suggestions, additions or any other improvements.

Happy switching!

Greetz,
Hans.
hansh64
 
Posts: 31
Joined: 03 Jun 2015, 15:48

Re: RuneAudio and OpenElec on one SD card

Postby hondagx35 » 09 Feb 2016, 16:51

Hi Hans,

thank you very much for this tutorial.

Frank
User avatar
hondagx35
 
Posts: 3042
Joined: 11 Sep 2014, 22:06
Location: Germany

Re: RuneAudio and OpenElec on one SD card

Postby surfninja » 09 Feb 2016, 19:02

Hans, this is great. Thanks for posting. I got tired of swapping SD cards too so I bought another RP. I need to try this.

Thanks again for the detail.
rAudio 1, Raspberry Pi 2B
rAudio 1, Raspberry Pi 4B
rAudio 1, Raspberry Pi Zero W
surfninja
 
Posts: 95
Joined: 13 Mar 2015, 22:06
Location: Minnesota

Re: RuneAudio and OpenElec on one SD card

Postby hansh64 » 01 Apr 2016, 11:35

Hi all,

For those who don't want to mess around with terminals and SSH, or actually for your convenience, there is an Android app available in the Play Store to start the scripts "rune" and "openelec" as mentioned in my tutorial above with the press of a button. I use it myself.

Just download the SSH Button app and configure like shown in the images below:

2016-04-01 10.29.27.png
Entry to switch from RuneAudio to OpenElec where xx.xx.xx.xx is the IP address of your RuneAudio setup and password is "rune" (without the quotes)
2016-04-01 10.29.27.png (133.64 KiB) Viewed 3320 times

2016-04-01 10.30.13.png
Entry to switch from OpenElec to RuneAudio where yy.yy.yy.yy is the IP address of your OpenElec setup and password is "openelec" (without the quotes)
2016-04-01 10.30.13.png (133.45 KiB) Viewed 3320 times

2016-04-01 10.21.33.png
Now you have two buttons to switch from one setup to the other
2016-04-01 10.21.33.png (124.06 KiB) Viewed 3320 times

There is one catch: when changing from Rune 2 OE you don't get control back on the app. Just press the Home button on your Android device and kill the app.
hansh64
 
Posts: 31
Joined: 03 Jun 2015, 15:48

Re: RuneAudio and OpenElec on one SD card

Postby maravtatet » 29 Sep 2018, 10:06

Hi everyone,

Just wanted to share that I've been using this setup for a year now, and it works really well.
The sshbutton application is really simple to use, and has successfully passed the WAF (Wife Acceptance Factor) very quickly :lol:

I've slightly adapted the tutorial to use OMSC as a video distribution instead of OpenElec, and RuneAudio (was using successfully 0.3b/0.4b and now 0.5b).

Overall I just proceeded with hansh64's tutorial, but I slightly adapted the scripts to make it work for me

22. Insert the following code

Code: Select all
!/bin/sh
sudo mount -o remount,rw /boot
cd /boot
sudo find . -path './*' -prune -type f -exec mv -f {} osmc \;
sudo mv -f overlays osmc/
sudo sync
sudo mv -f runeaudio/* /boot/
sudo sync
/sbin/reboot


Happy dual booting everyone !
maravtatet
 
Posts: 2
Joined: 29 Sep 2018, 09:32

support RuneAudio Donate with PayPal


Return to Raspberry Pi

Who is online

Users browsing this forum: Google [Bot] and 6 guests
cron