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

feature(v3.7.x): bootcontrol: refactor jetson-cboot, add new firmware update support #287

Merged
merged 58 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
c1e0954
backport_v3.6.x: backport PR#270
Bodong-Yang Mar 27, 2024
b037ee4
integrate new ecu_info into boot_control module
Bodong-Yang Mar 27, 2024
2e36f56
WIP: integrate into otaclient package
Bodong-Yang Mar 27, 2024
3fae358
WIP: integrate into otaclient_service and otaclient_stub
Bodong-Yang Mar 27, 2024
bd9196a
WIP: integrate into otaclient
Bodong-Yang Mar 27, 2024
508791a
otaclient.boot_control: cleanup selector
Bodong-Yang Apr 8, 2024
9b4ad0d
fix lint
Bodong-Yang Apr 9, 2024
b7ca9c3
fix more lint
Bodong-Yang Apr 9, 2024
facb0bf
otaclient, otaclient_stub: not initialize with ecu_info
Bodong-Yang Apr 9, 2024
d3a8132
ecu_proxy_info: typing refinement
Bodong-Yang Apr 9, 2024
d5932dc
cleanup unused code
Bodong-Yang Apr 9, 2024
16170cb
log_setting, otaclient_stub: minor updates
Bodong-Yang Apr 9, 2024
c08fb46
fix up tests
Bodong-Yang Apr 9, 2024
e2d0d2a
minor update
Bodong-Yang Apr 9, 2024
17301d3
minor fix
Bodong-Yang Apr 9, 2024
6c9d655
ecu_info: fix deprecation warning over default value
Bodong-Yang Apr 9, 2024
57cce6f
minor fix
Bodong-Yang Apr 10, 2024
1222869
allow logging_server field to be null in proxy_info.yaml
Bodong-Yang Apr 10, 2024
610b86b
remove old cboot firmware update
Bodong-Yang Apr 10, 2024
22bc070
refactor cboot to jetson-cboot
Bodong-Yang Apr 11, 2024
f599462
introduce jetson-cboot type
Bodong-Yang Apr 11, 2024
50498d5
jetson-cboot: finish up firmware update implementation
Bodong-Yang Apr 12, 2024
4a67961
jetson-cboot: still distinguish the bootloader slot and rootfs slot
Bodong-Yang Apr 12, 2024
0fc0133
jetson-cboot: fix bugs that prevents startup
Bodong-Yang Apr 12, 2024
2860232
bootcontrl.common: cleanup unused mixins
Bodong-Yang Apr 12, 2024
9ed4648
deps: add pydantic
Bodong-Yang Apr 12, 2024
230e9d3
jetson-cboot: fix SlotID
Bodong-Yang Apr 12, 2024
173bcec
jetson-cboot: fix mixing devpath and devname, fix using switch rootfs…
Bodong-Yang Apr 12, 2024
9c75f93
fix FirmwareBSPVersion
Bodong-Yang Apr 12, 2024
0db10d3
bootctrl.common: refine copytree_identical, allow dst not existed and…
Bodong-Yang Apr 12, 2024
789d35f
jetson-cboot: add firmware related configs
Bodong-Yang Apr 12, 2024
4fe2dff
jetson-cboot: implement FirmwareBSPVersionControl helper class
Bodong-Yang Apr 15, 2024
51c921e
jetson-cboot: integrate FirmwareBSPVersionControl helper
Bodong-Yang Apr 15, 2024
0f6833a
jetson-cboot: finalize_switch_boot now detects firmware upate result,…
Bodong-Yang Apr 15, 2024
70ca8e8
jetson-cboot: finish up
Bodong-Yang Apr 15, 2024
4523c67
jetson-cboot: fix BSPVersion.parse
Bodong-Yang Apr 15, 2024
ec43b71
implement test files for jetson-cboot
Bodong-Yang Apr 15, 2024
719b016
jetson-cboot: minor fix
Bodong-Yang Apr 15, 2024
c817403
Merge branch 'backport/v3.7.x/ecu_info_proxy_info' into feature/v3.7.…
Bodong-Yang Apr 15, 2024
7b031e0
fix BootloaderType missing JETSON_CBOOT
Bodong-Yang Apr 15, 2024
5dc30c7
jetson-cboot: minor update
Bodong-Yang Apr 15, 2024
4999711
jetson-cboot: fix get_standby_slot
Bodong-Yang Apr 16, 2024
6346e26
fix typo
Bodong-Yang Apr 17, 2024
1c3c53f
Merge branch 'v3.7.x' into feature/v3.7.x/jetson_cboot
Bodong-Yang Apr 17, 2024
91c8932
remember to mark rootfs slot as success after first reboot
Bodong-Yang Apr 17, 2024
22bdb08
squash merge refine/v3.7.x/bootctrl_cmdhelper
Bodong-Yang Apr 21, 2024
8120f5c
jetson_cboot: minor update after integrate the new CMDHelperFuncs
Bodong-Yang Apr 21, 2024
154b461
Squashed commit of the following:
Bodong-Yang Apr 21, 2024
bc0464e
squash merge refine/v3.7.x/bootctrl_cmdhelper
Bodong-Yang Apr 21, 2024
a265ed2
Merge remote-tracking branch 'origin/v3.7.x' into feature/v3.7.x/jets…
Bodong-Yang Apr 21, 2024
d816d72
common: minor fix
Bodong-Yang Apr 21, 2024
6561332
jetson-cboot: minor update
Bodong-Yang Apr 21, 2024
ae69ac5
fix lint
Bodong-Yang Apr 21, 2024
a4476c6
otaclient_stub: fix related to mount external cache storage
Bodong-Yang Apr 21, 2024
d2a2f61
otaclient_stub: fix related to mount external cache storage
Bodong-Yang Apr 22, 2024
fa52311
Squashed commit of the following:
Bodong-Yang Apr 25, 2024
6b97393
Merge remote-tracking branch 'origin/v3.7.x' into feature/v3.7.x/jets…
Bodong-Yang Apr 25, 2024
7129e79
minor docstring fix
Bodong-Yang Apr 25, 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
854 changes: 854 additions & 0 deletions otaclient/app/boot_control/_jetson_cboot.py

Large diffs are not rendered by default.

17 changes: 11 additions & 6 deletions otaclient/app/boot_control/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from __future__ import annotations
from dataclasses import dataclass, field
from typing import Dict
from typing import Dict, List

from ..configs import BaseConfig

Expand All @@ -36,20 +36,25 @@ class GrubControlConfig(BaseConfig):


@dataclass
class CBootControlConfig(BaseConfig):
"""arm platform, with cboot as bootloader.
class JetsonCBootControlConfig(BaseConfig):
"""Jetson device booted with cboot.

NOTE: only for tegraid:0x19, roscube-x platform(jetson-xavier-agx series)
Suuports BSP version < R34.
"""

BOOTLOADER: BootloaderType = BootloaderType.CBOOT
TEGRA_CHIP_ID_PATH: str = "/sys/module/tegra_fuse/parameters/tegra_chip_id"
CHIP_ID_MODEL_MAP: Dict[int, str] = field(default_factory=lambda: {0x19: "rqx_580"})
OTA_STATUS_DIR: str = "/boot/ota-status"
FIRMWARE_BSP_VERSION_FNAME: str = "firmware_bsp_version"
EXTLINUX_FILE: str = "/boot/extlinux/extlinux.conf"
SEPARATE_BOOT_MOUNT_POINT: str = "/mnt/standby_boot"
# refer to the standby slot
FIRMWARE_CONFIG: str = "/opt/ota/firmwares/firmware.yaml"
FIRMWARE_DPATH: str = "/opt/ota_package"
FIRMWARE_LIST: List[str] = field(
default_factory=lambda: ["bl_only_payload", "xusb_only_payload"]
)
NV_TEGRA_RELEASE_FPATH: str = "/etc/nv_tegra_release"


@dataclass
Expand Down Expand Up @@ -77,5 +82,5 @@ class RPIBootControlConfig(BaseConfig):


grub_cfg = GrubControlConfig()
cboot_cfg = CBootControlConfig()
cboot_cfg = JetsonCBootControlConfig()
rpi_boot_cfg = RPIBootControlConfig()
75 changes: 0 additions & 75 deletions otaclient/app/boot_control/firmware.py

This file was deleted.

7 changes: 7 additions & 0 deletions otaclient/app/boot_control/selecter.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ def get_boot_controller(
from ._grub import GrubController

return GrubController
if (
bootloader_type == BootloaderType.CBOOT
or bootloader_type == BootloaderType.JETSON_CBOOT
):
from ._jetson_cboot import JetsonCBootControl

return JetsonCBootControl
if bootloader_type == BootloaderType.RPI_BOOT:
from ._rpi_boot import RPIBootController

Expand Down
3 changes: 2 additions & 1 deletion otaclient/configs/ecu_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ class BootloaderType(str, Enum):

AUTO_DETECT = "auto_detect"
GRUB = "grub"
CBOOT = "cboot"
CBOOT = "cboot" # deprecated, use jetson-cboot instead
JETSON_CBOOT = "jetson-cboot"
RPI_BOOT = "rpi_boot"

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion otaclient/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ aiohttp==3.8.5
aiofiles==22.1.0
zstandard==0.18.0
typing_extensions==4.6.3
pydantic==2.6.4
pydantic==2.7.0
pydantic-settings==2.2.1
30 changes: 30 additions & 0 deletions tests/data/extlinux.conf-r35.4.1-template1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
MENU LABEL primary kernel
LINUX /boot/Image
INITRD /boot/initrd
FDT /boot/tegra234-orin-agx-cti-AGX201.dtb
APPEND ${cbootargs} rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 console=tty0 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb

# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
# fallback to the original kernel. To do this:
#
# 1, Make a backup of the original kernel
# sudo cp /boot/Image /boot/Image.backup
#
# 2, Copy your custom kernel into /boot/Image
#
# 3, Uncomment below menu setting lines for the original kernel
#
# 4, Reboot

# LABEL backup
# MENU LABEL backup kernel
# LINUX /boot/Image.backup
# INITRD /boot/initrd
# APPEND ${cbootargs}
30 changes: 30 additions & 0 deletions tests/data/extlinux.conf-r35.4.1-template2
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
MENU LABEL primary kernel
LINUX /boot/Image
INITRD /boot/initrd
FDT /boot/tegra234-orin-agx-cti-AGX201.dtb
APPEND ${cbootargs} root=PARTUUID= rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 console=tty0 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb

# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
# fallback to the original kernel. To do this:
#
# 1, Make a backup of the original kernel
# sudo cp /boot/Image /boot/Image.backup
#
# 2, Copy your custom kernel into /boot/Image
#
# 3, Uncomment below menu setting lines for the original kernel
#
# 4, Reboot

# LABEL backup
# MENU LABEL backup kernel
# LINUX /boot/Image.backup
# INITRD /boot/initrd
# APPEND ${cbootargs}
30 changes: 30 additions & 0 deletions tests/data/extlinux.conf-r35.4.1-updated1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
MENU LABEL primary kernel
LINUX /boot/Image
INITRD /boot/initrd
FDT /boot/tegra234-orin-agx-cti-AGX201.dtb
APPEND ${cbootargs} rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 console=tty0 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb root=PARTUUID=11aa-bbcc-22dd

# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
# fallback to the original kernel. To do this:
#
# 1, Make a backup of the original kernel
# sudo cp /boot/Image /boot/Image.backup
#
# 2, Copy your custom kernel into /boot/Image
#
# 3, Uncomment below menu setting lines for the original kernel
#
# 4, Reboot

# LABEL backup
# MENU LABEL backup kernel
# LINUX /boot/Image.backup
# INITRD /boot/initrd
# APPEND ${cbootargs}
30 changes: 30 additions & 0 deletions tests/data/extlinux.conf-r35.4.1-updated2
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
TIMEOUT 30
DEFAULT primary

MENU TITLE L4T boot options

LABEL primary
MENU LABEL primary kernel
LINUX /boot/Image
INITRD /boot/initrd
FDT /boot/tegra234-orin-agx-cti-AGX201.dtb
APPEND ${cbootargs} root=PARTUUID=11aa-bbcc-22dd rw rootwait rootfstype=ext4 mminit_loglevel=4 console=ttyTCU0,115200 console=ttyAMA0,115200 console=tty0 firmware_class.path=/etc/firmware fbcon=map:0 net.ifnames=0 nospectre_bhb

# When testing a custom kernel, it is recommended that you create a backup of
# the original kernel and add a new entry to this file so that the device can
# fallback to the original kernel. To do this:
#
# 1, Make a backup of the original kernel
# sudo cp /boot/Image /boot/Image.backup
#
# 2, Copy your custom kernel into /boot/Image
#
# 3, Uncomment below menu setting lines for the original kernel
#
# 4, Reboot

# LABEL backup
# MENU LABEL backup kernel
# LINUX /boot/Image.backup
# INITRD /boot/initrd
# APPEND ${cbootargs}
57 changes: 0 additions & 57 deletions tests/test_boot_control/test_firmware.py

This file was deleted.

Loading
Loading