Page MenuHomeFreeBSD

nanobsd: Use gpart and create code image before full disk image
ClosedPublic

Authored by imp on Jul 7 2021, 9:59 PM.

Details

Summary

The attached patch brings two main changes to the nanobsd script:
1- gpart is used instead of fdisk;
2- the code image is created first, and then used to ``assemble'' the

full disk image.

The patch was first proposed on the freebsd-embedded list:
http://lists.freebsd.org/pipermail/freebsd-embedded/2012-June/001580.html
and is currently under discussion:
http://lists.freebsd.org/pipermail/freebsd-embedded/2014-January/002216.html

Another effect is that the -f option ("suppress code slice extraction")
now imples the -i option ("suppress disk image build").

Patch hand applied to new since stable/11 legacy.sh by imp@

Test Plan

Note: This needs to be tested. I wanted to get the forward-ported patch into someplace public.

Diff Detail

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

Event Timeline

imp requested review of this revision.Jul 7 2021, 9:59 PM
imp created this revision.
imp added a reviewer: phk.
tools/tools/nanobsd/defaults.sh
164

Don't know if it makes sense to derive them from NANO_ROOT/NANO_ALTROOT and NANO_SLICE_ROOT/NANO_SLICE_ALTROOT to prevent foot-shootings:

NANO_PARTITION_ROOT="${NANO_ROOT##$NANO_SLICE_ROOT}"
NANO_PARTITION_ALTROOT="${NANO_ALTROOT##$NANO_SLICE_ALTROOT}"
tools/tools/nanobsd/legacy.sh
104

I have tested this change building an "embedded" aarch64 NanoBSD image. As the first email warns, this breaks when building the code slice: dd: no value specified for seek, I had to use NANO_LOG instead of NANO_OBJ here.

imp marked an inline comment as done.Jul 8 2021, 2:57 AM
imp added inline comments.
tools/tools/nanobsd/defaults.sh
164

I don't think this makes sense because these variables are set later and also set in config files.

tools/tools/nanobsd/legacy.sh
104

Yes. That's needed.

183

And this should be NANO_LOG too.

Hello all,

I would be glad to help if I could, but I only have access to stable/11 systems at the moment and I cannot apply @imp 's patch because there is no file legacy.sh

I am also totally new to Phabricator, so please be patient ;-)

Feel free to contact me if you think I can be of any help.

imp marked an inline comment as done.Jul 8 2021, 3:52 PM

I would be glad to help if I could, but I only have access to stable/11 systems at the moment and I cannot apply @imp 's patch because there is no file legacy.sh

Yes. I split that out after stable/11 branch. The original bug has older patches.

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=186030

I didn't really change it much, other than what was noted here.

This revision was not accepted when it landed; it landed in state Needs Review.Jul 15 2021, 10:16 PM
This revision was automatically updated to reflect the committed changes.