(OpenMandriva runs in live multiboot mode from a USB flash drive)

Continuing PCLinuxOS, this tutorial explains the configuration file for OpenMandriva Lx 4.0 --a beautiful RPM-KDE based operating system-- to boot in multiboot USB using GLIM tool. If you don't know GLIM, read first the tutorial. If you wonder, multibooting is important to save cost as you can run multiple distro installers by just one flash drive, without having multiple flash drives. To speak about config, OpenMandriva is very different to Ubuntu (even different to PCLinuxOS too) both in bootloader code and its internal ISO file structure. Thus, it will not boot from multiboot flash drive unless we write the correct code. I managed to ship a USB with it twice in Indonesia this month only. That's why I share my success with you here. Happy hacking!

Subscribe to UbuntuBuzz Telegram Channel to get article updates directly.


Requirements


You will edit 3 different files:

  • grub.cfg - global configuration file
  • inc-openmandriva.cfg - specific configuration to boot OpenMandriva
  • openmandriva.png - OpenMandriva logo

Get OpenMandriva


You can download OpenMandriva Lx 4.0 GNU/Linux at no cost from official website.


ISO file name


The file is OpenMandrivaLx.4.0-plasma.x86_64.iso with size 2.4GiB. 


ISO content


By opening the ISO file with Ark Archive Manager, we see the kernel filename is vmlinuz0 and initrd filename is  liveinitrd.img both located under /boot/ directory.


1. grub.cfg

for isofile in ${isopath}/openmandriva/OpenMandriva*.iso; do
  if [ -e "$isofile" ]; then
    menuentry "OpenMandriva >" --class openmandriva {
      configfile "${prefix}/inc-openmandriva.cfg"
    }
    break
  fi
done


Explanation: this code first finds out the file name of OpenMandriva ISO, hence it uses * sign and to save the file name in variable $isofile. This code is responsible to draw "OpenMandriva >" sign you can choose on the USB bootloader among other distros. The code --class openmandriva is the one responsible to show openmandriva.png logo before the OS name on the bootloader.


2. inc-openmandriva.cfg

# OpenMandriva
for isofile in $isopath/openmandriva/OpenMandriva*.iso; do
  if [ ! -e "$isofile" ]; then break; fi
  regexp \
    --set 1:isoname \
    --set 2:version \
    --set 3:arch \
    --set 4:variant \
    "^${isopath}/openmandriva/(OpenMandriva([^-]+)-([^-]+)-([^-]+)\.iso)\$" "${isofile}"
  menuentry "OpenMandriva ${version} ${arch} ${variant}" "${isofile}" "${isoname}" --class openmandriva {
    set isofile=$2
    set isoname=$3
    boot_locale="locale.lang=en_US"
    boot_default="rootfstype=auto ro rd.luks=0 rd.lvm=0 rd.md=0 rd.dm=0 rd.live.image acpi_osi=Linux acpi_osi='!Windows 2012' acpi_backlight=vendor audit=0 logo.nologo"
    loopback loop $isofile
    probe --label --set=cd_label (loop)
    bootoptions="iso-scan/filename=$isofile $boot_default root=live:LABEL=$cd_label $boot_locale quiet rhgb splash=silent"
    linux (loop)/boot/vmlinuz0 $bootoptions
    initrd (loop)/boot/liveinitrd.img
  }
done

Explanation: this code runs the actual command to boot the OpenMandriva operating system. It works with loopback technology represented by (loop) code. In short, loopback is like mounting an ISO image on your file manager so you can access the files within it.  The booting command is divided in two, linux to call the kernel file, and initrd to call the initrd file. Before that, there is a long boot options specific to OpenMandriva (means different to Ubuntu's) that is divided in three sections combined in one.

3. Icon


You should have a 16x16 pixels PNG icon of OpenMandriva Lx with file name openmandriva.png in /boot/grub/themes/invader/icons/ directory so it appears properly at the booting time. Without icon, the entry will have no logo. GLIM current version does not support OpenMandriva so there is no its logo there. So I share my icon below so you just need to add it.

Icon:



How to put the icon:


How codes look in text editor:





By seeing this, you know how the code should be written.

Result


Booting the multiboot flash drive can boot the OpenMandriva Lx 4.0 in live mode. It works.

First bootloader:
See OpenMandriva Lx entry with its blue logo there.



Live session:
OpenMandriva Lx successfully runs.

(OpenMandriva on my laptop while testing the USB before shipping)


This article is licensed under CC BY-SA 3.0.


, , , , , , , ,