[syslinux] Adding memdisk or similar when booting linux

Kjetil.Mikkelborg at kongsberg.com Kjetil.Mikkelborg at kongsberg.com
Tue Mar 25 02:19:59 PDT 2008


>Kjetil.Mikkelborg at kongsberg.com wrote:
>>
>> Ok, thanks, but..
>>
>> Ive tried using linux.c as an example, but I am in no way capable of adding files with this simple code
>>
>> size_t kernel_len, dd_len;
>> void *kernel_data, *dd_data;
>> struct initramfs *initramfs;
>>
>> loadfile("path to vmlinuz on tftp server",&kernel_data,&kernel_len);
>> loadfile("Path to dd.img file on tftp server",&dd_data,&dd_len);
>> initramfs = initramfs_init();
>> initramfs_load_archive(initramfs,"path to redhat enterprise 4 initrd.img file on tftp server");
>> initramfs_add_file(initramfs,dd_data,dd_len,dd_len,"/dd.img",0,0755);
>> syslinux_boot-linux(kernel-data,kernel_len,initramfs,"append string",0xffff,0);
>>
>> is there any more init I have to do to add files? and,  is it really right to use dd_len,dd_len as arguments (whats the first len since the second is for how much data >we add).
>>
>
>Yes, that's correct (the reason there is data length and file length is
>that hard links are stored as a file with a data length of zero.)
>
>However, since you're loading a file from the underlying mendium, you're
>probably better off using initramfs_load_file(), which pretty much does
>the same thing you have above.
>
>However, you have the mem_limit argument (the last argument) to
>syslinux_boot_linux() set to zero, which is guaranteed to break every
>time.  Set it to -1 unless you have better information, although the
>best would be to use the code from linux.c as-is(*).
>
>        -hpa
>
>(*) I really should librarize extracting this kind of information from
>the kernel command line.


Thanks for your reply, but stil  no luck.
changed the last arg to -1, but still no sign of /dd.img in initrd after booting.
So, am i looking at the wrong end here? is an initrd image handled the same way as
a cpio archive regarding initramfs? Since i suspect redhat is stil using initrd image
(with ext2 filesystems).

Ive also just for testing tried to change to using initramfs_load_file instead of the code above,
but still no luck with that either.

Any more hints to were to look?

--Kjetil




More information about the Syslinux mailing list