ãœãããŠã§ã¢ã¯ã«ã¡ã©ãããã¯ããã«é »ç¹ã«æŽæ°ããããããåŸã§è§Šããå¿ èŠã®ãªãå Žæãç·šéããããšã¯çã«ããªã£ãŠããŸãã ãã®ãããã«ã¡ã©ã®åŽé¢ããä¿®æ£ããŸãã
ããªããžãããç 究
ãŸãæåã«ã ææ°ã®ãã¡ãŒã ãŠã§ã¢ ïŒç§ã®å Žåã¯firmware_TS38ABFG031-ONVIF-P2P-V2.5.0.6_20140126120110.binïŒã䜿çšããŠããããäœã§ãããã調ã¹ãŸãã
$ file firmware_TS38ABFG006-ONVIF-P2P-V2.5.0.6_20140126120110.bin firmware_TS38ABFG006-ONVIF-P2P-V2.5.0.6_20140126120110.binïŒããŒã¿ $ du -b firmware_TS38ABFG006-ONVIF-P2P-V2.5.0.6_20140126120110.bin 15222724 firmware_TS38ABFG006-ONVIF-P2P-V2.5.0.6_20140126120110.bin $ xxd firmware_TS38ABFG006-ONVIF-P2P-V2.5.0.6_20140126120110.bin | é 0000000ïŒ4649 524d 5741 5245 6481 db15 c447 e800ãã¡ãŒã ãŠã§ã¢.... G .. 0000010ïŒ0300 0000 1406 0000 b0f1 1b00 4c21 815d ............ LïŒã] 0000020ïŒ5453 3338 4f45 4d41 4246 475f 4c49 4e55 TS38OEMABFG_LINU 0000030ïŒ5800 0000 0000 0000 0000 0000 0000 0000 X ............... 0000040ïŒ0000 0000 0000 0000 0000 0000 0000 0000 ................ 0000050ïŒ0000 0000 0000 0000 0000 0000 0000 0000 ................ 0000060ïŒ0000 0000 0000 0000 0000 0000 0000 0000 ................ 0000070ïŒ0000 0000 0000 0000 0000 0000 0000 0000 ................ 0000080ïŒ0000 0000 0000 0000 0000 0000 0000 0000 ................ 0000090ïŒ0000 0000 0000 0000 0000 0000 0000 0000 ................ $ binwalk firmware_TS38ABFG006-ONVIF-P2P-V2.5.0.6_20140126120110.bin 10é²æ°ã®èª¬æ -------------------------------------------------- -------------------------------------------------- --- 1556 0x614 uImageããããŒãããããŒãµã€ãºïŒ64ãã€ããããããŒCRCïŒ0xB21E2C9Fãäœææ¥ïŒ2013幎9æ22æ¥11:07:02 2013ãã€ã¡ãŒãžãµã€ãºïŒ1831280ãã€ããããŒã¿ã¢ãã¬ã¹ïŒ0x80008000ããšã³ããªãã€ã³ãïŒ0x80008000ãããŒã¿CRCïŒ0x1F4EFBABãOS ïŒLinuxãCPUïŒARMãã€ã¡ãŒãžã¿ã€ãïŒOSã«ãŒãã«ã€ã¡ãŒãžãå§çž®ã¿ã€ãïŒãªããã€ã¡ãŒãžåïŒ "Linux-2.6.18_pro500-davinci_IPNC" 14468 0x3884 gzipå§çž®ããŒã¿ãUnixãããæçµå€æŽæ¥ïŒSun Sep 22 11:07:02 2013ãæ倧å§çž® 1832900 0x1BF7C4 CramFSãã¡ã€ã«ã·ã¹ãã ããªãã«ãšã³ãã£ã¢ã³ãµã€ãº13389824ããŒãžã§ã³ïŒ2 sort_dirs CRC 0xc832a8c3ããšãã£ã·ã§ã³0ã7334ãããã¯ã2607ãã¡ã€ã«
ãã®ããããã®åœ¢åŒã¯äžæã§ããããFIRMWAREããšããéå§ã©ãã«ã¯ããããç¬èªã®ãã®ã§ãããšããèããåŒã³èµ·ãããŸããuImageå ã®ã«ãŒãã«ãšcramfsã®ååšã¯ãå®éã«ã¯åçŽãªãã®ã§ããããšã瀺åããŠããŸãã TS38OEMABFG_LINUXè¡ã®ååšã¯ããããã¢ãŒã«ã€ãã®ããããŒãžã§ã³ãæãèµ·ãããããã®ã§ããããšã瀺åããŠããŸãã
ãããããã©ããæ¢ãããèŠã€ããå¿ èŠããããŸãããããããã¡ã€ã«ã·ã¹ãã ãåŒãåºããŠãåå ã¢ãžã¥ãŒã«ãæ¢ããŸãã
$ dd if = firmware_TS38ABFG006-ONVIF-P2P-V2.5.0.6_20140126120110.bin bs = 1832900 skip = 1 of = cramfs 7 + 1ã¬ã³ãŒããåä¿¡ããŸãã 7 + 1ã¬ã³ãŒããéä¿¡ãããŸãã 13389824ãã€ãïŒ13 MBïŒã³ããŒã0.161755ç§ã82.8 MB /ç§ $ fakeroot cramfsck -x fs cramfs $ grep LIVE555 -R fs / fs / opt / topsee / rtsp_streamerãã€ããªããã $æååfs / opt / topsee / rtsp_streamer | grep TCP sendRTPOverTCP 12RTCPInstance sendRTPOverTCPã倱æããŸãããsockïŒïŒ dãchnïŒïŒ d RTCPã€ã³ã¹ã¿ã³ã¹ã§ã¯ãªã RTCPInstance :: RTCPInstanceãšã©ãŒïŒtotSessionBWãã©ã¡ãŒã¿ãŒã¯ãŒãã§ãã£ãŠã¯ãªããŸããïŒ RTP / AVP / TCP ïŒ sTransportïŒRTP / AVP / TCP;ãŠããã£ã¹ã;å®å =ïŒ s;ãœãŒã¹=ïŒ s;ã€ã³ã¿ãŒãªãŒã=ïŒ d-ïŒ d / TCP;ãŠããã£ã¹ã RTCPãœã±ããã®äœæã«å€±æããŸããïŒããŒãïŒ dïŒ MediaSession :: beginïŒïŒïŒRTPããã³RTCPãœã±ãããäœæã§ããŸãã RTCPã€ã³ã¹ã¿ã³ã¹ã®äœæã«å€±æããŸãã ããã§RTCPãBYEããåä¿¡ããŸãã 18RTCPMemberDatabase
ã»ã»ã»ïŒ ãSendRTPOverTCPã倱æããŸãããsockïŒïŒ dãchnïŒïŒ dãã¯ãã³ãŒãããããã°åºåã§å€æãããããšã瀺ããŠããŸããã€ãŸããäœæ¥éãæ¡éãã«åæžãããŸãã
ãããã£ãŠãæ¢ããŠãããšã©ãŒãå«ãã¢ãžã¥ãŒã«ããããã°è¡ãå éšã«ããã¢ãžã¥ãŒã«ããããŸããããã¯ããµã€ãºå€æŽã®ããã»ã¹ãå€§å¹ ã«ç°¡çŽ åãããããšãæå³ããŸãã
ããŒã«ãªãŒãŒã·ã§ã³ãšåé¡ã®ä¿®æ£
ã¢ãžã¥ãŒã«ãéã¢ã»ã³ãã©ãŒã«ããŒãããOverTCPã䜿çšããŠãããã°è¡ãæ¢ããããããã³ãŒããæ¢ããŠåºåããŸã=> sendRTPOverTCPé¢æ°ãèŠã€ãããŸããã
ãããèŠããšãsendïŒïŒé¢æ°ãžã®2ã€ã®åŒã³åºããããã«ããããŸãã1ã€ã¯4ãã€ãããã1ã€ã¯å ¥åã«æž¡ããããããã¡ãŒã§ãã ããã¯ãæãå€ãããŒãžã§ã³ã§ã¯ãªããããã§ã«ãããã¡ãŒãçµ±åããããsendDataOverTCPé¢æ°ããŸã äœæããŠããªãå ŽåïŒå®è£ ã®éãã®è©³çŽ°ã«ã€ããŠã¯ã æåŸã®<postãåç §ããŠãã ããïŒ
ããã§åé¡ãçºçããŸããå®éã«ã¯äœçœããªãïŒãã¡ã€ã«å ã«ç©ºãã¹ããŒã¹ããªãïŒãšãã«ããã€ããªåœ¢åŒã§ãã°ãä¿®æ£ããæ¹æ³ãæããŠãã ããã
sendDataOverTCP-sendPacketãåŒã³åºãäžèšã®é¢æ°ã«ç§»åããŸãã ã³ãŒãã¯ããŒãžã§ã³ããšã«å€æŽããããæ¬è³ªçã«åãã§ã-foreachïŒã¹ããªãŒã ïŒ{sendDataOverTCPïŒãã±ãããã¹ããªãŒã ïŒ}ã
幞ããªããšã«ãã³ãŒãã¯ãããã°fprintsã§geneãã¿ãªãè©°ã蟌ãŸããŠããŸããã 以äžã«ããã®ã«ãŒãããã€ããªåœ¢åŒã§ã©ã®ããã«èŠãããã瀺ããŸãã
loop_next_5FAE4: LDR R4, [R4,#4] CMP R4, #0 BEQ loc_5FB68 loop_body_5FAF0: MOV R3, R4 MOV R1, R5 MOV R2, R7 MOV R0, R6 BL sendRTPOverTCP CMP R0, #0 BGE loop_next_5FAE4 MOV R1, #0 LDR R2, =aS_10 ; "%s(): " LDR R3, =aSendpacket ; "sendPacket" MOV R0, #STDERR_FILENO BL fprintf_0 LDRB R12, [R4,#0xC] LDR R3, [R4,#8] MOV R1, #7 LDR R2, =aSendrtpovert_0 ; "sendRTPOverTCP failed, sock: %d, chn: %"... MOV R0, #STDERR_FILENO STR R12, [SP,#0x350+var_350] BL fprintf_0 ......
ããã¯å®éã«ã¯æãã§ãïŒ ãããã°ããŒã¹ãåãåãã ãã§ã12åœä»€åã®ã¹ããŒã¹ãåŸãããŸãïŒARMã«ã¯ãã¹ãŠã®åœä»€ãæ£ç¢ºã«4ãã€ããããããã¯éåžžã«åªããŠããŸãïŒã
ãããã£ãŠãç¶æ³ãæ¹åããããã«äœããããããã®12ã®æ瀺ããããŸãã ã§ãäœïŒ ããã§ææ°ããŒãžã§ã³ããsendDataOverTCPã³ãŒããå®å šã«ããã·ã¥ããããšã¯éåžžã«å°é£ã§ã...
åæ¢ããŸããã ãªãã§ïŒ æ£ããsendDataOverTCPãã©ãŒã ã䜿çšããŠããªãæªããšè©³çŽ°ã«èª¬æããŠããããã§ã...ãããŠéãããªããã°ãåã«makeSocketBlockingïŒïŒ.. makeSocketNonBlockingïŒïŒã§åŒã³åºããã©ããããªãã®ã§ããïŒ
å®éãã·ã¹ãã ãããã¡ã«å Žæãããå ŽåãsendïŒïŒã¯å³åº§ã«å®è¡ãããŸãã ã¹ããŒã¹ããªãå ŽåãsendDataOverTCPã®å®è£ ã¯ãã®ãŸãŸæ®ããŸãïŒãªããŒãã«åºå®ãããŠããã«æãèœã¡ãªãã®ã-åã®èšäºãåç §ïŒã
ãããïŒ fcntlé¢æ°ãããã°ããå·»ãæ»ããšã makeSocketBlockingãšmakeSocketNonBlockingãèŠã€ãããŸãã ãã®åŸ ãã©ã®ã³ãŒãã«ãªãããæç»ããŸãã
loop_next_5FAE4: LDR R4, [R4,#4] CMP R4, #0 BEQ loc_5FB68 loop_body_5FAF0: ; LDR R0, [R4,#8] BL makeSocketBlocking ; MOV R3, R4 MOV R1, R5 MOV R2, R7 MOV R0, R6 BL sendRTPOverTCP ; STMFD SP!, {R0} ; LDR R0, [R4,#8] BL makeSocketNonBlocking ; LDMFD SP!, {R0} ; CMP R0, #0 BGE loc_5FAE4 ; NOP NOP NOP NOP NOP NOP
ããããé©çšããã«ã¯ãã¢ãŒã ã®ããã¥ã¡ã³ããéããŠå¿ã®äžã§ç¿»èš³ããããå¥ã®ãã¡ã€ã«ã«ã³ãŒããèšè¿°ããŠç¿»èš³ããŸãïŒãã¹ãŠã®é·ç§»ïŒBL / BGE / ITDïŒãæ£ããåã«ãŠã³ããããããã«ãORGã§æ£ç¢ºãªã¢ãã¬ã¹ãèšå®ããããšãå¿ããªãã§ãã ããïŒã³ãŒãã§é©åãªæ瀺ãèŠã€ããã®ã§ãããã«åºã¥ããŠå¿ èŠãªãªãã³ãŒããèšç®ããŸããïŒARMãåããŠç·šéããŠããŸããç³ãèš³ãããŸããïŒã
ãã®çµæãç ŽæããTCPã¹ããªãŒã ãä¿è·ããããããéããããrtsp_streamerãååŸããŸãã
ã¯ãã ä»ããå°å³ãªçµã¿ç«ãŠ
ãã®ãããæ°ããrtsp_streamerãããããã¡ãŒã ãŠã§ã¢... binãçµã¿èŸŒãŸããŠããŸãã ãŸããããã¯ãã¹ãŠãç°¡åã ãšæãããŸãïŒcramfsã解åãããã¡ã€ã«ã眮ãæãããããå ã«æ»ããbinå ã§çœ®ãæããå¿ èŠããããŸãïŒ
$ fakeroot -s .fakeroot cramfsck -x repack cramfs $ cp rtsp_streamer repack / opt / topsee / $ fakeroot -i .fakeroot mkcramfs repack newcramfs $ dd if = firmware_TS38ABFG006-ONVIF-P2P-V2.5.0.6_20140126120110.bin of = firmware_new.bin bs = 1832900 count = 1 $ cat newcramfs >> firmware_new.bin
ååŸããfirmware_new.binãã«ã¡ã©... 0ãšãã§ã¯ãã«æ³šããŸãã ã«ã¡ã©ã¯ãã¡ãŒã ãŠã§ã¢ãé£ã¹ãŸãããäœãèµ·ãããŸããã äžå¿«ã§ãã ãã®ããããã®.binã®åœ¢åŒãç解ããå¿ èŠããããŸãã
16é²ãšãã£ã¿ã§éããkumekuãèµ·åããŸãã
ïŒ0ïŒ ããã¡ãŒã ãŠã§ã¢ã-100ïŒ ããããŒã8ãã€ãã
ïŒ8ïŒ 64 81 DB 15-4ãã€ããç®çã¯æ確ã§ã¯ãããŸããã ã«ãã-ãã§ãã¯ãµã
ïŒ12ïŒ 0x00E847C4 = 15222724-ã¯ãã4ãã€ãããã¡ãŒã ãŠã§ã¢ã®ãµã€ãºã _new.binã確èªããŸã-ãããããµã€ãºã¯å€æŽãããŠããŸãããã€ãŸãããµã€ãºãšã¯é¢ä¿ãããŸããã
ïŒ16ïŒ 0x00000003-4ãã€ãxsäœã ããããŒããŒãžã§ã³ã¯ã§ããŸããïŒ
ïŒ20ïŒ 0x00000614 = 1556-ãããã£ãŠãããã¯å éšã®ã³ã¢ãžã®å€äœã§ã
ïŒ24ïŒ 0x001BF1B0 = 1831344-ããã¯ã³ã¢ã®ãµã€ãºã§ãïŒ1831344 + 1556 = 1832900ïŒ
ïŒ28ïŒ 4C 21 81 5D-ããŒãã åã³ãã§ãã¯ãµã ã«äŒŒããã®ã
ïŒ32ïŒ ãTS38OEMABFG_LINUXããšãã®åŸã®ãŒãã®æ-100hãã€ããæããã«ã»ã¯ã·ã§ã³åã®å Žæ
ïŒ288ïŒ 0x001BF7C4 = 1832900-ã¯ãã次ã®ã»ã¯ã·ã§ã³ãžã®ãªãã»ãã
ïŒ292ïŒ 0x00CC5000 = 13389824-ã¯ããã»ã¯ã·ã§ã³ãµã€ãº
ïŒ296ïŒ ãTS38OEMABFG_V2.5.0.6ãããã³ãŒãã®æã¯äžéæã§ãã ã»ã¯ã·ã§ã³åã®äžã®100hãã€ãã
ãããããã®åã«ãã§ãã¯ãµã ã¯ãããŸããO_O
ïŒ552-1556ïŒ -å€èŠ³ãäžæãªãã®ã
ã ãããããããã®ãã€ã³ãã¯æããã§ãã cramfsã®ãµã€ãºã¯å€æŽãããŠããŸãããã€ãŸãããããã¯ãµã€ãºã§ã¯ãªãããããã§ãã¯ãµã ã§ãã
ã«ãŒãã«ãæœåºãããã®é·ã4ãã€ãã®ãã§ãã¯ãµã ãèæ ®ããŸãã
$ dd if = firmware_TS38ABFG006-ONVIF-P2P-V2.5.0.6_20140126120110.bin of = kernel bs = 1 skip = 1556 count = 1831344 $ crc32ã«ãŒãã« 5d81214c
ãŸãããŸã...ãªãã»ãã28ã§ã¡ããã©0x5D81214Cã ã©ãããŒã¯æšæºã®CRC32ã§ãã 幞éãªã®ã¯ãæšæºããŒã«ã¯ãããæ°ããæ¹æ³ããç¥ããªãããã§ãã ããã§ãªããã°ãç§ã¯Pythonãå®è¡ãããã§ã«ãããé£ããããšèããªããã°ãªããŸãã:)
ãããã£ãŠãç§ãã¡ãæã£ãŠãããã§ãã¯ãµã ã¯crc32ã§ãã ãããŠãå ã®cramfsã®ãã§ãã¯ãµã ã¯äœã§ããïŒ.. 37499eefã ãŸããŸãã ãªãã»ãã552ã§ã¯ã0x37499eefãæžã蟌ãŸããŸãã ãã®ãããäœããã®çç±ã§ããã¡ã€ã«ã·ã¹ãã ã®ããŒãã£ã·ã§ã³åã®åŸã®ãã§ãã¯ãµã ãæžã蟌ãŸããŸãã ããŠãäœãå¿ èŠãªã®ããèªãã«æã£ãŠããŸããã ãã¬ãŒãã®æŽæ°ïŒ
ïŒ28ïŒ 0x5D81214C-crc32ã«ãŒãã«ããŒãã£ã·ã§ã³
ïŒ552ïŒ 0x37499eef-crc32ããŒãã£ã·ã§ã³FS
ïŒ556-1556ïŒ -å€èŠ³ãäžæãªãã®
crc32 newcramfsãæ°ãçŽãã16é²æ°ã®ãšãã£ã¿ãŒã§ããã€ããªãŒã®ãªãã»ãã552ã«å ¥åããã«ã¡ã©ã«å ¥åããŸãã
ãããŠ...äœãO_Oã ã ãããæèœã¯å€±æããŸããã§ãã-ãªãã»ãã8ã§ã¯æ¬åœã«crc32ã§ãããäœããã§ããïŒ
ããã§ç§ãã¡ã¯åçŽã«è¡åããŸã-ç·åœããæ»æãéå§ããŸãã
$ python >>> zlib import crc32ãã >>> d =ãªãŒãã³ïŒ "firmware_TS38ABFG006-ONVIF-P2P-V2.5.0.6_20140126120110.bin"ãââ "r"ïŒãreadïŒïŒ >>> hexïŒcrc32ïŒd [12ïŒ]ïŒïŒ '-0x781aca29'ïŒããã >>> hexïŒcrc32ïŒd [12ïŒ1556]ïŒïŒ '-0x6f8f1744'ïŒããã >>> hexïŒcrc32ïŒd [0ïŒ8] + d [12ïŒ1556]ïŒ '0x6d29f056'ïŒããã >>> hexïŒcrc32ïŒd [0ïŒ8] + d [12ïŒ]ïŒïŒ '-0x652ac4fd'ïŒããã >>> hexïŒcrc32ïŒd [0ïŒ8] + "\ 0 \ 0 \ 0 \ 0" + d [12ïŒ1556]ïŒïŒ '0x15db8164'ïŒãšã©ãŒ ããïŒ
ãããã£ãã ãããã£ãŠããã¬ãŒããæŽæ°ããŸãã
ïŒ8ïŒ 0x15DB8164-CRC32ããããŒïŒæåã®1556ãã€ãïŒãæåã«ãã®ãã£ãŒã«ãããã«ã«ãã
ãã®ãããPythonã§ããã«ãããããŒfirmware_new.binããcrc32ããã°ããã«ãŠã³ãããæåã«16é²ãšãã£ã¿ãŒã«æžã蟌ã¿ãŸãã
ã«ã¡ã©ã«æ³šã...圌女ã¯åèµ·åã«å ¥ããŸãã ãããŠçããªã...çããªã...å¥ã®ã¬ã³ã¬...ããïŒ ping goïŒ ãµã
cam-resync.pyãååŸããåã³ã«ã¡ã©ãã¹ãã£ãã¯ã§åºå®ããŸãã ãããŠ...ãããŠã¹ããªãŒã ã¯å£ããŸããïŒ ããã«ãæåã®è©Šè¡ã§ïŒ Wiiii :)
ãã³ã«å¡ãããŠããããã§ã«é£ã¹ãããšãã§ããŸãããäœããæ£ãããããŸãã
äžæ¹ãåè¿°ã®Andrei Syomochkinã¯ãä¿®æ£ããrtsp_streamerã§ãã¡ãŒã ãŠã§ã¢ãåéããåé¡ã®ããã«ã¡ã©ã®1ã€ã«ã¢ããããŒãããŸããã ãã®çµæãUDPã§ãã±ããã倱ã£ããšããšåãããã«ããã¹ãã¯ã¹ããªãŒã ãå£ããªãããšã瀺ããŸãããããããªã¢ãŒãã£ãã¡ã¯ããå§ãŸããŸããã ç§ã¯ãã®ãããªãã®ãäœãåã蟌ãŸãªãã£ãã®ã§ãç§ã¯ãããäœã§ãããèå³ããããŸãã-ç§ã¯åã³ã³ãŒãã調ã¹ãªããã°ãªããŸããã§ããã ãŸããæååãèŠãŠãã ãããããããã®ãããã°è¡ããããŸãã ãïŒ dç§ã®CheckBufferTimeout !!!ãããïŒ dmsãè¶ ãããããã¡ããŒã¿ããã¹ãŠã®ãããã¡ããŒã¿ãåé€!!!ãã
ããïŒ ã¡ãŒã«ãŒããªãŒããŒãããŒä¿è·ãè¡ã£ãŠããããšãããããŸããïŒ ãŸããäœããã®çç±ã§åæéä¿¡ïŒïŒãå¿ èŠä»¥äžã«ãã³ã°ã¢ããããŠããå ŽåïŒããã©ã«ãã§ã¯1ç§ïŒãè¶ éåã¯ãããããããŸãã ããã¯ãèããã£ãã«ã«åãŸããªãå Žåã«OOMãšãããªã®é 延ããä¿è·ããŸãã ãããããã³ããããã³ã°ãœã±ãããšsendïŒïŒã䜿çšããŠãããããã³ãŒãã¯æããã«ä»¥åã¯æ©èœããŠããŸããã§ããã
Blocking ... NonBlockingã§ã©ããããåŸãã³ãŒãã¯æ©èœãå§ããŸãã:)
ãã ããå°ããªåé¡ããããŸãã1ç§ã§ã¯äžååã§ãã ãã£ãã«ãæ éãå§ããããååã«åãå Žåãããããã®ç¢ºçã¯ãã匷ããªããŸãã ãã®ãããªããããã®åŸããããªã¯ããŒãã¬ãŒã ã®åŸã«ã®ã¿åŸ©å ãããŸãã éåžžãããŒãã¬ãŒã ã¯éåžžã«ãŸãã§ãïŒ5ã10ç§ããšã«1åïŒ...ãããŠäžå¿«ãªç¶æ³ãå€æããŸã-é害ãçºçããå Žåã次ã®ããŒãã¬ãŒã ãŸã§5ã10ç§åŸ ã£ãŠãããããªã修埩ããå¿ èŠããããŸãã ããŒãã¬ãŒã ã®åšæ³¢æ°ãäžãããšãããŒãã¬ãŒã ãéåžžã«åããããéä¿¡ãããããŒã¿ã®éãèªåçã«å¢å ããŸããã€ãŸãããã£ãã«ãæ»ã¬é »åºŠãé«ããªããŸãã æªåŸªç°ã
äžè¬ã«ããããã¡ãªã³ã°ã¿ã€ã ã¢ãŠãã10ç§ã«è¿œå ããŸãããããã¯OOMããã£ããããã«ã¯ååã§ã¯ãããŸããããéå®å®ãã£ãã«ã§ã®åéä¿¡ãšé 延ãéãã«ééããã«ã¯ååãªã¯ãã§ãã
ãšããã§ãã "ãªãæ²»çã¢ã«ãŽãªãºã
ååã®èšäºã§ãç¶æ³ãä¿®æ£ããã®ãã©ãã»ã©ç°¡åããäŒãããšçŽæããŸããã 解決çã¯ãã§ã«ãããŒãã®ãããªãã®ã§ããRTPãã±ãããéä¿¡ãããããããããã«ã¿ã€ã ã¹ã¿ã³ãããããŸãã ãã±ããã®æå¹æéãéä¿¡ããåã«sendRTPorRTCPPacketOverTCPããã§ãã¯ã€ã³ããã ãã§ååã§ããèšå®ãããæå¹æéãããçãå ŽåïŒTCPã§ã¯1ç§ã§ã¯äžååã ãšæããŸãã6ã10ç§ã§ããå¿ èŠããããŸãïŒã
çµç«å解ã®èªåå
æ®ã£ãŠããã®ã¯ããã¡ãŒã ãŠã§ã¢ã®çµã¿ç«ãŠãšå解ãèªååããããšã ãã§ãã
unpack.sh
é衚瀺ã®ããã¹ã
fw=${1?Please give firmware bin as argument} if [ -e $fw.unpack ]; then echo "Already exists: $fw.unpack" exit 1 fi # Check format if [ "$(dd if=$1 bs=8 count=1 2>/dev/null)" != "FIRMWARE" ]; then echo "Wrong file" exit 1 fi mkdir -p $fw.unpack echo "Extract header..." dd if=$1 of=$fw.unpack/00header bs=1556 count=1 2>/dev/null echo "Extract kernel..." ksize=$(dd if=$1 bs=1 count=4 skip=24 2>/dev/null | perl -e 'print unpack("l", <>);') dd if=$1 of=$fw.unpack/01kernel bs=1 skip=1556 count=$ksize 2>/dev/null echo "Extract filesystem..." foff=$(dd if=$1 bs=1 count=4 skip=288 2>/dev/null | perl -e 'print unpack("l", <>);') dd if=$1 of=$fw.unpack/02cramfs bs=$foff skip=1 2>/dev/null echo "Unpack filesystem..." cd $fw.unpack fakeroot -s .fakeroot cramfsck -x root 02cramfs chmod +r -R root/ echo "Done"
ã¿ã€ãã«éšåã®æå³ãããããªããããã«ã¡ã©ã殺ããªãããã«ä»»æã®éšåãåéããããšã¯ã§ããŸããããããã£ãŠããã¹ãŠã®éšåããã®ãŸãŸä¿åããŸãã
ãã¡ãŒã ãŠã§ã¢å ã«ãããã¯ããã³ãã®ä»ã®ããã€ã¹ããããããåçŽãªãŠãŒã¶ãŒããã¯æäœã§ããŸããã ãããããã®åŸfakerootãå©ããšãªããå€éšãã¡ã€ã«ã«ç¶æ ãä¿åã§ããŸãã ãããã£ãŠãfakerootã䜿çšããŠè§£åããŸãã
ãã ããããã«ã¯åŸ®åŠãªåé¡ããããŸã-æåŸã«ããã¡ã€ã«ã¯çŸåšã®ãŠãŒã¶ãŒãèªã¿åãããšãã§ããã¯ãã§ãã ãå®éã®ãã«ãŒãã§ããã°ããchmod -rãã§ãã£ãŠããã¡ã€ã«ãç°¡åã«èªã¿åãããšãã§ããŸãã ããããfakerootã¯ãã®ãããªãã¡ã€ã«ãå£ããŸãã ãããã£ãŠã解ååŸããã«ããã¹ãŠã®ãã¡ã€ã«ã®èªã¿åãæš©éãå€æŽããŸãã ãã ããæ£ããã¢ã¯ã»ã¹æš©ã¯fakerootç¶æ ãã³ãã«ä¿åããããããéã¢ã»ã³ããªã¯ãã¿ã³ãšé³ŽããŸãã
æ®ãã®å±éã«ã¯ãèå³æ·±ãç¹ã¯ãããŸããã
pack.sh
é衚瀺ã®ããã¹ã
dir=${1?Please give path to a directory with unpacked firmware} nfw=${2?Please give name for a newly packed firmware} if [ ! -e $dir ]; then echo "Directory not exists: $dir" exit 1 fi if [ -e $nfw ]; then echo "Firmware already exists: $nfw" exit 1 fi # repack cramfs if [ ! -e $dir/02cramfs.bak ]; then mv $dir/02cramfs $dir/02cramfs.bak 2>/dev/null fi fakeroot -i $dir/.fakeroot mkcramfs $dir/root/ $dir/02cramfs # construct new firmware dd if=$dir/00header bs=1556 of=$nfw conv=notrunc 2>/dev/null # remove old header crc32 dd if=/dev/zero bs=1 seek=8 count=4 of=$nfw conv=notrunc 2>/dev/null # save kernel size if [ $(stat -c %s $dir/01kernel) -ge 2097152 ]; then echo "WARN: size of kernel is more than 0x200000. FW probably will not flash" fi perl -e 'print pack("l", -s "'$dir/01kernel'")' | dd bs=1 seek=24 count=4 of=$nfw conv=notrunc 2>/dev/null # save kernel crc32 crc32 $dir/01kernel | perl -e 'print pack("l", oct("0x".<>));' | dd bs=1 seek=28 count=4 of=$nfw conv=notrunc 2>/dev/null # save fs offset perl -e 'print pack("l", 1556+(-s "'$dir/01kernel'"))' | dd bs=1 seek=288 count=4 of=$nfw conv=notrunc 2>/dev/null # save fs size if [ $(stat -c %s $dir/02cramfs) -lt 8388608 ]; then echo "WARN: size of filesystem is less than 0x800000. FW probably will not flash" fi if [ $(stat -c %s $dir/02cramfs) -ge 15728640 ]; then echo "WARN: size of filesystem is more than 0xF00000. FW probably will not flash" fi perl -e 'print pack("l", -s "'$dir/02cramfs'")' | dd bs=1 seek=292 count=4 of=$nfw conv=notrunc 2>/dev/null # save fs crc32 crc32 $dir/02cramfs | perl -e 'print pack("l", oct("0x".<>));' | dd bs=1 seek=552 count=4 of=$nfw conv=notrunc 2>/dev/null # save full FW size perl -e 'print pack("l", 1556+(-s "'$dir/02cramfs'")+(-s "'$dir/01kernel'"))' | dd bs=1 seek=12 count=4 of=$nfw conv=notrunc 2>/dev/null # Update header crc32 crc32 $nfw | perl -e 'print pack("l", oct("0x".<>));' | dd bs=1 seek=8 count=4 of=$nfw conv=notrunc 2>/dev/null # concat rest cat $dir/01kernel >> $nfw cat $dir/02cramfs >> $nfw echo "Done"
ããããããã±ãŒãžã³ã°ã¯ââãã§ã«ããå°ãè€éã§ãã cramfsãããã¯ããã¯ããåã ã®ãã¡ã€ã«ã®é·ããšããããŒã®åèšé·ãæŽæ°ããå¿ èŠããããŸãã èŠåºããå«ããã§ãã¯ãµã ãæ°ãçŽããŠããããã¹ãŠãäžç·ã«ããŒãžããŸãã
äžè¬ã«ãã«ã¡ã©ã¯èªåã§å¢çå€ããã§ãã¯ããŸããã䟿å®äžããã¡ã€ã«ã·ã¹ãã ã®å¢çãšã«ãŒãã«ãµã€ãºã®ãã§ãã¯ãè¿œå ããŸãããããã«ãããã¢ã»ã³ããªäžã«ãµã€ãºããããå ŽåãèŠåã衚瀺ããããã¡ãŒã ãŠã§ã¢ããäœåãªããŒã«ãåé€ãããŸãã
åŽåã®çµæ
ããã§ãææ°ããŒãžã§ã³2.5.0.6ã®æ¬¡ã®ããããé©çšããããã¡ãŒã ãŠã§ã¢ãåéããŸããã
- firmware_TS38ABFG006-ONVIF-P2P-V2.5.0.6_20140126120110-TCPFIX.bin
- firmware_TS38CD-ONVIF-P2P-V2.5.0.6_20140126121011-TCPFIX.bin
- firmware_TS38HI-ONVIF-P2P-V2.5.0.6_20140126121444-TCPFIX.bin
- firmware_TS38LM-ONVIF-P2P-V2.5.0.6_20140126121913-TCPFIX.bin
- firmware_HI3518C-V4-ONVIF-V2.5.0.6_20140126124339-TCPFIX.bin
åãã¡ãŒã«ãŒã®ä»ã®ã¢ãžã¥ãŒã«ã®ä¿®æ£ãçªç¶å¿ èŠã«ãªã£ãå Žåã¯ãã³ã¡ã³ãã«æžããŠãã ãããå¯èœã§ããã°è¡šç€ºããŸãã
psïŒãããã®ãã¡ãŒã ãŠã§ã¢ããäœãä»ã®ãã®ãå¿ èŠãšãã人ã¯èª°ã§ãããã䟿å©ãªå Žæ-githubã«ã¹ã¯ãªãããæçš¿ããŠããŸãã