Files
BPI-CM9-Linux/aml-comp/vendor/amlogic/provision/tool/t5d/pfid_derive.py
T
2026-08-24 10:03:24 +08:00

47 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python3
#
# Copyright (C) 2021 Amlogic, Inc. All rights reserved.
#
# This source code is subject to the terms and conditions defined in the
# file 'LICENSE' which is part of this source code package.
import sys
import random
sys.dont_write_bytecode = True
import soc
TARGET_NAME = 'pfid'
SCRIPT_PATH = sys.path[0] + '/../dependents/pfid_derive.py'
def get_args():
from argparse import ArgumentParser
parser = ArgumentParser()
parser.add_argument('--count', type = int, required = True, help = 'device count')
parser.add_argument('--counter_base', type = int, default = random.randint(0, 10000), help = 'base of the first PFID')
parser.add_argument('--model_id', type = int, default = random.randint(0x1, 0xFFFF), help = 'model id')
parser.add_argument('--sub_id', type = int, default = random.randint(0x1, 0xFFFF), help = 'sub id')
parser.add_argument('--out_dir', type = str, default = './' + soc.SOC + '-' + TARGET_NAME + '/', help = 'output directory')
return parser.parse_args()
def main():
import os
import sys
import subprocess
args = get_args()
cmd = [sys.executable, SCRIPT_PATH]
cmd.extend(['--soc=' + soc.SOC])
cmd.extend(['--model_id=' + str(args.model_id)])
cmd.extend(['--sub_id=' + str(args.sub_id)])
cmd.extend(['--counter_base=' + str(args.counter_base)])
cmd.extend(['--count=' + str(args.count)])
cmd.extend(['--out_dir=' + args.out_dir])
sub = subprocess.Popen(cmd)
sub.communicate()
if __name__ == '__main__':
main()