Page MenuHomeFreeBSD

nanobsd: Add a NO_ROOT build option
AcceptedPublic

Authored by jlduran on Feb 1 2025, 4:26 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Oct 13, 11:07 AM
Unknown Object (File)
Sep 17 2025, 5:59 AM
Unknown Object (File)
Sep 15 2025, 9:24 AM
Unknown Object (File)
Sep 9 2025, 12:48 PM
Unknown Object (File)
Aug 31 2025, 2:55 AM
Unknown Object (File)
Aug 31 2025, 2:33 AM
Unknown Object (File)
Aug 25 2025, 3:40 PM
Unknown Object (File)
Aug 14 2025, 11:35 PM
Subscribers
None

Details

Reviewers
emaste
imp
Summary

Add a -U option to build NanoBSD images without root privileges. It
relies on makefs/mkimg and metalog (mtree) files, similar to what
release engineering uses to build images.

Keep the current way to build NanoBSD images untouched. Once this
method gets battle tested, it may be used to build images as root as
well.

TODO:

  • Unify a tgt_echo function that does echo and writes to the metalog?
  • Gather suggestions regarding metalog handling. Specifically debate makefs -F vs. makefs <metalog last argument>
Test Plan
  1. The default, two (almost) identical code slices:

    $ sh nanobsd.sh -U
  1. Two code slices, with the second code slice zeroed (better compression):

    $ mkdir -p ~/nanobsd/test $ echo "NANO_INIT_IMG2=0" > ~/nanobsd/test/config.nano $ sh nanobsd.sh -U -c ~/nanobsd/test/config.nano
  1. A single code slice (no ping-pong):

    $ mkdir -p ~/nanobsd/test $ echo "NANO_IMAGES=1" > ~/nanobsd/test/config.nano $ sh nanobsd.sh -U -c ~/nanobsd/test/config.nano
  1. An image with a custom media size:

    $ mkdir -p ~/nanobsd/test $ echo "NANO_MEDIASIZE=16000000" > ~/nanobsd/test/config.nano $ sh nanobsd.sh -U -c ~/nanobsd/test/config.nano

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 62204
Build 59088: arc lint + arc unit

Event Timeline

jlduran created this revision.

I think it's better if I split this commit further, to make it easier to review.

What do you think about a subsequent change to remove the non--U code, and always use the NO_ROOT mode? @imp?

What do you think about a subsequent change to remove the non--U code, and always use the NO_ROOT mode? @imp?

Love the idea

This revision is now accepted and ready to land.Apr 10 2025, 12:52 AM