mirror of
https://github.com/BigfootACA/arch-image-builder.git
synced 2024-11-11 07:57:53 +08:00
builder: disk: filesystem: build.py: remove unnecessary rootflags in kernel cmdline
Signed-off-by: BigfootACA <bigfoot@classfun.cn>
This commit is contained in:
parent
97bcdf7379
commit
0fa8d98e58
@ -19,6 +19,11 @@ class FileSystemBuilder(ImageContentBuilder):
|
|||||||
|
|
||||||
def proc_cmdline_root(self, cfg: dict, mnt: MountPoint):
|
def proc_cmdline_root(self, cfg: dict, mnt: MountPoint):
|
||||||
ccfg = self.builder.ctx.config_orig
|
ccfg = self.builder.ctx.config_orig
|
||||||
|
mnt.remove_option("ro")
|
||||||
|
mnt.remove_option("rw")
|
||||||
|
for opt in mnt.option:
|
||||||
|
if opt.startswith("x-"):
|
||||||
|
mnt.option.remove(opt)
|
||||||
if "kernel" not in ccfg: ccfg["kernel"] = {}
|
if "kernel" not in ccfg: ccfg["kernel"] = {}
|
||||||
kern = ccfg["kernel"]
|
kern = ccfg["kernel"]
|
||||||
if "cmdline" not in kern: kern["cmdline"] = []
|
if "cmdline" not in kern: kern["cmdline"] = []
|
||||||
@ -27,12 +32,16 @@ class FileSystemBuilder(ImageContentBuilder):
|
|||||||
raise ArchBuilderConfigError("root already set in cmdline")
|
raise ArchBuilderConfigError("root already set in cmdline")
|
||||||
if mnt.target != "/":
|
if mnt.target != "/":
|
||||||
log.warning(f"root target is not / ({mnt.target})")
|
log.warning(f"root target is not / ({mnt.target})")
|
||||||
|
if not mnt.source.startswith("/") and "=" not in mnt.source:
|
||||||
|
log.warning(f"bad root source ({mnt.source})")
|
||||||
ecmds = [
|
ecmds = [
|
||||||
"ro", "rootwait",
|
"ro", "rootwait",
|
||||||
f"root={mnt.source}",
|
f"root={mnt.source}",
|
||||||
f"rootfstype={mnt.fstype}",
|
|
||||||
f"rootflags={mnt.options}",
|
|
||||||
]
|
]
|
||||||
|
if mnt.fstype != "none":
|
||||||
|
ecmds.append(f"rootfstype={mnt.fstype}")
|
||||||
|
if len(mnt.option) > 0:
|
||||||
|
ecmds.append(f"rootflags={mnt.options}")
|
||||||
scmds = " ".join(ecmds)
|
scmds = " ".join(ecmds)
|
||||||
log.debug(f"add root cmdline {scmds}")
|
log.debug(f"add root cmdline {scmds}")
|
||||||
cmds.extend(ecmds)
|
cmds.extend(ecmds)
|
||||||
@ -113,7 +122,7 @@ class FileSystemBuilder(ImageContentBuilder):
|
|||||||
self.builder.ctx.fstab.append(mnt)
|
self.builder.ctx.fstab.append(mnt)
|
||||||
self.builder.ctx.fsmap[mnt.source] = self.builder.device
|
self.builder.ctx.fsmap[mnt.source] = self.builder.device
|
||||||
if "boot" in fstab and fstab["boot"]:
|
if "boot" in fstab and fstab["boot"]:
|
||||||
self.proc_cmdline_root(cfg, mnt)
|
self.proc_cmdline_root(cfg, mnt.clone())
|
||||||
|
|
||||||
def format(self, fstype: str):
|
def format(self, fstype: str):
|
||||||
from builder.disk.filesystem.creator import FileSystemCreators
|
from builder.disk.filesystem.creator import FileSystemCreators
|
||||||
|
Loading…
Reference in New Issue
Block a user