I have included the minor changes I made below. The issue lies in how lower level modules will reset the processor without updating information about A/B boot success. These are surface level changes and likely do not cover all cases, but at least its a start.
bootloader/partner/common/lib/a_b_boot/tegrabl_a_b_boot_control.c :
tegrabl_error_t tegrabl_a_b_get_current_rootfs_id(void *smd, uint8_t *rootfs_id)
{
struct slot_meta_data_v2 *smd_v2;
uint8_t rootfs_select;
uint16_t version;
uint32_t bl_slot;
tegrabl_error_t error = TEGRABL_NO_ERROR;
if (rootfs_id == NULL) {
return TEGRABL_ERROR(TEGRABL_ERR_INVALID, 0);
}
if (smd == NULL) {
error = tegrabl_a_b_get_smd((void **)&smd);
if (error != TEGRABL_NO_ERROR) {
TEGRABL_SET_HIGHEST_MODULE(error);
return error;
}
}
version = tegrabl_a_b_get_version(smd);
if (BOOTCTRL_SUPPORT_ROOTFS_AB(version) == 0U) {
return TEGRABL_ERROR(TEGRABL_ERR_INVALID, 0);
}
/*
* "Unified bl&rf a/b" is supported from version
* BOOT_CHAIN_VERSION_UNIFY_RF_BL_AB. If supported and enabled,
* use bootloader active slot for rootfs.
*/
if (BOOTCTRL_IS_UNIFIED_AB_ENABLED(version)) {
error = tegrabl_a_b_get_active_slot(smd, &bl_slot);
if (error != TEGRABL_NO_ERROR) {
- return error;
+ //no valid rootfs slot found
+ return TEGRABL_ERR_NOT_FOUND;
}
*rootfs_id = (uint8_t)bl_slot;
return error;
}
smd_v2 = (struct slot_meta_data_v2 *)smd;
rootfs_select = ROOTFS_SELECT(smd_v2);
*rootfs_id = GET_ROOTFS_ACTIVE(rootfs_select);
return TEGRABL_NO_ERROR;
}
bootloader/partner/common/lib/linuxboot/fixed_boot.c :
/* Load normal kernel and kernel-dtb */
err = tegrabl_load_from_partition(kernel, boot_img_load_addr,
dtb_load_addr, kernel_dtbo,
data, data_size,
false);
if (err != TEGRABL_NO_ERROR) {
pr_error("Storage boot failed, err: %u\n", err);
#if defined(CONFIG_ENABLE_A_B_SLOT)
pr_error("A/B loader failure\n");
pr_trace("Trigger SoC reset\n");
- tegrabl_reset();
+ //tegrabl_reset();
#endif
}
fail:
#if defined(CONFIG_ENABLE_EXTLINUX_BOOT)
if (fm_handle != NULL) {
tegrabl_fm_close(fm_handle);
}
#endif
return err;
}
bootloader/partner/common/lib/linuxboot/linux_load.c :
fail:
#if defined(CONFIG_ENABLE_SECURE_BOOT)
pr_debug("%s: completing auth ...\n", __func__);
- err = tegrabl_auth_complete();
+ tegrabl_auth_complete();
#endif
tegrabl_free(kernel_dtbo);
bootloader/partner/t18x/common/lib/partitionloader/tegrabl_partition_loader.c :
tegrabl_error_t tegrabl_load_binary(
tegrabl_binary_type_t bin_type, void **load_address,
uint32_t *binary_length)
{
#if defined(CONFIG_ENABLE_A_B_SLOT)
tegrabl_error_t err;
tegrabl_binary_copy_t bin_copy = TEGRABL_BINARY_COPY_PRIMARY;
/* Do A/B selection and set bin_copy accordingly */
err = a_b_get_bin_copy(bin_type, &bin_copy);
if (err != TEGRABL_NO_ERROR) {
pr_error("A/B select failed\n");
goto done;
}
err = tegrabl_load_binary_copy(bin_type, load_address, binary_length,
bin_copy);
if (err == TEGRABL_NO_ERROR) {
goto done;
}
/*
* TODO: Add error handling such as fallover to other good slot or
* enter fastboot if no good slot is found
*/
pr_error("A/B loader failure\n");
TEGRABL_ERROR_PRINT(err);
pr_debug("Trigger soc reset\n");
- tegrabl_reset();
+ //tegrabl_reset();
#else /* !defined(CONFIG_ENABLE_A_B_SLOT) */