28.08.2015 Views

The Design and Implementation of the Anykernel and Rump Kernels

1F3KDce

1F3KDce

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

192<br />

4.2.2 makefs<br />

For a source tree to be fully cross-buildable with build.sh [77], <strong>the</strong> build process<br />

cannot rely on any non-st<strong>and</strong>ard kernel functionality because <strong>the</strong> functionality might<br />

not exist on a non-NetBSD build host. <strong>The</strong> build.sh m<strong>and</strong>ate also dem<strong>and</strong>s that a<br />

build can be performed fully unprivileged, i.e. a root account is not required.<br />

Before build.sh, <strong>the</strong> canonical approach to building a file system image for boot<br />

media was to be to create a regular file, mount it using <strong>the</strong> loopback driver, copy <strong>the</strong><br />

files to <strong>the</strong> file system <strong>and</strong> unmount <strong>the</strong> image. This approach was not compatible<br />

with <strong>the</strong> goals <strong>of</strong> build.sh.<br />

When build.sh was introduced to NetBSD, it came with a tool called makefs which<br />

creates a file system image from a given directory tree using only application level<br />

code. In o<strong>the</strong>r words, <strong>the</strong> makefs application contains <strong>the</strong> file system driver implemented<br />

for a userspace environment. This approach does not require privileges to<br />

mount a file system or support <strong>of</strong> <strong>the</strong> target file system in <strong>the</strong> kernel. <strong>The</strong> original<br />

utility had support for Berkeley FFS <strong>and</strong> was implemented by modifying <strong>and</strong><br />

reimplementing <strong>the</strong> FFS kernel code to be able to run in userspace. This copy-<strong>and</strong>modify<br />

approach was <strong>the</strong> only good approach available at <strong>the</strong> time.<br />

<strong>The</strong> process <strong>of</strong> makefs consists <strong>of</strong> four phases:<br />

1. scan <strong>the</strong> source directory<br />

2. calculate target image size based on scan data<br />

3. create <strong>the</strong> target image<br />

4. copy source directory files to <strong>the</strong> target image

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!