buildroot: make mounting /boot optional
Currently, we take to paths from the root file system supplied to the `BuildRoot` class: `/boot` and `/usr`. The reason for mounting `/boot` is that grub2 and shim install efi binaries there and for certain images we want to copy the binaries from the build root and not install the respective packages. However, if we build to build root itself, we probably don't want the mount the hosts' `/boot` since we don't want to copy anything from there. This change should give us the ability to do exactly that.
This commit is contained in:
parent
d8a8dc84d6
commit
ccb26806fc
1 changed files with 6 additions and 1 deletions
|
|
@ -69,6 +69,7 @@ class BuildRoot(contextlib.AbstractContextManager):
|
|||
self._apis = []
|
||||
self.dev = None
|
||||
self.var = None
|
||||
self.mount_boot = True
|
||||
|
||||
@staticmethod
|
||||
def _mknod(path, name, mode, major, minor):
|
||||
|
|
@ -154,7 +155,11 @@ class BuildRoot(contextlib.AbstractContextManager):
|
|||
mounts = []
|
||||
|
||||
# Import directories from the caller-provided root.
|
||||
for p in ["boot", "usr"]:
|
||||
imports = ["usr"]
|
||||
if self.mount_boot:
|
||||
imports.insert(0, "boot")
|
||||
|
||||
for p in imports:
|
||||
source = os.path.join(self._rootdir, p)
|
||||
if os.path.isdir(source) and not os.path.islink(source):
|
||||
mounts += ["--ro-bind", source, os.path.join("/", p)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue