WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: help need for chainloading, from grub to syslinux on logical partition  (Read 1499 times)

Offline nick65go

  • Full Member
  • ***
  • Posts: 153
grub1 is instaled on primary partition sda1; syslinux is instaled on primary partition sda3 and also on logical partition sda13
I can boot from grub1 only (for kernel on sda13 , format ext2);
I can also boot grub1 and chain-load to syslinux on sda3 (for kernel on sda3, format ext2)
But I can not boot grub1 and chain-load to syslinux on sda13.

it does not work something like this (from grub menu.lst): chainload (hd0,12)/boot/extlinux/syslinux.bin
because no *.bin is installed, only /mnt/sda13/boot/extlinux/ldlinux.sys exist.

I think the extlinux loader looks for wrong offset at logical partition boot sector
Any links or tricks to do it, please?
« Last Edit: July 01, 2015, 12:07:58 PM by nick65go »

Offline nick65go

  • Full Member
  • ***
  • Posts: 153
http://www.syslinux.org/wiki/index.php/Mbr

altmbr.bin is also for msdos-style partition table, but it boots from a partition with fixed number,
The altmbr.bin (all 3 variants) is only 439 bytes long, -- one extra byte should be set to the number of partition to boot from. An easy way to set the desired boot partition to 13 (hexa=xd) with altmbr.bin is:

printf '\xd' | cat altmbr.bin - | dd bs=440 count=1 conv=notrunc of=/dev/sda
(altmbr.bin from /tmp/tcloop/syslinux/user/local/share/syslinux/altmbr.bin)

==Or,==
from https://wiki.archlinux.org/index.php/Syslinux#MBR_partition_table
An alternate MBR which Syslinux provides is: altmbr.bin. This MBR does not scan for bootable partitions; instead, the last byte of the MBR is set to a value indicating which partition to boot from. Here is an example of how altmbr.bin can be copied into position:

# printf '\x5' | cat /usr/lib/syslinux/bios/altmbr.bin - | dd bs=440 count=1 iflag=fullblock of=/dev/sda

In this case, a single byte of value 5 (hexadecimal) is appended to the contents of altmbr.bin and the resulting 440 bytes are written to the MBR on device sda. Syslinux was installed on the first logical partition (/dev/sda5) of the disk.

now, I hope it will work... I need to reboot to test it
« Last Edit: July 01, 2015, 03:10:05 PM by nick65go »

Offline beerstein

  • Hero Member
  • *****
  • Posts: 503
Hi:
You wrote that grub1 (the older version of grub) is installed into the primary partition sda1. To boot the system, the boot-loader grub should to be in the MBR of the hard drive,  which is sda.
From sda you can chainload to any partition on the hard drive which has another bootloader installed.
This is what I think. I might be wrong. So please correct me if I did not understand the subject. Thank you.

t(w)o be(ers) or not t(w)o be(ers) that is the question

Offline nick65go

  • Full Member
  • ***
  • Posts: 153
Clarification, for beerstein:
BIOS search for first HDD (my BIOS setup HDD, PXE etc) and give control to it.
On first HDD, the MBR code (first 440 biti in /dev/sda, out of the file system, is grub stage 1) scan partition table for an ACTIVE boot partition.
my /dev/sda1  is the bootable one; here is grub1 stage 2 installed on an ext2 file system. All is OK here.

extlinux is installed on /dev/sda3 (primary partition). grub CAN give control to extlinux ( by chain loading). All is OK here also.

The problem is when extlinux is installed on /dev/sda13 (a LOGICAL partition). Because extlinux installs a file in mounted partition, at /dev/sda13/boot/extlinux/ldlinux.sys;
AND also a file (hidden, because is out of the ext2 file system) something like /dev/sda13/ldlinux.bin; this second file is like the MBR code but in logical partition. this hidden ldlinux.bin use ldlinux.sys to read the ext2 file format etc...

The error message "Boot error" came from altmbr.bin in the start of the logical partition.
I think my problem is altmbr.bin need a manually made "partition table" with LBA (logical block address) in it, to jump to start the ldlinux.bin

( the purpose to have extlinux is for its skills to dynamically concatenate initrd, so quick remaster on the fly, by using APPEND=path/to/core1.gz, /path/to/mycore2.gz; grub1 can not do it, it need first something like
cat core1.gz, mycore2.gz > mycore3.gz, not so easy to split again...)


« Last Edit: July 02, 2015, 01:23:02 PM by nick65go »

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4176
I believe Grub 1 can only boot from primary partitions.
Since this in not a tinycore issue, you should probably check Grub Legacy official documentation.