This project was essentially the impetus to establishing this site, I wanted to have a complete and polished experience in my theatre room which allowed me to easily (and for the wife and kids too) and relatively seamlessly watch movies and play retro games. Through many web searches and by playing around with things I finally got things setup the way I’d like, but there wasn’t one place with all or a majority of the information I needed. So, here we are!
I have used both RetroPie and various different version of Kodi (be it OpenELEC, LibreELEC, OSMC or others). These have generally worked really well on a stand alone installation (i.e. download disk images intended for one boot option on an SD card). I also do some Kodi skinning and have started to translate most of my skins into Kodi Krypton and base new work off of the Estuary Skin created by Phil65 and Piers. This means I needed to be running a beta version of Kodi 17 (Krypton). The problem is that RetroPie doesn’t come with a beta version of Kodi 17, so I need to setup a system which dual boots. [Related Article: Plex and Kodi Integration – PlexKodiConnect]
So I decided to start with LibreELEC because well, it was the new band on the block and I hadn’t checked out their tunes yet.
I have also recently been playing around with RetroPie and have been enjoying that experience. I don’t do much playing around or testing with RetroPie so a nice stable version like Version 3.8.1 works for me.
What You’ll Need
- A Raspberry Pi (and all it’s accessories);
- SD/Mirco SD card (large enough to hold your images and BerryBoot);
- USB Drive (large enough to hold your images);
- BerryBoot up and running on your Raspberry Pi;
- A linux based machine (to which you can install kpartx and squashfs-tools);
- SD Card Formatter 4.0;
- Win32 Disk Imager;
- Image file for the desired versions of LibreELEC;
- Image file for the desired version of RetroPie;
Berryboot uses images files in a SquashFS format. So the majority of the process will be to create SquashFS image files of both LibreELEC Alpha and RetroPie V.3.8.1. Of course there are version of both systems already available through the BerryBoot loader, but being older they just won’t do. I’ve assumed that you already have Raspberry Pi which is running BerryBoot. If you need instructions on how to install BerryBoot they are available on their website.
The good news is that LibreELEC (and it’s I’m assuming its source OpenELEC too) already uses a SquashFS file format. The file called SYSTEM, which you can find after writing a LibreELEC image, is a BerryBoot image, all you need to do is copy that to a USB card for loading in BerryBoot.
- Download your desired image from LibreELEC site;
- Write or mount that image so that you are able to browse it. You can use Win32 Disk Imager to write to a spare SD card;
- Locate the file called SYSTEM (no extension) and copy it to your PC;
- Rename the file called SYSTEM to your desired description (so something like LibreELEC 7.9.03.img), but ensure that you give it a .img extension;
- Copy that renamed file to your USB stick that you will be using to add the images to your Raspberry Pi with BerryBoot.
RetroPie was a little bit tougher and requires a bit of linux command line magic. However there’s no reason to fret, if you follow the instruction exactly all will be well. To be quite honest I am relatively new to Linux based OSes (although I’m being forced learning quickly) and am not exactly sure what the syntax in these commands is doing exactly, but I understand on a general level what’s going on and will try and explain that as we go through these steps. This portion of the setup I got from How to Geek, so feel free to head there to see their instructions too.
The first step is to copy of the version of the RetroPie .img file you wish to use to a Linux based machine. After that, you’ll have to run the following at the Linux command prompt:
- install squashfs-tool using the following command:
sudo apt-get install squashfs-tools
- insert the SD card you installed RetroPie to and run the following command to view the partitions on drive (make sure of course you have navigated to the location of the file):
sudo kpartx -av nameofimage.img
- the output from this command will look something like this:
add map loop0p1 (252:5): 0 117187 linear /dev/loop0 1
add map loop0p2 (252:6): 0 3493888 linear /dev/loop0 118784
- We are interested in the larger partition. In the example above, the partition with the name “loop0p2” is the larger partition. Look at your output from this command – it might be “loop0p2” or it could be another name. The following commands will mount the larger partition within the image file, remove the filesystem table, create a compressed squashfs image without lib/modules/ and then unmounts and deletes the partition mapping. Remember to replace “loop0p2” with whatever your largest partition was named.
sudo mount /dev/mapper/loop0p2 /mnt
sudo sed -i â€˜s/^\/dev\/mmcblk/#\0/gâ€™ /mnt/etc/fstab
sudo mksquashfs /mnt newnameofsquashfsimage.img -comp lzo -e lib/modules
sudo umount /mnt
sudo kpartx -d NewBerryBoot.img
- Now all you have to do is copy the newnameofsquashfsimage.img to the same USB drive which already contains your version of LibreELEC and we’re ready to move to the Raspberry Pi to complete installation.
Raspberry Pi BerryBoot Setup
Now that the squashfs images are on a USB drive, we can move to over to the Raspberry Pi with BerryBoot installed to continue the installation.
- Insert the USB drive into the Raspberry Pi and turn the Pi on.
- When the BerryBoot menu comes up press the ‘Edit Menu’ button.
- Click and hold the ‘Add OS’ button. A drop down menu will come up. Select ‘Copy OS from USB Stick’ (see image below).
- Select the first image to install.
- Once it is finished copying, repeat for the second image.
Once they are done copying, you should can reboot your pi and select the image you want to boot to.
The next step I will need to do is to develop scripts so that when you’re in Kodi, you have an addon which will let you reboot into RetroPie and a script to run from RetroPie to return to Kodi. This will be the next project, so stay tuned to see how to do that!
Some Other Notes
- As we are essentially striping away the boot partition for LibreELEC, the update process no longer works. This means to upgrade, you will need to download the new version and perform all the steps in the LibreELEC section above and then reconfigure your Kodi setup (unless there are backup solutions that would work).
So, all and all I’m pretty happy with how this setup is working – there are some stability issues with Kodi Beta I’m experiencing right now – hopefully my debug logs are useful to the team there in resolving the issues. I have to say that I’ve learned a lot along the way in this project. I still need to add the final touches in terms of the scripts mentioned above to eliminate the need to get up and manually restart the Pi to select a different OS and to incease simplicity to make the wife happy.
Maybe when Kodi finally gets the RetroPlayer integrated we won’t need to have two systems, with dual boot. Although this project is still active, it is ambitious and could still be some time away from completion.
Hopefully compiling this information into one place has helped some people! If you have a setup which includes new versions of LibreELEC and RetroPie, I’d be really interested to hear how you managed it.