Page MenuHomeFreeBSD

Fix MFS builds when both MD_ROOT_SIZE and MFS_IMAGE are specified
ClosedPublic

Authored by Sgalabov_gmail.com on Jan 27 2016, 5:01 PM.

Details

Summary

MD_ROOT_SIZE and embed_mfs.sh were basically retired as part of https://reviews.freebsd.org/D2903 .
However, when building a kernel with 'options MD_ROOT_SIZE' specified, this results in a non-working MFS, as within sys/dev/md/md.c we fall within the wrong # ifdef.

The proposed solution is the following:

  • Allow kernels to be built without the MD_ROOT_SIZE option, which results in a kernel built as per D2903.
  • Allow kernels to be built with the MD_ROOT_SIZE option, which results in a kernel built similarly to the pre-D2903 way, with the following differences:
  • The MFS is now put in a separate section within the kernel (oldmfs, so it differs from the mfs section introduced by D2903).
  • embed_mfs.sh is changed, so it looks up the oldmfs section within the kernel, gets its size and offset, sees if the MFS will fit within the allocated oldmfs section and only if all is well does a dd of the MFS image into the kernel.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Sgalabov_gmail.com retitled this revision from to Fix MFS builds when both MD_ROOT_SIZE and MFS_IMAGE are specified.
Sgalabov_gmail.com updated this object.
Sgalabov_gmail.com edited the test plan for this revision. (Show Details)
Sgalabov_gmail.com set the repository for this revision to rS FreeBSD src repository - subversion.
brooks edited edge metadata.

This looks like is will accommodate both usecases well. Thanks for working on this.

sys/conf/kern.pre.mk
199 ↗(On Diff #12766)

This seems a bit evil, but is probably as good as it gets with our current config(8).

This revision is now accepted and ready to land.Jan 28 2016, 10:45 PM
imp edited edge metadata.

looks good, modulo my comment.

sys/conf/kern.pre.mk
199 ↗(On Diff #12766)

We already have this information and don't need to grep again to get them. in config.mk we have:

KERN_OPTS!=cat ${KERNBUILDDIR}/opt*.h | awk '{print $$2;}' | sort -u

so you can check MD_ROOT_SIZE in KERN_OPTS.

But it looks like it is only included in kmod.mk. So maybe we could include it in kern.pre.mk as well and use it here? It should be MFCable too, if that's a concern.

This revision was automatically updated to reflect the committed changes.