/*
 * Copyright 2025 Sony Corporation
 */

#include <string.h>
#include <common.h>
#include <utility.h>
#include <debug_impl.h>

int sony_frp_init(void)
{
	int ret = -1;
	unsigned int device = 0;
	char storage_info[STORAGE_INDEX_BUF_SIZE] = { 0 };
	static const char frp_key[] = "androidboot.vendor.extended_core.sony.frp.pst";
	static char frp_value[] = "androidboot.vendor.extended_core.sony.frp.pst=/dev/block/by-name/frp";

	ret = sys_get_storage_info(device, "frp", storage_info);
	if (ret < 0) {
		printf("frp partition not found.\n");
		return 0;
	}

	ret = add_bootargs((char *)frp_key, frp_value, 0);
	if (ret != 0) {
		UBOOT_ERROR("failed to add bootargs %s.\n", frp_value);
	}

	return ret;
}

