Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Jun 2015 21:10:47 +0800
From:      Julian Elischer <julian@freebsd.org>
To:        Don whY <Don.whY@gmx.com>, FreeBSD-Hackers Mailing List <freebsd-hackers@freebsd.org>
Subject:   Re: PXE boot an XIP image?
Message-ID:  <557C2BD7.1000104@freebsd.org>
In-Reply-To: <557C073E.1060702@gmx.com>
References:  <557C073E.1060702@gmx.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 6/13/15 6:34 PM, Don whY wrote:
> Hi,
>
> Apologies as to whether this belongs here... or on -embedded. :<
>
> I'd like to PXE boot a kernel then fetch (any choice of protocol)
> a *single* image to load into RAM thereafter not requiring any
> access to external media to operate.  I.e., as if the image
> had resided in the device all along.

what do you mean by "single"? any PXE boot is by definition a number 
of transactions.
The regular PXE boot code from FreeBSD is capable of loading a kernel 
and a
matching ram filesystem, which when executed, will boot up as a running
system and not touch any medium. I haven't done it for a while but at
one stage there used to be a suitable memory filesystem on one fo the 
boot media.
(that may no longer be true)

you can also boot a completely NFS system as well, and that will not 
touch media either.

Finally, if having the network boot loader load TWO modules (kernel 
and FS) is too much,
you could make a kernel that has the filesystem statically linked into it.
But that's more work.


>
> A crude approach *might* be something like crunchgen'ing init
> with all of the (static linked) binaries that are required
> and letting the loaded kernel NFS read (load) that init(1).
> Obviously, I'd trim the kernel and other binaries down to the
> bare essentials to minimize RAM requirements (as there would be no
> swap, etc.)
>
> [I.e., creating a tiny filesystem that simply links every executable
> back to this *one* image]
>
> In practice, this won't (?) really work as hoped.  Any pointers on
> a proven technique to achieve these results?
I don't know why that wouldn't work, but what you put in your memory 
filesystem is up to you.
You dont say what your limits are.   How much RAM is on the machine?

All this is documented on many blogs, man pages, etc. so spend a while 
on google and you should be able to patch it together.

remember:
the bootblocks/loader used for Regular PXE booting can load using NFS 
or tftp.
teh loader can link a file with the kernel that is just a filesystem 
image..
(I forget the exact 'type' is needs to use.. I'm sure the man pages 
would have it)
teh filesystem image is just that.. you make it bu making a memory 
based drive,
and formatting and filling it just as you would a regular drive.

We DID at one stage have the ability to have the filesystem loaded be 
compressed.
(in fact at one stag the kernel could also be compressed. I presume we 
cna stil do that
but as I said, I haven't done this for some time.

finally you can load the filesystem image and kernel from GRUB too, so 
if you get the net lodaing capable version of grub going you should be 
able to do exactly the same thing. it's just a case of giving the 
right 'type' and name for the image, and giving the right "mountfrom" 
value (ufs:md0 would be an expected value for example).



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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?557C2BD7.1000104>