Friday 22 January 2016

Editing the MPI Tool Pack CSM menu (+ German version from Frettt)

The MPI Tool Pack only contains an English menu.lst file.

However, it does allow you to easily modify the files in the MPI Tool Pack to add your own menu.lst, background file and other files by using the CUSTOM folder.

When you run MPI, it starts by:
  1. Creates a file-backed RAM DISK
  2. Extracts the contents of the source (e.g. an ISO) to the RAMDISK
  3. Copies the contents of the csm folder to the  root of the RAMDISK
  4. Copies the contents of the CUSTOM folder to the root of the RAMDISK
  5. Processes the files on the RAMDISK to convert them for use with E2B, including modifying the menu.lst file, etc.


So you can see that you do not need to change any of the original files in the MPI Tool Pack download. Simply add files into the CUSTOM folder and preserve the same folder layout that you see in the csm folder.

Now, whenever we run the MPI script, it will use the files in the CUSTOM folder for any .imgPTN file we create in future.

It also means that when a new version of the MPI Tool Pack is released, you just need to copy the CUSTOM folder from the old version to the new version (but check that the menu.lst has not changed as there may be improvements/bugfixes!).

I don't intend to provide the CSM menu.lst file in different languages because there are only a few menu entries in it and supporting many different languages would involve quite a bit of work (every time a new version was released!).

The easiest way to experiment is to switch to a .imgPTN file and then directly edit the \menu.lst file on the USB drive whilst in 'CSM mode'. However, you should not copy the modified menu.lst file to the MPI Tool Pack folder because it will have been modified by MPI (it can not be used as a template file).

Change the background wallpaper

The wallpaper bitmap is in the csm\e2b folder and is called CSM.bmp.gz.

If you want to replace this file with your own bitmap, simply place a bitmap file (which can be in .bmp format or .bmp.gz format or compressed using the LZMA encoder in E2B to compress it) in the CUSTOM\e2b folder - e.g.
"C:\Users\Steve\Desktop\MPI_Tool_Pack_Plus_CloverLite_060\CUSTOM\e2b\CSM.bmp.gz"

Unless you also have a CUSTOM\menu.lst file and modify it, the filename must be "CSM.bmp.gz" even if it is not in .gz format. Grub4dos will automatically decompress the file if it is in .gz or LZMA format, or just use it 'as is' if it is in standard .bmp format.

Change the CSM menu appearance/position/etc.

The CSM menu appearance is determined by the menu.lst file. If you want to change for all future partition images that you create, this simply copy the .\csm\menu.lst file to the CUSTOM folder and then edit the .\CUSTOM\menu.lst file.

If you want a German version, Frettt has already made a version (for 0.060) which you can find in the E2B Alternate Downloads - Other files areas (direct link here).

If you wish, you can modify the .\CUSTOM\menu.lst file to use a different wallpaper or even use a GFX Boot menu (as used by Laura in some cases).

Do NOT use an existing menu.lst from within a .imgPTN image because this will have been modified by MPI and so will no longer work correctly as a template file for the MPI script.

CSM Menu.lst file

If you want to modify the appearance of the CSM menu, you will need to modify your .\CUSTOM\menu.lst file.

The important section of the menu.lst file is shown below.
Hopefully the comments will help you to understand it.



# --- HEADING, PAYLOAD and FOOTER TEXT -----

# set CENTREHD to 1 to centre the heading and payload description or else comment out
set CENTREHD=1
set CHEADING=\x20Easy2Boot CSM Menu (v%VER%) (UUID=%UUID%)
set CHELPTEXT=\x20     This menu has booted in MBR\\CSM Mode (not UEFI)                      (c) www.easy2boot.com\x20



# ---

clear
default 2
debug off
password easy2boot
/e2b/hotkey -A

# backup PBR
cat --locate="BOOT7" --length=10 --skip=0x58 ()+1 > nul || dd if=()+2 of=()/PBR.BIN > nul

# this loads the thin unifont font for non-ASCII characters (e.g. Chinese) - to save menu load time, you can comment it out and remove the /e2b/unifont.hex.gz file
font /e2b/unifont.hex.gz

# autonumber menu entries - use 0x0000 for no numbering
write 0x8274 0x2001 > nul

# ----- GRAPHICS MODE AND BACKGROUND BITMAP ----
graphicsmode -1 800 600 && splashimage /e2b/csm.bmp.gz > nul

set E=
# To adjust position, change P:XXXX in lines below
if exist /EFI/boot/bootia32.efi   set E=%E%echo -n -e    -P:2800 \\x24[0103]INFORMATION: x86 32-bit UEFI boot file \\\\EFI\\\\boot\\\\bootia32.efi present 
if exist /EFI/boot/bootx64.efi    set E=%E% \necho -n -e -P:2900 \\x24[0103]INFORMATION: x86 64-bit UEFI boot file \\\\EFI\\\\boot\\\\bootx64.efi  present

if exist /EFI/boot/bootia64.efi   set E=%E% \necho -n -e -P:3000 \\x24[0103]INFORMATION: ITANIUM 64-bit UEFI boot file \\\\EFI\\\\boot\\\\bootia64.efi present
if exist /EFI/boot/bootARM.efi    set E=%E% \necho -n -e -P:3100 \\x24[0103]INFORMATION: ARM 32-bit UEFI boot file \\\\EFI\\\\boot\\\\bootARM.efi  present
if exist /EFI/boot/bootAA64.efi   set E=%E% \necho -n -e -P:3200 \\x24[0103]INFORMATION: ARM 64-bit UEFI boot file \\\\EFI\\\\boot\\\\bootAA64.efi present

ls /EFI > nul ||                  set E=\necho -n -e -P:2800 \\x24[0103]   INFORMATION: No \\\\EFI folder present (cannot UEFI boot)


# -------- MENU COLOURS -------
# Colour pairs are Text/Background - i.e cyan/blue = cyan text on blue background
# Use black if a transparent background is required for menu highlight background - e.g. highlight=red/black
# Valid colours are: black, blue, green, cyan, red, magenta, brown, light-gray, dark-gray, light-blue, light-green, light-cyan, light-red, light-magenta, yellow and white.
#  normal    = normal menu text
#  highlight = highlighted menu text when a menu entry is selected
#  helptext  = the colour of the title help text shown just below the menu box
#  standard  = the console background and text colours (e.g. when listing files)
#  border    = the colour of the border of the menu box

color normal=light-cyan/black highlight=yellow/dark-gray helptext=white/black standard=light-cyan/black border=light-green/black

# ----- MENU POSITION ---
# wordspacing linespacing borderwidth tophelp numberofitemsinmenu topstart menuwidth rightstartposofmenu
# tophelp=topstart+noitems for menuhelp text just under menu box
set wdspace=0
set lnspace=0
set topstart=5
set rstart=4
set noitems=13
set menuw=66
set bdwidth=1
set tophelp=18

/e2b/menusetting.gz   %wdspace% %lnspace% %bdwidth% %tophelp% %noitems% %topstart% %menuw% %rstart% && clear

# --- HEADER --- 
# HCOLOUR sets the colour of the HEADING and FOOTER TEXT text 
# HCOLOUR=ABCD specifies the text colour  [BLINK|BRIGHT|BACKGROUND|FOREGROUND]
# A=0/1 1 = BLINK text (does not work under VM)
# B=0/1 1 = BRIGHT colour for foreground text
# C=0-7 = BACKGROUND colour - transparent if graphics mode so has no effect!
# D=0-7 = FOREGROUND menu text colour
# Colours parameters are: 0=black/grey 1=blue, 2=green, 3=cyan, 4=red, 5=pink, 6=yellow/brown, 7=grey/white.
# e.g. 0106 is non-blinking yellow text, 0006 is brown text, 0101 is light blue text

# HEADING
set CHPAD=\x20 ;;    # PADDING for CHEADING and PAYLOAD - set to same as rstart-3
set CHTOP=0100 ;;    # HEADING POSITION
set CHCOLOUR=0107 ;; # HEADING COLOUR

# PAYLOAD DESCRIPTION
set CPAY_POS=0300 ;; # PAYLOAD NAME POSITION XXYY
set CPAY_COL=0106 ;; # PAYLOAD NAME COLOUR

# FOOTER HELP TEXT
set CHBTM=3601 ;; # HELP TEXT BOTTOM POSITION XXYY
set CFCOLOUR=0005 ;; # FOOTER COLOUR

#------

## use PAYLOAD variable to hold title of payload (MakePartImage will replace next line with the payload name)
##set PAYLOAD= ;; ###################################################################################################################################################

set CLRTOP=\x20                                                             \x20
# This displays the heading, description and footer text
if "%CENTREHD%"=="1" set CENTREHD=%menuw%
if exist CENTREHD call /e2b/centrehd.g4b CHEADING
if exist CENTREHD call /e2b/centrehd.g4b PAYLOAD

write (md)0x220+2 !BAT\necho -n -P:0000 $[0122]%CLRTOP%\necho -n -P:%CHTOP% $[%CHCOLOUR%] %CHPAD%%CHEADING%\necho -n -P:%CPAY_POS% $[%CPAY_COL%]%CHPAD%%PAYLOAD%\necho -n -P:%CHBTM% $[%CFCOLOUR%]%CHELPTEXT%\n\0 > nul
# add EFI boot file messages
echo -e %E% \0 >> (md)0x220+2
initscript (md)0x220+2

# ---------------- MENU ENTRIES ------------------


To design your own menu, you can use the E2B_Editor to make a new .cfg file and then transfer the relevant settings for menu position and colours, etc. from the .cfg file into the CUSTOM\menu.lst file if you wish.

Frettt show an example with the menu box on the left here.

Note: The ##set PAYLOAD= ;; #######   line must not be changed. This is automatically modified by MPI so that it contains the name of the payload when you run the MPI script.

Change the menu entries (language, etc.)

If you need to change the menu entries, you will need to find each title or iftitle line in the menu.lst which will be below the "# ---------------- MENU ENTRIES ------------------" line and edit those lines.

e.g.

iftitle [if not exist /konboot.img] BOOT from this drive (MBR mode)\n This may not work for some images\n In case of problems, try another boot menu entry

can be changed to:

iftitle [if not exist /konboot.img] Starte von diesem Laufwerk (MBR-Modus)\n Funktioniert nicht unbedingt mit allen Images.\n Wähle eine andere Option falls Probleme auftreten.


More info on the E2B page here.

No comments:

Post a Comment