Page MenuHomeFreeBSD

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

Authored by imp on Jul 7 2021, 9:59 PM.
Tags
None
Referenced Files
Unknown Object (File)
Oct 1 2024, 10:16 PM
Unknown Object (File)
Oct 1 2024, 4:25 AM
Unknown Object (File)
Sep 30 2024, 5:07 PM
Unknown Object (File)
Sep 29 2024, 4:05 PM
Unknown Object (File)
Sep 28 2024, 1:53 PM
Unknown Object (File)
Sep 23 2024, 1:45 PM
Unknown Object (File)
Sep 23 2024, 1:45 AM
Unknown Object (File)
Sep 22 2024, 3:57 AM

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
rG FreeBSD src repository
Lint
Lint Not Applicable
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
165

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
105

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
165

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

tools/tools/nanobsd/legacy.sh
105

Yes. That's needed.

184

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.