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, Dec 22, 11:15 PM
Unknown Object (File)
Sun, Nov 30, 11:19 AM
Unknown Object (File)
Fri, Nov 28, 6:32 PM
Unknown Object (File)
Nov 25 2025, 7:53 PM
Unknown Object (File)
Nov 10 2025, 9:04 AM
Unknown Object (File)
Oct 29 2025, 4:00 AM
Unknown Object (File)
Oct 27 2025, 8:26 PM
Unknown Object (File)
Oct 26 2025, 1:52 AM
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