LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Puppy (http://www.linuxquestions.org/questions/puppy-71/)
-   -   ldlinux.sys? what does it do? (http://www.linuxquestions.org/questions/puppy-71/ldlinux-sys-what-does-it-do-942097/)

twelvenine 04-27-2012 10:35 AM

ldlinux.sys? what does it do?
 
I recently started playing around with puppy and syslinux. I've been trying to get a feel for how the boot process works and the one thing that's confusing me is this ldlinux.sys file. The only information I've been able to find on it is this: http://wiki.answers.com/Q/What_is_ldlinux.sys
Quote:

ldlinux.sys is the name of the bootloader file used in SYSLINUX and ISOLINUX (used for booting Linux off of FAT32 and ISO9660 filesystems, respectively). It is loaded into memory by the BIOS on bootup. The loader then parses the configuration file (syslinux.cfg or isolinux.cfg) to know which kernel to launch, along with parameters to be passed to it.
I don't know if that's accurate, but I decided to try deleting the file from my usb boot disk and booting without it. I figured if it's really responsible for reading the syslinux.cfg file, then things should fail when I try to boot without it. However, everything still worked fine without ldlinux.sys. My logo image still loaded, the boot messages came up, I was even able to boot a kernel.

Can some knowledgeable person please tell me what the purpose of this file is and how it fits into the boot process? Does all of the important syslinux code come from the boot sector and if so, why is this ldlinux.sys necessary?

twelvenine 04-27-2012 11:00 AM

hey, I think i figured it out. the archlinux wiki had a good explanation:
Quote:

At boot, the computer loads the MBR (/usr/lib/syslinux/mbr.bin). Then the MBR looks for the partition that is marked as active (boot flag). Once found, the volume boot record (VBR) will be executed. In the case of ext2/3/4 and fat12/16/32, the starting sector of ldlinux.sys is hard-coded into the VBR. The VBR will execute (ldlinux.sys). Therefore, if the location of ldlinux.sys changes, syslinux will no longer boot. In the case of btrfs, the above method will not work since files move around resulting in the sector location of ldlinux.sys changing. Therefore, the entire Syslinux code needs to be stored outside the filesystem. The code is stored in the sectors following the VBR. Once Syslinux is fully loaded, it looks for a configuration file, either extlinux.conf or syslinux.cfg. If one is found, the configuration file is loaded. If no configuration file is found you will be given a syslinux prompt.
So, I guess that ldlinux.sys is important after all. The reason everything was fine without it was because the VBR had the starting sector of ldlinux.sys hard coded into it. I was only doing an rm on it so it was getting unlinked, but the VBR still knew where to find it. I opened it up in vi and deleted everything, saved, and tried to boot the usb then. Bam! boot error.

catkin 04-27-2012 11:04 AM

Thanks for sharing :)


All times are GMT -5. The time now is 12:22 AM.