[syslinux] com32 fswrite to filesystem
Gert Hulselmans
gerth at zytor.com
Thu Mar 11 13:01:49 PST 2010
Don Hiatt wrote:
> On Thu, Mar 11, 2010 at 9:25 AM, Gene Cumm <gene.cumm at gmail.com> wrote:
>> I'm pretty sure this was discussed previously on the list.
>>
>> This is my understanding of H. Peter Anvin's opinion/view. Due to the
>> unpredictable nature of the quality of different BIOSs, this has been
>> explicitly not implemented. If you happen to have a bad BIOS, you
>> might (at worst) nuke your entire hard drive by overwriting it with
>> corrupt data when you only wanted to write to one small text file.
>>
>
> Thanks for your reply Gene. I have looked at your rosh but I'd like to
> make it rwosh. ;-)
>
> One thing I'd like to do is, say, from syslinux download a new kernel
> image
> over TFTP and then write it to the filesystem. Or do some other sort
> similar FS writes. I certainly don't expect this to be needed by too
> many people,
> but I'd certainly release any changes I make which allow FS write support.
> Basically, what I'm looking for is any words of advice on just where to
> begin
> to add support. It may be a futile effort, but I'd like to give it a go.
> ;-)
>
> Cheers and thanks again!
>
> don
Syslinux can create/modify initramfs filesystems.
So you can make a small Linux kernel which has ext2/3/4 support (or any
filesystem of your liking) and let the boot scripts look for certain files
you have added to the initramfs, so it can write them to a partition.
See com32/modules/linux.c for an example (dhcp info writen to file in
initramfs):
/* Initialize the initramfs chain */
initramfs = initramfs_init();
if (!initramfs)
goto bail;
if ((arg = find_argument(argp, "initrd="))) {
do {
p = strchr(arg, ',');
if (p)
*p = '\0';
if (!opt_quiet)
printf("Loading %s... ", arg);
if (initramfs_load_archive(initramfs, arg)) {
if (opt_quiet)
printf("Loading %s ", kernel_name);
printf("failed!\n");
goto bail;
}
if (!opt_quiet)
printf("ok\n");
if (p)
*p++ = ',';
} while ((arg = p));
}
/* Append the DHCP info */
if (opt_dhcpinfo &&
!pxe_get_cached_info(PXENV_PACKET_TYPE_DHCP_ACK, &dhcpdata, &dhcplen)) {
if (initramfs_add_file(initramfs, dhcpdata, dhcplen, dhcplen,
"/dhcpinfo.dat", 0, 0755))
goto bail;
}
/* This should not return... */
syslinux_boot_linux(kernel_data, kernel_len, initramfs, cmdline);
- Gert Hulselmans
More information about the Syslinux
mailing list