本博客倡导开放源代码,在此公布之程序源代码如无特别声明均采用GNU通用公共 许可证(GPL)

乐在其中

分享学习Linux的乐趣

  IT博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  23 随笔 :: 0 文章 :: 401 评论 :: 0 Trackbacks
研究一下海信官方发布的MP800H固件,以春节版V049_0121为例。

固件文件名叫:install.img
在Linux系统上用file命令探测一下文件类型
1 $ file install.img
2 install.img: POSIX tar archive (GNU)

原来是tar文件,用tar命令显示文件列表
 1 $ tar tvf install.img
 2 -rwxr-xr-x root/root    143300 2010-01-21 19:30 arial.ttf
 3 -rwxr-xr-x root/root   1773344 2010-01-21 19:30 audio_firmware.install.bin
 4 -rwxr-xr-x root/root      1773 2010-01-21 19:30 configuration.xml
 5 -rwxr-xr-x root/root     43400 2010-01-21 19:30 flash_erase
 6 -rwxr-xr-x root/root   1730100 2010-01-21 19:30 install_a
 7 -rwxr-xr-x root/root    163948 2010-01-21 19:30 mkfs.jffs2
 8 -rwxr-xr-x root/root     56936 2010-01-21 19:30 nandwrite
 9 drwxr-xr-x root/root         0 2010-01-21 19:30 package1/
10 -rw-r--r-- root/root    797104 2010-01-21 19:30 package1/bluecore.audio.lzma
11 -rwxr--r-- root/root  10260480 2010-01-21 19:30 package1/squashfs1.img
12 -rw-r--r-- root/root    632911 2010-01-21 19:30 package1/bluecore.video.lzma
13 -rw-r--r-- root/root    988127 2010-01-21 19:30 package1/vmlinux.develop.avhdd.mars.bin.lzma
14 -rw-r--r-- root/root      2064 2010-01-21 19:30 package1/usr.local.etc.tar.bz2
15 -rwxr-xr-x root/root   1623760 2010-01-21 19:30 video_firmware.install.bin

其中有个configuration.xml文件,看一下
 1 <?xml version="1.0" encoding="ISO-8859-1" ?>
 2 <packageFile>
 3     <info>
 4         <company>Realtek Semiconductor Corp.</company>
 5         <description>This image file contains 2 Mars packages. One is for AVHDD on NOR and the other is for AVHDD on NAND.</description>
 6         <version>0.0.1</version>
 7         <releaseDate>01/21/10 19:30</releaseDate>
 8         <signature>MARS AVHDD on NOR or NAND</signature>
 9     </info>
10     <installerAP>
11         <fileName>install_a</fileName>
12     </installerAP>
13     <package>
14         <info>
15             <description>This is Mars AVHDD on NOR</description>
16             <version>N/A</version>
17         </info>
18         <flash>
19             <image type="linuxKernel">
20                 <fileName>package1/vmlinux.develop.avhdd.mars.bin.lzma</fileName>
21                 <targetAddress>0x80100000</targetAddress>
22                 <version>SVN:</version>
23             </image>
24             <image type="audioKernel">
25                 <fileName>package1/bluecore.audio.lzma</fileName>
26                 <targetAddress>0x81b00000</targetAddress>
27                 <version>N/A</version>
28             </image>
29             <image type="videoKernel">
30                 <fileName>package1/bluecore.video.lzma</fileName>
31                 <targetAddress>0x81d80000</targetAddress>
32                 <version>N/A</version>
33             </image>
34             <image type="squash">
35                 <fileName>package1/squashfs1.img</fileName>
36                 <mountPoint>/</mountPoint>
37             </image>
38             <image type="jffs2">
39                 <fileName>package1/usr.local.etc.tar.bz2</fileName>
40                 <sizeBytesMin>0x50000</sizeBytesMin>
41                 <mountPoint>/usr/local/etc</mountPoint>
42             </image>
43         </flash>
44     </package>
45 </packageFile>

install_a 是固件安装程序
下面3个文件是我们最关心的,自制固件就是通过修改/替换它们来实现的:
1) vmlinux.develop.avhdd.mars.bin.lzma 是Linux内核,用lzma压缩的二进制文件。
2) squashfs1.img是根文件系统,类型为squashfs,一种压缩的只读文件系统。
3) usr.local.etc.tar.bz2包含一些系统配置文件,其内容将会被复制到可读写的文件系统/usr/local/etc下。

用unsquashfs命令解开squashfs1.img
$ unsquashfs squashfs1.img
解开的文件系统放在squashfs-root目录下,麻雀虽小,五脏具全,目录结构如下(只列出目录名):
 1 $ find squashfs-root -type d
 2 squashfs-root                                                                       
 3 squashfs-root/bin                                                                   
 4 squashfs-root/dev                                                                   
 5 squashfs-root/etc                                                                   
 6 squashfs-root/etc/reexec_init                                                       
 7 squashfs-root/etc/init.d                                                            
 8 squashfs-root/etc/dvdplayer                                                         
 9 squashfs-root/etc/dvdplayer/script                                                  
10 squashfs-root/lib                                                                   
11 squashfs-root/lib/modules                                                           
12 squashfs-root/lib/modules/2.6.12.6-VENUS                                            
13 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel                                     
14 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/fs                                  
15 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/fs/ptp                              
16 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/fs/udf                              
17 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/fs/vcd                              
18 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/fs/ufsd                             
19 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/fs/isofs                            
20 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/net                                 
21 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/net/ipv4                            
22 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers                             
23 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net                         
24 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net/wireless                
25 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net/wireless/realtek        
26 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net/wireless/realtek/rtl8187
27 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net/wireless/realtek/rtl8187/ieee80211
28 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net/wireless/realtek/rtl8187/rtl8187  
29 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net/wireless/realtek/11n8709          
30 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net/wireless/realtek/11n8709/HAL      
31 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net/wireless/realtek/11n8709/HAL/rtl8192u
32 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net/wireless/realtek/11n8709/ieee80211   
33 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net/wireless/realtek/rtl8191su           
34 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net/wireless/realtek/rtl8191su/HAL       
35 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net/wireless/realtek/rtl8191su/HAL/rtl8192u
36 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/net/wireless/realtek/rtl8191su/ieee80211   
37 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/usb                                        
38 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/usb/net                                    
39 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/usb/host                                   
40 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/drivers/scsi                                       
41 squashfs-root/lib/modules/2.6.12.6-VENUS/kernel/crypto                                             
42 squashfs-root/mnt                                                                                  
43 squashfs-root/mnt/rd                                                                               
44 squashfs-root/mnt/hda                                                                              
45 squashfs-root/mnt/hdb                                                                              
46 squashfs-root/mnt/hdc                                                                              
47 squashfs-root/mnt/hdd                                                                              
48 squashfs-root/tmp                                                                                  
49 squashfs-root/sys                                                                                  
50 squashfs-root/usr                                                                                  
51 squashfs-root/usr/bin                                                                              
52 squashfs-root/usr/sbin                                                                             
53 squashfs-root/usr/local                                                                            
54 squashfs-root/usr/local/bin                                                                        
55 squashfs-root/usr/local/bin/DVD                                                                    
56 squashfs-root/usr/local/bin/Resource                                                               
57 squashfs-root/usr/local/bin/Resource/bmp                                                           
58 squashfs-root/usr/local/bin/Resource/TT_Font                                                       
59 squashfs-root/usr/local/bin/Resource/CC_Font                                                       
60 squashfs-root/usr/local/bin/Resource/dtv_table                                                     
61 squashfs-root/usr/local/etc                                                                        
62 squashfs-root/usr/local/etc/hdd.old                                                                
63 squashfs-root/usr/local/etc/hdd.old/root                                                           
64 squashfs-root/usr/local/etc/hdd.old/root/lock                                                      
65 squashfs-root/usr/local/etc/hdd.old/root/recovery
66 squashfs-root/usr/local/etc/hdd.old/dvdvr
67 squashfs-root/usr/local/etc/hdd.old/fat32
68 squashfs-root/usr/local/etc/hdd.old/livepause
69 squashfs-root/usr/local/etc/dvdplayer
70 squashfs-root/usr/local/lib
71 squashfs-root/usr/local/sbin
72 squashfs-root/usr/local/firmware
73 squashfs-root/proc
74 squashfs-root/sbin
75 squashfs-root/tmp_orig
76 squashfs-root/tmp_orig/lib
77 squashfs-root/tmp_orig/lib/hotplug
78 squashfs-root/tmp_orig/log
79 squashfs-root/tmp_orig/log/dvdplayer
80 squashfs-root/tmp_orig/www
81 squashfs-root/tmp_orig/www/adm
82 squashfs-root/tmp_orig/www/cgi-bin
83 squashfs-root/tmp_orig/lock
84 squashfs-root/tmp_orig/lock/subsys
85 squashfs-root/tmp_orig/lock/hotplug
86 squashfs-root/tmp_orig/lock/hotplug/mount_tmp
87 squashfs-root/tmp_orig/lock/hotplug/rename_tmp
88 squashfs-root/tmp_orig/lock/hotplug/convert_tmp
89 squashfs-root/tmp_orig/ramfs
90 squashfs-root/tmp_orig/ramfs/labels
91 squashfs-root/tmp_orig/ramfs/volumes
92 squashfs-root/tmp_orig/usbmounts


了解了这些,我们已经具备了自制固件的基本条件了。
posted on 2010-03-16 09:29 gouzhuang 阅读(3835) 评论(1)  编辑 收藏 引用 所属分类: 嵌入式Linux

评论

# re: 固件解析(Firmware Dissected) 2012-07-20 08:08 siwei
gouzhuang你好,请问一下如果移除不需要的无线网卡驱动有多大价值?另外那些新浪,优酷的在线播放应用大致可能是放在哪个位置?谢谢啦。  回复  更多评论
  

只有注册用户登录后才能发表评论。