Limits:
	> tested host pc: ubuntu 14/16/18 with 64bit, 32bits Linux UNSUPPORTED
	> see ${tool_dir}/templates for supported projects/soc

1, Create 'DV SCS related keys'
	U need follow <<Amlogic XXXX Device Vendor SCS Signing Process User Guide>>
    e.g. ./stool/s4/generate-device-keys/gen_all_device_key.sh --key-dir tmp/s4_dv_scs_keys \
            --rsa-size 4096 --project s905y4 --rootkey-index 0 \
            --template-dir templates/s4 --out-dir tmp/s4_device_keys
	

2. Generate pattern.efuse(SECURE_BOOT_SET)
	U need follow <<Amlogic XXXX Device Vendor SCS Signing Process User Guide>>
	at charpter Device SCS efuse pattern generation
    >> Strong Strong Recommand Combine all the efuse-gen.sh commands and generate only one efuse pattern
     e.g. ./stool/t3/bin/efuse-gen.sh --input stool/t3/bin/device.license.bin  \
         --dvgk xx/dv_scs_keys/root/dvgk/t982/dvgk.bin \
         --device-roothash xx/dv_scs_keys/root/rsa/t982/roothash/hash-device-rootcert.bin \
         --dvuk xx/dv_scs_keys/root/dvuk/t982/dvuk.bin \
         --enable-usb-password true \
         --enable-dvuk-derive-with-cid true \
         ... \
         -o t982.all_functions.efuse

3, Android related keys
   3 .1 AVB KEY
        For Sign/Encrypt Android P image, If your sdk enable AVB(Android Verified Boot) function, your need prepare AVB key
        For Amlogic Reference Configure, the AVB key is located in this path
        [ device/amlogic/common/security/testkey_rsa2048.pem ]

   3 .1 OTA re-sign key (prepare follow 2 keys from android and saved in a folder)
        build/target/product/security/testkey.pk8
        build/target/product/security/testkey.x509.pem
        ----For release key, use the releasekey.pk8 and releasekey.x509.pem

4, Sample Commands to sign upgrade packagbe
    
	Note: a> Follow commands are sample only, need replace file path to yours
		  b> sc2_ah212-u-boot.aml.zip is located in path $AmlogicAndroidSdkRoot/bootloader/uboot-repo/build
		  c> You don't only need specify --fw_arb_cfg only when your Amlogic soc doesn't enable anti-rollback
		  	 You DO need specify --fw_arb_cfg even your anti-rollback value not changed if arb enabled
          d> check which projects supported
		$ tree templates/ -L 2
			templates/
			├── LICENSE.TXT
			├── a5
			│   └── a113x2
			├── p1
			│   ├── azp1
			│   └── azp1eng
			├── s4
			│   ├── s805c3
			│   ├── s805x2
			│   ├── s805x2g
				....
		Above> a5/p1/s4.. in Level 1 of tree command is soc family, and 
			a113x2/azp1/.. in Level 2 of tree command is project name which used in this tool.

	4.0 Need re-create device-keys for code sigining if your update arb configure value
		Follow the <<Amlogic XXX Firmware Anti-rollback User Guide>>
			4.2 Resign Template File With Anti-rollback Versions
			./stool/sc2/generate-device-keys/export_signing_keys_and_sign_template.sh \
			--rootkey-index 0 --project s905x4 \
			--template-dir  templates/sc2 \
			--key-dir ../keys/xxxx/dv_scs_keys --arb-config ../keys/sc2_ah212/fw_arb.cfg \
			--out-dir ../keys/sc2_ah212/device-keys 
		
	4.1> Input normal/unsigned aml_upgrade_package.img, output signed img for usb burning tool
        bash amlogic_scs_sign_whole_pkg.bash --soc s905x4 \
                --aml_key xxxx/bl33/v2019/board/amlogic/sc2_ah212/device-keys \
				--fw_arb_cfg xxx/bl33/v2019/board/amlogic/sc2_ah212/fw_arb.cfg \
				--aml_img xxx/sc2_ah212/.../aml_upgrade_package.img \
				--bootloader_zip xxx/sc2_ah212/xxx/sc2_ah212-u-boot.aml.zip \
				--output xxx/sc2_ah212/xxx/sc2.scs_and_arb.signed.img

	4.2, Input normal/unsigned  OTA zip , output signed ota for Android upgrade
		 bash amlogic_scs_sign_whole_pkg.bash --soc s905x4 \
		 --aml_key xxxx/bl33/v2019/board/amlogic/sc2_ah212/device-keys \
		 --fw_arb_cfg xxx/bl33/v2019/board/amlogic/sc2_ah212/fw_arb.cfg \
		 --ota_zip xxx/sc2_ah212/xxx/ohm-ota-20210127.zip \
		 --bootloader_zip xxx/sc2_ah212/xxx/sc2_ah212-u-boot.aml.zip \
		 --ota_key ../amletool/aml-keys/testkeys/otaKey/ \
		 --output xxx/sc2_ah212/xxx/ohm-ota-20210127.scs_and_arb.signed.zip

        ####the ota_key folder contains the 'pk8 and x509.pem' for ota sign

	4.3, Input fastboot upgrade zip , output singed zip for fastboot upgrade in bootloader
		 bash amlogic_scs_sign_whole_pkg.bash --soc s905x4 \
		 --aml_key xxxx/bl33/v2019/board/amlogic/sc2_ah212/device-keys \
		 --fw_arb_cfg xxx/bl33/v2019/board/amlogic/sc2_ah212/fw_arb.cfg \
		 --fastboot_zip xxx/sc2_ah212/xxx/ohm-fastboot-flashall-20210125.zip \
		 --bootloader_zip xxx/sc2_ah212/xxx/sc2_ah212-u-boot.aml.zip \
		 --output xxx/sc2_ah212/xxx/ohm-fastboot-flashall-20210125.scs_and_arb.signed.zip

        ####NOT need ota_key for fastboot zip

5, Android avb2 rollback index configure supported
	if your sdk contains SWPL-83421 Support AVB with anti-rollback protection
		then u can configure avb2 rollback index with 'avb_arb_id' in fw_arb_cfg.cfg

6, Maybe needed lib
  6.1> lua53-18: error while loading shared libraries: libtinfo.so.5
  	sudo apt-get install libtinfo5
  6.2> when called in android Makefile and report error
        make: xxxx not found(required by make)
	cp $(which make) vendor/amlogic/common/tools/secureboot_sign/Aml_Linux_SCS_SignTool/exe4Android/
