On Sat, 2013-02-23 at 16:28 +0100, Wojciech Puchar wrote:
> can it be done?
> 
> converting ELF kernel (i don't use kld modules) to format that can be 
> loaded directly over TFTP - without intermediate stages like loader(8)?
> 
> just to have SINGLE FILE that tftp would load and run. no loader(8) etc.

The kernel build process for arm and mips create such a kernel as one of
the standard outputs from buildkernel.  That doesn't appear to be the
case for x86 kernels, but you could use sys/conf/makefile.arm as a
guide.

Basically what needs doing is to link the kernel with a modified
ldscript that doesn't add space for the program headers, and then run
the output of that link through "objcopy -S -O binary" to create a
kernel.bin file.  That file can be directly loaded to the address it was
linked for, and a jump to the load address launches the kernel.

Whether the kernel runs properly when launched that way is a different
question.  An arm kernel will run that way because we haven't had the
luxury of loader(8) in the arm world until recently.  The x86 kernel may
expect values in the environment that the loader obtained from the bios.
Without a loader you may need to modify the kernel to get that
information in some other way early in startup.

-- Ian


_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to