Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rpi_boot: use chroot to run flash-kernel, ditch double reboot strategy #318

Merged
merged 29 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
6ca02f6
utils.linux: implement subprocess_run_wrapper with optional chroot
Bodong-Yang Jun 3, 2024
2a7f3cd
rpi_boot: add helpers for boot files fpath generation
Bodong-Yang Jun 3, 2024
b1ab6d2
rpi_boot: use new get_boot_files_fpath
Bodong-Yang Jun 3, 2024
7091005
utils.linux: subprocess_run_wrapper now supports passing envs
Bodong-Yang Jun 3, 2024
386dffb
rpiboot: switch to use chroot to flash-kernel
Bodong-Yang Jun 3, 2024
f3dfe32
refine rpi_boot
Bodong-Yang Jun 3, 2024
bf93eea
keep backward compatible
Bodong-Yang Jun 3, 2024
6d3968d
rpi_boot: cleanup .bak files on success
Bodong-Yang Jun 3, 2024
a96a816
rpi_boot: update_firmware installs the kernel and initrd.img for us
Bodong-Yang Jun 3, 2024
865dbff
fix up rpi_boot test
Bodong-Yang Jun 3, 2024
0f77b06
Merge remote-tracking branch 'origin/main' into refactor/rpi_faster
Bodong-Yang Jun 10, 2024
a434d25
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 10, 2024
09e3aa0
otaclient_common.common now uses suprocess_run_wrapper from otaclient…
Bodong-Yang Jun 10, 2024
912bea5
also mount /sys
Bodong-Yang Jun 10, 2024
93b6859
rpi_boot: minor fix
Bodong-Yang Jun 17, 2024
24900cb
rpi_boot: flash-kernel uses absolute path
Bodong-Yang Jun 17, 2024
bb6f86e
rpi_boot: fix flag file location
Bodong-Yang Jun 17, 2024
f6be2aa
Squashed commit of the following:
Bodong-Yang Jun 17, 2024
ac35f65
Merge branch 'main' into refactor/rpi_faster
Bodong-Yang Jun 18, 2024
6fbb2cd
Merge remote-tracking branch 'origin/main' into refactor/rpi_faster
Bodong-Yang Jun 19, 2024
8f8d8eb
rpi_boot: hide the flag_file things to _RPIBootControl
Bodong-Yang Jun 19, 2024
0bfee43
fix up test
Bodong-Yang Jun 19, 2024
737ab58
rpi_boot: if system-boot partition is not mounted, try to mount it by…
Bodong-Yang Jun 19, 2024
8560a08
minor cleanup
Bodong-Yang Jun 19, 2024
41e80fc
rpi_boot: add back the sanity check, ensure we are running on raspber…
Bodong-Yang Jun 19, 2024
0ba07f3
update test_rpi_boot accordingly
Bodong-Yang Jun 19, 2024
14caa8a
rpi_boot: fix system-boot mount
Bodong-Yang Jun 19, 2024
b149289
boot_control.common: add a plain version of mount
Bodong-Yang Jun 19, 2024
81cc143
rpi_boot: use mount from CMDHelperFuncs
Bodong-Yang Jun 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/otaclient/app/boot_control/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
subprocess_check_output,
write_str_to_file_sync,
)
from otaclient_common.typing import StrOrPath

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -234,6 +235,36 @@ def set_ext4_fslabel(cls, dev: str, fslabel: str, *, raise_exception: bool = Tru
cmd = ["e2label", dev, fslabel]
subprocess_call(cmd, raise_exception=raise_exception)

@classmethod
def mount(
cls,
target: StrOrPath,
mount_point: StrOrPath,
*,
options: list[str] | None = None,
params: list[str] | None = None,
raise_exception: bool = True,
) -> None:
"""Thin wrapper to call mount using subprocess.

This will call the following:
mount [-o <option1>,[<option2>[,...]] [<param1> [<param2>[...]]] <target> <mount_point>

Args:
target (StrOrPath): The target device to mount.
mount_point (StrOrPath): The mount point to mount to.
options (list[str] | None, optional): A list of options, append after -o. Defaults to None.
params (list[str] | None, optional): A list of params. Defaults to None.
raise_exception (bool, optional): Whether to raise exception on failed call. Defaults to True.
"""
cmd = ["mount"]
if options:
cmd.extend(["-o", ",".join(options)])
if params:
cmd.extend(params)
cmd = [*cmd, str(target), str(mount_point)]
subprocess_call(cmd, raise_exception=raise_exception)

@classmethod
def mount_rw(
cls, target: str, mount_point: Path | str, *, raise_exception: bool = True
Expand Down
Loading
Loading