{"id":307674,"date":"2020-07-29T15:00:30","date_gmt":"2020-07-29T15:00:30","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=307674"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=307674","title":{"rendered":"\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u0440\u0430\u0437\u0430 Ubuntu \u0434\u043b\u044f ARM \u00abfrom scratch\u00bb"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/512994\/\">\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u043e \u0435\u0449\u0435 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0430\u043a\u0435\u0442\u044b \u043f\u043e\u0439\u0434\u0443\u0442 \u0432 \u0446\u0435\u043b\u0435\u0432\u0443\u044e rootfs.<\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0445\u0432\u0430\u0442\u0430\u0442\u044c\u0441\u044f \u0437\u0430 LFS, buildroot \u0438\u043b\u0438 yocto (\u0438\u043b\u0438 \u0435\u0449\u0435 \u0447\u0442\u043e-\u0442\u043e) \u0435\u0449\u0435 \u0440\u0430\u043d\u043e, \u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0443\u0436\u0435 \u043d\u0443\u0436\u043d\u043e. \u0414\u043b\u044f \u0431\u043e\u0433\u0430\u0442\u044b\u0445 (\u0443 \u043c\u0435\u043d\u044f \u043d\u0430 \u043f\u0438\u043b\u043e\u0442\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0437\u0446\u0430\u0445 4GB eMMC) \u0435\u0441\u0442\u044c \u0432\u044b\u0445\u043e\u0434 \u0440\u0430\u0437\u0434\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0447\u0435\u0433\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u0430 \u0437\u0430\u0442\u0435\u043c \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0432\u043e\u0439 rootfs.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f \u043d\u0435 \u043d\u0435\u0441\u0435\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043d\u043e\u0432\u0438\u0437\u043d\u044b \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u043f\u0440\u043e\u0441\u0442\u0443\u044e copy-paste \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e.<\/p>\n<p>  <\/p>\n<p>\u0426\u0435\u043b\u044c \u0441\u0442\u0430\u0442\u044c\u0438 \u0441\u0431\u043e\u0440\u043a\u0430 Ubuntu rootfs \u0434\u043b\u044f ARM \u0431\u043e\u0440\u0434\u044b (\u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430 \u0431\u0430\u0437\u0435 Colibri imx7d).<\/p>\n<p>  <\/p>\n<h2 id=\"sborka-obraza\">\u0421\u0431\u043e\u0440\u043a\u0430 \u043e\u0431\u0440\u0430\u0437\u0430<\/h2>\n<p>  <\/p>\n<p>\u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0446\u0435\u043b\u0435\u0432\u043e\u0439 rootfs \u0434\u043b\u044f \u0442\u0438\u0440\u0430\u0436\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f.<\/p>\n<p>  <\/p>\n<h3 id=\"raspakovyvaem-ubuntu-base\">\u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u043c Ubuntu Base<\/h3>\n<p>  <\/p>\n<p>\u0420\u0435\u043b\u0438\u0437 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0430\u043c\u0438 \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0442\u0435\u043d\u0438\u0439. \u0417\u0434\u0435\u0441\u044c \u044f \u043f\u0440\u0438\u0432\u0435\u043b 20.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$ mkdir ubuntu20 $ cd ubuntu20 $ mkdir rootfs $ wget http:\/\/cdimage.ubuntu.com\/ubuntu-base\/releases\/20.04\/release\/ubuntu-base-20.04-base-armhf.tar.gz $ tar xf ubuntu-base-20.04-base-armhf.tar.gz -C rootfs<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"proverka-podderzhki-binfmt-v-yadre\">\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 BINFMT \u0432 \u044f\u0434\u0440\u0435<\/h3>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u0439 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432, \u0442\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 BINFMT_MISC \u0435\u0441\u0442\u044c \u0438 \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0435\u0442 \u2014 \u0442\u043e \u044f \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435 \u043a\u0430\u043a \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 BINFMT \u0432 \u044f\u0434\u0440\u0435.<\/p>\n<p>  <\/p>\n<p>\u0423\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e BINFMT_MISC \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u043e \u0432 \u044f\u0434\u0440\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$ zcat \/proc\/config.gz | grep BINFMT CONFIG_BINFMT_ELF=y CONFIG_COMPAT_BINFMT_ELF=y CONFIG_BINFMT_SCRIPT=y CONFIG_BINFMT_MISC=y<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$ ls \/proc\/sys\/fs\/binfmt_misc qemu-arm  register  status $ cat \/proc\/sys\/fs\/binfmt_misc\/qemu-arm enabled interpreter \/usr\/bin\/qemu-arm flags: OC offset 0 magic 7f454c4601010100000000000000000002002800 mask ffffffffffffff00fffffffffffffffffeffffff<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/wiki.gentoo.org\/wiki\/Embedded_Handbook\/General\/Compiling_with_qemu_user_chroot#Usage\" rel=\"nofollow\">\u0432\u043e\u0442 \u044d\u0442\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438<\/a>.<\/p>\n<p>  <\/p>\n<h2 id=\"nastroyka-qemu-static-arm\">\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 qemu static arm<\/h2>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 qemu \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438.<\/p>\n<p>  <\/p>\n<blockquote><p>!!! \u0412\u041d\u0418\u041c\u0410\u041d\u0418\u0415!!!<br \/>  \u0415\u0441\u043b\u0438 \u0432\u044b \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u0435\u0442\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u043a\u0438 \u0447\u0435\u0433\u043e \u043b\u0438\u0431\u043e, \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u044c\u0442\u0435\u0441\u044c:<br \/>  <a href=\"https:\/\/sourceware.org\/bugzilla\/show_bug.cgi?id=23960\" rel=\"nofollow\">https:\/\/sourceware.org\/bugzilla\/show_bug.cgi?id=23960<\/a><br \/>  <a href=\"https:\/\/bugs.launchpad.net\/qemu\/+bug\/1805913\" rel=\"nofollow\">https:\/\/bugs.launchpad.net\/qemu\/+bug\/1805913<\/a><br \/>  \u0422\u043e\u0433\u0434\u0430 \u0434\u043b\u044f x86_64 host \u0438 arm guest \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c i386 \u0432\u0435\u0440\u0441\u0438\u044e qemu:<br \/>  <a href=\"http:\/\/ftp.ru.debian.org\/debian\/pool\/main\/q\/qemu\/qemu-user-static_5.0-13_i386.deb\" rel=\"nofollow\">http:\/\/ftp.ru.debian.org\/debian\/pool\/main\/q\/qemu\/qemu-user-static_5.0-13_i386.deb<\/a><\/p><\/blockquote>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$ wget http:\/\/ftp.debian.org\/debian\/pool\/main\/q\/qemu\/qemu-user-static_5.0-13_amd64.deb $ alient -t qemu-user-static_5.0-13_amd64.deb # \u043f\u0443\u0442\u044c \u0432 rootfs \u0438 \u0438\u043c\u044f \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u0444\u0430\u0439\u043b\u0430 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \/proc\/sys\/fs\/binfmt_misc\/qemu-arm $ mkdir qemu $ tar xf qemu-user-static-5.0.tgz -C qemu $ file qemu\/usr\/bin\/qemu-arm-static qemu\/usr\/bin\/qemu-arm-static: ELF 64-bit LSB executable, x86-64, version 1 (GNU\/Linux), statically linked, BuildID[sha1]=be45f9a321cccc5c139cc1991a4042907f9673b6, for GNU\/Linux 3.2.0, stripped $ cp qemu\/usr\/bin\/qemu-arm-static rootfs\/usr\/bin\/qemu-arm $ file rootfs\/usr\/bin\/qemu-arm rootfs\/usr\/bin\/qemu-arm: ELF 64-bit LSB executable, x86-64, version 1 (GNU\/Linux), statically linked, BuildID[sha1]=be45f9a321cccc5c139cc1991a4042907f9673b6, for GNU\/Linux 3.2.0, stripped<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"chroot\">Chroot<\/h3>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">ch-mount.sh<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\">#!\/bin\/bash  function mnt() {     echo &quot;MOUNTING&quot;     sudo mount -t proc \/proc ${2}proc     sudo mount --rbind \/sys ${2}sys     sudo mount --make-rslave ${2}sys     sudo mount --rbind \/dev ${2}dev     sudo mount --make-rslave ${2}dev     sudo mount -o bind \/dev\/pts ${2}dev\/pts     sudo chroot ${2} }  function umnt() {     echo &quot;UNMOUNTING&quot;     sudo umount ${2}proc     sudo umount ${2}sys     sudo umount ${2}dev\/pts     sudo umount ${2}dev  }  if [ &quot;$1&quot; == &quot;-m&quot; ] &amp;&amp; [ -n &quot;$2&quot; ] ; then     mnt $1 $2 elif [ &quot;$1&quot; == &quot;-u&quot; ] &amp;&amp; [ -n &quot;$2&quot; ]; then     umnt $1 $2 else     echo &quot;&quot;     echo &quot;Either 1'st, 2'nd or both parameters were missing&quot;     echo &quot;&quot;     echo &quot;1'st parameter can be one of these: -m(mount) OR -u(umount)&quot;     echo &quot;2'nd parameter is the full path of rootfs directory(with trailing '\/')&quot;     echo &quot;&quot;     echo &quot;For example: ch-mount -m \/media\/sdcard\/&quot;     echo &quot;&quot;     echo 1st parameter : ${1}     echo 2nd parameter : ${2} fi<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u041b\u044e\u0431\u0443\u0435\u043c\u0441\u044f \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$ .\/ch-mount.sh -m rootfs\/ # cat \/etc\/os-release NAME=&quot;Ubuntu&quot; VERSION=&quot;20.04 LTS (Focal Fossa)&quot; ID=ubuntu ID_LIKE=debian PRETTY_NAME=&quot;Ubuntu 20.04 LTS&quot; VERSION_ID=&quot;20.04&quot; HOME_URL=&quot;https:\/\/www.ubuntu.com\/&quot; SUPPORT_URL=&quot;https:\/\/help.ubuntu.com\/&quot; BUG_REPORT_URL=&quot;https:\/\/bugs.launchpad.net\/ubuntu\/&quot; PRIVACY_POLICY_URL=&quot;https:\/\/www.ubuntu.com\/legal\/terms-and-policies\/privacy-policy&quot; VERSION_CODENAME=focal UBUNTU_CODENAME=focal # uname -a Linux NShubin 5.5.9-gentoo-x86_64 #1 SMP PREEMPT Mon Mar 16 14:34:52 MSK 2020 armv7l armv7l armv7l GNU\/Linux<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0430\u0434\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u0437\u0430\u043c\u0435\u0440\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u0434\u043e \u0438 \u043f\u043e\u0441\u043b\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e (\u0434\u043b\u044f \u043c\u0435\u043d\u044f) \u043d\u0430\u0431\u043e\u0440\u0430 \u043f\u0430\u043a\u0435\u0442\u043e\u0432:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># du -d 0 -h \/ 2&gt;\/dev\/null 63M     \/<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u043d\u043e\u0432\u0438\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># apt update # apt upgrade --yes<\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0435 \u043d\u0430\u0441 \u043f\u0430\u043a\u0435\u0442\u044b:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># SYSTEMD_IGNORE_CHROOT=yes apt install --yes autoconf kmod socat ifupdown ethtool iputils-ping net-tools ssh g++ iproute2 dhcpcd5 incron ser2net udev systemd gcc minicom vim cmake make mtd-utils util-linux git strace gdb libiio-dev iiod<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u0447\u043d\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u044f\u0434\u0440\u0430, \u043c\u043e\u0434\u0443\u043b\u0438, \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440. \u0417\u0430\u0433\u0440\u0443\u0437\u0447\u0438\u043a, \u044f\u0434\u0440\u043e, \u043c\u043e\u0434\u0443\u043b\u0438, device tree \u0447\u0435\u0440\u0435\u0437 Ubuntu \u043c\u044b \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435 \u043d\u0435 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c. \u041e\u043d\u0438 \u043f\u0440\u0438\u0434\u0443\u0442 \u043a \u043d\u0430\u043c \u0438\u0437\u0432\u043d\u0435 \u0438\u043b\u0438 \u0441\u0430\u043c\u0438 \u0441\u043e\u0431\u0435\u0440\u0435\u043c \u0438\u043b\u0438 \u043d\u0430\u043c \u0438\u0445 \u0432\u044b\u0434\u0430\u0441\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c \u0431\u043e\u0440\u0434\u044b, \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e \u0437\u0430 \u0433\u0440\u0430\u043d\u044c\u044e \u0434\u0430\u043d\u043d\u043e\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438.<\/p>\n<p>  <\/p>\n<p>\u0414\u043e \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0441\u0442\u0435\u043f\u0435\u043d\u0438 \u0440\u0430\u0441\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0435 \u0432\u0435\u0440\u0441\u0438\u0439 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e, \u043d\u043e \u043b\u0443\u0447\u0448\u0435 \u0432\u0437\u044f\u0442\u044c \u0438\u0445 \u0441\u043e \u0441\u0431\u043e\u0440\u043a\u0438 \u044f\u0434\u0440\u0430.<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># apt install --yes linux-headers-generic<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u043c\u0430\u043b\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># apt clean # du -d 0 -h \/ 2&gt;\/dev\/null 770M    \/<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c.<\/p>\n<p>  <\/p>\n<h2 id=\"pakuem-obraz\">\u041f\u0430\u043a\u0443\u0435\u043c \u043e\u0431\u0440\u0430\u0437<\/h2>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$ sudo tar -C rootfs --transform &quot;s|^.\/||&quot; --numeric-owner --owner=0 --group=0 -c .\/ | tar --delete .\/ | gzip &gt; rootfs.tar.gz<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"dopolnitelno-mozhem-postavit-etckeeper-s-nastroykoy-autopush\">\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c etckeeper \u0441 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u043e\u0439 autopush<\/h2>\n<p>  <\/p>\n<p>\u041d\u0443 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0440\u0430\u0437\u0434\u0430\u043b\u0438 \u043c\u044b \u043d\u0430\u0448\u0443 \u0441\u0431\u043e\u0440\u043a\u0443, \u0440\u0430\u0431\u043e\u0442\u0430 \u043f\u043e\u0448\u043b\u0430, \u043a\u0430\u043a \u043b\u0443\u0447\u0448\u0435 \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0442\u043e\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u043d\u0430\u0448\u0435\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043d\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0439\u0442\u0438 etckeeper.<\/p>\n<p>  <\/p>\n<blockquote><p>\u0411\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u043b\u0438\u0447\u043d\u043e\u0435 \u0434\u0435\u043b\u043e \u043a\u0430\u0436\u0434\u043e\u0433\u043e:  <\/p>\n<ul>\n<li>\u043c\u043e\u0436\u0435\u0442\u0435 \u0437\u0430\u0449\u0438\u0442\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u044b\u0435 \u0432\u0435\u0442\u043a\u0438<\/li>\n<li>\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430<\/li>\n<li>\u0437\u0430\u043f\u0440\u0435\u0442\u0438\u0442\u044c force push<\/li>\n<li>\u0438 \u0442.\u0434. &#8230;<\/li>\n<\/ul>\n<p>  <\/p><\/blockquote>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># ssh-keygen # apt install etckeeper # etckeeper init # cd \/etc # git remote add origin ...<\/code><\/pre>\n<p>  <\/p>\n<h3 id=\"nastroim-autopush\">\u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c autopush<\/h3>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u0435\u043c \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0435\u0442\u043a\u0438 \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 (\u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u043b\u0438 \u0441\u043b\u0443\u0436\u0431\u0443, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0435).<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># cat \/etc\/etckeeper\/etckeeper.conf PUSH_REMOTE=&quot;origin&quot;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u0442\u0443\u043f\u0438\u0442\u044c \u0445\u0438\u0442\u0440\u0435\u0435&#8230;<\/p>\n<p>  <\/p>\n<h3 id=\"lenivyy-put\">\u041b\u0435\u043d\u0438\u0432\u044b\u0439 \u043f\u0443\u0442\u044c<\/h3>\n<p>  <\/p>\n<p>\u041f\u0443\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440, \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c \u0441\u0435\u0440\u0438\u0439\u043d\u044b\u0439 \u043d\u043e\u043c\u0435\u0440 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 (\u043d\u0443 \u0438\u043b\u0438 MAC \u2014 \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0438 \u043f\u043e\u043a\u0443\u043f\u0430\u044e\u0442 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d):<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">cat \/proc\/cpuinfo<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"plaintext\"># cat \/proc\/cpuinfo processor       : 0 model name      : ARMv7 Processor rev 5 (v7l) BogoMIPS        : 60.36 Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm  CPU implementer : 0x41 CPU architecture: 7 CPU variant     : 0x0 CPU part        : 0xc07 CPU revision    : 5  processor       : 1 model name      : ARMv7 Processor rev 5 (v7l) BogoMIPS        : 60.36 Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm  CPU implementer : 0x41 CPU architecture: 7 CPU variant     : 0x0 CPU part        : 0xc07 CPU revision    : 5  Hardware        : Freescale i.MX7 Dual (Device Tree) Revision        : 0000 Serial          : 06372509<\/code><\/pre>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0422\u043e\u0433\u0434\u0430 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0434\u043b\u044f \u0438\u043c\u0435\u043d\u0438 \u0432\u0435\u0442\u043a\u0438 \u0432 \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u0431\u0443\u0434\u0435\u043c \u043f\u0443\u0448\u0438\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># cat \/proc\/cpuinfo | grep Serial | cut -d':' -f 2 | tr -d [:blank:] 06372509<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"># cat \/etc\/etckeeper\/commit.d\/40myown-push #!\/bin\/sh set -e  if [ &quot;$VCS&quot; = git ] &amp;&amp; [ -d .git ]; then   branch=$(cat \/proc\/cpuinfo | grep Serial | cut -d':' -f 2 | tr -d [:blank:])   cd \/etc\/   git push origin master:${branch} fi<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u0432\u0441\u0451 \u2014 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0438 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0432\u043e\u0439 \u043f\u0440\u043e\u0448\u0438\u0432\u043a\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"rekomendovannye-materialy\">\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b<\/h2>\n<p>  <\/p>\n<p><a href=\"https:\/\/en.wikipedia.org\/wiki\/Binfmt_misc\" rel=\"nofollow\">BINFMT_MISC<\/a><br \/>  <a href=\"https:\/\/www.kernel.org\/doc\/Documentation\/admin-guide\/binfmt-misc.rst\" rel=\"nofollow\">Kernel Support for miscellaneous Binary Formats (binfmt_misc)<\/a><br \/>  <a href=\"https:\/\/wiki.gentoo.org\/wiki\/Embedded_Handbook\/General\/Compiling_with_qemu_user_chroot\" rel=\"nofollow\">Compiling with qemu user chroot<\/a><br \/>  <a href=\"https:\/\/gnu-linux.org\/building-ubuntu-rootfs-for-arm.html\" rel=\"nofollow\">Building Ubuntu rootfs for ARM<\/a><br \/>  <a href=\"https:\/\/itnext.io\/how-to-create-a-custom-ubuntu-live-from-scratch-dd3b3f213f81\" rel=\"nofollow\">How to create a custom Ubuntu live from scratch<\/a><br \/>  <a href=\"https:\/\/wiki.gentoo.org\/wiki\/Crossdev_qemu-static-user-chroot\" rel=\"nofollow\">Crossdev qemu-static-user-chroot<\/a><br \/>  <a href=\"https:\/\/wiki.archlinux.org\/index.php\/Etckeeper\" rel=\"nofollow\">etckeeper<\/a><\/p>\n<p>  <\/p>\n<h2 id=\"problema-getdents64\">\u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 getdents64<\/h2>\n<p>  <\/p>\n<p><a href=\"https:\/\/bugs.launchpad.net\/qemu\/+bug\/1805913\" rel=\"nofollow\">readdir() returns NULL (errno=EOVERFLOW) for 32-bit user-static qemu on 64-bit host<\/a><br \/>  <a href=\"https:\/\/bugzilla.kernel.org\/show_bug.cgi?id=205957\" rel=\"nofollow\">Ext4 64 bit hash breaks 32 bit glibc 2.28+<\/a><br \/>  <a href=\"https:\/\/gitlab.kitware.com\/cmake\/cmake\/-\/issues\/20568\" rel=\"nofollow\">compiler_id_detection fails for armhf when using QEMU user-mode emulation<\/a><br \/>  <a href=\"https:\/\/bugzilla.redhat.com\/show_bug.cgi?id=1787228\" rel=\"nofollow\">CMake doesn&#8217;t work properly under qemu-arm<\/a><\/p>\n<\/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=\"https:\/\/habr.com\/ru\/post\/512994\/\"> https:\/\/habr.com\/ru\/post\/512994\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/512994\/\">\n<p>\u041a\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0447\u0430\u0441\u0442\u043e \u0435\u0449\u0435 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043a\u0430\u043a\u0438\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u043f\u0430\u043a\u0435\u0442\u044b \u043f\u043e\u0439\u0434\u0443\u0442 \u0432 \u0446\u0435\u043b\u0435\u0432\u0443\u044e rootfs.<\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u044b\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438 \u0445\u0432\u0430\u0442\u0430\u0442\u044c\u0441\u044f \u0437\u0430 LFS, buildroot \u0438\u043b\u0438 yocto (\u0438\u043b\u0438 \u0435\u0449\u0435 \u0447\u0442\u043e-\u0442\u043e) \u0435\u0449\u0435 \u0440\u0430\u043d\u043e, \u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0443\u0436\u0435 \u043d\u0443\u0436\u043d\u043e. \u0414\u043b\u044f \u0431\u043e\u0433\u0430\u0442\u044b\u0445 (\u0443 \u043c\u0435\u043d\u044f \u043d\u0430 \u043f\u0438\u043b\u043e\u0442\u043d\u044b\u0445 \u043e\u0431\u0440\u0430\u0437\u0446\u0430\u0445 4GB eMMC) \u0435\u0441\u0442\u044c \u0432\u044b\u0445\u043e\u0434 \u0440\u0430\u0437\u0434\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e \u0434\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0447\u0435\u0433\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0432 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u0430 \u0437\u0430\u0442\u0435\u043c \u043c\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u0435\u043c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043a\u0438 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0438 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043f\u0438\u0441\u043e\u043a \u0434\u043b\u044f \u0446\u0435\u043b\u0435\u0432\u043e\u0439 rootfs.<\/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-307674","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307674","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=307674"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/307674\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=307674"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=307674"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=307674"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}