{"id":263652,"date":"2015-08-16T20:14:02","date_gmt":"2015-08-16T16:14:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=263652"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=263652","title":{"rendered":"\u0418\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c OpenWRT: \u0447\u0435\u043c \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0437\u044b uImage \u0438 sysupgrade"},"content":{"rendered":"<p>     \t<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d90\/9e5\/26b\/d909e526b8034f0bb821806160cc0c32.jpg\"\/><br \/>  \u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"http:\/\/habrahabr.ru\/post\/264025\/\">\u201c\u041f\u0440\u043e\u0448\u0438\u0432\u0430\u0435\u043c \u0440\u043e\u0443\u0442\u0435\u0440 Upvel UR-313N4G \u043d\u0430 OpenWRT\u201d <\/a> \u043c\u0435\u0436\u0434\u0443 \u0432\u0430\u0448\u0438\u043c \u043f\u043e\u043a\u043e\u0440\u043d\u044b\u043c \u0441\u043b\u0443\u0433\u043e\u0439 \u0438 \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u043c  <a href=\"http:\/\/habrahabr.ru\/users\/maysoft\/\" class=\"user_link\">Maysoft<\/a> \u0437\u0430\u0432\u044f\u0437\u0430\u043b\u0441\u044f \u0441\u043f\u043e\u0440 \u043d\u0430\u0441\u0447\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 uImage \u0438 sysupgrade \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 OpenWRT. \u042f \u043e\u0431\u0435\u0449\u0430\u043b  <a href=\"http:\/\/habrahabr.ru\/users\/maysoft\/\" class=\"user_link\">Maysoft<\/a> \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435, \u0438 \u0432\u043e\u0442 \u043f\u0435\u0440\u0435\u0434 \u0432\u0430\u043c\u0438 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f.<\/p>\n<p>  \u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a OpenWRT \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b, \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u0438, \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u0434\u0432\u0443\u0445 \u0442\u0438\u043f\u043e\u0432 \u2014 uImage \u0438 sysupgrade, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  openwrt-15.05-rc3-ramips-rt305x-dir-320-b1-initramfs-uImage.bin<br \/>  openwrt-15.05-rc3-ramips-rt305x-dir-320-b1-squashfs-sysupgrade.bin<\/p>\n<p>  <a href=\"http:\/\/wiki.openwrt.org\/doc\/faq\/before.installation\">\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 FAQ<\/a> \u043f\u0438\u0448\u0435\u0442 \u043e\u0431 \u0438\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f\u0445 \u0432\u0435\u0441\u044c\u043c\u0430 \u0441\u043a\u0443\u043f\u043e:  <\/p>\n<blockquote><p>What is the difference between the different image formats?<br \/>  a factory image is one built for the bootloader flasher or stock software flasher<br \/>  a sysupgrade image (previously named trx image) is designed to be flashed from within openwrt itself<br \/>  The two have the same content, but a factory image would have extra header information or whatever the platform needs. Generally speaking, the factory image is to be used with the OEM GUI or OEM flashing utilities to convert the device to OpenWrt. After that, use the sysupgrade images.<\/p><\/blockquote>\n<p>  \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432 \u043e\u0431\u0440\u0430\u0437\u0435 factory \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0442 \u043e\u0431\u0440\u0430\u0437 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0448\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 Web-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438.<br \/>  <a name=\"habracut\"><\/a><br \/>  \u041e\u0442\u043b\u0438\u0447\u043d\u043e, \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u043f\u0440\u043e\u0448\u0438\u0432\u043e\u043a:<\/p>\n<p>  openwrt-15.05-rc3-ramips-rt305x-dir-320-b1-initramfs-uImage.bin \u2014 <i>3253035 \u0431\u0430\u0439\u0442.<\/i><\/p>\n<p>  openwrt-15.05-rc3-ramips-rt305x-dir-320-b1-squashfs-sysupgrade.bin \u2014 <i>3407876 \u0431\u0430\u0439\u0442.<\/i><\/p>\n<p>  \u041e\u0433\u043e, \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0430 sysupgrade \u043f\u043e\u0447\u0442\u0438 \u043d\u0430 140 \u041a\u0431 \u0431\u043e\u043b\u044c\u0448\u0435 uImage, \u0430 \u043f\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430, \u043f\u0440\u0438\u0447\u0435\u043c uImage \u0437\u0430 \u0441\u0447\u0435\u0442 \u044d\u0442\u043e\u0439 \u0441\u0430\u043c\u043e\u0439 \u201cextra header information\u201d \u2014 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0435.<\/p>\n<p>  \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0441\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f uImage \u0438 sysupgrade-\u043e\u0431\u0440\u0430\u0437\u044b, \u043d\u043e \u044d\u0442\u043e, \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u043d\u0435\u0441\u043f\u043e\u0440\u0442\u0438\u0432\u043d\u043e. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u201c\u0432 \u043b\u043e\u0431\u201d, \u043a\u0430\u043a \u0431\u0443\u0434\u0442\u043e \u0443 \u043d\u0430\u0441 \u043d\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432, \u0430 \u0443\u0436\u0435 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0437\u0430\u0433\u043b\u044f\u043d\u0435\u043c \u0432 \u0441\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0434\u0438\u0442\u044c \u043d\u0430\u0448\u0438 \u0434\u043e\u0433\u0430\u0434\u043a\u0438.<\/p>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043f\u0440\u043e\u0448\u0438\u0432\u043e\u043a \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430 binwalk, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430\u044f \u043f\u043e\u0434 Linux. \u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u0443\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u043f\u0440\u043e\u0448\u0438\u0432\u043e\u043a \u043f\u043e\u043a\u043e\u0440\u043e\u0447\u0435, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u043c \u0431\u044b\u043b\u043e \u0443\u0434\u043e\u0431\u043d\u0435\u0435, \u0438 \u043d\u0430\u0447\u043d\u0435\u043c \u0430\u043d\u0430\u043b\u0438\u0437.<\/p>\n<pre><code class=\"bash\">&gt; binwalk .\/uImage.bin   DECIMAL       HEXADECIMAL     DESCRIPTION -------------------------------------------------------------------------------- 0             0x0             uImage header, header size: 64 bytes, header CRC: 0x19DE1499, created: Fri Jul  3 22:16:00 2015, image size: 3252971 bytes, Data Address: 0x80000000, Entry Point: 0x80000000, data CRC: 0x886ADE01, OS: Linux, CPU: IPS, image type: OS Kernel Image, compression type: lzma, image name: &quot;MIPS OpenWrt Linux-3.18.17&quot; 64            0x40            LZMA compressed data, properties: 0x6D, dictionary size: 8388608 bytes, uncompressed size: 5479932 bytes <\/code><\/pre>\n<p>  \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0432\u0441\u044f \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043e\u0431\u0440\u0430\u0437 uImage \u2014 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a \u0434\u043b\u0438\u043d\u043e\u0439 64 (0x40) \u0431\u0430\u0439\u0442, \u0430 \u0432\u0441\u043b\u0435\u0434 \u0437\u0430 \u043d\u0430\u043c \u2014 \u043f\u043e\u0442\u043e\u043a \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u0436\u0430\u0442\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c LZMA, \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c 3252971 \u0431\u0430\u0439\u0442. \u0421\u043b\u043e\u0436\u0438\u043c 64 \u0438 3252971, \u043f\u043e\u043b\u0443\u0447\u0438\u043c 3253035 \u0431\u0430\u0439\u0442, \u0442\u043e \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440 \u0441\u043a\u0430\u0447\u0430\u043d\u043d\u043e\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430. \u0421\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u043a\u0440\u043e\u043c\u0435 \u043e\u0431\u0440\u0430\u0437\u0430 uImage \u0432 \u0444\u0430\u0439\u043b\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435\u0442. Binwalk \u0443\u043c\u0435\u0435\u0442 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 LZMA-\u043f\u043e\u0442\u043e\u043a\u0438. \u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043c\u043e\u0436\u043d\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043e\u0442\u0440\u0435\u0437\u0430\u0442\u044c \u043e\u0442 \u0444\u0430\u0439\u043b\u0430 \u043f\u0435\u0440\u0432\u044b\u0435 64 \u0431\u0430\u0439\u0442\u0430 \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439 lzma -d, \u043d\u043e \u0437\u0430\u0447\u0435\u043c, \u043a\u043e\u0433\u0434\u0430 \u0435\u0441\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442?<\/p>\n<pre><code class=\"bash\">&gt; binwalk -e .\/uImage.bin <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c  <\/p>\n<pre><code class=\"bash\">&gt; ls -l .\/_uImage.bin.extracted\/ \u0438\u0442\u043e\u0433\u043e 8532                                                                                                                                                                           -rw-r--r-- 1 user user 5479932 \u0430\u0432\u0433  8 23:10 40                                                                                                                                   -rw-r--r-- 1 user user 3252971 \u0430\u0432\u0433  8 23:10 40.7z <\/code><\/pre>\n<p>  \u0424\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c 40 (\u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u0444\u0430\u0439\u043b\u0435) \u2014 \u0438 \u0435\u0441\u0442\u044c \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0442\u043e\u043a. \u041d\u0430\u0442\u0440\u0430\u0432\u0438\u043c \u043d\u0430 \u043d\u0435\u0433\u043e binwalk:<\/p>\n<pre><code class=\"bash\">binwalk .\/_uImage.bin.extracted\/40  DECIMAL       HEXADECIMAL     DESCRIPTION -------------------------------------------------------------------------------- 2812692       0x2AEB14        Linux kernel version &quot;3.18.17 (buildbot@builder1) (gcc version 4.8.3 (OpenWrt\/Linaro c version 4.8.3 (OpenWrt\/Linaro GCC 4.8-2014.04 r46018) ) #2 Fr&quot; 2932132       0x2CBDA4        LZMA compressed data, properties: 0x5D, dictionary size: 16777216 bytes, missing uncompressed size 2936592       0x2CCF10        xz compressed data 3400392       0x33E2C8        LZMA compressed data, properties: 0x6D, dictionary size: 1048576 bytes, uncompressed size: -1 bytes <\/code><\/pre>\n<p>  \u0410 \u0437\u0434\u0435\u0441\u044c \u0443 \u043d\u0430\u0441 \u0447\u0442\u043e-\u0442\u043e, \u043d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e\u0435 \u2014 binwalk \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u044f\u0434\u0440\u043e Linux \u043f\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e 0x2AEB14 \u0438 \u0442\u0440\u0438 \u0441\u0436\u0430\u0442\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0437\u0430 \u044f\u0434\u0440\u043e\u043c. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e binwalk \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u044d\u0432\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0438 \u0442\u043e, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0443 \u043d\u0435\u0433\u043e \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u2014 \u043d\u0435 \u0438\u0441\u0442\u0438\u043d\u0430 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0438\u043d\u0441\u0442\u0430\u043d\u0446\u0438\u0438, \u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043a \u0440\u0430\u0437\u043c\u044b\u0448\u043b\u0435\u043d\u0438\u044e.<br \/>  \u0417\u0434\u0440\u0430\u0432\u044b\u0439 \u0441\u043c\u044b\u0441\u043b \u043f\u043e\u0434\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u044f\u0434\u0440\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c\u0441\u044f \u0441\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044f 0, \u0430 \u0441\u0436\u0430\u0442\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u2014 \u0431\u044b\u0442\u044c \u043e\u0434\u0438\u043d \u0438 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c initramfs \u2014 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u0444\u0430\u0439\u043b\u043e\u0432\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443, \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u0443\u044e \u0432 RAM. \u041e \u0442\u043e\u043c \u0436\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u0438 <a href=\"https:\/\/www.kernel.org\/doc\/Documentation\/filesystems\/ramfs-rootfs-initramfs.txt\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f<\/a> \u043d\u0430 \u044f\u0434\u0440\u043e:  <\/p>\n<blockquote><p>What is initramfs?<br \/>   \u2014 All 2.6 Linux kernels contain a gzipped \u00abcpio\u00bb format archive, which is extracted into rootfs when the kernel boots up. After extracting, the kernel checks to see if rootfs contains a file \u00abinit\u00bb, and if so it executes it as PID 1.<\/p><\/blockquote>\n<p>  \u0438 \u0434\u0430\u043b\u0435\u0435  <\/p>\n<blockquote><p>Populating initramfs:<br \/>   \u2014 The 2.6 kernel build process always creates a gzipped cpio format initramfs archive and links it into the resulting kernel binary. By default, this archive is empty (consuming 134 bytes on x86).<\/p><\/blockquote>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0436\u0435 \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0438 \u0444\u043e\u0440\u043c\u0430\u0442 \u043f\u043e\u0442\u043e\u043a\u0430 \u2014 CPIO.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e binwalk \u0441\u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u0432\u043b\u0435\u0447\u044c \u0438\u0437 \u043d\u0430\u0448\u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0437\u0430:<\/p>\n<pre><code class=\"bash\">&gt; binwalk -e .\/_uImage.bin.extracted\/40 ls -l .\/_uImage.bin.extracted\/_40.extracted\/ \u0438\u0442\u043e\u0433\u043e 14028 -rw-r--r-- 1 user user 2547808 \u0430\u0432\u0433  8 23:25 2CBDA4.7z -rw-r--r-- 1 user user 2543340 \u0430\u0432\u0433  8 23:25 2CCF10.tar -rw-r--r-- 1 user user 7186944 \u0430\u0432\u0433  8 23:25 33E2C8 -rw-r--r-- 1 user user 2079540 \u0430\u0432\u0433  8 23:25 33E2C8.7z <\/code><\/pre>\n<p>  \u0418\u0442\u0430\u043a, \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u043b\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u043e\u043a \u043f\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e 33E2C8. \u0415\u0441\u043b\u0438 \u043c\u044b \u0432\u0441\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0434\u0435\u043b\u0430\u0435\u043c, \u0442\u043e \u044d\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c CPIO-\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0441 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439:<\/p>\n<pre><code class=\"bash\">&gt; binwalk _uImage.bin.extracted\/_40.extracted\/33E2C8  DECIMAL       HEXADECIMAL     DESCRIPTION -------------------------------------------------------------------------------- 0             0x0             ASCII cpio archive (SVR4 with no CRC), file name: &quot;dev&quot;, file name length: &quot;0x00000004&quot;, file size: &quot;0x00000000&quot; 116           0x74            ASCII cpio archive (SVR4 with no CRC), file name: &quot;dev\/console&quot;, file name length: &quot;0x0000000C&quot;, file size: &quot;0x00000000&quot; 240           0xF0            ASCII cpio archive (SVR4 with no CRC), file name: &quot;lib&quot;, file name length: &quot;0x00000004&quot;, file size: &quot;0x00000000&quot; 356           0x164           ASCII cpio archive (SVR4 with no CRC), file name: &quot;lib\/netifd&quot;, file name length: &quot;0x0000000B&quot;, file size: &quot;0x00000000&quot; 480           0x1E0           ASCII cpio archive (SVR4 with no CRC), file name: &quot;lib\/netifd\/netifd-wireless.sh&quot;, file name length: &quot;0x0000001E&quot;, file size: &quot;0x00001638&quot;  ***********\u041a\u0443\u0447\u0430 \u0444\u0430\u0439\u043b\u043e\u0432***********  7186416       0x6DA7F0        ASCII cpio archive (SVR4 with no CRC), file name: &quot;dev\/urandom&quot;, file name length: &quot;0x0000000C&quot;, file size: &quot;0x00000000&quot; 7186540       0x6DA86C        ASCII cpio archive (SVR4 with no CRC), file name: &quot;dev\/pts&quot;, file name length: &quot;0x00000008&quot;, file size: &quot;0x00000000&quot; 7186660       0x6DA8E4        ASCII cpio archive (SVR4 with no CRC), file name: &quot;TRAILER!!!&quot;, file name length: &quot;0x0000000B&quot;, file size: &quot;0x00000000&quot; <\/code><\/pre>\n<p>  \u0412 \u043a\u043e\u043d\u0446\u0435 \u0430\u0440\u0445\u0438\u0432\u0430 \u043c\u044b \u0432\u0438\u0434\u0438\u043c \u0444\u0430\u0439\u043b \u0441 \u0438\u043c\u0435\u043d\u0435\u043c TRAILER!!!.. \u043a\u043e\u0442\u043e\u0440\u044b\u0439. \u0441\u043e\u0433\u043b\u0430\u0441\u043d\u043e <a href=\"https:\/\/www.kernel.org\/doc\/Documentation\/early-userspace\/buffer-format.txt\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0435\u0442\u043a\u043e\u0439 \u043a\u043e\u043d\u0446\u0430 \u0430\u0440\u0445\u0438\u0432\u0430.<\/p>\n<p>  \u0417\u043d\u0430\u0447\u0438\u0442, \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 initramfs-uImage \u0442\u0430\u043a\u043e\u0432\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/4a1\/1dc\/cfa\/4a11dccface14747906267e1cddd283b.png\"\/><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u043e\u0437\u044c\u043c\u0435\u043c\u0441\u044f \u0437\u0430 \u043e\u0431\u0440\u0430\u0437 squashfs-sysupgrade. \u0418\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u0441\u043b\u0435\u0434\u0443\u0435\u0442, \u0447\u0442\u043e \u0432 \u043e\u0431\u0440\u0430\u0437\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f (\u043a\u0440\u043e\u043c\u0435 \u044f\u0434\u0440\u0430) \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 squashfs. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0442\u0430\u043a \u043b\u0438 \u044d\u0442\u043e:<\/p>\n<pre><code class=\"bash\">&gt; binwalk -e .\/sysupgrade.bin   DECIMAL       HEXADECIMAL     DESCRIPTION -------------------------------------------------------------------------------- 0             0x0             uImage header, header size: 64 bytes, header CRC: 0x66CC90D2, created: Mon Jul  6 21:54:35 2015, image size: 1142606 bytes, Data Address: 0x80000000, Entry Point: 0x80000000, data CRC: 0x91B77696, OS: Linux, CPU: MIPS, image type: OS Kernel Image, compression type: lzma, image name: &quot;MIPS OpenWrt Linux-3.18.17&quot; 64            0x40            LZMA compressed data, properties: 0x6D, dictionary size: 8388608 bytes, uncompressed size: 3396940 bytes 1142670       0x116F8E        Squashfs filesystem, little endian, version 4.0, compression:lzma (non-standard type definition), size: 2221946 bytes,  1132 inodes, blocksize: 262144 bytes, created: Mon Jul  6 21:54:02 2015 <\/code><\/pre>\n<p>  \u0412\u043e\u0437\u044c\u043c\u0435\u043c\u0441\u044f \u0437\u0430 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u043a\u0443: 64 + 1142606 (image size) = 1142670, \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u043e \u044d\u0442\u043e\u043c\u0443 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u043e\u0431\u0440\u0430\u0437 squashfs, \u0430 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043e\u043d \u043f\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e 1142670 + 2221946 = 3364616. \u0420\u0430\u0437\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0437\u0430, \u043c\u0435\u0436\u0434\u0443 \u0442\u0435\u043c, 3407876 \u0431\u0430\u0439\u0442, \u0437\u043d\u0430\u0447\u0438\u0442, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0435\u0449\u0435 3407876 \u2014 3364616 = 43260 \u0431\u0430\u0439\u0442 \u043d\u0435\u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0442\u0430\u043c, hexdump\u2019\u043e\u043c  <\/p>\n<pre><code class=\"bash\">&gt; hexdump -s 3364616 .\/sysupgrade.bin  0335708 ffff ffff ffff ffff ffff ffff ffff ffff * 0335ff8 ffff ffff ffff ffff adde dec0 ffff ffff 0336008 ffff ffff ffff ffff ffff ffff ffff ffff * 0337ff8 ffff ffff ffff ffff adde dec0 ffff ffff 0338008 ffff ffff ffff ffff ffff ffff ffff ffff * 033fff8 ffff ffff ffff ffff adde dec0           0340004 <\/code><\/pre>\n<p>  \u0422\u0443\u0442 \u044f\u0432\u043d\u043e \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430. \u0412\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u043a \u043d\u0435\u0439 \u043f\u043e\u0437\u0434\u043d\u0435\u0435.<\/p>\n<p>  \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0441 \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"bash\">&gt; ls -l _sysupgrade.bin.extracted\/ \u0438\u0442\u043e\u0433\u043e 8820 -rw-r--r-- 1 user user 2221946 \u0430\u0432\u0433  8 23:40 116F8E.squashfs -rw-r--r-- 1 user user 3396940 \u0430\u0432\u0433  8 23:40 40 -rw-r--r-- 1 user user 3407812 \u0430\u0432\u0433  8 23:40 40.7z <\/code><\/pre>\n<p>  \u0420\u0430\u0441\u043f\u0430\u043a\u0443\u0435\u043c LZMA-\u043f\u043e\u0442\u043e\u043a \u043f\u043e \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u044e 40:<\/p>\n<pre><code class=\"bash\">binwalk -e _sysupgrade.bin.extracted\/40  DECIMAL       HEXADECIMAL     DESCRIPTION -------------------------------------------------------------------------------- 2812644       0x2AEAE4        Linux kernel version &quot;3.18.17 (buildbot@builder1) (gcc version 4.8.3 (OpenWrt\/Linaro c version 4.8.3 (OpenWrt\/Linaro GCC 4.8-2014.04 r46018) ) #1 Fr&quot; 2932068       0x2CBD64        LZMA compressed data, properties: 0x5D, dictionary size: 16777216 bytes, missing uncompressed size 2936444       0x2CCE7C        xz compressed data 3396424       0x33D348        ASCII cpio archive (SVR4 with no CRC), file name: &quot;dev&quot;, file name length: &quot;0x00000004&quot;, file size: &quot;0x00000000&quot; 3396540       0x33D3BC        ASCII cpio archive (SVR4 with no CRC), file name: &quot;dev\/console&quot;, file name length: &quot;0x0000000C&quot;, file size: &quot;0x00000000&quot; 3396664       0x33D438        ASCII cpio archive (SVR4 with no CRC), file name: &quot;root&quot;, file name length: &quot;0x00000005&quot;, file size: &quot;0x00000000&quot; 3396780       0x33D4AC        ASCII cpio archive (SVR4 with no CRC), file name: &quot;TRAILER!!!&quot;, file name length: &quot;0x0000000B&quot;, file size: &quot;0x00000000&quot; <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u0443 \u043d\u0430\u0441 \u044f\u0434\u0440\u043e Linux \u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 initramfs-\u043e\u0431\u0440\u0430\u0437 \u0441 \u0447\u0435\u0442\u044b\u0440\u044c\u043c\u044f \u0444\u0430\u0439\u043b\u0430\u043c\u0438. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u043e\u0435, \u0432\u0438\u0434\u0438\u043c\u043e, \u043f\u0435\u0440\u0435\u043c\u0435\u0441\u0442\u0438\u043b\u043e\u0441\u044c \u0432 \u043e\u0431\u0440\u0430\u0437 squashfs:<\/p>\n<pre><code class=\"bash\">&gt; unsquashfs -i .\/_sysupgrade.bin.extracted\/116F8E.squashfs  Parallel unsquashfs: Using 4 processors 1033 inodes (1034 blocks) to write  squashfs-root squashfs-root\/bin squashfs-root\/bin\/ash squashfs-root\/bin\/board_detect squashfs-root\/bin\/busybox ***********\u041a\u0443\u0447\u0430 \u0444\u0430\u0439\u043b\u043e\u0432***********  squashfs-root\/www\/luci-static\/resources\/load.svg squashfs-root\/www\/luci-static\/resources\/wifirate.svg squashfs-root\/www\/luci-static\/resources\/wireless.svg squashfs-root\/www\/luci-static\/resources\/xhr.js  created 848 files created 99 directories created 184 symlinks created 0 devices created 0 fifos <\/code><\/pre>\n<p>  \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0430\u0439\u043b\u043e\u0432\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f \u0432 \u043e\u0431\u0440\u0430\u0437\u0435 squashfs.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c\u0441\u044f \u0441 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u043e\u0439 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043e\u0431\u0440\u0430\u0437\u0430. \u0415\u0441\u0442\u044c \u043f\u043e\u0434\u043e\u0437\u0440\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043e\u043d\u0430 \u043a\u0430\u043a-\u0442\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0424\u0421 JFFS2, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u0440\u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0435 \u043e\u0431\u0440\u0430\u0437\u0430 sysupgrade \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u0432 dmesg \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438:<\/p>\n<pre><code class=\"bash\">[   29.550000] jffs2_scan_eraseblock(): End of filesystem marker found at 0x0 [   29.580000] jffs2_build_filesystem(): unlocking the mtd device... done. [   29.590000] jffs2_build_filesystem(): erasing all blocks after the end marker... <\/code><\/pre>\n<p>  \u0430 \u043f\u0440\u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0435 \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0435 \u043e\u0431\u0440\u0430\u0437\u0430 uImage \u044d\u0442\u0438\u0445 \u0441\u0442\u0440\u043e\u043a \u043d\u0435\u0442. \u041f\u043e\u0438\u0441\u043a \u0432 \u201c\u0432\u0430\u043d\u0438\u043b\u044c\u043d\u043e\u043c\u201c \u044f\u0434\u0440\u0435 \u043f\u043e \u044d\u0442\u0438\u043c \u0441\u0442\u0440\u043e\u043a\u0430\u043c \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0434\u0430\u0435\u0442, \u0430 \u0432\u043e\u0442 \u0432 <a href=\"http:\/\/git.openwrt.org\/?p=15.05\/openwrt.git;a=blob;f=target\/linux\/generic\/patches-3.18\/532-jffs2_eofdetect.patch;h=9cbe183138889dc558857d2d565562acfcbd7afa;hb=HEAD\">\u0434\u0435\u0440\u0435\u0432\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u0434\u043e\u0432 OpenWRT<\/a> \u0442\u0430\u043a\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0435\u0441\u0442\u044c:<\/p>\n<pre><code class=\"diff\">--- a\/fs\/jffs2\/build.c +++ b\/fs\/jffs2\/build.c @@ -114,6 +114,16 @@ static int jffs2_build_filesystem(struct  \tdbg_fsbuild(&quot;scanned flash completely\\n&quot;);  \tjffs2_dbg_dump_block_lists_nolock(c);   +\tif (c-&gt;flags & (1 &lt;&lt; 7)) { +\t\tprintk(&quot;%s(): unlocking the mtd device... &quot;, __func__); +\t\tmtd_unlock(c-&gt;mtd, 0, c-&gt;mtd-&gt;size); +\t\tprintk(&quot;done.\\n&quot;); + +\t\tprintk(&quot;%s(): erasing all blocks after the end marker... &quot;, __func__); +\t\tjffs2_erase_pending_blocks(c, -1); +\t\tprintk(&quot;done.\\n&quot;); +\t} +  \tdbg_fsbuild(&quot;pass 1 starting\\n&quot;);  \tc-&gt;flags |= JFFS2_SB_FLAG_BUILDING;  \t\/* Now scan the directory tree, increasing nlink according to every dirent found. *\/ --- a\/fs\/jffs2\/scan.c +++ b\/fs\/jffs2\/scan.c @@ -148,8 +148,14 @@ int jffs2_scan_medium(struct jffs2_sb_in  \t\t\/* reset summary info for next eraseblock scan *\/  \t\tjffs2_sum_reset_collected(s);   -\t\tret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb-&gt;offset), -\t\t\t\t\t\tbuf_size, s); +\t\tif (c-&gt;flags & (1 &lt;&lt; 7)) { +\t\t\tif (mtd_block_isbad(c-&gt;mtd, jeb-&gt;offset)) +\t\t\t\tret = BLK_STATE_BADBLOCK; +\t\t\telse +\t\t\t\tret = BLK_STATE_ALLFF; +\t\t} else +\t\t\tret = jffs2_scan_eraseblock(c, jeb, buf_size?flashbuf:(flashbuf+jeb-&gt;offset), +\t\t\t\t\t\t\tbuf_size, s);    \t\tif (ret &lt; 0)  \t\t\tgoto out; @@ -561,6 +567,17 @@ full_scan:  \t\t\treturn err;  \t}   +\tif ((buf[0] == 0xde) && +\t\t(buf[1] == 0xad) && +\t\t(buf[2] == 0xc0) && +\t\t(buf[3] == 0xde)) { +\t\t\/* end of filesystem. erase everything after this point *\/ +\t\tprintk(&quot;%s(): End of filesystem marker found at 0x%x\\n&quot;, __func__, jeb-&gt;offset); +\t\tc-&gt;flags |= (1 &lt;&lt; 7); + +\t\treturn BLK_STATE_ALLFF;```` +\t} +  \t\/* We temporarily use 'ofs' as a pointer into the buffer\/jeb *\/  \tofs = 0;  \tmax_ofs = EMPTY_SCAN_SIZE(c-&gt;sector_size); <\/code><\/pre>\n<p>  \u0410\u0433\u0430, \u0432\u043e\u0442 \u0438 \u043d\u0430\u0448\u0430 \u0437\u0430\u0433\u043b\u0443\u0448\u043a\u0430 0xDEADCODE. \u0415\u0441\u043b\u0438 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 JFFS2 \u043d\u0430\u0445\u043e\u0434\u0438\u0442 \u044d\u0442\u0443 \u043c\u0435\u0442\u043a\u0443, \u0442\u043e \u043e\u043d \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0435\u0435 \u043a\u043e\u043d\u0446\u043e\u043c \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0438 \u0441\u0442\u0438\u0440\u0430\u0435\u0442 \u0432\u0441\u0435, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043d\u0443\u043b\u0435\u0432\u043e\u0433\u043e \u0431\u0430\u0439\u0442\u0430 \u043c\u0435\u0442\u043a\u0438 \u0438 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044f \u043a\u043e\u043d\u0446\u043e\u043c \u043d\u0430\u043a\u043e\u043f\u0438\u0442\u0435\u043b\u044f. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441\u0430\u043c\u0430 \u043c\u0435\u0442\u043a\u0430 \u0442\u0430\u043a\u0436\u0435 \u0437\u0430\u0442\u0438\u0440\u0430\u0435\u0442\u0441\u044f.<br \/>  \u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043d\u043e\u0432\u044b\u0439 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 JFFS2.<br \/>  \u0418\u0442\u0430\u043a, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u043e\u0431\u0440\u0430\u0437\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/3d8\/10d\/495\/3d810d4959f94827b32755ac1cb90686.png\"\/><\/p>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:  <\/p>\n<ol>\n<li>uImage \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 OpenWRT \u0438 \u0437\u0430 \u0441\u0447\u0435\u0442 \u044d\u0442\u043e\u0433\u043e \u0435\u0433\u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0430 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0441\u0442\u044c \u0432 Web-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0445 \u043f\u0440\u043e\u0448\u0438\u0432\u043e\u043a.<\/li>\n<li>Sysupgrade \u0443\u0441\u0442\u0440\u043e\u0435\u043d \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 Linux-\u0441\u043f\u0435\u0446\u0438\u0444\u0438\u0447\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u2014 SquashFS \u0438 JFFS2. <\/li>\n<li>\u041e\u0431\u0430 \u0442\u0438\u043f\u0430 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 (\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b)<\/li>\n<li>\u041f\u0440\u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0435 \u0447\u0435\u0440\u0435\u0437 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a (\u0447\u0435\u0440\u0435\u0437 UART \u0438\u043b\u0438 \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u043e\u0435 \u0432\u043e\u0441\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435) \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u0448\u0438\u0442\u044c sysuprade.<\/li>\n<li>\u041f\u0440\u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0435 \u0447\u0435\u0440\u0435\u0437 mtd_write, \u0435\u0441\u043b\u0438 \u044d\u0442\u0430 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430 \u0447\u0435\u0440\u0435\u0437 telnet \u0438\u0437 \u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438, \u0442\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u0448\u0438\u0442\u044c sysupgrade.<\/li>\n<\/ol>\n<p>  \u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0437\u0430\u0433\u043b\u044f\u043d\u0435\u043c \u0441\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u044b OpenWRT, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f \u0432 \u0441\u0432\u043e\u0438\u0445 \u0432\u044b\u0432\u043e\u0434\u0430\u0445. \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0444\u0430\u0439\u043b\u0430 <a href=\"https:\/\/dev.openwrt.org\/browser\/trunk\/target\/linux\/ramips\/image\/Makefile\">\/target\/linux\/ramips\/Makefile<\/a>. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b \u0434\u0443\u043c\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 GNU Makefile, \u0442\u043e \u044d\u0442\u043e \u043d\u0435 \u0442\u0430\u043a. \u0412\u043e\u0442 \u043a\u0430\u043a <a href=\"http:\/\/wiki.openwrt.org\/doc\/devel\/packages\">\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u044e\u0442<\/a> \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u043d\u044b\u0439 Makefile \u0441\u0430\u043c\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438:  <\/p>\n<blockquote><p>Looking at one of the package makefiles, you&#8217;d hardly recognize it as a makefile. Through what can only be described as blatant disregard and abuse of the traditional make format, the makefile has been transformed into an object oriented template which simplifies the entire ordeal.<\/p><\/blockquote>\n<p>  \u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0441\u0431\u043e\u0440\u043a\u0430 \u043e\u0431\u0440\u0430\u0437\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 564:<\/p>\n<pre><code class=\"bash\">Image\/Build\/Profile\/DIR-320-B1=$(call BuildFirmware\/Default8M\/$(1),$(1),dir-320-b1,DIR-320-B1) <\/code><\/pre>\n<p>  \u0426\u0435\u043b\u044c BuildFirmware\/Default8M \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u0430\u0445 195 \u0438 196:<\/p>\n<pre><code class=\"bash\">BuildFirmware\/Default8M\/squashfs=$(call BuildFirmware\/OF,$(1),$(2),$(3),$(ralink_default_fw_size_8M),$(4)) BuildFirmware\/Default8M\/initramfs=$(call BuildFirmware\/OF\/initramfs,$(1),$(2),$(3),$(4)) <\/code><\/pre>\n<p>  \u041e\u043d\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0434\u0432\u0443\u0445 \u043f\u043e\u0437\u0438\u0446\u0438\u0439: squashfs \u0438 initramfs. \u0426\u0435\u043b\u0438 BuildFirmware\/OF \u0438 BuildFirmware\/OF\/initramfs \u043e\u043f\u0438\u0441\u0430\u043d\u044b \u0432 \u0442\u043e\u043c \u0436\u0435 \u0444\u0430\u0439\u043b\u0435 \u0447\u0443\u0442\u044c \u0432\u044b\u0448\u0435<\/p>\n<pre><code class=\"bash\">149    # $(1), Rootfs type, e.g. squashfs 150    # $(2), lowercase board name 151    # $(3), DTS filename without .dts extension 152    # $(4), maximum size of sysupgrade image 153    # $(5), uImage header's ih_name field 154    define BuildFirmware\/OF 155            $(call MkImageLzmaDtb,$(2),$(3),$(5)) 156            $(call MkImageSysupgrade\/$(1),$(1),$(2),$(4),$(6)) 157    endef <\/code><\/pre>\n<p>  \u0438<\/p>\n<pre><code class=\"bash\">169    # $(1), squashfs\/initramfs 170    # $(2), lowercase board name 171    # $(3), DTS filename without .dts extension 172    # $(4), ih_name field of uImage header 173    define BuildFirmware\/OF\/initramfs 174            $(call MkImageLzmaDtb,$(2),$(3),$(4),-initramfs) 175            $(CP) $(KDIR)\/vmlinux-$(2)-initramfs.uImage $(call imgname,$(1),$(2))-uImage.bin 176    endef <\/code><\/pre>\n<p>  \u041f\u043e \u0438\u043c\u0435\u043d\u0438 \u0446\u0435\u043b\u0438 MkImageLzmaDtb \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0433\u0430\u0434\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u0435\u0442 \u043e\u0431\u0440\u0430\u0437 uImage \u043f\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044e \u0438\u0437 DTS-\u0444\u0430\u0439\u043b\u0430. \u0414\u043b\u044f \u0446\u0435\u043b\u0438 BuildFirmware\/OF\/initramfs \u043a \u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u0440\u0430\u0437\u0443 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0434\u0435\u043b initramfs \u0441 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u0431\u0440\u0430\u0437 \u043a\u043e\u043f\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433. \u0414\u043b\u044f \u0446\u0435\u043b\u0438 BuildFirmware\/OF \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043e\u0431\u0440\u0430\u0437 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 MkImageSysupgrade, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u201ccat\u201d \u043f\u0440\u0438\u0446\u0435\u043f\u043b\u044f\u0435\u0442 \u043a \u043d\u0435\u043c\u0443 \u0440\u0430\u0437\u0434\u0435\u043b squashfs, \u0430 \u0437\u0430\u0442\u0435\u043c, \u0432\u0437\u044b\u0432\u0430\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u044e prepare_generic_squashfs, \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u0432 \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/dev.openwrt.org\/browser\/trunk\/include\/image.mk\">image.mk<\/a>.<\/p>\n<pre><code class=\"bash\"># pad to 4k, 8k, 16k, 64k, 128k, 256k and add jffs2 end-of-filesystem mark 110\t   define prepare_generic_squashfs 111\t           $(STAGING_DIR_HOST)\/bin\/padjffs2 $(1) 4 8 16 64 128 256 112\t   endef <\/code><\/pre>\n<p>  \u0410 \u0443\u0442\u0438\u043b\u0438\u0442\u0430 padjffs2, <a href=\"https:\/\/dev.openwrt.org\/browser\/trunk\/tools\/padjffs2\/src\/padjffs2.c\">\u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u0430\u044f \u043d\u0430 C<\/a>, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043e\u0442\u043c\u0435\u0442\u043a\u0443 0xDEADCODE \u0432 \u043a\u043e\u043d\u0435\u0446 \u0444\u0430\u0439\u043b\u0430 \u043e\u0431\u0440\u0430\u0437\u0430:<\/p>\n<pre><code class=\"cpp\">static unsigned char eof_mark[4] = {0xde, 0xad, 0xc0, 0xde}; *** static unsigned char *pad = eof_mark; ***    \/* write out the JFFS end-of-filesystem marker *\/ \t                t = write(fd, pad, pad_len); \t                if (t != pad_len) { \t                        ERRS(&quot;Unable to write to %s&quot;, name); \t                        goto close; \t                } <\/code><\/pre>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c, \u043c\u0438\u0440 OpenWRT \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u0435\u043d \u0438 \u0443\u0434\u0438\u0432\u0438\u0442\u0435\u043b\u0435\u043d, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0442\u0438\u043f\u0430:  <\/p>\n<blockquote><p># The real magic happens inside these templates<\/p><\/blockquote>\n<p>  \u0438\u043b\u0438  <\/p>\n<blockquote><p>\/* vodoo from original driver *\/<\/p><\/blockquote>\n<p>  \u0412 \u0437\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 OpenWRT \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0445 \u043a\u043e\u0434\u043e\u0432 \u043d\u0443\u0436\u043d\u043e \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u0431\u043e\u0440\u043e\u0447\u043d\u0443\u044e \u0441\u0440\u0435\u0434\u0443, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 <a href=\"https:\/\/github.com\/utessel\/edimax\">\u044d\u0442\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a> \u043d\u0430 \u043c\u043e\u0435\u043c Debian 8+Sid \u043d\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u0434\u0430\u0436\u0435 \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043a\u0440\u043e\u0441\u0441-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. \u0410 \u0432\u043e\u0442 \u043d\u0430 Debian 7 \u0432\u0441\u0435 \u044d\u0442\u043e \u0431\u043e\u0433\u0430\u0442\u0441\u0442\u0432\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0441\u0442\u043e \u0438\u0437\u0443\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e. \u0415\u0441\u043b\u0438 \u0436\u0435 \u0435\u0435 \u043f\u043e\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 Web-\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0431\u043e\u0440\u043e\u0447\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u0442 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u043a\u043e\u0434\u044b, \u0443\u0436\u0435 \u201c\u043f\u0440\u043e\u0442\u0443\u0445\u043b\u0438\u201d, \u043d\u0430\u0434\u043e \u0438\u0441\u043a\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438, \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435.     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/264843\/\"> http:\/\/habrahabr.ru\/post\/264843\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d90\/9e5\/26b\/d909e526b8034f0bb821806160cc0c32.jpg\"\/><br \/>  \u0412 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u043a \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"http:\/\/habrahabr.ru\/post\/264025\/\">\u201c\u041f\u0440\u043e\u0448\u0438\u0432\u0430\u0435\u043c \u0440\u043e\u0443\u0442\u0435\u0440 Upvel UR-313N4G \u043d\u0430 OpenWRT\u201d <\/a> \u043c\u0435\u0436\u0434\u0443 \u0432\u0430\u0448\u0438\u043c \u043f\u043e\u043a\u043e\u0440\u043d\u044b\u043c \u0441\u043b\u0443\u0433\u043e\u0439 \u0438 \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u043c  <a href=\"http:\/\/habrahabr.ru\/users\/maysoft\/\" class=\"user_link\">Maysoft<\/a> \u0437\u0430\u0432\u044f\u0437\u0430\u043b\u0441\u044f \u0441\u043f\u043e\u0440 \u043d\u0430\u0441\u0447\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u0439 \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 uImage \u0438 sysupgrade \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 OpenWRT. \u042f \u043e\u0431\u0435\u0449\u0430\u043b  <a href=\"http:\/\/habrahabr.ru\/users\/maysoft\/\" class=\"user_link\">Maysoft<\/a> \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0435, \u0438 \u0432\u043e\u0442 \u043f\u0435\u0440\u0435\u0434 \u0432\u0430\u043c\u0438 \u044d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u044f.<\/p>\n<p>  \u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e, \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a OpenWRT \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b, \u043f\u043e \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0447\u0430\u0441\u0442\u0438, \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u0434\u0432\u0443\u0445 \u0442\u0438\u043f\u043e\u0432 \u2014 uImage \u0438 sysupgrade, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<p>  openwrt-15.05-rc3-ramips-rt305x-dir-320-b1-initramfs-uImage.bin<br \/>  openwrt-15.05-rc3-ramips-rt305x-dir-320-b1-squashfs-sysupgrade.bin<\/p>\n<p>  <a href=\"http:\/\/wiki.openwrt.org\/doc\/faq\/before.installation\">\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 FAQ<\/a> \u043f\u0438\u0448\u0435\u0442 \u043e\u0431 \u0438\u0445 \u0440\u0430\u0437\u043b\u0438\u0447\u0438\u044f\u0445 \u0432\u0435\u0441\u044c\u043c\u0430 \u0441\u043a\u0443\u043f\u043e:  <\/p>\n<blockquote><p>What is the difference between the different image formats?<br \/>  a factory image is one built for the bootloader flasher or stock software flasher<br \/>  a sysupgrade image (previously named trx image) is designed to be flashed from within openwrt itself<br \/>  The two have the same content, but a factory image would have extra header information or whatever the platform needs. Generally speaking, the factory image is to be used with the OEM GUI or OEM flashing utilities to convert the device to OpenWrt. After that, use the sysupgrade images.<\/p><\/blockquote>\n<p>  \u0421\u043e\u0433\u043b\u0430\u0441\u043d\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0437\u043e\u0432 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u043e, \u0437\u0430 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u0432 \u043e\u0431\u0440\u0430\u0437\u0435 factory \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0442 \u043e\u0431\u0440\u0430\u0437 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0448\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 Web-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-263652","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/263652","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=263652"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/263652\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=263652"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=263652"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=263652"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}