madisongh / test-distro

My old test distro setup
MIT License
5 stars 9 forks source link

Conditions for eks partition update from runtime? #6

Closed kekiefer closed 4 years ago

kekiefer commented 4 years ago

I'm seeing the below problem writing the eks partition with the changes introduced by 6bacf2664c50ccd17556b772d97c414235f4d90e. When would this be expected to work? I don't have secureboot enabled, and I wonder if that has something to do with the failure.

root@jetson-tx2:~# nv_update_engine -i
Nvidia A/B-Redundancy Update tool Version 1.2
A/B has been disabled. Need to enable A/B.
root@jetson-tx2:~# nv_update_engine -e
Nvidia A/B-Redundancy Update tool Version 1.2
enabling A/B redundancy
A/B Redundancy has been enabled.
root@jetson-tx2:~# nv_update_engine -i
Nvidia A/B-Redundancy Update tool Version 1.2
current slot 0
Start updating slot 1
Tegra User Block Device: /dev/disk/by-partlabel
Tegra Boot Block Device: /dev/mmcblk0boot0
HEADER: MAGIC NVIDIA__BLOB__V2
HEX_VALUE 131072
BLOB_SIZE 50493333
HEADER_SIZE 48
NUMBER_OF_ELEMENTS 45
HEADER_TYPE 0
UNCOMP_SIZE 50493333
MB1_RATCHET_LV 0
MTS_RATCHET_LV 0
ROLLBACK_FUSE_LV 0
config COMPATIBLE_SPEC not found in /etc/nv_boot_control.conf
Device TN Spec: 3310-D00-1000-F.0-1-0-jetson-tx2-mmcblk0p1
config COMPATIBLE_SPEC not found in /etc/nv_boot_control.conf
Device TN Spec: 3310-D00-1000-F.0-1-0-jetson-tx2-mmcblk0p1
Device is fused board.
ENTRY_TABLE:
PART  POS  LEN  VER TNSPEC TYPE UPDATABLE
bpmp-fw  5448  533904  2    1  1
sce-fw  539352  125568  2    1  1
cpu-bootloader  664920  284688  2    1  1
mb2  949608  116832  2    0  1
spe-fw  1066440  95984  2    0  1
secure-os  1162424  249968  2    1  1
adsp-fw  1412392  108208  2    1  1
dram-ecc-fw  1520600  52368  2    0  1
badpage-fw  1572968  4496  2    0  1
eks  1577464  1440  2    1  1
mb1  1578904  99664  2    2  1
mts-bootpack  1678568  2082144  2    1  1
mts-preboot  3760712  63104  2    0  1
sc7  3823816  23632  2    1  1
bpmp-fw-dtb  3847448  605120  2  3310-B00-1000--1-0-jetson-tx2-mmcblk0p1  1  0
bpmp-fw-dtb  4452568  605120  2  3310-B02-1000--1-0-jetson-tx2-mmcblk0p1  1  0
bpmp-fw-dtb  5057688  605120  2  3310-C04-1000--1-0-jetson-tx2-mmcblk0p1  1  0
bpmp-fw-dtb  5662808  605120  2  3310-D00-1000--1-0-jetson-tx2-mmcblk0p1  1  1
bpmp-fw-dtb  6267928  605120  2  3310-D01-1000--1-0-jetson-tx2-mmcblk0p1  1  0
bootloader-dtb  6873048  371808  2  3310-B00-1000--1-0-jetson-tx2-mmcblk0p1  1  0
bootloader-dtb  7244856  371808  2  3310-B02-1000--1-0-jetson-tx2-mmcblk0p1  1  0
bootloader-dtb  7616664  371808  2  3310-C04-1000--1-0-jetson-tx2-mmcblk0p1  1  0
bootloader-dtb  7988472  371808  2  3310-D00-1000--1-0-jetson-tx2-mmcblk0p1  1  1
bootloader-dtb  8360280  371808  2  3310-D01-1000--1-0-jetson-tx2-mmcblk0p1  1  0
VER  8732088  102  2  3310-B00-1000--1-0-jetson-tx2-mmcblk0p1  0  0
VER  8732190  102  2  3310-B02-1000--1-0-jetson-tx2-mmcblk0p1  0  0
VER  8732292  102  2  3310-C04-1000--1-0-jetson-tx2-mmcblk0p1  0  0
VER  8732394  102  2  3310-D00-1000--1-0-jetson-tx2-mmcblk0p1  0  1
VER  8732496  101  2  3310-D01-1000--1-0-jetson-tx2-mmcblk0p1  0  0
BCT  8732597  3584  2  3310-B00-1000--1-0-jetson-tx2-mmcblk0p1  2  0
BCT  8736181  3584  2  3310-B02-1000--1-0-jetson-tx2-mmcblk0p1  2  0
BCT  8739765  3584  2  3310-C04-1000--1-0-jetson-tx2-mmcblk0p1  2  0
BCT  8743349  3584  2  3310-D00-1000--1-0-jetson-tx2-mmcblk0p1  2  1
BCT  8746933  3584  2  3310-D01-1000--1-0-jetson-tx2-mmcblk0p1  2  0
MB1_BCT  8750517  50096  2  3310-B00-1000--1-0-jetson-tx2-mmcblk0p1  0  0
MB1_BCT  8800613  50096  2  3310-B02-1000--1-0-jetson-tx2-mmcblk0p1  0  0
MB1_BCT  8850709  50096  2  3310-C04-1000--1-0-jetson-tx2-mmcblk0p1  0  0
MB1_BCT  8900805  50096  2  3310-D00-1000--1-0-jetson-tx2-mmcblk0p1  0  1
MB1_BCT  8950901  50096  2  3310-D01-1000--1-0-jetson-tx2-mmcblk0p1  0  0
kernel  9000997  39633296  2    1  1
kernel-dtb  48634293  371808  2  3310-B00-1000--1-0-jetson-tx2-mmcblk0p1  1  0
kernel-dtb  49006101  371808  2  3310-B02-1000--1-0-jetson-tx2-mmcblk0p1  1  0
kernel-dtb  49377909  371808  2  3310-C04-1000--1-0-jetson-tx2-mmcblk0p1  1  0
kernel-dtb  49749717  371808  2  3310-D00-1000--1-0-jetson-tx2-mmcblk0p1  1  1
kernel-dtb  50121525  371808  2  3310-D01-1000--1-0-jetson-tx2-mmcblk0p1  1  0
Saving Entry table to /opt/ota_package/entry_table
Writing 533904 bytes to /dev/disk/by-partlabel/bpmp-fw_b for bpmp-fw
Writing 125568 bytes to /dev/disk/by-partlabel/sce-fw_b for sce-fw
Writing 284688 bytes to /dev/disk/by-partlabel/cpu-bootloader_b for cpu-bootloader
mb2 write: slot = 1 offset = 1276928 bytes = 116832
spe-fw write: slot = 1 offset = 883712 bytes = 95984
Writing 249968 bytes to /dev/disk/by-partlabel/secure-os_b for secure-os
Writing 108208 bytes to /dev/disk/by-partlabel/adsp-fw_b for adsp-fw
dram-ecc-fw write: slot = 1 offset = 0 bytes = 52368
badpage-fw write: slot = 1 offset = 748032 bytes = 4496
Slot could not be opened eks
eks fail to write 
Writing to partitions failed.
OTA Blob update failed. Status: 5
/usr/sbin/nv_bootloader_payload_updater --no-dependent-partition failed.
Slot 1 update failed
madisongh commented 4 years ago

There should still be an eks partition even if you don't have secure boot enabled. You can find out more about why it's having trouble locating the partition using strace (see here).

I made the addition of the other partitions in 6bacf2664c50ccd17556b772d97c414235f4d90e to test the ability of completely reformatting and repopulating the entire eMMC in the installer image I'm using for the secureboot-enabled TX2. IIRC I ran into this same issue using nv_update_engine, so I switched to using my own tegra-bootloader-update tool for updates as well as the initial installation. There's probably a better solution that doesn't involve making changes to the BUP payloads that nv_update_engine can't handle.

(updated to add) Now I remember... nv_update_engine doesn't handle having blobs in the BUP payload for non-redundant partitions.

kekiefer commented 4 years ago

Thanks, that explains it. This turns off my big flashing red light for not being able to rewrite the flash during updates in the inevitable case NVIDIA decide to change up the entire flash layout in L4T (again).

I think it makes sense to put the tegra-boot-tools in meta-tegra, for the same reasons we moved tegra-bup-payload. I'd also like to be able to use tegra-bootinfo for other update mechanisms in the way it is used in testdistro.

As I'm looking at tegra-bootinfo, I'm also thinking the bootcountcheck service and the initrd-setup that calls it might be nice as well, to avoid duplicating all that, but that's starting to feel a little bit too specialized.

madisongh commented 4 years ago

This turns off my big flashing red light for not being able to rewrite the flash during updates in the inevitable case NVIDIA decide to change up the entire flash layout in L4T (again).

Yeah, this is tricky. I'm not sure I have it working for all cases... I did come up with an OTA upgrader to handle an update from R32.2.x to R32.3.1, and a slightly different method to handle my slightly-off R32.3.1 flash layout updating to the correct layout (which also works with R32.4.2) that didn't require a complete reformat of the flash. But the bootloader is very finicky in ways I'm not sure I fully understand yet.

I think it makes sense to put the tegra-boot-tools in meta-tegra

I'm open to this. The tools there could use some additional sprucing up in the code and the documentation, though.

kekiefer commented 4 years ago

Thanks for the input. I'll spend a little more time with tegra-boot-tools and send over any PRs that make sense.