[syslinux] [Patch]: Drive/Partition and extensible filesystem support for syslinux

Ram Yalamanchili ramyinc at gmail.com
Wed Apr 18 01:46:11 PDT 2007


Forgot two things:

1) the patch file's extension is missing
2) The diffs are made against the following tarball:
http://www.kernel.org/pub/linux/utils/boot/syslinux/Testing/syslinux-3.50-pre5.tar.bz2

I'm attaching the same patch file with a .patch extension.

--
Ram

On 4/18/07, Ram Yalamanchili <ramyinc at gmail.com> wrote:
> Here is the patch for making syslinux enable opening partitions with
> fat filesystems (well, the architecture is in place to make it open
> other filesystems too).
>
> Usage is like this:
>
> #include <syslinux/io.h>
> #include <syslinux/partitions.h>
> #include <fs/fat/libfat.h>
>
> syslinux_devdesc dfd;
> struct libfat_filesystem* fs;
> diskinfo disk_info;
> char mbr[512];
> static part_entry *partition;
> int fd;
>
> syslinux_get_disk_params(drive, &disk_info); // specify your drive number
> syslinux_read_disk(&disk_info, mbr, 0, 1); // Read mbr
> partition = PARTITION_ENTRY(mbr, 2); // 2 for partition 2
>
> // this is the disk device/partition descriptor
> dfd.disk_info = &disk_info;
> dfd.partition = partition;
>
> // try opening libfat partition on the given partition descriptor
> fs = libfat_open(syslinux_fs_partition_read_handle, (intptr_t) &dfd);
> fd = fs->ops.open(fs, "MYFILE    CFG", O_RDONLY);
> // This will give you a open descriptor
>
> // Now on, you can read files just like any other *nix file...! :)
> read(fd, mybuf, 128); // read 128 bytes from file..
>
> OR
>
> you can use zlib funtionality of syslinux with:
>
> gzFile gzf = gzdopen(fd, "r");
> gzread(gzf, mybuffer, 128);
> etc...
>
> //After you are done, you can close the descriptor with
> close(fd);
>
> // FS can be closed with
> libfat_close(fs);
>
>
>
> One thing which is missing is the way you specify file names for open.
> It is the short name format of DOS. Would appreciate if someone can
> add long file name search for libfat.
>
> thanks.
>
> --
> Ram
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drive_partition_fs_syslinux.patch
Type: text/x-patch
Size: 43340 bytes
Desc: not available
URL: <http://www.zytor.com/pipermail/syslinux/attachments/20070418/2798ef44/attachment.bin>


More information about the Syslinux mailing list