最近刷到了一个长虹55D3P海思平台固件,很多人想问长虹55D3P海思平台固件如何解包?今天就给大家分享一个长虹55D3P固件刷机教程。
![]()
一、长虹55D3P海思平台固件如何解包?长虹55D3P固件刷机教程
目前网上还没有长虹海思平台智能电视的固件打包解包教程,仅有一个znds的解包,但大佬迟迟没更新打包教程和工具。帖子中也没讲解解包的原理,对于不熟悉海思平台的来说,感觉无从下手。
znds海思解包贴:#长虹整机厂USB升级包-海思格式bin解包工具
1.固件研究
根据工具解包出来的image看,可以知道每个image的地址和大小,这些信息来源于bootargs分区
但是这些地址并不是相对于固件包的偏移地址,无法直接用来合成固件包。 探索是否raw分区没被压缩,只是带文件系统的分区被压缩,如果这样的话就可以用dd制作raw格式包,再转稀疏格式 先拿fastboot来试试 - dd if=upgrade_ZLH74GiR2G_V1.00099.bin of=fastboot bs=1M count=2
复制代码对比dd得到的fastboot,与工具解包的fastboot差异
可以看到其实fastboot分区前面还有一段数据,目前不清楚这是什么信息(分区表?head?)
另外读出的2M fastboot除了有头外,比工具解析出来的fastboot多出部分不是全0,看来raw分区也无法直接dd来合并,通过对比发现后面的信息也不是下一个分区bootargs的,而是recovery的
看来使用dd来生成新的固件无望 不过dd生成固件也大致研究了下,写在这里备忘 - dd if=/dev/zero of=firmware.bin bs=1k count=0 seek=total_size
- 注:total_size = 所有分区大小之和(可以再大一点,不超过emmc容量即可)
- dd if=kernel of=firmware.bin bs=1k seek=offset conv=notrunc
-
- offset 为kernel的偏移地址,也就是bootargs中kernel之前所有分区大小加起来的总和
-
- dd if=system.bin of=firmware.bin bs=1k seek=offset conv=notrunc
-
- 注意:system.bin为raw格式的,不是稀疏格式的
-
- ./img2simg firmware.bin firmware_sparse_fip.bin 262144
-
- 将整个firmware转换为稀疏格式
-
- 262144代表256K对齐,非必须,也可调整
复制代码
2.解包
用大佬提供的解包工具可以成功解包,system可以成功挂载 - 解包出来的image是稀疏格式,需要先转换为raw格式才能挂载
- ./simg2img 229M_1024M-system system.ext4
-
- mount -t ext4 system.ext4 mnt/
-
- ~/tools/ext4_tool/mnt#ls
- app bin build.prop etc fonts framework lib lib64 lost+found media priv-app tts usr vendor xbin
- ~/tools/ext4_tool/mnt#cd app
- ~/tools/ext4_tool/mnt#ls
- AppPermission ChanghongMisc CHPointStore com.changhong.chhongbaofortv com.tencent.qqmusictv iPPTV_agent QLive tv.huan.recognizecore webview
- AtvMain CHAppManager CHPowerEmpty com.changhong.ipptv Easysetting karaoke RdTvEntry tv.huan.screensaveralbum XiriIme
- Bluetooth CHAppUpgrade CHRecommenderSystem com.changhong.remoteassistance factory LauncherVideoPlayer rtkbtAutoPairService tv.huan.sdk.pay2
- BluetoothWizard CHFileExplorer CHThemeStore com.changhong.tvos.dtv HiRMService Lexue_CHIQ SourceMenu tv.huan.xmpp
- BootWizard ChGlobalSearch CHUserCenter com.egame.tv huan.tv.strongtv MiniLauncher SourceService TvManager
- ChAccountSystem CHistory CHVoiceControlApp com.iflytek.xiri IflytekTVService Miracast Spanner UpdateLocalSystem
- CHAirPlay CHLogoService com.changhong.appstore com.ktcp.video inspection MultiScrInteraction StoreShow UpgradeSystemUI
- ChangHongImagePlayer CHNoticeSystem com.changhong.chchoujiangfortv com.qiyi.tv.changhongappstore IntelligentService PCMRecorder SystemXiri UserLoginManager
复制代码
可以修改build.prop 删除长虹自带APP来定制rom
- 修改build.prop
-
- 将persist.sys.usb.config=none 改为 persist.sys.usb.config=adb
-
- 将ro.adb.secure=1 改为 ro.adb.secure=0
-
- 确认下service.adb.tcp.port=5555有没有,没有加上
-
- 注意:修改文件可能会导致文件selinux和权限变化,注意改回来。改之前执行ls -lZ看下文件权限
-
- ~/tools/ext4_tool/mnt# ls -lZ
- total 76
- drwxr-xr-x. 68 root root u:object_r:system_file:s0 4096 May 30 2018 app
- drwxr-xr-x. 2 root 2000 u:object_r:system_file:s0 8192 May 30 2018 bin
- -rw-r--r--. 1 root root u:object_r:system_file:s0 3843 May 30 2018 build.prop
- drwxr-xr-x. 16 root root u:object_r:system_file:s0 4096 May 30 2018 etc
- drwxr-xr-x. 2 root root u:object_r:system_file:s0 4096 May 30 2018 fonts
- drwxr-xr-x. 2 root root u:object_r:system_file:s0 4096 May 30 2018 framework
- drwxr-xr-x. 9 root root u:object_r:system_file:s0 12288 May 30 2018 lib
- drwxr-xr-x. 7 root root u:object_r:system_file:s0 8192 May 30 2018 lib64
- drwx------. 2 root root u:object_r:system_file:s0 4096 Jan 1 1970 lost+found
- drwxr-xr-x. 3 root root u:object_r:system_file:s0 4096 May 30 2018 media
- drwxr-xr-x. 11 root root u:object_r:system_file:s0 4096 May 30 2018 priv-app
- drwxr-xr-x. 3 root root u:object_r:system_file:s0 4096 May 30 2018 tts
- drwxr-xr-x. 7 root root u:object_r:system_file:s0 4096 May 30 2018 usr
- drwxr-xr-x. 4 root 2000 u:object_r:system_file:s0 4096 May 30 2018 vendor
- drwxr-xr-x. 2 root 2000 u:object_r:system_file:s0 4096 May 30 2018 xbin
-
- 修改selunx 标签,可以用chcon 指令,可以找一个和你目标权限一致的文件做参考来改,简单些
-
- chcon --reference etc/clatd.conf build.prop
-
-
-
- APP 精简
-
- 删除app目录下不需要的app
-
- rm -rf com.egame.tv/
- rm -rf com.qiyi.tv.changhongappstore/
- rm -rf huan.tv.strongtv/
- rm -rf tv.huan.sdk.pay2/
- rm -rf tv.huan.xmpp/
- rm -rf UpdateLocalSystem/
- rm -rf UpgradeSystemUI/
- rm -rf UserLoginManager/
- rm -rf com.tencent.qqmusictv/
- rm -rf com.changhong.chhongbaofortv/
- rm -rf CHAppUpgrade/
- rm -rf com.changhong.ipptv
- rm -rf com.changhong.chchoujiangfortv
- rm -rf com.changhong.remoteassistance
- rm -rf Lexue_CHIQ
- rm -rf LauncherVideoPlayer
复制代码打包新的system
注意:不建议使用mkuserimg.sh 和mkfs.ext4等工具打包system,因为我们没有selinux的file-contents文件,直接打包会丢失selinux 标签,系统可能无法启动
打包直接umount mnt/ 即可,仍然保留了文件的selinux 标签
生成稀疏格式system,可能没必要 - ./img2simg system.ext4 new_system
复制代码
3.打包
网上查到海思固件合并可以使用hitool,待尝试
4.另一种思路
长虹电视有工厂模式和远程协助功能,这里是否有突破口,通过反编译,工厂模式没发现什么暗门开网络adb或提权,远程协助倒是有可能是个突破口,librd.so看到远程协助是ssh方式连接
APK反编译看启动这个APK就会自动启动连接,就看我们能不能拿到连接的密码或私钥了
启动远程协助服务的方法: am start com.changhong.rdtventry/.RdTvEntryActivity 或 am start -a com.changhong.rdtventry.action.SHOWUI
但是终端模拟器没权限启动这个APK,还是得从固件入手了
以上就是我对“长虹55D3P海思平台固件如何解包?长虹55D3P固件刷机教程”的内容分享,希望对大家有帮助。
![]()
相关阅读:
长虹智能电视55D3P(机芯:ZLH74GiR2G)海思平台固件解析打包
|