{"id":353465,"date":"2024-05-20T22:28:34","date_gmt":"2024-05-20T22:28:34","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=353465"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=353465","title":{"rendered":"<span>\u0412\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0434\u043b\u044f \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 U-Boot<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043b U-Boot \u0438 TCP\/IP \u0441\u0442\u0435\u043a LWIP, \u0438 c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c LWIP \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043d\u0430 WebSocket, \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 DHCP-\u0441\u0435\u0440\u0432\u0435\u0440 \u0438 HTTP-\u0441\u0435\u0440\u0432\u0435\u0440. \u041a\u043e\u0434 \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u0445 <a href=\"https:\/\/github.com\/karen07\/u-boot\">U-Boot<\/a> \u0438 <a href=\"https:\/\/github.com\/karen07\/lwip\">LWIP<\/a>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a81\/179\/6fc\/a811796fc7abeab47c2fca956daa0c5b.png\" alt=\"\u0412\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c\" title=\"\u0412\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c\" width=\"974\" height=\"978\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a81\/179\/6fc\/a811796fc7abeab47c2fca956daa0c5b.png\"\/><\/p>\n<div><figcaption>\u0412\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0441\u0451 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u043d\u0435 \u043f\u043e\u0434\u0430\u0440\u0438\u043b\u0438 \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u043e\u0443\u0442\u0435\u0440 <a href=\"https:\/\/openwrt.org\/toh\/hwdata\/xiaomi\/xiaomi_miwifi_3c\">Xiaomi Mi Wi-Fi Router 3C<\/a>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/cea\/e17\/d3a\/ceae17d3a704bbc006fea2f5d4e83631.png\" alt=\"Xiaomi Mi Wi-Fi Router 3C\" title=\"Xiaomi Mi Wi-Fi Router 3C\" width=\"974\" height=\"554\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/cea\/e17\/d3a\/ceae17d3a704bbc006fea2f5d4e83631.png\"\/><\/p>\n<div><figcaption>Xiaomi Mi Wi-Fi Router 3C<\/figcaption><\/div>\n<\/figure>\n<p>\u042f \u043d\u0430\u0447\u0430\u043b \u0441 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 OpenWRT \u0434\u043b\u044f \u0440\u043e\u0443\u0442\u0435\u0440\u0430, \u043d\u043e \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0441\u043a\u0443\u0447\u0438\u043b\u043e. \u0422\u0430\u043a \u043a\u0430\u043a \u0441 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0443 \u043c\u0435\u043d\u044f \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0442\u043e\u0440 \u0438 USB-UART-\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440 <a href=\"https:\/\/habr.com\/ru\/articles\/262731\">CH341A<\/a>, \u0442\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u0440\u043e\u0443\u0442\u0435\u0440\u0430, \u0437\u0430\u043b\u0438\u0432 \u0435\u0433\u043e \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432 SPI Flash \u043f\u0430\u043c\u044f\u0442\u044c \u0440\u043e\u0443\u0442\u0435\u0440\u0430.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b76\/847\/6bd\/b768476bd8e041f49b522db8c8666615.png\" alt=\"CH341A \u0438 Xiaomi Mi Wi-Fi Router 3C\" title=\"CH341A \u0438 Xiaomi Mi Wi-Fi Router 3C\" width=\"782\" height=\"587\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b76\/847\/6bd\/b768476bd8e041f49b522db8c8666615.png\"\/><\/p>\n<div><figcaption>CH341A \u0438 Xiaomi Mi Wi-Fi Router 3C<\/figcaption><\/div>\n<\/figure>\n<h2>\u0417\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a Breed<\/h2>\n<p>\u041d\u0430 <a href=\"https:\/\/4pda.to\/forum\/index.php?showtopic=764502\">4PDA<\/a> \u0431\u044b\u043b\u0430 \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430 OpenWRT c \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u043e\u043c <a href=\"https:\/\/breed.hackpascal.net\">Breed<\/a>. \u042d\u0442\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a c Web-GUI \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0447\u0435\u0440\u0435\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438. \u041d\u043e \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0439\u0442\u0438 \u0432 Web-GUI, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0436\u0430\u0442\u044c Enter \u0432 UART \u043a\u043e\u043d\u0441\u043e\u043b\u0438. \u041a\u0430\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c UART, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"https:\/\/openwrt.org\/toh\/xiaomi\/mir3c\">\u0442\u0443\u0442<\/a>. \u0410 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/www.putty.org\">PuTTY<\/a>. \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u043a\u0430\u043a\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 COM-\u043f\u043e\u0440\u0442 \u0441\u043e\u0437\u0434\u0430\u043b \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/0fe\/733\/003\/0fe73300308923adb52317d147037b48.png\" alt=\"COM \u043f\u043e\u0440\u0442\" title=\"COM \u043f\u043e\u0440\u0442\" width=\"383\" height=\"53\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/0fe\/733\/003\/0fe73300308923adb52317d147037b48.png\"\/><\/p>\n<div><figcaption>COM \u043f\u043e\u0440\u0442<\/figcaption><\/div>\n<\/figure>\n<p>\u0410 \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u044d\u0442\u043e\u0442 \u043d\u043e\u043c\u0435\u0440 \u0432 PuTTY:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/160\/a82\/aa5\/160a82aa58d9e0fcb7cf172a9addb597.png\" alt=\"PuTTy\" title=\"PuTTy\" width=\"682\" height=\"614\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/160\/a82\/aa5\/160a82aa58d9e0fcb7cf172a9addb597.png\"\/><\/p>\n<div><figcaption>PuTTy<\/figcaption><\/div>\n<\/figure>\n<p>\u0418 \u0432\u0438\u0434\u0438\u043c \u043b\u043e\u0433 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 Breed:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6f4\/3e9\/1a2\/6f43e91a223e1bf94a4763e00d58397d.png\" alt=\"\u041b\u043e\u0433 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 Breed\" title=\"\u041b\u043e\u0433 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 Breed\" width=\"974\" height=\"614\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/6f4\/3e9\/1a2\/6f43e91a223e1bf94a4763e00d58397d.png\"\/><\/p>\n<div><figcaption>\u041b\u043e\u0433 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 Breed<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 Linux, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 Web-GUI \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <code>192.168.1.1<\/code>. \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0442 \u0430\u0434\u0440\u0435\u0441 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u043b \u0441 \u0432\u0430\u0448\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u043c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e5c\/39d\/0f2\/e5c39d0f20da574b1191e9beb6fe8f3f.png\" alt=\"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0432 Web-GUI \" title=\"\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0432 Web-GUI \" width=\"974\" height=\"529\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e5c\/39d\/0f2\/e5c39d0f20da574b1191e9beb6fe8f3f.png\"\/><\/p>\n<div><figcaption>\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0432 Web-GUI <\/figcaption><\/div>\n<\/figure>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 \u043c\u0435\u043d\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9c1\/6b5\/c8f\/9c16b5c8f4a670b3c6a7781239e58512.png\" alt=\"\u0420\u0430\u0437\u0434\u0435\u043b \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432 Web-GUI\" title=\"\u0420\u0430\u0437\u0434\u0435\u043b \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432 Web-GUI\" width=\"974\" height=\"524\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9c1\/6b5\/c8f\/9c16b5c8f4a670b3c6a7781239e58512.png\"\/><\/p>\n<div><figcaption>\u0420\u0430\u0437\u0434\u0435\u043b \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432 Web-GUI<\/figcaption><\/div>\n<\/figure>\n<p>\u041c\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0438\u0434\u0435\u044f \u0441 Web-GUI \u0438 \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0435\u0451 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 open source \u043a\u043e\u0434\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 open source \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a U-Boot.<\/p>\n<h2>U-Boot<\/h2>\n<p>\u0420\u043e\u0443\u0442\u0435\u0440 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u0431\u0430\u0437\u0435 MediaTek MT7628AN, \u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0447\u0438\u043f\u0430 \u0432 U-Boot \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430. \u041d\u043e \u0434\u0430\u0436\u0435 \u0441\u0431\u043e\u0440\u043a\u0430 U-Boot \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0434\u043b\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u044d\u0442\u0438\u043c \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437. \u042f \u0431\u0443\u0434\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0441 Ubuntu 22.04 LTS.<\/p>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<pre><code class=\"bash\">sudo apt update sudo apt upgrade sudo apt install build-essential bison flex libncurses5-dev libncursesw5-dev unzip \\ qemu-system-mips gcc-mips-linux-gnu colordiff firefox ncdu dos2unix libssl-dev \\  bc u-boot-tools<\/code><\/pre>\n<p>\u0412\u044b\u043a\u0430\u0447\u0430\u0442\u044c U-Boot:<\/p>\n<pre><code class=\"bash\">git clone https:\/\/github.com\/u-boot\/u-boot.git<\/code><\/pre>\n<p>\u0412\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0440\u043e\u0441\u0441-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438:<\/p>\n<pre><code class=\"bash\">export ARCH=mips export CROSS_COMPILE=mips-linux-gnu-<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<pre><code class=\"bash\">make mt7628_rfb_defconfig<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0443:<\/p>\n<pre><code>make<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u043d\u0430 \u0440\u043e\u0443\u0442\u0435\u0440, \u044f \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u043d\u0430 \u043d\u0451\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a Breed, \u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a U-Boot \u0437\u0430\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u043b \u0432 \u043e\u0431\u0440\u0430\u0437 \u044f\u0434\u0440\u0430 Linux. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a Breed \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a U-Boot. \u0410 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u0437\u0430\u043b\u0438\u043b \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a Breed \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0442\u043e\u0440.<\/p>\n<pre><code class=\"bash\">mkimage -A mips -T kernel -C none -O linux -a 0x80200000 -e 0x80200000 \\ -n \"U-Boot\" -d u-boot.bin u-boot.img<\/code><\/pre>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043e\u0431\u0440\u0430\u0437 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 U-Boot:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/03a\/941\/5c6\/03a9415c6046b5b718dc4729ce5bb125.png\" alt=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 u-boot.img\" title=\"\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 u-boot.img\" width=\"974\" height=\"523\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/03a\/941\/5c6\/03a9415c6046b5b718dc4729ce5bb125.png\"\/><\/p>\n<div><figcaption>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 u-boot.img<\/figcaption><\/div>\n<\/figure>\n<p>\u0418 \u0443\u0432\u0438\u0434\u0438\u043c \u0432 PuTTY \u043b\u043e\u0433 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 U-Boot:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/807\/8d0\/720\/8078d072029447fc09350e1d4fdedd21.png\" alt=\"\u041b\u043e\u0433 U-Boot\" title=\"\u041b\u043e\u0433 U-Boot\" width=\"974\" height=\"610\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/807\/8d0\/720\/8078d072029447fc09350e1d4fdedd21.png\"\/><\/p>\n<div><figcaption>\u041b\u043e\u0433 U-Boot<\/figcaption><\/div>\n<\/figure>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a Breed \u0438\u043c\u0435\u0435\u0442 Web-GUI, \u0442\u043e \u0434\u043b\u044f U-Boot \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c.<\/p>\n<p>\u0414\u043b\u044f \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c WebSocket, \u0430 \u043e\u043d \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 TCP. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e U-Boot \u0443\u043c\u0435\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 UDP. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f TCP \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u043c TCP\/IP \u0441\u0442\u0435\u043a\u043e\u043c. \u0412\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 LWIP.<\/p>\n<h2>LWIP<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u044f \u0432\u044b\u043a\u0430\u0447\u0430\u043b LWIP \u0432 \u043f\u0430\u043f\u043a\u0443 <code>\/lib<\/code> \u043f\u0440\u043e\u0435\u043a\u0442\u0430 U-Boot:<\/p>\n<pre><code class=\"bash\">git clone https:\/\/github.com\/lwip-tcpip\/lwip.git<\/code><\/pre>\n<p>\u0421\u0431\u043e\u0440\u043a\u0430 U-Boot \u043e\u0441\u043d\u043e\u0432\u0430 \u043d\u0430 Kconfig, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 Kconfig \u0434\u043b\u044f LWIP. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e Kconfig \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/www.kernel.org\/doc\/html\/next\/kbuild\/kconfig-language.html\">\u0442\u0443\u0442<\/a>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u0447\u0430\u0441\u0442\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 makefile:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cmake\">ccflags-y += -I$(obj)\/..\/include  obj-y += \\     init.o \\ def.o \\ dns.o \\ inet_chksum.o \\ ip.o \\ mem.o \\ memp.o \\<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 LWIP \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b <code>lwipopts.h<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 TCP, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0442. \u0434. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/www.nongnu.org\/lwip\/2_0_x\/group__lwip__opts.html\">\u0442\u0443\u0442<\/a>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u0447\u0430\u0441\u0442\u0438 lwipopts.h:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#ifndef __LWIPOPTS_H__ #define __LWIPOPTS_H__  #define NO_SYS                  1 #define SYS_LIGHTWEIGHT_PROT    0  #define LWIP_NETCONN                    0 #define LWIP_SOCKET                     0 #define LWIP_DHCP                       1  #define MEM_ALIGNMENT           4 #define MEM_SIZE                        (8 * 1024 * 1024)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b <code>cc.h<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u0447\u0430\u0441\u0442\u0438 cc.h:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#ifndef __ARCH_CC_H__ #define __ARCH_CC_H__  #include &lt;stdio.h> #include &lt;stdlib.h> #include &lt;string.h>  int atoi(const char *str);  #ifdef CONFIG_SYS_BIG_ENDIAN #define BYTE_ORDER BIG_ENDIAN #else #define BYTE_ORDER LITTLE_ENDIAN #endif  #define LWIP_NO_LIMITS_H 1 #define LWIP_NO_CTYPE_H 1  typedef uint8_t     u8_t; typedef int8_t      s8_t;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u0440\u043e\u0431 \u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u043e\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 Ethernet \u043a LWIP.<\/p>\n<p>\u0423 U-Boot \u0435\u0441\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f callback-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c API \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u0431\u043e\u0440\u043a\u0438.<\/p>\n<pre><code>make menuconfig<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9a6\/1df\/ff0\/9a61dfff04029db100a60bcf0a5e0acc.png\" alt=\"make menuconfig\" title=\"make menuconfig\" width=\"974\" height=\"853\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/9a6\/1df\/ff0\/9a61dfff04029db100a60bcf0a5e0acc.png\"\/><\/p>\n<div><figcaption>make menuconfig<\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u043e\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 Ethernet \u043a LWIP <\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">void eth_save_packet_lwip(void* packet, int length) { if (length > 0) { struct pbuf* p = pbuf_alloc(PBUF_RAW, length, PBUF_POOL); if (p != NULL) { pbuf_take(p, packet, length); if (netif.input(p, &amp;netif) != ERR_OK) { pbuf_free(p); } } } }<\/code><\/pre>\n<pre><code class=\"cpp\">push_packet = eth_save_packet_lwip;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u0430\u043a\u0435\u0442\u0430 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e U-Boot <code>eth_send<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u043e\u0442 LWIP \u043a \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0443 Ethernet<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">err_t netif_output(struct netif* netif, struct pbuf* p) { unsigned char mac_send_buffer[p->tot_len]; pbuf_copy_partial(p, (void*)mac_send_buffer, p->tot_len, 0); eth_send(mac_send_buffer, p->tot_len); return ERR_OK; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f LWIP, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 IP-\u0430\u0434\u0440\u0435\u0441\u0430, \u043c\u0430\u0441\u043a\u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0438 \u0448\u043b\u044e\u0437\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 LWIP, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 IP-\u0430\u0434\u0440\u0435\u0441\u0430, \u043c\u0430\u0441\u043a\u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0438 \u0448\u043b\u044e\u0437\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">eth_halt(); eth_init();  ip4_addr_t addr; ip4_addr_t netmask; ip4_addr_t gw;  IP4_ADDR(&amp;addr, 192, 168, 10, 1); IP4_ADDR(&amp;netmask, 255, 255, 255, 0); IP4_ADDR(&amp;gw, 192, 168, 10, 2);  lwip_init();  netif_add(&amp;netif, &amp;addr, &amp;netmask, &amp;gw, NULL, netif_set_opts, netif_input);  netif.name[0] = 'e'; netif.name[1] = '0'; netif_set_default(&amp;netif);<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 MTU \u0438 MAC \u0430\u0434\u0440\u0435\u0441\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 MTU \u0438 MAC \u0430\u0434\u0440\u0435\u0441\u0430.<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">err_t netif_set_opts(struct netif* netif) { netif->linkoutput = netif_output; netif->output = etharp_output; netif->mtu = 1500; netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP \\     | NETIF_FLAG_ETHERNET | NETIF_FLAG_LINK_UP | NETIF_FLAG_UP; netif->hwaddr_len = 6;  if (env_get(\"ethaddr\")) string_to_enetaddr(env_get(\"ethaddr\"), netif->hwaddr); else memset(netif->hwaddr, 0, 6);  return ERR_OK; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>DHCP-\u0441\u0435\u0440\u0432\u0435\u0440<\/h2>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u0432\u044b\u0434\u0430\u0432\u0430\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e IP-\u0430\u0434\u0440\u0435\u0441, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u044b\u0439 DHC-\u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043e\u0442\u0434\u0430\u0451\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043f\u0430\u043a\u0435\u0442, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0432\u044b\u0434\u0430\u0435\u0442\u0441\u044f IP-\u0430\u0434\u0440\u0435\u0441 <code>192.168.10.2<\/code>, \u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u0438\u043c\u0435\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 <code>192.168.10.1<\/code>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/www.xelent.ru\/blog\/printsipy-raboty-protokola-dhcp\">\u0442\u0443\u0442<\/a>. \u041a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u0432 <a href=\"https:\/\/github.com\/karen07\/lwip\/blob\/master\/src\/apps\/web_load\/lwip_u_boot_port.c\">lwip_u_boot_port.c<\/a>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 DHCP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">struct udp_pcb *dhcp = udp_new(); udp_bind(dhcp, IP_ADDR_ANY, 67); udp_recv(dhcp , dhcp_recv, NULL);<\/code><\/pre>\n<pre><code class=\"cpp\">void dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p,                 const ip_addr_t *addr, u16_t port) { if(p == NULL) return;  dhcps_msg dhcp_rec;  int data_len = p->tot_len; pbuf_copy_partial(p, (void*)&amp;dhcp_rec, data_len, 0); pbuf_free(p);  int i = 4; while(dhcp_rec.options[i] != 255 &amp;&amp; dhcp_rec.options[i] != 53) { i += dhcp_rec.options[i+1] + 2; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>HTTP-\u0441\u0435\u0440\u0432\u0435\u0440<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u0434\u0430\u0442\u044c http-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443. \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u0430\u044f http-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430, \u0442\u043e \u043d\u0430\u043c \u0445\u0432\u0430\u0442\u0438\u0442 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e http-\u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043e\u0442\u0434\u0430\u0451\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0437\u0430\u043f\u0440\u043e\u0441. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/developer.mozilla.org\/ru\/docs\/Web\/HTTP\/Overview\">\u0442\u0443\u0442<\/a>. \u041d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u0430 \u0432 \u0441\u0435\u0431\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u0445 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>xxd<\/code> \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f C. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u0432 <a href=\"https:\/\/github.com\/karen07\/lwip\/blob\/master\/src\/apps\/web_load\/lwip_u_boot_port.c\">lwip_u_boot_port.c<\/a>.<\/p>\n<pre><code class=\"bash\">xxd -include index.html<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0432\u043e\u0434\u0430 xxd<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">unsigned char http_ans[] = {   0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0x0a, 0x3c, 0x68, 0x65, 0x61, 0x64,   0x3e, 0x0a, 0x09, 0x3c, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x3e, 0x0a, 0x09,   0x2e, 0x78, 0x74, 0x65, 0x72, 0x6d, 0x7b, 0x66, 0x6f, 0x6e, 0x74, 0x2d,   0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2d, 0x73, 0x65, 0x74, 0x74,   0x69, 0x6e, 0x67, 0x73, 0x3a, 0x22, 0x6c, 0x69, 0x67, 0x61, 0x22, 0x20,   0x30, 0x3b, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x72,   0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x3b, 0x75, 0x73, 0x65, 0x72,   0x2d, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x3a, 0x6e, 0x6f, 0x6e, 0x65,   0x3b, 0x2d, 0x6d, 0x73, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x2d, 0x73, 0x65,   0x6c, 0x65, 0x63, 0x74, 0x3a, 0x6e, 0x6f, 0x6e, 0x65, 0x3b, 0x2d, 0x77,   0x65, 0x62, 0x6b, 0x69, 0x74, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x2d, 0x73,   0x65, 0x6c, 0x65, 0x63, 0x74, 0x3a, 0x6e, 0x6f, 0x6e, 0x65, 0x7d, 0x2e,   0x78, 0x74, 0x65, 0x72, 0x6d, 0x2e, 0x66, 0x6f, 0x63, 0x75, 0x73, 0x2c,   0x2e, 0x78, 0x74, 0x65, 0x72, 0x6d, 0x3a, 0x66, 0x6f, 0x63, 0x75, 0x73,   0x7b, 0x6f, 0x75, 0x74, 0x6c, 0x69, 0x6e, 0x65, 0x3a, 0x30, 0x7d, 0x2e,   0x78, 0x74, 0x65, 0x72, 0x6d, 0x20, 0x2e, 0x78, 0x74, 0x65, 0x72, 0x6d,   0x2d, 0x68, 0x65, 0x6c, 0x70, 0x65, 0x72, 0x73, 0x7b, 0x70, 0x6f, 0x73,   0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x61, 0x62, 0x73, 0x6f, 0x6c, 0x75,   0x74, 0x65, 0x3b, 0x74, 0x6f, 0x70, 0x3a, 0x30, 0x3b, 0x7a, 0x2d, 0x69,   0x6e, 0x64, 0x65, 0x78, 0x3a, 0x31, 0x30, 0x7d, 0x2e, 0x78, 0x74, 0x65,<\/code><\/pre>\n<pre><code class=\"cpp\">unsigned int http_ans_len = 227384;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0431\u0435\u0437 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"xml\">&lt;html> &lt;head> &lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/xterm\/3.14.5\/xterm.min.css\" \/>     &lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/xterm\/3.14.5\/xterm.min.js\">&lt;\/script> &lt;\/head> &lt;body>     &lt;div id=\"terminal\">&lt;\/div>     &lt;script>         var opts = { cols: 80, rows: 54, convertEol : 1         }          var term = new Terminal(opts);         term.open(document.getElementById('terminal'));  var ws = new WebSocket(\"ws:\/\/192.168.10.1:3000\"); ws.binaryType = \"arraybuffer\";  ws.addEventListener('message', function (event) { term.write(event.data); });          term.on(\"key\", function(key, ev) { if (ev.keyCode === 13) { ws.send(\"\\n\"); } else if (ev.keyCode === 8) { ws.send(\"\\b\"); } else { ws.send(key); }         });     &lt;\/script> &lt;\/body> &lt;\/html><\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 HTTP \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">struct tcp_pcb* http = tcp_new(); tcp_bind(http, IP_ADDR_ANY, 80); http = tcp_listen_with_backlog(http, TCP_DEFAULT_LISTEN_BACKLOG); tcp_accept(http, http_accept);<\/code><\/pre>\n<pre><code class=\"cpp\">err_t http_recv(void* arg, struct tcp_pcb* tpcb, struct pbuf* p,                 err_t err) { int data_len = p->tot_len; char tcp_rec[data_len]; pbuf_copy_partial(p, (void*)tcp_rec, data_len, 0); tcp_recved(tpcb, data_len); pbuf_free(p);  char answer_html[1000]; sprintf(answer_html, HTTP_RSP, http_ans_len);  tcp_write(tpcb, answer_html, strlen(answer_html), 0x01);  http_ans_sended = 0;  return ERR_OK; }<\/code><\/pre>\n<pre><code class=\"cpp\">const char HTTP_RSP[] = \\ \"HTTP\/1.1 200 OK\\r\\n\" \\ \"Content-Length: %d\\r\\n\" \\ \"Content-Type: text\/html\\r\\n\\r\\n\";<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>WebSocket-\u0441\u0435\u0440\u0432\u0435\u0440<\/h2>\n<p>\u0421 WebSocket \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0432\u043d\u0438\u043a\u0430\u0442\u044c, \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u00a0\u041f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c SHA1 \u0438 Base64, \u044d\u0442\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 WebSocket-\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b, \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/sandbox\/171066\">\u0442\u0443\u0442<\/a>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u0432 <a href=\"https:\/\/github.com\/karen07\/lwip\/blob\/master\/src\/apps\/web_load\/lwip_u_boot_port.c\">lwip_u_boot_port.c<\/a>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 WebSocket-\u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">const char WS_RSP[] = \\ \"HTTP\/1.1 101 Switching Protocols\\r\\n\" \\ \"Upgrade: websocket\\r\\n\" \\ \"Connection: Upgrade\\r\\n\" \\ \"Sec-WebSocket-Accept: %s\\r\\n\\r\\n\"; const char WS_GUID[] = \"258EAFA5-E914-47DA-95CA-C5AB0DC85B11\"; const char WS_KEY[] = \"Sec-WebSocket-Key: \";<\/code><\/pre>\n<pre><code class=\"cpp\">err_t websocket_recv(void* arg, struct tcp_pcb* tpcb, struct pbuf* p,                      err_t err) { if (p == NULL) { web_socket_open = 0; globa_tcp = NULL; tcp_get = 0; return ERR_OK; }  int data_len = p->tot_len; char tcp_rec[data_len]; pbuf_copy_partial(p, (void*)tcp_rec, data_len, 0); tcp_recved(tpcb, data_len);  if(web_socket_open == 0){ char * sec_websocket_position_start = strstr(tcp_rec, WS_KEY); if(sec_websocket_position_start){<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0412\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u0441\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043d\u0430\u0439\u0442\u0438 \u043c\u0435\u0441\u0442\u043e \u0432\u0432\u043e\u0434\u0430\/\u0432\u044b\u0432\u043e\u0434\u0430 \u043e\u0431\u044b\u0447\u043d\u043e\u0439 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 U-Boot \u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u043d\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0435\/\u0443\u0448\u0435\u0434\u0448\u0438\u0435 \u0438\u0437 WebSocket. \u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043c\u044b \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u0434 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0436\u0434\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434, \u0444\u0430\u0439\u043b <a href=\"https:\/\/github.com\/karen07\/u-boot\/blob\/48ae5ba4f84dbe777e1a000179b876847a486060\/common\/main.c\">main.c<\/a>. \u0410 \u0441\u0430\u043c\u0430 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0444\u0430\u0439\u043b\u0435 <a href=\"https:\/\/github.com\/karen07\/u-boot\/blob\/48ae5ba4f84dbe777e1a000179b876847a486060\/common\/console.c\">console.c<\/a>. \u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0438\u043b\u0438 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0440\u0430\u0432\u0438\u043b\u0430 WebSocket.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u0438<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>lwip_u_boot_port();  cli_loop();<\/code><\/pre>\n<pre><code class=\"cpp\">#ifndef CONFIG_SPL_BUILD if(push_packet) { eth_rx(); char tmp = tcp_get; tcp_get = 0; if(tmp) return tmp; } #endif<\/code><\/pre>\n<pre><code class=\"cpp\">#ifndef CONFIG_SPL_BUILD if(globa_tcp) { unsigned char buf[3]; buf[0] = 0x80 | 0x01; buf[1] = 1; buf[2] = c; tcp_write(globa_tcp, buf, 3, 1); tcp_output(globa_tcp); } else { #endif<\/code><\/pre>\n<pre><code class=\"cpp\">#ifndef CONFIG_SPL_BUILD if(globa_tcp) { int len = strlen(s); unsigned char buf[150]; while (len) { int send_len = min(len, 125); buf[0] = 0x80 | 0x01; buf[1] = send_len; memcpy(&amp;buf[2], s, send_len); tcp_write(globa_tcp, buf, send_len + 2, 1); len -= send_len; s += send_len; } tcp_output(globa_tcp); } else { #endif<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>\u0417\u0430\u043f\u0443\u0441\u043a \u043d\u0430 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 QEMU<\/h2>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0437\u0430\u043b\u0438\u0432\u0430\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u043d\u0430 \u0440\u043e\u0443\u0442\u0435\u0440 &#8212; \u043d\u0435 \u0441\u0430\u043c\u0430\u044f \u0431\u044b\u0441\u0442\u0440\u0430\u044f \u0437\u0430\u0442\u0435\u044f, \u0438 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c U-Boot \u043f\u043e\u0434 QEMU.<\/p>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<pre><code class=\"bash\">sudo apt update sudo apt upgrade sudo apt install build-essential bison flex libncurses5-dev libncursesw5-dev unzip \\ qemu-system-mips gcc-mips-linux-gnu colordiff firefox ncdu dos2unix libssl-dev \\  bc u-boot-tools<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0432\u044b\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b LWIP \u043a\u0430\u043a \u043f\u043e\u0434\u043c\u043e\u0434\u0443\u043b\u044c \u0434\u043b\u044f U-Boot. \u0412\u044b\u043a\u0430\u0447\u0430\u0442\u044c \u0438\u0445 \u0432\u043c\u0435\u0441\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<pre><code class=\"bash\">git clone --recurse-submodules https:\/\/github.com\/karen07\/u-boot.git<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u043f\u043e\u0434 \u0434\u0440\u0443\u0433\u043e\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e Malta:<\/p>\n<pre><code class=\"bash\">make malta_defconfig<\/code><\/pre>\n<p>\u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c U-Boot API \u0432 make menuconfig, \u043a\u0430\u043a \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043f\u043e\u0432\u044b\u0448\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0432 \u043c\u0435\u043d\u044e \u201cBoot options\u201d -> \u201cAutoboot options\u201d -> \u201dAutoboot\u201d \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/796\/009\/fd5\/796009fd5f792437c0dfdf2ff4fa233a.png\" alt=\"Autoboot \u043e\u043f\u0446\u0438\u044f\" title=\"Autoboot \u043e\u043f\u0446\u0438\u044f\" width=\"974\" height=\"158\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/796\/009\/fd5\/796009fd5f792437c0dfdf2ff4fa233a.png\"\/><\/p>\n<div><figcaption>Autoboot \u043e\u043f\u0446\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441\u0431\u043e\u0440\u043a\u0443:<\/p>\n<pre><code class=\"bash\">make<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u00a0Ethernet:<\/p>\n<pre><code class=\"bash\">sudo ip tuntap add dev tap0 mode tap &amp;&amp; sudo ip link set dev tap0 up<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c U-Boot \u0432 Qemu:<\/p>\n<pre><code class=\"bash\">sudo qemu-system-mips -M malta -m 256 --nographic -net nic \\ -net tap,ifname=tap0,script=no,downscript=no -bios u-boot.bin<\/code><\/pre>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c IP-\u0430\u0434\u0440\u0435\u0441:<\/p>\n<pre><code class=\"bash\">sudo dhclient tap0<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0438 \u0437\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 <code>192.168.10.1<\/code>:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e53\/698\/783\/e536987837232f8ae089da5110385ab2.png\" alt=\"\u0412\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c\" title=\"\u0412\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c\" width=\"793\" height=\"865\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e53\/698\/783\/e536987837232f8ae089da5110385ab2.png\"\/><\/p>\n<div><figcaption>\u0412\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/figcaption><\/div>\n<\/figure>\n<p>\u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0443 \u0441\u0435\u0431\u044f \u0437\u0430\u043f\u0443\u0441\u043a \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0432 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 QEMU.<\/p>\n<h2>\u0412\u044b\u0432\u043e\u0434\u044b<\/h2>\n<p>\u0421\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u0443\u044e \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043d\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0435, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0441\u043f\u0438\u0441\u043e\u043a \u043a\u043e\u043c\u0430\u043d\u0434, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043a\u0430\u0436\u0434\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u043d\u0430 \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435 QEMU. \u041d\u043e \u043a\u043e\u0434 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u044d\u0442\u0430\u043b\u043e\u043d\u043e\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u0442\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0439 \u0438 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0441\u0442\u0435\u0439, \u0438 \u0431\u044b\u043b \u0441\u0434\u0435\u043b\u0430\u043d \u043f\u0440\u043e\u0441\u0442\u043e \u0447\u0442\u043e\u0431\u044b \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0445\u043e\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430.<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/757614\/\"> https:\/\/habr.com\/ru\/articles\/757614\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043b U-Boot \u0438 TCP\/IP \u0441\u0442\u0435\u043a LWIP, \u0438 c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c LWIP \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c \u043d\u0430 WebSocket, \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 DHCP-\u0441\u0435\u0440\u0432\u0435\u0440 \u0438 HTTP-\u0441\u0435\u0440\u0432\u0435\u0440. \u041a\u043e\u0434 \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u044f\u0445 <a href=\"https:\/\/github.com\/karen07\/u-boot\">U-Boot<\/a> \u0438 <a href=\"https:\/\/github.com\/karen07\/lwip\">LWIP<\/a>.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0412\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c<\/figcaption><\/div>\n<\/figure>\n<p>\u0412\u0441\u0451 \u043d\u0430\u0447\u0430\u043b\u043e\u0441\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u043d\u0435 \u043f\u043e\u0434\u0430\u0440\u0438\u043b\u0438 \u0434\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0440\u043e\u0443\u0442\u0435\u0440 <a href=\"https:\/\/openwrt.org\/toh\/hwdata\/xiaomi\/xiaomi_miwifi_3c\">Xiaomi Mi Wi-Fi Router 3C<\/a>.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>Xiaomi Mi Wi-Fi Router 3C<\/figcaption><\/div>\n<\/figure>\n<p>\u042f \u043d\u0430\u0447\u0430\u043b \u0441 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 OpenWRT \u0434\u043b\u044f \u0440\u043e\u0443\u0442\u0435\u0440\u0430, \u043d\u043e \u044d\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u043e \u043d\u0430\u0441\u043a\u0443\u0447\u0438\u043b\u043e. \u0422\u0430\u043a \u043a\u0430\u043a \u0441 \u043f\u0440\u043e\u0448\u043b\u044b\u0445 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0443 \u043c\u0435\u043d\u044f \u043e\u0441\u0442\u0430\u0432\u0430\u043b\u0441\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0442\u043e\u0440 \u0438 USB-UART-\u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440 <a href=\"https:\/\/habr.com\/ru\/articles\/262731\">CH341A<\/a>, \u0442\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u043c\u0435\u043d\u044f\u0442\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u0440\u043e\u0443\u0442\u0435\u0440\u0430, \u0437\u0430\u043b\u0438\u0432 \u0435\u0433\u043e \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432 SPI Flash \u043f\u0430\u043c\u044f\u0442\u044c \u0440\u043e\u0443\u0442\u0435\u0440\u0430.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>CH341A \u0438 Xiaomi Mi Wi-Fi Router 3C<\/figcaption><\/div>\n<\/figure>\n<h2>\u0417\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a Breed<\/h2>\n<p>\u041d\u0430 <a href=\"https:\/\/4pda.to\/forum\/index.php?showtopic=764502\">4PDA<\/a> \u0431\u044b\u043b\u0430 \u0433\u043e\u0442\u043e\u0432\u0430\u044f \u0441\u0431\u043e\u0440\u043a\u0430 OpenWRT c \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u043e\u043c <a href=\"https:\/\/breed.hackpascal.net\">Breed<\/a>. \u042d\u0442\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a c Web-GUI \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0447\u0435\u0440\u0435\u0437 \u0431\u0440\u0430\u0443\u0437\u0435\u0440 \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438. \u041d\u043e \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0439\u0442\u0438 \u0432 Web-GUI, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0430\u0436\u0430\u0442\u044c Enter \u0432 UART \u043a\u043e\u043d\u0441\u043e\u043b\u0438. \u041a\u0430\u043a \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c UART, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e <a href=\"https:\/\/openwrt.org\/toh\/xiaomi\/mir3c\">\u0442\u0443\u0442<\/a>. \u0410 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043c\u043e\u0436\u043d\u043e \u0447\u0435\u0440\u0435\u0437 <a href=\"https:\/\/www.putty.org\">PuTTY<\/a>. \u041d\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432, \u043a\u0430\u043a\u043e\u0439 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 COM-\u043f\u043e\u0440\u0442 \u0441\u043e\u0437\u0434\u0430\u043b \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440.<\/p>\n<figure class=\"\">\n<div><figcaption>COM \u043f\u043e\u0440\u0442<\/figcaption><\/div>\n<\/figure>\n<p>\u0410 \u0434\u0430\u043b\u044c\u0448\u0435 \u0432\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u044d\u0442\u043e\u0442 \u043d\u043e\u043c\u0435\u0440 \u0432 PuTTY:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>PuTTy<\/figcaption><\/div>\n<\/figure>\n<p>\u0418 \u0432\u0438\u0434\u0438\u043c \u043b\u043e\u0433 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 Breed:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041b\u043e\u0433 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 Breed<\/figcaption><\/div>\n<\/figure>\n<p>\u041e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0432 \u0430\u0432\u0442\u043e\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 Linux, \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 Web-GUI \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 <code>192.168.1.1<\/code>. \u0413\u043b\u0430\u0432\u043d\u043e\u0435, \u0447\u0442\u043e\u0431\u044b \u044d\u0442\u043e\u0442 \u0430\u0434\u0440\u0435\u0441 \u043d\u0435 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u043b \u0441 \u0432\u0430\u0448\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u0440\u043e\u0443\u0442\u0435\u0440\u043e\u043c.<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0418\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e\u0431 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u0432 Web-GUI <\/figcaption><\/div>\n<\/figure>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u0432 \u043c\u0435\u043d\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0420\u0430\u0437\u0434\u0435\u043b \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0432 Web-GUI<\/figcaption><\/div>\n<\/figure>\n<p>\u041c\u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u0438\u0434\u0435\u044f \u0441 Web-GUI \u0438 \u043c\u043d\u0435 \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0435\u0451 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 open source \u043a\u043e\u0434\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 open source \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a U-Boot.<\/p>\n<h2>U-Boot<\/h2>\n<p>\u0420\u043e\u0443\u0442\u0435\u0440 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u043d\u0430 \u0431\u0430\u0437\u0435 MediaTek MT7628AN, \u0430 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0447\u0438\u043f\u0430 \u0432 U-Boot \u0435\u0441\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430. \u041d\u043e \u0434\u0430\u0436\u0435 \u0441\u0431\u043e\u0440\u043a\u0430 U-Boot \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u043d\u0435\u0442\u0440\u0438\u0432\u0438\u0430\u043b\u044c\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u0434\u043b\u044f \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441 \u044d\u0442\u0438\u043c \u0432 \u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0430\u0437. \u042f \u0431\u0443\u0434\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b \u0441 Ubuntu 22.04 LTS.<\/p>\n<p>\u041d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<pre><code class=\"bash\">sudo apt update sudo apt upgrade sudo apt install build-essential bison flex libncurses5-dev libncursesw5-dev unzip \\ qemu-system-mips gcc-mips-linux-gnu colordiff firefox ncdu dos2unix libssl-dev \\  bc u-boot-tools<\/code><\/pre>\n<p>\u0412\u044b\u043a\u0430\u0447\u0430\u0442\u044c U-Boot:<\/p>\n<pre><code class=\"bash\">git clone https:\/\/github.com\/u-boot\/u-boot.git<\/code><\/pre>\n<p>\u0412\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043a\u0440\u043e\u0441\u0441-\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438:<\/p>\n<pre><code class=\"bash\">export ARCH=mips export CROSS_COMPILE=mips-linux-gnu-<\/code><\/pre>\n<p>\u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<pre><code class=\"bash\">make mt7628_rfb_defconfig<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0443:<\/p>\n<pre><code>make<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u0437\u0430\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438 \u043d\u0430 \u0440\u043e\u0443\u0442\u0435\u0440, \u044f \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u043d\u0430 \u043d\u0451\u043c \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a Breed, \u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a U-Boot \u0437\u0430\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u043b \u0432 \u043e\u0431\u0440\u0430\u0437 \u044f\u0434\u0440\u0430 Linux. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a Breed \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a U-Boot. \u0410 \u043f\u0435\u0440\u0432\u043e\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u044f \u0437\u0430\u043b\u0438\u043b \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a Breed \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0442\u043e\u0440.<\/p>\n<pre><code class=\"bash\">mkimage -A mips -T kernel -C none -O linux -a 0x80200000 -e 0x80200000 \\ -n \"U-Boot\" -d u-boot.bin u-boot.img<\/code><\/pre>\n<p>\u0417\u0430\u0433\u0440\u0443\u0437\u0438\u043c \u043e\u0431\u0440\u0430\u0437 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 U-Boot:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u0417\u0430\u0433\u0440\u0443\u0437\u043a\u0430 u-boot.img<\/figcaption><\/div>\n<\/figure>\n<p>\u0418 \u0443\u0432\u0438\u0434\u0438\u043c \u0432 PuTTY \u043b\u043e\u0433 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a\u0430 U-Boot:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u041b\u043e\u0433 U-Boot<\/figcaption><\/div>\n<\/figure>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a Breed \u0438\u043c\u0435\u0435\u0442 Web-GUI, \u0442\u043e \u0434\u043b\u044f U-Boot \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0445\u043e\u0442\u044f \u0431\u044b \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c.<\/p>\n<p>\u0414\u043b\u044f \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c WebSocket, \u0430 \u043e\u043d \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 TCP. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e U-Boot \u0443\u043c\u0435\u0435\u0442 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 UDP. \u0410 \u0437\u043d\u0430\u0447\u0438\u0442 \u0434\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f TCP \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u043d\u0435\u0448\u043d\u0438\u043c TCP\/IP \u0441\u0442\u0435\u043a\u043e\u043c. \u0412\u044b\u0431\u043e\u0440 \u043f\u0430\u043b \u043d\u0430 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0439 LWIP.<\/p>\n<h2>LWIP<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u044f \u0432\u044b\u043a\u0430\u0447\u0430\u043b LWIP \u0432 \u043f\u0430\u043f\u043a\u0443 <code>\/lib<\/code> \u043f\u0440\u043e\u0435\u043a\u0442\u0430 U-Boot:<\/p>\n<pre><code class=\"bash\">git clone https:\/\/github.com\/lwip-tcpip\/lwip.git<\/code><\/pre>\n<p>\u0421\u0431\u043e\u0440\u043a\u0430 U-Boot \u043e\u0441\u043d\u043e\u0432\u0430 \u043d\u0430 Kconfig, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0431\u043e\u0440\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 Kconfig \u0434\u043b\u044f LWIP. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u0440\u043e Kconfig \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/www.kernel.org\/doc\/html\/next\/kbuild\/kconfig-language.html\">\u0442\u0443\u0442<\/a>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u0447\u0430\u0441\u0442\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0438\u0437 makefile:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cmake\">ccflags-y += -I$(obj)\/..\/include  obj-y += \\     init.o \\ def.o \\ dns.o \\ inet_chksum.o \\ ip.o \\ mem.o \\ memp.o \\<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 LWIP \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b <code>lwipopts.h<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 TCP, \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0440\u0430\u0437\u043c\u0435\u0440\u044b \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0442. \u0434. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/www.nongnu.org\/lwip\/2_0_x\/group__lwip__opts.html\">\u0442\u0443\u0442<\/a>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u0447\u0430\u0441\u0442\u0438 lwipopts.h:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#ifndef __LWIPOPTS_H__ #define __LWIPOPTS_H__  #define NO_SYS                  1 #define SYS_LIGHTWEIGHT_PROT    0  #define LWIP_NETCONN                    0 #define LWIP_SOCKET                     0 #define LWIP_DHCP                       1  #define MEM_ALIGNMENT           4 #define MEM_SIZE                        (8 * 1024 * 1024)<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b <code>cc.h<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u0440\u0430\u043d\u0438\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u0447\u0430\u0441\u0442\u0438 cc.h:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">#ifndef __ARCH_CC_H__ #define __ARCH_CC_H__  #include &lt;stdio.h> #include &lt;stdlib.h> #include &lt;string.h>  int atoi(const char *str);  #ifdef CONFIG_SYS_BIG_ENDIAN #define BYTE_ORDER BIG_ENDIAN #else #define BYTE_ORDER LITTLE_ENDIAN #endif  #define LWIP_NO_LIMITS_H 1 #define LWIP_NO_CTYPE_H 1  typedef uint8_t     u8_t; typedef int8_t      s8_t;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041c\u0435\u0442\u043e\u0434\u043e\u043c \u043f\u0440\u043e\u0431 \u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u044d\u0442\u0438 \u0444\u0430\u0439\u043b\u044b \u0431\u044b\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u044b.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u043f\u0430\u043a\u0435\u0442 \u043e\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 Ethernet \u043a LWIP.<\/p>\n<p>\u0423 U-Boot \u0435\u0441\u0442\u044c \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f callback-\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0432\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u043f\u0430\u043a\u0435\u0442\u043e\u0432. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c API \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0441\u0431\u043e\u0440\u043a\u0438.<\/p>\n<pre><code>make menuconfig<\/code><\/pre>\n<figure class=\"full-width\">\n<div><figcaption>make menuconfig<\/figcaption><\/div>\n<\/figure>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u043e\u0442 \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0430 Ethernet \u043a LWIP <\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">void eth_save_packet_lwip(void* packet, int length) { if (length > 0) { struct pbuf* p = pbuf_alloc(PBUF_RAW, length, PBUF_POOL); if (p != NULL) { pbuf_take(p, packet, length); if (netif.input(p, &amp;netif) != ERR_OK) { pbuf_free(p); } } } }<\/code><\/pre>\n<pre><code class=\"cpp\">push_packet = eth_save_packet_lwip;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u0430\u043a\u0435\u0442\u0430 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u044e U-Boot <code>eth_send<\/code>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u0430\u043a\u0435\u0442\u0430 \u043e\u0442 LWIP \u043a \u0434\u0440\u0430\u0439\u0432\u0435\u0440\u0443 Ethernet<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">err_t netif_output(struct netif* netif, struct pbuf* p) { unsigned char mac_send_buffer[p->tot_len]; pbuf_copy_partial(p, (void*)mac_send_buffer, p->tot_len, 0); eth_send(mac_send_buffer, p->tot_len); return ERR_OK; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u0418\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f LWIP, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 IP-\u0430\u0434\u0440\u0435\u0441\u0430, \u043c\u0430\u0441\u043a\u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0438 \u0448\u043b\u044e\u0437\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 LWIP, \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 IP-\u0430\u0434\u0440\u0435\u0441\u0430, \u043c\u0430\u0441\u043a\u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0438 \u0448\u043b\u044e\u0437\u0430 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e.<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">eth_halt(); eth_init();  ip4_addr_t addr; ip4_addr_t netmask; ip4_addr_t gw;  IP4_ADDR(&amp;addr, 192, 168, 10, 1); IP4_ADDR(&amp;netmask, 255, 255, 255, 0); IP4_ADDR(&amp;gw, 192, 168, 10, 2);  lwip_init();  netif_add(&amp;netif, &amp;addr, &amp;netmask, &amp;gw, NULL, netif_set_opts, netif_input);  netif.name[0] = 'e'; netif.name[1] = '0'; netif_set_default(&amp;netif);<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<p>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 MTU \u0438 MAC \u0430\u0434\u0440\u0435\u0441\u0430.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 MTU \u0438 MAC \u0430\u0434\u0440\u0435\u0441\u0430.<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">err_t netif_set_opts(struct netif* netif) { netif->linkoutput = netif_output; netif->output = etharp_output; netif->mtu = 1500; netif->flags = NETIF_FLAG_BROADCAST | NETIF_FLAG_ETHARP \\     | NETIF_FLAG_ETHERNET | NETIF_FLAG_LINK_UP | NETIF_FLAG_UP; netif->hwaddr_len = 6;  if (env_get(\"ethaddr\")) string_to_enetaddr(env_get(\"ethaddr\"), netif->hwaddr); else memset(netif->hwaddr, 0, 6);  return ERR_OK; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>DHCP-\u0441\u0435\u0440\u0432\u0435\u0440<\/h2>\n<p>\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c\u044e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u0432\u044b\u0434\u0430\u0432\u0430\u043b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e IP-\u0430\u0434\u0440\u0435\u0441, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0447\u0435\u043d\u044c \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u044b\u0439 DHC-\u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043e\u0442\u0434\u0430\u0451\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u043f\u0430\u043a\u0435\u0442, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0432\u044b\u0434\u0430\u0435\u0442\u0441\u044f IP-\u0430\u0434\u0440\u0435\u0441 <code>192.168.10.2<\/code>, \u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a \u0438\u043c\u0435\u0435\u0442 \u0430\u0434\u0440\u0435\u0441 <code>192.168.10.1<\/code>. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/www.xelent.ru\/blog\/printsipy-raboty-protokola-dhcp\">\u0442\u0443\u0442<\/a>. \u041a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u0432 <a href=\"https:\/\/github.com\/karen07\/lwip\/blob\/master\/src\/apps\/web_load\/lwip_u_boot_port.c\">lwip_u_boot_port.c<\/a>.<\/p>\n<details class=\"spoiler\">\n<summary>\u041a\u043e\u0434 DHCP-\u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">struct udp_pcb *dhcp = udp_new(); udp_bind(dhcp, IP_ADDR_ANY, 67); udp_recv(dhcp , dhcp_recv, NULL);<\/code><\/pre>\n<pre><code class=\"cpp\">void dhcp_recv(void *arg, struct udp_pcb *pcb, struct pbuf *p,                 const ip_addr_t *addr, u16_t port) { if(p == NULL) return;  dhcps_msg dhcp_rec;  int data_len = p->tot_len; pbuf_copy_partial(p, (void*)&amp;dhcp_rec, data_len, 0); pbuf_free(p);  int i = 4; while(dhcp_rec.options[i] != 255 &amp;&amp; dhcp_rec.options[i] != 53) { i += dhcp_rec.options[i+1] + 2; }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<h2>HTTP-\u0441\u0435\u0440\u0432\u0435\u0440<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u0432\u0435\u0431-\u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0442\u0434\u0430\u0442\u044c http-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443. \u0422\u0430\u043a \u043a\u0430\u043a \u0443 \u043d\u0430\u0441 \u0441\u0442\u0430\u0442\u0438\u0447\u043d\u0430\u044f http-\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430, \u0442\u043e \u043d\u0430\u043c \u0445\u0432\u0430\u0442\u0438\u0442 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e http-\u0441\u0435\u0440\u0432\u0435\u0440\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430 \u043b\u044e\u0431\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043e\u0442\u0434\u0430\u0451\u0442 \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0437\u0430\u043f\u0440\u043e\u0441. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/developer.mozilla.org\/ru\/docs\/Web\/HTTP\/Overview\">\u0442\u0443\u0442<\/a>. \u041d\u043e \u0442\u0430\u043a \u043a\u0430\u043a \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b\u0430 \u0432 \u0441\u0435\u0431\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0438\u0445 \u0432\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0432 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0435\u0437 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u043b\u0430\u0441\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b <code>xxd<\/code> \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0432 \u043c\u0430\u0441\u0441\u0438\u0432 \u0434\u043b\u044f C. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043a\u043e\u0434 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u043d \u0432 <a href=\"https:\/\/github.com\/karen07\/lwip\/blob\/master\/src\/apps\/web_load\/lwip_u_boot_port.c\">lwip_u_boot_port.c<\/a>.<\/p>\n<pre><code class=\"bash\">xxd -include index.html<\/code><\/pre>\n<details class=\"spoiler\">\n<summary>\u041f\u0440\u0438\u043c\u0435\u0440 \u0432\u044b\u0432\u043e\u0434\u0430 xxd<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"cpp\">unsigned char http_ans[] = {   0x3c, 0x68, 0x74, 0x6d, 0x6c, 0x3e, 0x0a, 0x3c, 0x68, 0x65, 0x61, 0x64,   0x3e, 0x0a, 0x09, 0x3c, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x3e, 0x0a, 0x09,   0x2e, 0x78, 0x74, 0x65, 0x72, 0x6d, 0x7b, 0x66, 0x6f, 0x6e, 0x74, 0x2d,   0x66, 0x65, 0x61, 0x74, 0x75, 0x72, 0x65, 0x2d, 0x73, 0x65, 0x74, 0x74,   0x69, 0x6e, 0x67, 0x73, 0x3a, 0x22, 0x6c, 0x69, 0x67, 0x61, 0x22, 0x20,   0x30, 0x3b, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x72,   0x65, 0x6c, 0x61, 0x74, 0x69, 0x76, 0x65, 0x3b, 0x75, 0x73, 0x65, 0x72,   0x2d, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x3a, 0x6e, 0x6f, 0x6e, 0x65,   0x3b, 0x2d, 0x6d, 0x73, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x2d, 0x73, 0x65,   0x6c, 0x65, 0x63, 0x74, 0x3a, 0x6e, 0x6f, 0x6e, 0x65, 0x3b, 0x2d, 0x77,   0x65, 0x62, 0x6b, 0x69, 0x74, 0x2d, 0x75, 0x73, 0x65, 0x72, 0x2d, 0x73,   0x65, 0x6c, 0x65, 0x63, 0x74, 0x3a, 0x6e, 0x6f, 0x6e, 0x65, 0x7d, 0x2e,   0x78, 0x74, 0x65, 0x72, 0x6d, 0x2e, 0x66, 0x6f, 0x63, 0x75, 0x73, 0x2c,   0x2e, 0x78, 0x74, 0x65, 0x72, 0x6d, 0x3a, 0x66, 0x6f, 0x63, 0x75, 0x73,   0x7b, 0x6f, 0x75, 0x74, 0x6c, 0x69, 0x6e, 0x65, 0x3a, 0x30, 0x7d, 0x2e,   0x78, 0x74, 0x65, 0x72, 0x6d, 0x20, 0x2e, 0x78, 0x74, 0x65, 0x72, 0x6d,   0x2d, 0x68, 0x65, 0x6c, 0x70, 0x65, 0x72, 0x73, 0x7b, 0x70, 0x6f, 0x73,   0x69, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x61, 0x62, 0x73, 0x6f, 0x6c, 0x75,   0x74, 0x65, 0x3b, 0x74, 0x6f, 0x70, 0x3a, 0x30, 0x3b, 0x7a, 0x2d, 0x69,   0x6e, 0x64, 0x65, 0x78, 0x3a, 0x31, 0x30, 0x7d, 0x2e, 0x78, 0x74, 0x65,<\/code><\/pre>\n<pre><code class=\"cpp\">unsigned int http_ans_len = 227384;<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<details class=\"spoiler\">\n<summary>\u0421\u0442\u0440\u0430\u043d\u0438\u0446\u0430 \u0431\u0435\u0437 \u0432\u0441\u0442\u0430\u0432\u043a\u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0435\u0439<\/summary>\n<div class=\"spoiler__content\">\n<pre><code class=\"xml\">&lt;html> &lt;head> &lt;link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/xterm\/3.14.5\/xterm.min.css\" \/>     &lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/xterm\/3.14.5\/xterm.min.js\">&lt;\/script> &lt;\/head> &lt;body>     &lt;div id=\"terminal\">&lt;\/div>     &lt;script>         var opts = { cols: 80, rows: 54, convertEol : 1         }          var term = new Terminal(opts);         term.open(document.getElementById('terminal'));  var ws = new WebSocket(\"ws:\/\/192.168.10.1:3000\"); ws.binaryType = \"arraybuffer\";  ws.addEventListener('message', function (event) { term.write(event.data); });          term.on(\"key\", function(key, ev) { if (ev.keyCode === 13) { ws.send(\"\\n\"); } else if (ev.keyCode === 8) { ws.send(\"\\b\"); } else { ws.send(key); }         });     &lt;\/script> &lt;<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-353465","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353465","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=353465"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/353465\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=353465"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=353465"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=353465"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}