Thursday, 24 November 2016

Add LibreELEC Live to E2B (Kodi)

You can add OpenElec Live to E2B by following my previous blog here.

You can follow a similar procedure to add LibreELEC to E2B (and also have UEFI-booting) as follows:

Instructions (MBR-booting):

You will need to install the MPI Tool Kit first...

1. Download the img.gz file. I did this by downloading the 'Creator' Windows utility LibreELEC.USB-SD.Creator.Win32.exe from here and then used it to download LibreELEC-Generic.x86_64-7.0.2.img.gz.

2. Extract the all of the files inside the image including the KERNEL and SYSTEM files to a folder on your system hard disk - e.g. C:\temp\LibreELEC

The .img.gz file contains a LibreELEC-Generic.x86_64-7.0.2.img file which contains two primary.img files. Use 7Zip to extract the files from the largest primary.img file (mine was shown as 'Windows BDP' File System).



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

4. Run RMPrepUSB with the E2B USB drive connected and selected. Make a \LibreElec-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 later versions of E2B at \_ISO\docs\Sample mnu files folder on your E2B drive or you can modify the OpenElec 2014 NTFS menu file):

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

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

set IMG=$HOME$/LibreELEC702.img
set PER=/LibreElec-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 tty vga=ask

# 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:
  • If when booting from VBox or a real system, LibreElec fails to start Xorg and said 'Is your GPU supported'. Use a different 'Legacy' build.
  • Error in check_disks: could not repair filesystem - If LibreELEC started to boot OK but then failed, and now does not start at all and gives this error message immediately - re-make the LibreELEC-rw file - it may have been corrupted due to an untidy shutdown/reset. Use ext3 and not ext2 for better reliability.
  • If you get a UUID boot error - try a USB 2.0 port instead of a USB 3.0 port

UEFI-booting

LibreELEC also supports 64-bit UEFI booting.

Once you have the MBR boot process working, here is how to convert it to support both MBR and UEFI-booting:

1. Rename the .img file you created to have a .imgPTN file extension

2. Move the .imgPTN file to a menu folder (e.g. \_ISO\LINUX)

3. Rename the LibreElec-rw file so that it has exactly the same filename as the .imgPTN file but without any file extension.

Note: Do not use a dot (.) in the filename. Use - or _ instead.

4. Move the file to the same menu folder as the .imgPTN file

You should now have something like:

\_ISO\LINUX\LibreELEC6_95_3.imgPTN   (was .img)
\_ISO\LINUX\LibreELEC6_95_3                  (was LibreElec-rw)

5. Switch in the new .imgPTN file by running \_ISO\SWITCH_E2B.exe and double-click on the .imgPTN file.

6. In Windows Explorer, find the file \syslinux.cfg and edit it as follows:

DEFAULT live

LABEL live
  KERNEL /KERNEL
  APPEND boot=UUID=3657-9BA4 disk=LABEL=DATA quiet tty vga=current 

Important

  1. Make sure that the live parameter is NOT in the APPEND list of parameters or you will not get persistence!
  2. Note that the UUID numbers in red will be different for you. You must keep whatever UUID is specified in your .cfg file (do NOT use 3657-9BA4).
  3. The example shown is the whole file contents. You can delete any other lines.

7. Copy the same syslinux.cfg file to \EFI\BOOT and overwrite the syslinux.cfg file that is already there.

You should now find you can MBR or UEFI-boot with live persistence.

Please tick one of the Reactions check-boxes if you enjoyed this article and subscribe to this blog.