summaryrefslogtreecommitdiff
Diffstat
-rw-r--r--Android.mk20
-rw-r--r--alarm/alarm_blacklist.txt8
-rw-r--r--alarm/alarm_whitelist.txt5
-rw-r--r--android.software.google_atv.xml11
-rw-r--r--android.software.input_methods.xml4
-rw-r--r--android.software.leanback.xml18
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/anim/atv_fade_in_bottom.xml25
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/anim/atv_fade_in_top.xml25
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/anim/atv_fade_out_bottom.xml25
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/anim/atv_fade_out_top.xml25
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/anim/atv_wallpaper_enter.xml24
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/anim/atv_wallpaper_exit.xml24
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.png3
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/drawable/progress_volume.xml41
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/layout/volume_adjust.xml49
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/layout/volume_adjust_item.xml44
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/values-sw600dp/dimens.xml22
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/values/config.xml65
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/values/dimens.xml31
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/values/styles.xml54
-rw-r--r--aosp_gms_overlay/frameworks/base/core/res/res/xml/global_keys.xml36
-rw-r--r--aosp_gms_overlay/frameworks/base/packages/SettingsLib/res/layout-television/settings_with_drawer.xml46
-rw-r--r--aosp_gms_overlay/packages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_device.xml36
-rw-r--r--aosp_gms_overlay/packages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_profile.xml26
-rw-r--r--aosp_gms_overlay/packages/apps/Provision/AndroidManifest.xml39
-rw-r--r--aosp_gms_overlay/vendor/amlogic/apps/MboxLauncher2/AndroidManifest.xml40
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/anim/atv_fade_in_bottom.xml25
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/anim/atv_fade_in_top.xml25
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/anim/atv_fade_out_bottom.xml25
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/anim/atv_fade_out_top.xml25
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/anim/atv_wallpaper_enter.xml24
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/anim/atv_wallpaper_exit.xml24
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/drawable-nodpi/default_wallpaper.png4
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/drawable/progress_volume.xml41
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/layout/volume_adjust.xml49
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/layout/volume_adjust_item.xml44
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/values-sw600dp/dimens.xml22
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/values-television/config.xml27
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/values-television/dimens.xml24
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/values-television/themes.xml30
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/values/config.xml105
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/values/dimens.xml31
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/values/styles.xml54
-rw-r--r--atv_gms_overlay/frameworks/base/core/res/res/xml/global_keys.xml36
-rw-r--r--atv_gms_overlay/frameworks/base/packages/SettingsLib/res/layout-television/settings_with_drawer.xml46
-rw-r--r--atv_gms_overlay/frameworks/base/packages/SettingsProvider/res/values/defaults.xml34
-rw-r--r--atv_gms_overlay/frameworks/base/packages/SystemUI/res/drawable-hdpi/recents_tv_bg_default.png6015
-rw-r--r--atv_gms_overlay/frameworks/base/packages/SystemUI/res/drawable-mdpi/recents_tv_bg_default.png2462
-rw-r--r--atv_gms_overlay/frameworks/base/packages/SystemUI/res/drawable-xhdpi/recents_tv_bg_default.png8975
-rw-r--r--atv_gms_overlay/frameworks/base/packages/SystemUI/res/values/config.xml31
-rw-r--r--atv_gms_overlay/packages/apps/Bluetooth/res/values/config.xml17
-rw-r--r--atv_gms_overlay/packages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_device.xml36
-rw-r--r--atv_gms_overlay/packages/apps/ManagedProvisioning/res/values/vendor_required_apps_managed_profile.xml26
-rw-r--r--atv_gms_overlay/packages/apps/Provision/AndroidManifest.xml38
-rw-r--r--atv_gms_overlay/packages/providers/ContactsProvider/res/values/config.xml21
-rw-r--r--atv_gms_overlay/vendor/amlogic/apps/MboxLauncher2/AndroidManifest.xml40
-rw-r--r--audio.mk123
-rw-r--r--audio/a2dp_audio_policy_configuration.xml48
-rw-r--r--audio/audio_data.ko243
-rw-r--r--audio/audio_policy_configuration.xml184
-rw-r--r--audio/audio_policy_volumes.xml179
-rw-r--r--audio/default_volume_tables.xml70
-rw-r--r--audio/dia_remote_audio_policy_configuration.xml37
-rw-r--r--audio/r_submix_audio_policy_configuration.xml44
-rw-r--r--audio/usb_audio_policy_configuration.xml43
-rw-r--r--bluetooth.mk477
-rw-r--r--config/lowmemorykiller.txt3
-rw-r--r--config/lowmemorykiller_2G.txt3
-rw-r--r--config/lowmemorykiller_512M.txt3
-rw-r--r--core_amlogic.mk485
-rw-r--r--ddr/ddr_window_64.ko263
-rw-r--r--ddrtest.sh7
-rw-r--r--droidlogic.software.netflix.xml5
-rw-r--r--dumpstate/Android.mk39
-rw-r--r--dumpstate/DumpstateDevice.cpp76
-rw-r--r--dumpstate/DumpstateDevice.h50
-rw-r--r--dumpstate/NOTICE190
-rw-r--r--dumpstate/android.hardware.dumpstate@1.0-service.droidlogic.rc4
-rw-r--r--dumpstate/service.cpp41
-rw-r--r--dynamic_zygote_seondary/dynamic_zygote_64_bit.mk41
-rw-r--r--dynamic_zygote_seondary/init.zygote32_64.rc26
-rw-r--r--dynamic_zygote_seondary/init.zygote64_32.rc26
-rw-r--r--factory.mk306
-rw-r--r--gpu.mk17
-rw-r--r--gpu/mali450-kernel.mk17
-rw-r--r--gpu/mali450-user-arm.mk25
-rw-r--r--gpu/mali450-user-arm64.mk24
-rw-r--r--gpu/t82x-kernel.mk18
-rw-r--r--gpu/t82x-user-arm.mk26
-rw-r--r--gpu/t82x-user-arm64.mk26
-rw-r--r--gpu/t83x-kernel.mk18
-rw-r--r--gpu/t83x-user-arm.mk26
-rw-r--r--gpu/t83x-user-arm64.mk26
-rw-r--r--hdcp_rx22/arm_tools/aictool4274
-rw-r--r--hdcp_rx22/arm_tools/esm_swap3512
-rw-r--r--hdcp_rx22/arm_tools/hdcprxkeys4183
-rw-r--r--hdcp_rx22/firmware/esm_config.i1
-rw-r--r--hdcp_rx22/firmware/firmware.aic22
-rw-r--r--hdcp_rx22/firmware/firmware.le464
-rw-r--r--hdcp_rx22/firmware/firmware.rom0
-rw-r--r--hdcp_rx22/hdcp_rx22104
-rw-r--r--hdcp_tx22/hdcp_tx22209
-rw-r--r--hdcp_tx22/hdcp_tx22.contenttype1165
-rw-r--r--init.amlogic.media.rc29
-rw-r--r--init.amlogic.wifi.rc42
-rw-r--r--init.amlogic.wifi_bcm.rc21
-rw-r--r--init.amlogic.wifi_rtk.rc16
-rw-r--r--kernel_build_check.sh240
-rw-r--r--keyboards/Vendor_0484_Product_5738.kl441
-rw-r--r--keyboards/Vendor_0c45_Product_1109.kl36
-rw-r--r--keyboards/Vendor_7045_Product_1820.kl34
-rw-r--r--media.mk274
-rw-r--r--media_modules.mk23
-rw-r--r--mobile.mk14
-rw-r--r--optimization/config1
-rw-r--r--optimization/liboptimization_32.so66
-rw-r--r--optimization/liboptimization_64.so57
-rw-r--r--patch/Readme.txt12
-rw-r--r--patch/frameworks#base#0001.patch41
-rw-r--r--products/dongle/product_dongle.mk1
-rw-r--r--products/dvb/product_dvb.mk1
-rw-r--r--products/iptv/product_iptv.mk1
-rw-r--r--products/mbox/bootanimation.zip21947
-rw-r--r--products/mbox/default_wallpaper.png1406
-rw-r--r--products/mbox/init.amlogic.rc426
-rw-r--r--products/mbox/mbox.mp49032
-rw-r--r--products/mbox/product_mbox.mk97
-rw-r--r--products/mbox/ueventd.amlogic.rc106
-rw-r--r--products/mbox/upgrade_3.14/aml_emmc_logic_table.xml14
-rw-r--r--products/mbox/upgrade_3.14/aml_upgrade_package.conf25
-rw-r--r--products/mbox/upgrade_3.14/aml_upgrade_package_AB.conf24
-rw-r--r--products/mbox/upgrade_3.14/aml_upgrade_package_AB_enc.conf28
-rw-r--r--products/mbox/upgrade_3.14/aml_upgrade_package_enc.conf29
-rw-r--r--products/mbox/upgrade_4.9/aml_upgrade_package.conf27
-rw-r--r--products/mbox/upgrade_4.9/aml_upgrade_package_AB.conf26
-rw-r--r--products/mbox/upgrade_4.9/aml_upgrade_package_AB_enc.conf31
-rw-r--r--products/mbox/upgrade_4.9/aml_upgrade_package_enc.conf31
-rw-r--r--products/tablet/init.amlogic.rc366
-rw-r--r--products/tablet/product_tablet.mk48
-rw-r--r--products/tablet/ueventd.amlogic.rc76
-rw-r--r--products/tv/bootanimation.zip25778
-rw-r--r--products/tv/default_wallpaper.png1406
-rw-r--r--products/tv/init.amlogic.rc438
-rw-r--r--products/tv/product_tv.mk137
-rw-r--r--products/tv/tv.mp465398
-rw-r--r--products/tv/ueventd.amlogic.rc106
-rw-r--r--products/tv/upgrade_3.14/aml_emmc_logic_table.xml15
-rw-r--r--products/tv/upgrade_3.14/aml_upgrade_package.conf25
-rw-r--r--products/tv/upgrade_3.14/aml_upgrade_package_AB.conf24
-rw-r--r--products/tv/upgrade_3.14/aml_upgrade_package_AB_enc.conf28
-rw-r--r--products/tv/upgrade_3.14/aml_upgrade_package_enc.conf29
-rw-r--r--products/tv/upgrade_4.9/aml_upgrade_package.conf27
-rw-r--r--products/tv/upgrade_4.9/aml_upgrade_package_AB.conf26
-rw-r--r--products/tv/upgrade_4.9/aml_upgrade_package_AB_enc.conf31
-rw-r--r--products/tv/upgrade_4.9/aml_upgrade_package_enc.conf31
-rw-r--r--quick_build_kernel.sh58
-rw-r--r--recovery/Android.mk8
-rw-r--r--recovery/check/Android.mk25
-rw-r--r--recovery/check/dtbcheck.cpp860
-rw-r--r--recovery/check/dtbcheck.h15
-rw-r--r--recovery/check/security.cpp578
-rw-r--r--recovery/check/security.h158
-rw-r--r--recovery/fdt/Android.mk18
-rw-r--r--recovery/fdt/Makefile.libfdt10
-rw-r--r--recovery/fdt/fdt.c222
-rw-r--r--recovery/fdt/fdt.h60
-rw-r--r--recovery/fdt/fdt_empty_tree.c84
-rw-r--r--recovery/fdt/fdt_ro.c574
-rw-r--r--recovery/fdt/fdt_rw.c492
-rw-r--r--recovery/fdt/fdt_strerror.c96
-rw-r--r--recovery/fdt/fdt_sw.c256
-rw-r--r--recovery/fdt/fdt_wip.c118
-rw-r--r--recovery/fdt/libfdt.h1478
-rw-r--r--recovery/fdt/libfdt_env.h29
-rw-r--r--recovery/fdt/libfdt_internal.h95
-rw-r--r--recovery/init.rc112
-rw-r--r--recovery/recovery_extra/Android.mk29
-rw-r--r--recovery/recovery_extra/recovery_amlogic.cpp392
-rw-r--r--recovery/recovery_extra/recovery_amlogic.h25
-rw-r--r--recovery/ubootenv/Android.mk17
-rw-r--r--recovery/ubootenv/set_display_mode.cpp24
-rw-r--r--recovery/ubootenv/set_display_mode.h4
-rw-r--r--recovery/ubootenv/uboot_env.cpp107
-rw-r--r--recovery/ubootenv/uboot_env.h24
-rw-r--r--recovery/ui/Android.mk30
-rw-r--r--recovery/ui/amlogic_ui.cpp205
-rw-r--r--recovery/ui/amlogic_ui.h25
-rwxr-xr-xrecovery/updater-script10
-rw-r--r--recovery/updater_extra/Android.mk22
-rw-r--r--recovery/updater_extra/install_amlogic.cpp751
-rw-r--r--recovery/updater_extra/install_amlogic.h20
-rwxr-xr-xreleasetools.py230
-rw-r--r--rtk_bt_driver.mk11
-rw-r--r--scripts/check_patch.py268
-rwxr-xr-xscripts/checkpatch.pl45
-rw-r--r--seccomp/mediacodec.policy11
-rw-r--r--seccomp/mediaextractor.policy7
-rw-r--r--security/Android.mk13
-rw-r--r--security/verity.pk84
-rw-r--r--security/verity.x509.der9
-rw-r--r--security/verity.x509.pem24
-rw-r--r--security/verity_key2
-rw-r--r--sepolicy.mk3
-rw-r--r--sepolicy/adbd.te1
-rw-r--r--sepolicy/app.te80
-rw-r--r--sepolicy/audioserver.te7
-rw-r--r--sepolicy/bcmdl.te12
-rw-r--r--sepolicy/blkid_untrusted.te4
-rw-r--r--sepolicy/bootanim.te1
-rw-r--r--sepolicy/bootvideo.te36
-rw-r--r--sepolicy/charger.te2
-rw-r--r--sepolicy/device.te33
-rw-r--r--sepolicy/drmserver.te14
-rw-r--r--sepolicy/droidvold.te97
-rw-r--r--sepolicy/file.te42
-rw-r--r--sepolicy/file_contexts131
-rw-r--r--sepolicy/firmload.te10
-rw-r--r--sepolicy/fsck.te12
-rw-r--r--sepolicy/fsck_untrusted.te3
-rwxr-xr-xsepolicy/genfs_contexts9
-rw-r--r--sepolicy/hal_audio_default.te15
-rw-r--r--sepolicy/hal_bootctl_default.te7
-rw-r--r--sepolicy/hal_camera_default.te3
-rw-r--r--sepolicy/hal_drm_default.te4
-rw-r--r--sepolicy/hal_dumpstate_impl.te9
-rw-r--r--sepolicy/hal_graphics_allocator_default.te2
-rw-r--r--sepolicy/hal_graphics_composer_default.te13
-rw-r--r--sepolicy/hal_keymaster_default.te1
-rw-r--r--sepolicy/hal_memtrack_default.te39
-rw-r--r--sepolicy/hal_power_default.te2
-rw-r--r--sepolicy/hal_tv_cec_default.te2
-rw-r--r--sepolicy/hal_wifi_default.te18
-rw-r--r--sepolicy/hal_wifi_supplicant_default.te1
-rw-r--r--sepolicy/hdcp_rx22.te14
-rw-r--r--sepolicy/hdcp_tx22.te9
-rw-r--r--sepolicy/hdmicecd.te15
-rw-r--r--sepolicy/healthd.te3
-rw-r--r--sepolicy/hidraw_device.te1
-rw-r--r--sepolicy/hwservice.te3
-rw-r--r--sepolicy/hwservice_contexts3
-rw-r--r--sepolicy/hwservicemanager.te14
-rw-r--r--sepolicy/imageserver.te44
-rw-r--r--sepolicy/init.te111
-rw-r--r--sepolicy/kernel.te6
-rw-r--r--sepolicy/mediacodec.te18
-rw-r--r--sepolicy/mediadrmserver.te5
-rw-r--r--sepolicy/mediaextractor.te12
-rw-r--r--sepolicy/mediaserver.te34
-rw-r--r--sepolicy/netd.te10
-rw-r--r--sepolicy/ntfs-3g.te24
-rw-r--r--sepolicy/platform_app.te42
-rw-r--r--sepolicy/pppoe_wrapper.te31
-rw-r--r--sepolicy/priv_app.te16
-rw-r--r--sepolicy/property.te7
-rw-r--r--sepolicy/property_contexts9
-rw-r--r--sepolicy/recovery.te39
-rw-r--r--sepolicy/remotecfg.te7
-rw-r--r--sepolicy/sdcardd.te8
-rw-r--r--sepolicy/service.te10
-rw-r--r--sepolicy/service_contexts10
-rw-r--r--sepolicy/servicemanager.te1
-rw-r--r--sepolicy/sgdisk.te4
-rw-r--r--sepolicy/shell.te6
-rw-r--r--sepolicy/surfaceflinger.te6
-rw-r--r--sepolicy/system_app.te84
-rw-r--r--sepolicy/system_control.te105
-rw-r--r--sepolicy/system_server.te49
-rw-r--r--sepolicy/tee.te11
-rw-r--r--sepolicy/toolbox.te1
-rw-r--r--sepolicy/ueventd.te2
-rw-r--r--sepolicy/update_engine.te9
-rw-r--r--sepolicy/update_verifier.te5
-rw-r--r--sepolicy/vold.te35
-rw-r--r--sepolicy/webview_zygote.te1
-rw-r--r--sepolicy/wificond.te3
-rw-r--r--sepolicy/zygote.te13
-rw-r--r--software.mk75
-rw-r--r--t83x-armv8.mk26
-rw-r--r--t83x.mk17
-rw-r--r--tb_detect.mk28
-rw-r--r--tb_detect/tb_detect.ko266
-rw-r--r--tutorial-library-google.zip2457
-rw-r--r--vndk/Android.mk57
-rw-r--r--wifi.mk1690
-rw-r--r--wifi/config.txt3
-rw-r--r--wifi_driver.mk203
-rw-r--r--wifi_modules.mk5
287 files changed, 177798 insertions, 0 deletions
diff --git a/recovery/check/dtbcheck.cpp b/recovery/check/dtbcheck.cpp
new file mode 100644
index 0000000..9d13bee
--- a/dev/null
+++ b/recovery/check/dtbcheck.cpp
@@ -0,0 +1,860 @@
+#include <errno.h>
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <ziparchive/zip_archive.h>
+#include "dtbcheck.h"
+
+
+extern "C" {
+#include "fdt/libfdt.h"
+}
+
+
+
+#define MAX_LEVEL 32 /* how deeply nested we will go */
+#define CONFIG_CMD_FDT_MAX_DUMP 64
+
+#define DT_HEADER_MAGIC 0xedfe0dd0 /*header of dtb file*/
+#define AML_DT_HEADER_MAGIC 0x5f4c4d41 /*"AML_", multi dtbs supported*/
+
+#define AML_DT_ID_VARI_TOTAL 3 //Total 3 strings
+/*Latest version: v2*/
+#define AML_DT_VERSION_OFFSET 4
+#define AML_DT_TOTAL_DTB_OFFSET 8
+#define AML_DT_FIRST_DTB_OFFSET 12
+
+#define AML_DT_DTB_DT_INFO_OFFSET 0
+
+#define ENV_DTB "aml_dt"
+#define CMDLINE "/proc/cmdline"
+#define STORE_DEVICE "/sys/class/aml_store/store_device"
+#define DEVICE_NAND 2
+#define DEVICE_EMMC 1
+
+extern int IsPlatformEncrypted(void);
+
+extern int DtbImgEncrypted(
+ const char *imageName,
+ const unsigned char *imageBuffer,
+ const int imageSize,
+ const char *flag,
+ unsigned char *encryptedbuf);
+
+struct fdt_header *working_fdt;
+
+static Dtb_Partition_S dtb_zip[24];
+static Dtb_Partition_S dtb_dev[24];
+
+unsigned int recovery_size1 = 32*1024*1024; //default value 32M
+
+static int isEncrypted = 0;
+
+struct Dtb_header {
+ unsigned int dt_magic;
+ unsigned int dt_tool_version;
+ unsigned int dt_total;
+ char data[0];
+};
+
+
+/****************************************************************************/
+
+
+unsigned int
+STRTOU32(unsigned char* p){
+ return (p[3]<<24)|(p[2]<<16)|(p[1]<<8)|p[0];
+}
+
+int GetDeviceType()
+{
+ FILE *p = NULL;
+ int len = 0;
+ char buffer[32] = {0};
+ int type = 0;
+
+ p = fopen(STORE_DEVICE, "r");
+ if (p == NULL) {
+ printf("open failed!\n");
+ return -1;
+ }
+
+ len = fread(buffer, 1, 32, p);
+ if (len <= 0) {
+ printf("fread failed!\n");
+ fclose(p);
+ return -1;
+ }
+ fclose(p);
+
+ printf("buffer:%s\n",buffer);
+
+ type = atoi(buffer);
+ printf("type=%d\n",type);
+ return type;
+}
+
+signed int
+GetDtbId(char *pdt){
+ FILE *p = NULL;
+ int len = 0;
+ char buffer[1024] = {0};
+
+ if (pdt == NULL) {
+ printf("param error!\n");
+ return -1;
+ }
+
+ p = fopen(CMDLINE, "r");
+ if (p == NULL) {
+ printf("open failed!\n");
+ return -1;
+ }
+
+ len = fread(buffer, 1, 1023, p);
+ if (len <= 0) {
+ printf("fread failed!\n");
+ fclose(p);
+ return -1;
+ }
+ fclose(p);
+
+ char *paddr=strstr(buffer, ENV_DTB);
+ if (paddr == NULL) {
+ printf("not find env:aml_dt !\n");
+ return -1;
+ }
+
+ paddr = strtok(paddr, " ");
+
+ paddr = paddr+strlen(ENV_DTB)+1;
+ //printf("cmdline, aml_dt=%s\n", paddr);
+
+ strcpy(pdt, paddr);
+ return 0;
+}
+
+
+/*
+ * Heuristic to guess if this is a string or concatenated strings.
+ */
+
+static int
+is_printable_string(const void *data, int len){
+ const char *s = (char *)data;
+
+ /* zero length is not */
+ if (len == 0)
+ return 0;
+
+ /* must terminate with zero or '\n' */
+ if (s[len - 1] != '\0' && s[len - 1] != '\n')
+ return 0;
+
+ /* printable or a null byte (concatenated strings) */
+ while (((*s == '\0') || isprint(*s) || isspace(*s)) && (len > 0)) {
+ /*
+ * If we see a null, there are three possibilities:
+ * 1) If len == 1, it is the end of the string, printable
+ * 2) Next character also a null, not printable.
+ * 3) Next character not a null, continue to check.
+ */
+ if (s[0] == '\0') {
+ if (len == 1)
+ return 1;
+ if (s[1] == '\0')
+ return 0;
+ }
+ s++;
+ len--;
+ }
+
+ /* Not the null termination, or not done yet: not printable */
+ if (*s != '\0' || (len != 0))
+ return 0;
+
+ return 1;
+}
+
+
+
+/*
+ * Print the property in the best format, a heuristic guess. Print as
+ * a string, concatenated strings, a byte, word, double word, or (if all
+ * else fails) it is printed as a stream of bytes.
+ */
+static void print_data(const void *data, int len, int *index, int flag)
+{
+ int j;
+
+ char *pd = (char *)data;
+
+ /* no data, don't print */
+ if (len == 0)
+ return;
+
+ /*
+ * It is a string, but it may have multiple strings (embedded '\0's).
+ */
+ if (is_printable_string(pd, len)) {
+ j = 0;
+ while (j < len) {
+ if (flag == 0) {
+ strcpy(dtb_zip[*index].partition_name, pd);
+ } else {
+ strcpy(dtb_dev[*index].partition_name, pd);
+ }
+ j += strlen(pd) + 1;
+ pd += strlen(pd) + 1;
+ }
+ return;
+ }
+
+ if ((len %4) == 0) {
+ if (len > CONFIG_CMD_FDT_MAX_DUMP)
+ ;
+ else if (len == 8){
+ const __be32 *p;
+ p = (__be32 *)pd;
+ if (flag == 0)
+ {
+ dtb_zip[*index].partition_size = fdt32_to_cpu(p[1]) - fdt32_to_cpu(p[0]);
+ }
+ else
+ {
+ dtb_dev[*index].partition_size = fdt32_to_cpu(p[1]) - fdt32_to_cpu(p[0]);
+ }
+ (*index)++;
+ }
+ } else { /* anything else... hexdump */
+ if (len > CONFIG_CMD_FDT_MAX_DUMP)
+ ;
+ else {
+ const unsigned char *s;
+ }
+ }
+}
+
+
+int
+GetPartitionFromDtb(const char *pathp, int depth, int *partition_num, int flag){
+ static char tabs[MAX_LEVEL+1] =
+ "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t"
+ "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
+ const void *nodep; /* property node pointer */
+ int nodeoffset; /* node offset from libfdt */
+ int index = 0;
+ int nextoffset; /* next node offset from libfdt */
+ uint32_t tag; /* tag */
+ int len; /* length of the property */
+ int level = 0; /* keep track of nesting level */
+ const struct fdt_property *fdt_prop;
+
+ nodeoffset = fdt_path_offset (working_fdt, pathp);
+ if (nodeoffset < 0) {
+ /*
+ * Not found or something else bad happened.
+ */
+ printf ("libfdt fdt_path_offset() returned %s\n",
+ fdt_strerror(nodeoffset));
+ return 1;
+ }
+
+
+ /*
+ * The user passed in a node path and no property,
+ * print the node and all subnodes.
+ */
+ while (level >= 0) {
+ tag = fdt_next_tag(working_fdt, nodeoffset, &nextoffset);
+ switch (tag) {
+ case FDT_BEGIN_NODE:
+ pathp = fdt_get_name(working_fdt, nodeoffset, NULL);
+ if (level <= depth) {
+ if (pathp == NULL)
+ pathp = "/* NULL pointer error */";
+ if (*pathp == '\0')
+ pathp = "/"; /* root is nameless */
+ }
+ level++;
+ if (level >= MAX_LEVEL) {
+ printf("Nested too deep, aborting.\n");
+ return 1;
+ }
+ break;
+ case FDT_END_NODE:
+ level--;
+ if (level <= depth)
+ ;
+ if (level == 0) {
+ level = -1; /* exit the loop */
+ }
+ break;
+ case FDT_PROP:
+ fdt_prop = (struct fdt_property *)fdt_offset_ptr(working_fdt, nodeoffset,
+ sizeof(*fdt_prop));
+ pathp = fdt_string(working_fdt,
+ fdt32_to_cpu(fdt_prop->nameoff));
+ len = fdt32_to_cpu(fdt_prop->len);
+ nodep = fdt_prop->data;
+ if (len < 0) {
+ printf ("libfdt fdt_getprop(): %s\n",
+ fdt_strerror(len));
+ return 1;
+ } else if (len == 0) {
+ /* the property has no value */
+ if (level <= depth)
+ ;
+ } else {
+ if (level <= depth) {
+ print_data (nodep, len, &index, flag);
+ }
+ }
+ break;
+ case FDT_NOP:
+ printf("%s/* NOP */\n", &tabs[MAX_LEVEL - level]);
+ break;
+ case FDT_END:
+ return 1;
+ default:
+ if (level <= depth)
+ printf("Unknown tag 0x%08X\n", tag);
+ return 1;
+ }
+ nodeoffset = nextoffset;
+ }
+
+ *partition_num = index;
+ return 0;
+}
+
+unsigned char *
+GetMultiDtbEntry(unsigned char *fdt_addr, int *plen){
+ unsigned int dt_magic = STRTOU32(fdt_addr);
+ signed int dt_total = 0;
+ unsigned int dt_tool_version = 0;
+
+ //printf(" Amlogic multi-dtb tool\n");
+ if (dt_magic == DT_HEADER_MAGIC) {/*normal dtb*/
+ printf(" Single dtb detected\n");
+ return fdt_addr;
+ }
+ else if (dt_magic == AML_DT_HEADER_MAGIC) {/*multi dtb*/
+ printf(" Multi dtb detected\n");
+ /* check and set aml_dt */
+ int i = 0;
+ char *aml_dt_buf;
+ aml_dt_buf = (char *)malloc(sizeof(char)*64);
+ memset(aml_dt_buf, 0, sizeof(aml_dt_buf));
+
+ GetDtbId(aml_dt_buf);
+ //printf("aml_dt_buf:%s\n", aml_dt_buf);
+
+ unsigned int aml_dt_len = aml_dt_buf ? strlen(aml_dt_buf) : 0;
+ if (aml_dt_len <= 0) {
+ printf("Get env aml_dt failed!Ignore dtb check !\n");
+ *plen = 0;
+ return fdt_addr;
+ }
+
+ /*version control, compatible with v1*/
+ dt_tool_version = STRTOU32(fdt_addr + AML_DT_VERSION_OFFSET);
+ unsigned int aml_each_id_length=0;
+ unsigned int aml_dtb_offset_offset;
+ unsigned int aml_dtb_header_size;
+
+ if (dt_tool_version == 1)
+ aml_each_id_length = 4;
+ else if(dt_tool_version == 2)
+ aml_each_id_length = 16;
+
+ aml_dtb_offset_offset = aml_each_id_length * AML_DT_ID_VARI_TOTAL;
+ aml_dtb_header_size = 8+(aml_each_id_length * AML_DT_ID_VARI_TOTAL);
+ //printf(" Multi dtb tool version: v%d .\n", dt_tool_version);
+
+ /*fdt_addr + 0x8: num of dtbs*/
+ dt_total = STRTOU32(fdt_addr + AML_DT_TOTAL_DTB_OFFSET);
+ //printf(" Support %d dtbs.\n", dt_total);
+
+ /* split aml_dt to 3 strings */
+ char *tokens[3] = {NULL, NULL, NULL};
+ for (i = 0; i < AML_DT_ID_VARI_TOTAL; i++) {
+ tokens[i] = strsep(&aml_dt_buf, "_");
+ }
+
+ if (aml_dt_buf)
+ free(aml_dt_buf);
+ //printf(" aml_dt soc: %s platform: %s variant: %s\n", tokens[0], tokens[1], tokens[2]);
+
+ /*match and print result*/
+ char **dt_info;
+ dt_info = (char **)malloc(sizeof(char *)*AML_DT_ID_VARI_TOTAL);
+ for (i = 0; i < AML_DT_ID_VARI_TOTAL; i++)
+ dt_info[i] = (char *)malloc(sizeof(char)*aml_each_id_length);
+
+ unsigned int dtb_match_num = 0xffff;
+ unsigned int x = 0, y = 0, z = 0; //loop counter
+ unsigned int read_data;
+ for (i = 0; i < dt_total; i++) {
+ for (x = 0; x < AML_DT_ID_VARI_TOTAL; x++) {
+ for (y = 0; y < aml_each_id_length; y+=4) {
+ read_data = STRTOU32(fdt_addr + AML_DT_FIRST_DTB_OFFSET + \
+ i * aml_dtb_header_size + AML_DT_DTB_DT_INFO_OFFSET + \
+ (x * aml_each_id_length) + y);
+ dt_info[x][y+0] = (read_data >> 24) & 0xff;
+ dt_info[x][y+1] = (read_data >> 16) & 0xff;
+ dt_info[x][y+2] = (read_data >> 8) & 0xff;
+ dt_info[x][y+3] = (read_data >> 0) & 0xff;
+ }
+
+ for (z=0; z<aml_each_id_length; z++) {
+ /*fix string with \0*/
+ if (0x20 == (uint)dt_info[x][z]) {
+ dt_info[x][z] = '\0';
+ }
+ }
+ }
+
+ if (dt_tool_version == 1)
+ printf(" dtb %d soc: %.4s plat: %.4s vari: %.4s\n", i, (char *)(dt_info[0]), (char *)(dt_info[1]), (char *)(dt_info[2]));
+ else if(dt_tool_version == 2)
+ printf(" dtb %d soc: %.16s plat: %.16s vari: %.16s\n", i, (char *)(dt_info[0]), (char *)(dt_info[1]), (char *)(dt_info[2]));
+ uint match_str_counter = 0;
+
+ for (z=0; z<AML_DT_ID_VARI_TOTAL; z++) {
+ /*must match 3 strings*/
+ if (!strncmp(tokens[z], (char *)(dt_info[z]), strlen(tokens[z])) && \
+ (strlen(tokens[z]) == strlen(dt_info[z])))
+ match_str_counter++;
+ }
+
+ if (match_str_counter == AML_DT_ID_VARI_TOTAL) {
+ //printf("Find match dtb\n");
+ dtb_match_num = i;
+ }
+
+ for (z=0; z<AML_DT_ID_VARI_TOTAL; z++) {
+ /*clear data for next loop*/
+ memset(dt_info[z], 0, sizeof(aml_each_id_length));
+ }
+ }
+
+ /*clean malloc memory*/
+ for (i = 0; i < AML_DT_ID_VARI_TOTAL; i++) {
+ if (dt_info[i])
+ free(dt_info[i]);
+ }
+
+ if (dt_info)
+ free(dt_info);
+
+ /*if find match dtb, return address, or else return main entrance address*/
+ if (0xffff != dtb_match_num) {
+ printf(" Find match dtb: %d\n", dtb_match_num);
+ /*this offset is based on dtb image package, so should add on base address*/
+ *plen = STRTOU32(fdt_addr + AML_DT_FIRST_DTB_OFFSET + \
+ dtb_match_num * aml_dtb_header_size + aml_dtb_offset_offset+4);
+ return fdt_addr + STRTOU32(fdt_addr + AML_DT_FIRST_DTB_OFFSET + \
+ dtb_match_num * aml_dtb_header_size + aml_dtb_offset_offset);
+ } else {
+ printf(" Not match any dtb.\n");
+ return NULL;
+ }
+ } else {
+ printf(" Cannot find legal dtb!\n");
+ return NULL;
+ }
+
+ return NULL;
+}
+
+
+/**
+ * --- get upgrade package image data
+ *
+ * @zipArchive: zip archive object
+ * @imageName: upgrade package image's name
+ * @imageSize: upgrade package image's size
+ *
+ * return value:
+ * <0: failed
+ * =0: can't find image
+ * >0: get image data successful
+ */
+static unsigned char *s_pDtbBuffer = NULL;
+static int
+GetZipDtbImage(const ZipArchiveHandle za, const char *imageName, int *imageSize){
+ int len = 0;
+ int ret = 0;
+ unsigned char *paddr = NULL;
+
+ ZipString zip_path(imageName);
+ ZipEntry entry;
+ if (FindEntry(za, zip_path, &entry) != 0) {
+ printf("no %s in package!\n", imageName);
+ return 0;
+ }
+
+ *imageSize = entry.uncompressed_length;
+ if (*imageSize <= 0) {
+ printf("can't get package entry uncomp len(%d) (%s)\n",*imageSize, strerror(errno));
+ return -1;
+ }
+
+ len = *imageSize;
+
+ unsigned char* buffer = (unsigned char *)calloc(len, sizeof(unsigned char));
+ if (!buffer) {
+ printf("can't malloc %d size space (%s)\n",len, strerror(errno));
+ return -1;
+ }
+
+ ret = ExtractToMemory(za, &entry, buffer, entry.uncompressed_length);
+ if (ret != 0) {
+ printf("can't extract package entry to image buffer\n");
+ free(buffer);
+ return -1;
+ }
+
+
+ if (isEncrypted == 1) {
+ ret = DtbImgEncrypted(DTB_IMG, buffer, len, "1", buffer);
+ if (ret == 2) {
+ printf("no decrypt_dtb and no support!");
+ free(buffer);
+ return 2;
+ }else if (ret <= 0) {
+ printf("dtb.img encrypt from zip failed!\n");
+ free(buffer);
+ return -1;
+ }
+ }
+
+ paddr = GetMultiDtbEntry(buffer, &len);
+ if (paddr == NULL)
+ {
+ printf("Cannot find legal dtb from zip \n");
+ free(buffer);
+ return -1;
+ } else if (len == 0) {
+ printf("No need to check dtb \n");
+ free(buffer);
+ return 2;
+ }
+
+ if (s_pDtbBuffer != NULL) {
+ free(s_pDtbBuffer);
+ s_pDtbBuffer = NULL;
+ }
+
+ s_pDtbBuffer = (unsigned char *)calloc(len, sizeof(unsigned char));
+ if (!s_pDtbBuffer) {
+ printf("can't malloc %d size space (%s)\n",len, strerror(errno));
+ free(buffer);
+ return -1;
+ }
+
+ memcpy(s_pDtbBuffer, paddr, len);
+ free(buffer);
+
+ return 1;
+}
+
+static int
+GetDevDtbImage(){
+ int fd = 0;
+ int len = 0;
+ int ret = 0;
+ unsigned char *paddr = NULL;
+ const char *DTB_DEV= "/dev/dtb";
+ const int DTB_DATA_MAX = 256*1024;
+
+ unsigned char* buffer = (unsigned char *)calloc(DTB_DATA_MAX+256, sizeof(unsigned char));
+ if (buffer == NULL) {
+ printf("malloc %d failed!\n", DTB_DATA_MAX+256);
+ return -1;
+ }
+
+ fd = open(DTB_DEV, O_RDONLY);
+ if (fd < 0) {
+ printf("open %s failed!\n", DTB_DEV);
+ free(buffer);
+ return -1;
+ }
+
+ len = read(fd, buffer, DTB_DATA_MAX);
+ if (len < 0) {
+ printf("read failed len = %d\n", len);
+ close(fd);
+ free(buffer);
+ return -1;
+ }
+
+ close(fd);
+
+ if (isEncrypted == 1) {
+ ret = DtbImgEncrypted(DTB_IMG, buffer, len, "1", buffer);
+ if (ret <= 0) {
+ printf("dtb.img encrypt from dev failed!\n");
+ free(buffer);
+ return -1;
+ }
+ }
+ paddr = GetMultiDtbEntry(buffer, &len);
+ if (paddr == NULL) {
+ printf("Cannot find legal dtb from dev block \n");
+ free(buffer);
+ return -1;
+ }
+
+ if (s_pDtbBuffer != NULL) {
+ free(s_pDtbBuffer);
+ s_pDtbBuffer = NULL;
+ }
+
+ s_pDtbBuffer = (unsigned char *)calloc(len, sizeof(unsigned char));
+ if (s_pDtbBuffer == NULL) {
+ printf("malloc %d failed!\n", len);
+ free(buffer);
+ return -1;
+ }
+
+ memcpy(s_pDtbBuffer, paddr, len);
+ free(buffer);
+
+ return 0;
+}
+
+int
+GetEnvPartitionOffset(const ZipArchiveHandle za) {
+ int i = 0;
+ int find = 0;
+ int ret = -1;
+ int offset = 116*1024*1024; //bootloader(4M) GAP(32M) reserved(64M) GAP(8M) cache(--) GAP(8M)
+ int imageSize = 0;
+ int partition_num_zip = 0;
+
+ ret = GetZipDtbImage(za, DTB_IMG, &imageSize);
+ if ((ret == 0) || (ret == 2)) {
+ printf("no dtb.img in the update or no need check dtb, check dtb over!\n");
+ return 0;
+ } else if (ret < 0) {
+ printf("get dtb.img from update.zip failed!\n");
+ ret = -1;
+ goto END;
+ }
+
+ working_fdt = (struct fdt_header *)s_pDtbBuffer;
+
+ ret = GetPartitionFromDtb("/partitions", MAX_LEVEL, &partition_num_zip, 0);
+ if (ret != 0) {
+ printf("get partition map from dtb.img failed!\n");
+ ret = -1;
+ goto END;
+ }
+
+ for (i=0; i<partition_num_zip;i++) {
+ printf("%s:0x%08x\n", dtb_zip[i].partition_name, dtb_zip[i].partition_size);
+ if (!strcmp("cache", dtb_zip[i].partition_name)) {
+ offset += dtb_zip[i].partition_size;
+ find = 1;
+ }
+ }
+
+ if (find == 0) {
+ printf("get cache partition size from dtb.img failed!\n");
+ ret = -1;
+ goto END;
+ }
+ printf("env partition offset:0x%08x\n", offset);
+
+ ret = offset;
+
+END:
+ if (s_pDtbBuffer != NULL)
+ {
+ free(s_pDtbBuffer);
+ s_pDtbBuffer = NULL;
+ }
+
+ return ret;
+}
+
+int
+RecoveryDtbCheck(const ZipArchiveHandle za){
+ int i = 0, ret = -1, err = -1;
+ int fd = -1;
+ int partition_num_zip = 0;
+ int partition_num_dev = 0;
+ int imageSize = 0;
+ int recovery_dev = 0, recovery_zip = 0;
+ int data_dev = 0, data_zip = 0;
+ int recovery_offset_dev = 0, recovery_offset_zip = 0;
+ int data_offset_dev = 0, data_offset_zip = 0;
+ int device_type = 0;
+ int partition_num;
+ int cache_offset_dev = 0, cache_offset_zip = 0;
+ int recovery_size_dev = 0, recovery_size_zip = 0;
+ int cache_size_dev = 0, cache_size_zip = 0;
+
+ isEncrypted = IsPlatformEncrypted();
+ if (isEncrypted == 2) {
+ printf("kernel doesn't support!\n");
+ return 0;
+ } else if (isEncrypted < 0) {
+ return -1;
+ }
+
+ ret = GetZipDtbImage(za, DTB_IMG, &imageSize);
+ if ((ret == 0) || (ret == 2)) {
+ printf("no dtb.img in the update or no need check dtb, check dtb over!\n");
+ return 0;
+ } else if (ret < 0) {
+ printf("get dtb.img from update.zip failed!\n");
+ ret = -1;
+ goto END;
+ }
+
+ working_fdt = (struct fdt_header *)s_pDtbBuffer;
+
+ ret = GetPartitionFromDtb("/partitions", MAX_LEVEL, &partition_num_zip, 0);
+ if (ret != 0) {
+ printf("get partition map from dtb.img failed!\n");
+ ret = -1;
+ goto END;
+ }
+
+ ret = GetDevDtbImage();
+ if (ret != 0) {
+ printf("read dtb from /dev/dtb failed!\n");
+ ret = -1;
+ goto END;
+ }
+
+ working_fdt = (struct fdt_header *)s_pDtbBuffer;
+ ret = GetPartitionFromDtb("/partitions", MAX_LEVEL, &partition_num_dev, 1);
+ if (ret != 0) {
+ printf("get partition map from /dev/dtb failed!\n");
+ ret = -1;
+ goto END;
+ }
+
+ partition_num = partition_num_dev;
+ device_type = GetDeviceType();
+ printf("device_type = %d \n",device_type);
+
+ if (partition_num_zip != partition_num_dev) {
+ printf("partition num don't match zip:%d, dev:%d\n",partition_num_zip, partition_num_dev);
+ if (device_type == DEVICE_NAND) {
+ printf("the partitions changed & device is nand! can not upgrade!\n ");
+ ret = -1;
+ goto END;
+ }
+ #ifdef SUPPORT_PARTNUM_CHANGE
+ ret = 2;
+ partition_num = partition_num_zip > partition_num_dev ? partition_num_zip : partition_num_dev;
+ #else
+ printf("partition num don't match zip:%d, dev:%d, can not upgrade!\n",partition_num_zip, partition_num_dev);
+ ret = -1;
+ goto END;
+ #endif
+ }
+ printf("partition_num = %d \n",partition_num);
+
+ for (i=0; i<partition_num;i++) {
+ printf("%s:0x%08x\n", dtb_zip[i].partition_name, dtb_zip[i].partition_size);
+ printf("%s:0x%08x\n", dtb_dev[i].partition_name, dtb_dev[i].partition_size);
+
+ if (!strcmp("recovery", dtb_dev[i].partition_name)) {
+ recovery_size1 = dtb_zip[i].partition_size;
+ recovery_dev = i;
+ recovery_size_dev = dtb_dev[i].partition_size;
+ }
+ if (!strcmp("recovery", dtb_zip[i].partition_name)) {
+ recovery_zip = i;
+ recovery_size_zip = dtb_zip[i].partition_size;
+ }
+
+ if (!strcmp("data", dtb_dev[i].partition_name)) {
+ data_dev = i;
+ }
+ if (!strcmp("data", dtb_zip[i].partition_name)) {
+ data_zip = i;
+ }
+
+ if (!strcmp("cache", dtb_dev[i].partition_name)) {
+ cache_size_dev = dtb_dev[i].partition_size;
+ }
+ if (!strcmp("cache", dtb_zip[i].partition_name)) {
+ cache_size_zip = dtb_zip[i].partition_size;
+ }
+
+ if ((strcmp(dtb_zip[i].partition_name, dtb_dev[i].partition_name) != 0)||
+ (dtb_zip[i].partition_size != dtb_dev[i].partition_size)) {
+ ret = 2;
+ /*just emmc support partition changes*/
+ if (device_type == DEVICE_NAND) {
+ printf("the partitions changed & device is nand! can not upgrade!\n ");
+ ret = -1;
+ goto END;
+ }
+ }
+ }
+
+ /*the offset of recovery/data cannot be changed*/
+ for (i=0;i<recovery_dev;i++) {
+ recovery_offset_dev += dtb_dev[i].partition_size;
+ }
+ for (i=0;i<recovery_zip;i++) {
+ recovery_offset_zip += dtb_zip[i].partition_size;
+ }
+ for (i=0;i<data_dev;i++) {
+ data_offset_dev += dtb_dev[i].partition_size;
+ }
+ for (i=0;i<data_zip;i++) {
+ data_offset_zip += dtb_zip[i].partition_size;
+ }
+
+ for (i=0;i<2;i++) {
+ cache_offset_dev += dtb_dev[i].partition_size;
+ cache_offset_zip += dtb_zip[i].partition_size;
+ }
+
+ printf("recovery_dev: %d recovery_offset_dev :0x%08x\n", recovery_dev, recovery_offset_dev);
+ printf("recovery_zip: %d recovery_offset_zip :0x%08x\n", recovery_zip, recovery_offset_zip);
+ printf("data_dev: %d data_offset_dev :0x%08x\n", data_dev, data_offset_dev);
+ printf("data_zip: %d data_offset_zip :0x%08x\n", data_zip, data_offset_zip);
+ printf("cache_offset_dev :0x%08x, cache_size_dev: %d\n", cache_offset_dev, cache_size_dev);
+ printf("cache_offset_zip :0x%08x, cache_size_zip: %d\n", cache_offset_zip, cache_size_zip);
+
+ if (data_offset_dev != data_offset_zip) {
+ printf("data changed, need wipe_data\n ");
+ ret = 3;
+ }
+
+ if ((recovery_offset_dev != recovery_offset_zip) || (recovery_size_dev != recovery_size_zip)) {
+ printf("recovery part changed! can not upgrade!\n ");
+ ret = -1;
+ goto END;
+ }
+
+ if ((cache_offset_dev != cache_offset_zip) || (cache_size_dev != cache_size_zip)) {
+ printf("cache part changed! can not upgrade!\n ");
+ ret = -1;
+ goto END;
+ }
+
+END:
+ if (s_pDtbBuffer != NULL)
+ {
+ free(s_pDtbBuffer);
+ s_pDtbBuffer = NULL;
+ }
+
+ return ret;
+}