NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Building PXE/XIP environment

On 24.04.2011 20:43, Scrap Happy wrote:
>> Once you have your system ready to be packaged:
>> - use makefs(8) to create the filesystem image:
>>      makefs<image file>  <image root directory>
> So, if I've built a filesystem "/foo" and verified
> everything works as expected after 'chroot /foo',
> this (makefs foo.image /foo) will bundle it up for
> me?


> (presumably, that filesystem should be *quiescent*
> when I do this?)

Recommended. It does not snapshot the content, it will just read it to
build up the image.

>> - note down the resulting file system image file, then compile a kernel
>> with:
>> options MEMORY_DISK_IS_ROOT     # root on memory disk
>> options MEMORY_DISK_ROOT_SIZE=40000   # size of fs image in blocks
> Is this *literally* the number of blocks in the "foo.image" file?
> (i.e., any "overhead" in that file is refected in this count)

Yes. It only tells the tools to allocate space in the resulting image so
you can stash the file image inside. No binary headers or the like.

> I assume you don't want this number too exceed the image's size
> as that just wastes memory that could be used for run-time?

Yep. This is harmless anyway, you only waste space.

> OTOH, if the memory disk image will be treated as r/w at run time,
> can padding this number give you "extra space" in the resulting file
> system?

I don't think so.

The number specifies the amount of space you reserve in kernel to put a
file-system image inside the binary. Free/extra space is rather a
property of the file-system itself. If you want to keep extra space, see
the -s option of makefs(8).

>> - mdsetimage(8) to embed the image in the resulting kernel:
>>      mdsetimage<kernel>  <image file>
>> Boot with the resulting<kernel>. If your host system is not NetBSD,
>> build these tools via
> Can I just pass this entire image to the device via PXE?

You mean the bootloader?

Yes, although I would avoid using TFTP for that. It is damn slow to
download multi-MiB images, plus you risk hitting the size's limitation
(typically, 2^16 * 512B, but NetBSD's tftp(1) code does not suffer from it).

>  Or, am
> I better off getting the kernel to the device and *then* having
> the kernel drag over the image?

Whatever suits you.

I generally prefer to have the file system image residing in a separate
kernel module (like miniroot.kmod), it's easier to manage; you don't
have to reserve space in the resulting kernel image, it's loaded as a
traditional module(7). And you can switch from one miniroot to another
for testing.

In other cases, having kernel + fs image in one standalone file is
easier to deploy and validate (hashes, signatures, ...). YMMV.

Jean-Yves Migeon

Home | Main Index | Thread Index | Old Index