Thursday, 10 October 2013

Run OpenELEC LIVE from your Easy2Boot USB drive

You can also run OpenElec Live (i.e. run XBox Media Centre - XBMC, and play video, music and internet TV, etc.) directly from your Easy2Boot USB drive.

See below for 2014 version - the next instructions are for the 2013 version.

----- 2013 version -----


If you have a FAT32 E2B USB drive, then download the appropriate version (I used Generic i386 Version 3.2.2) and extract the KERNEL and SYSTEM files from the target folder and place them in the root of your E2B drive (actually you could move the KERNEL file if you changed the path in the .mnu file).

Then make a .mnu file for E2B as follows:

title OpenELEC
uuid () > nul
set UUID=%?%
kernel /KERNEL boot=UUID=%UUID% disk=FILE=STORAGE,512

This will cause OpenELEC to make a 512MB ext4 file called STORAGE on the root of the E2B USB drive when it first boots. This is used to hold all the OpenELEC downloaded files, changes, etc.

Adding OpenELEC to an NTFS E2B Drive

If your Easy2Boot USB drive is formatted as NTFS however, you need to follow these steps:

1. After downloading the OpenELEC .tar file, unpack it to a folder on your Windows hard disk.

2. Copy the KERNEL and SYSTEM files to a spare, freshly formatted FAT32 USB Flash drive - this should be formatted as the size of the two files + 512MB + 10MB. Don't make it any bigger as this will make the final image file bigger and waste space.

3. Add the following menu.lst file

uuid () > nul
set UUID=%?%
kernel /KERNEL boot=UUID=%UUID% disk=FILE=STORAGE,512
# if it exists, change the type 0C 4th ptn entry to 0
cat --locate=\x0c --number=1 --length=1 --skip=0x1f2 --replace=\x00 (hd0)+1


4. Install grub4dos (use RMPrepUSB - Install grub4dos - Yes=MBR).

5. Boot the spare USB flash drive on a real system - it should create a 512MB STORAGE file (or less than 512MB if there is not enough room on the USB drive) and then run XBMC. Test it out and check add-ins are working and remembered when you reboot.

6.  Make an image of the partition on the USB drive using RMPrepUSB - Disk->File - choose P1 for Start, P1 for End and 0 for the File Start position.
I will assume the file created is called Open_Elec_LIVE.img

7. Now copy the Open_Elec_Live.img file to your E2B NTFS USB drive's \_ISO\MAINMENU\Linux folder. Then create an Open_Elec_Live.mnu file in the same folder as below:

title OpenElec LIVE \n This runs OpenElec from an image file
# Write a permanent new entry into the E2B partition table pointing to the OpenElec partition
partnew (hd0,3) 0x0 %MFOLDER%/Linux/OpenElec_LIVE.img
root (hd0,3)
chainloader (hd0,3)/grldr

8. Run WinContig (RMPRepUSB - Ctrl+F2).

You should now be able to boot and run Open_ELEC XBMC from the image file.

This worked a treat on my Asus EeePC 904H when booting from my E2B NTFS USB hard disk!

P.S. Rather than run grub4dos twice, you could combine the two menus into just one menu for the .mnu file:

title OpenElec LIVE \n This runs OpenElec from an image file
# Write a permanent new entry into the E2B partition table pointing to the OpenElec partition
partnew (hd0,3) 0x0 %MFOLDER%/Linux/OpenElec_LIVE.img
root (hd0,3)
uuid () > nul
set UUID=%?%
kernel /KERNEL boot=UUID=%UUID% disk=FILE=STORAGE,512
# if it exists, change the type 0C 4th ptn entry to 0
cat --locate=\x0c --number=1 --length=1 --skip=0x1f2 --replace=\x00 (hd0)+1


or load the 2nd menu directly, by using this .mnu code:
title OpenElec LIVE \n This runs OpenElec from an image file
# Write a permanent new entry into the E2B partition table pointing to the OpenElec partition
partnew (hd0,3) 0x0 %MFOLDER%/Linux/OpenElec_LIVE.img
root (hd0,3)
configfile /menu.lst



----- 2014/2015/2016 versions -----

Tested on:

  • OpenELEC-Generic.x86_64-6.0.3.tar
  • v 5.0.6
  • OpenELEC-Generic.x86_64-4.0.2
This assumes you have the MakePartImage Tool Kit folder present on your system and you have installed ImDisk and made the Desktop Shortcuts (as in the ReadMe file).

Instructions:

1. Download the OpenElec .tar file

2. Extract the Target folder containing the kernel and system files to a folder on your system hard disk - e.g. C:\temp\target

3. Drag-and-Drop the C:\temp\target folder to the MPI FAT32 Desktop shortcut - when prompted, specify the target as C:\temp\OpenElec.img

4. Run RMPrepUSB with the E2B USB drive connected and selected.

    Make a \OpenElec-rw Ext3 Filesystem file with a Volume Label of DATA. The size is up to you!

5. Copy the OpenElec.img file to the \_ISO\MAINMENU\MNU folder of your E2B drive.

6. Create a .mnu file in the same folder with the following contents (this file can also be found in \_ISO\docs\Sample mnu files\OpenElec\OpenElec_LIVE_2014_NTFS.mnu on your E2B drive):

# For NTFS E2B USB drive (or FAT32)
# Create a FAT32 partition image file from a folder containing the kernel and system files from OpenElec using MPI Tool -> OpenElec.img
# Make ext2 FS file in root of E2B drive - FileName=OpenElec-rw  VolumeName=DATA
# Copy this .mnu file and OpenElecUSB.img to \_ISO\MAINMENU\MNU folder

iftitle [if exist not /system if not exist /kernel] OpenElec Live\n Boot OpenElec with persistence

set IMG=$HOME$/OpenElec.img
set PER=/OpenElec-rw

if "%E2BDEV%"=="" set E2BDEV=hd0 && pause E2BDEV forced to hd0!
if exist CD echo WARNING: Cannot use partnew command! && pause && configfile (bd)/menu.lst
partnew (%E2BDEV%,3) 0x0c %IMG%
debug 1
parttype (%E2BDEV%,2) | set check=
debug off
set check=%check:~-5,4%
# make empty table entry in 3rd position in ptn table
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0 0 0
if not "%check%"=="0x00" echo WARNING: PTN TABLE 3 IS ALREADY IN USE! && pause
debug 1
if not exist %PER% echo WARNING: %PER% persistence file not found! && pause
errorcheck off
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0x0 %PER%
errorcheck on

root (hd0,3)
uuid () > nul
set UUID=%?%
echo %UUID%
kernel /kernel boot=UUID=%UUID% disk=LABEL=DATA quiet
# if it exists, change the type 0C 4th ptn entry to 0
cat --locate=\x0c --number=1 --length=1 --skip=0x1f2 --replace=\x00 (hd0)+1

7. Run WinContig on the E2B drive (RMPrepUSB Ctrl+F2)

Notes:
  • When booting from VBox, OpenElec fails to start Xorg and said 'Is your GPU supported'. Use a Nightly-build that will work on Virtual Box - the stable versions don't run on VBox.
  • Error in check_disks: could not repair filesystem - If OpenElec started to boot OK but then failed, and now does not start at all and gives this error message immediately - re-make the OpenElec-rw file - it may have been corrupted due to an untidy shutdown/reset.
  • When booted from my Z87 mainboard using a slow USB HDD drive, it failed to find the system file and did not mount the USB HDD drive. However, a USB Flash drive in the Z87 USB 3.0 port did work. I booted it on my Asus Aspire 7741G notebook from the same USB HDD, and it did work.
If your E2B drive is a FAT32 volume, then you don't need to make a .img file, you can just copy the system and kernel files to the root of the E2B USB drive and modify the menu as follows:

# --- FAT32 E2B USB DRIVES ONLY ---
# Just copy \system and \kernel files to root of E2B USB drive
# Make ext2 FS file in root of E2B drive - FileName=OpenElec-rw  VolumeName=DATA
# Copy this .mnu file to \_ISO\MAINMENU\MNU folder

title OpenElec Live\n Boot OpenElec with persistence
set PER=/OpenElec-rw

if "%E2BDEV%"=="" set E2BDEV=hd0 && pause E2BDEV forced to hd0!
if exist CD echo WARNING: Cannot use partnew command! && pause && configfile (bd)/menu.lst
debug 1
parttype (%E2BDEV%,2) | set check=
debug off
set check=%check:~-5,4%
# make empty table entry in 3rd position in ptn table
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0 0 0
if not "%check%"=="0x00" echo WARNING: PTN TABLE 3 IS ALREADY IN USE! && pause
debug 1
if not exist %PER% echo WARNING: %PER% persistence file not found! && pause
errorcheck off
if "%check%"=="0x00" partnew (%E2BDEV%,2) 0x0 %PER%
errorcheck on

uuid () > nul
set UUID=%?%
echo %UUID%
kernel /kernel boot=UUID=%UUID% disk=LABEL=DATA quiet


P.S. The latest build from here worked under VBox when booting from my Easy2Boot USB drive. I actually downloaded OpenELEC-Virtual.i386-devel-20140317134709-r17946-gb27c946.tar.


UEFI-booting

See the instructions at the end of this LibreELEC blog post.