Skip to content

build: order the mount tools before bootfs for fs=ramfs - #1496

Open
gburd wants to merge 1 commit into
cloudius-systems:masterfrom
gburd:pr/ramfs-bootfs-tools-dep
Open

gburd wants to merge 1 commit into
cloudius-systems:masterfrom
gburd:pr/ramfs-bootfs-tools-dep

Conversation

@gburd

@gburd gburd commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Building a fresh tree with fs=ramfs fails during MKBOOTFS:

strip: 'tools/mount/mount-fs.so': No such file
FileNotFoundError: [Errno 2] No such file or directory: 'tools/mount/mount-fs.so'
make: *** [Makefile:2238: build/release.x64/bootfs.bin] Error 1

Cause

For fs=ramfs, scripts/build uses the generated $(out)/usr.manifest as the bootfs manifest, and that manifest is generated from usr_ramfs.manifest.skel, which names two tools:

/tools/mount-fs.so: tools/mount/mount-fs.so
/tools/umount.so: tools/mount/umount.so

bootfs_dep, however, only gains the tools for fs=ext and fs=zfs:

bootfs_dep := scripts/mkbootfs.py $(bootfs_manifest) $(bootfs_manifest_dep) $(out)/libenviron.so
ifeq ($(fs),ext)
bootfs_dep += $(out)/modules/libext/libext.so
else
ifeq ($(fs),zfs)
bootfs_dep += $(tools:%=$(out)/%) $(out)/libsolaris.so
endif
endif

So for fs=ramfs nothing orders those two objects before bootfs.bin, and mkbootfs.py stats a file make was never told to build first.

It is timing dependent, which is why it is not always visible: in a tree that already built something else the tools may happen to be present. In a clean clone it fails every time, because bootfs.bin is reached before anything else has a reason to build the mount tools.

Fix

Add just those two objects to bootfs_dep for fs=ramfs. Only the files the ramfs manifest actually names are added, rather than all of $(tools), so a ramfs build does not start pulling in mkfs/cpiod/uush, which it never references.

Verification

I checked this against a clean clone of this repository's master rather than only against my own tree, since that is where it reproduces most clearly:

build result
clean clone, fs=ramfs, without this change fails at MKBOOTFS (FileNotFoundError)
clean clone, fs=ramfs, with this change completes, image produced

I also re-ran the default (zfs) and fs=rofs builds with the change applied and both still complete, so the added dependency does not disturb the other filesystem paths.

Note this is a distinct problem from the bootfs ZFS-library dependency in #1494: that one is about libsolaris.so and the ZFS tools for a ZFS-enabled build, while this is the ramfs manifest's own two mount tools going unordered.

Building a fresh tree with fs=ramfs fails during MKBOOTFS:

  strip: 'tools/mount/mount-fs.so': No such file
  FileNotFoundError: [Errno 2] No such file or directory:
      'tools/mount/mount-fs.so'
  make: *** [Makefile:2238: build/release.x64/bootfs.bin] Error 1

For fs=ramfs, scripts/build uses the generated $(out)/usr.manifest as the
bootfs manifest, and that manifest comes from usr_ramfs.manifest.skel, which
lists two tools:

  /tools/mount-fs.so: tools/mount/mount-fs.so
  /tools/umount.so: tools/mount/umount.so

But bootfs_dep only gains the tools for fs=ext and fs=zfs, so for fs=ramfs
nothing orders those two objects before bootfs.bin. mkbootfs.py then stats a
file that make was never told to build first and aborts.

This is timing dependent, which is why it is not always seen: in a tree that
already built something else the tools may happen to exist. In a clean clone
it fails every time, because bootfs.bin is reached before anything else has a
reason to build the mount tools.

Add just those two objects to bootfs_dep for fs=ramfs. Only the files the
ramfs manifest actually names are added, rather than all of $(tools), to keep
the dependency minimal and avoid pulling mkfs/cpiod/uush into a ramfs build
that does not reference them.

Verified on a clean clone of upstream master, which is where this reproduces
most clearly:

  fresh clone, fs=ramfs, without this change: build fails at MKBOOTFS
  fresh clone, fs=ramfs, with this change:    build completes, image produced

and re-checked that the default (zfs) and fs=rofs builds still complete, so
the added dependency does not disturb the other filesystem paths.

Signed-off-by: Greg Burd <greg@burd.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant