Adding another OS to grub2

How may I add another OS to the grub2 menu? I have three OSs, Windoze 7, eComstation and Leap42.2 but whatever I do I cannot get the eComstation to boot. (eComStation succeeded and was mostly OS/2 Warp4.5)
Here is my setup:-

linux-rti7:~ # fdisk -l
Disk /dev/sdb: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe7e2a487

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sdb1  *          255 512006849 512006595 244.1G  7 HPFS/NTFS/exFAT
/dev/sdb2       512006850 681461999 169455150  80.8G  f W95 Ext'd (LBA)
/dev/sdb5       512007105 595433924  83426820  39.8G  7 HPFS/NTFS/exFAT
/dev/sdb6       595434180 681461999  86027820    41G  7 HPFS/NTFS/exFAT


Disk /dev/sda: 1.8 TiB, 2000398934016 bytes, 3907029168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00047476

Device     Boot     Start        End    Sectors   Size Id Type
/dev/sda1            2048     206847     204800   100M  7 HPFS/NTFS/exFAT
/dev/sda2          206848  819202047  818995200 390.5G  7 HPFS/NTFS/exFAT
/dev/sda3       819202048 3907028991 3087826944   1.4T  f W95 Ext'd (LBA)
/dev/sda5       819204096  823410687    4206592     2G 82 Linux swap / Solaris
/dev/sda6  *    823412736  865357823   41945088    20G 83 Linux
/dev/sda7       865359872 3012845567 2147485696     1T 83 Linux



The eCS system is on /dev/sdb1

When I look at the partitions using Yast expert partioner there is a label ^A against this partition. What does this mean? I cannot find reference to this in the manual. I also note that two partitions have a boot asterix and I ask is this correct. As it is now the system boots from /dev/sda6.

My objective is to be able to run the eCS sytem from the grub boot menu. Please can somebody advise.
Budge

eCS is not supported by os-prober that generates entries for foreign OSes. Someone who has experience with it needs to contribute code to recognize it. Assuming it has partition boot block, you can add menu entry to chainload it. Someone already asked similar question in the past, I do not remember any feedback whether chainloading was successful or not.

Hi and thanks for the info. I shall search a bit more. Meanwhile how can I add a menu entry to try chain loading?

Can grub2 identify filesystem uuid on eCS partition? Run

grub2-probe -t fs -d /dev/sdb1
grub2-probe -t fs_uuid -d /dev/sdb1

Hi, here are the results from your two commands:-


linux-rti7:~ # grub2-probe -t fs -d /dev/sdb1
jfs
linux-rti7:~ # grub2-probe -t fs_uuid -d /dev/sdb1
18000000-0d00-0d00-0800-0000f2ff0800
linux-rti7:~ # 

I have found a bit about adding lines to my grub.d file but am very confused by the examples which refer to partitions as hdx,y
and not sda(x) etc. Also in the examples there are lines such as “insmod ntfs.” I would like to add a line but need a bit more guidance please, assuming the above info helps.
many thanks for you help.
Budgie

Create /boot/grub2/custom.cfg with content similar to

menuentry "eCS on /dev/sdb1" --id custom-18000000-0d00-0d00-0800-0000f2ff0800 {
  insmod jfs
  insmod part_msdos
  set root=hd1,msdos1
  search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 18000000-0d00-0d00-0800-0000f2ff0800
  chainloader +1
}

It may be necessary to remap drives so hd1 becomes hd0; but try this version first.

Hi and thanks for this. Before I do this please could you reassure me as, in my ignorance, I am afraid a custom.cfg, if incorrect, might prevent me from ever getting back to my existing system. Why are you suggesting a custom.cfg rather than a custom menu item as mentioned above.

Well I’m darn’d! Did what you suggested and that gave me the additional grub menu item at startup referring to eCS which is correct. Unfortunately when I selected it I received an error message (something like wrong code for JFS 0000 0000) I shall try again and write it down.

The menu item was:-

eCS on /dev/sdb1

and when selected I get:-

Invalid code for JFS 0000:0000

The system them stalls and I have to reboot with ctrl-alt-del to get back to grub.

My recollection was that the partition used to boot but I am not sure it was JFS. I think just HPFS. your script passed insmod jfs. Is there another option we could try?

It does not come from grub, so apparently grub did load partition boot block and tried to execute it,

I shall try again and write it down

You can just make a photo of screen with this error.

The system them stalls and I have to reboot with ctrl-alt-del to get back to grub.

Well, if code that was loaded encountered some fatal error, it probably has no choice beyond freezing. it is entirely possible that there is no meaningful code in the first place.

My recollection was that the partition used to boot but I am not sure it was JFS. I think just HPFS.

That’s how grub detected it. What “wipefs -n /dev/sdb1” in Linux says (wipefs sounds dangerous, but should not do anything in this invocation; if in doubt, you can use --backup option to preserve disk content)?

your script passed insmod jfs.

It is needed only to get UUID value; grub does not attempt to actually access this filesystem in any way. It is entirely possible to omit it and “search” command but then you must be sure your disk is always the second one (i.e. hd1 in grub).

Is there another option we could try?

Try adding “drivemap -s hd0 hd1” as the last command. If this does not help, sorry - someone who understands how eCS boots needs to chime in here, or someone needs to reverse engineer boot code.

At one time, I used OS2. I have not tried the ECS version.

With OS2, there is a byte in the boot sector that indicates which drive to boot (i.e. which drive to use in BIOS calls). The OS2 boot manager would load the boot sector, then modify that byte as needed before jumping to it.

Back when I was using “lilo”, I modified my version to do the same thing. But it also worked to just copy the boot sector to a file, and use a hex-editor to change that one byte. And then I set “lilo” to chain-load from that file instead of from a partition.

I don’t know whether that trick still works. And I don’t remember which sector to modify, but it could easily be found by disassembling the boot code in the boot sector. I also don’t know if grub2 can chain-load from a file.

It can. It always chainloads from a file - blocklist is just a special kind of “filesystem”.

Amazing. That did it and eCS booted. Very many thanks. I only wish I knew what you did there but I am still learning!!!

I still have a remaining problem in that once booted into eCS I have no mouse or keyboard. I suspect this is an eCS config problem and perhaps because I am on a remote KVM. I shall now check my eCS installation.

Thanks again,
Budge