{"id":481,"date":"2016-08-12T14:47:03","date_gmt":"2016-08-12T13:47:03","guid":{"rendered":"http:\/\/snakenet.eu\/blog\/?p=481"},"modified":"2016-08-13T22:21:40","modified_gmt":"2016-08-13T21:21:40","slug":"chip-recompiler-le-kernel","status":"publish","type":"post","link":"https:\/\/snakenet.eu\/blog\/chip-recompiler-le-kernel\/481\/","title":{"rendered":"CHIP &#8211; Recompiler le kernel"},"content":{"rendered":"<p>Totalement inspir\u00e9 de http:\/\/www.raspibo.org\/wiki\/index.php\/Compile_the_Linux_kernel_for_Chip:_my_personal_HOWTO<br \/>\n<strong>Pr\u00e9-requis indispensable : un debian SID (unstable) 32 bit.<\/strong><\/p>\n<p># Stocker l&rsquo;IP du chip pour automatiser le reste des commandes.<br \/>\n# si scp ne fonctionne pas, installer openssh-client sur le chip et le PC<br \/>\nCHIP=10.254.0.6<\/p>\n<p>apt-get install git build-essential fakeroot kernel-package zlib1g-dev libncurses5-dev lzop<br \/>\napt-get install gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf<\/p>\n<p>mkdir -p \/extra\/tmp\/chip\/LINUX<br \/>\ncd \/extra\/tmp\/chip\/LINUX<br \/>\ngit clone https:\/\/github.com\/NextThingCo\/CHIP-linux.git<\/p>\n<p>cd \/extra\/tmp\/chip\/LINUX\/CHIP-linux<br \/>\ngit checkout -b debian\/4.3.0-ntc-4 origin\/debian\/4.3.0-ntc-4<\/p>\n<p>scp chip@$CHIP:\/boot\/config-4.3.0-ntc \/extra\/tmp\/chip\/LINUX\/CHIP-linux<\/p>\n<p>make ARCH=arm CROSS_COMPILE=\/usr\/bin\/arm-linux-gnueabihf- menuconfig<\/p>\n<p>## faire LOAD du fichier CONFIG copi\u00e9 depuis le CHIP.<br \/>\n## Ajouter iptables<br \/>\n# Networking &gt;&gt; Networking options &gt;&gt; Network packet filtering (replaces ipchains) &gt;&gt; Core Netfilter Configuration &gt;&gt; Netfilter Xtables support (required for ip_tables) and select the all following options as modules.<br \/>\n# Networking &gt;&gt; Networking options &gt;&gt; Network packet filtering (replaces ipchains) &gt;&gt; IP: Net Filter configurationS &gt;&gt; IP Tables support<br \/>\n## Ajouter un suffixe<br \/>\n# General setup &#8212;&gt; () Local version &#8211; append to kernel release<br \/>\n# my personal suffix is NLE.<br \/>\n# sauver la config dans le fichier \u00ab\u00a0.config\u00a0\u00bb<\/p>\n<p>### The parameter -j should be set to the number of cores of your computer + 1. I have an 4-core (2 real cores +\u00a02 hyperthreads), so I use 5.<br \/>\nmake ARCH=arm CROSS_COMPILE=\/usr\/bin\/arm-linux-gnueabihf- -j 5<\/p>\n<p>mkdir \/tmp\/lib<br \/>\nmake ARCH=arm CROSS_COMPILE=\/usr\/bin\/arm-linux-gnueabihf- INSTALL_MOD_PATH=\/tmp\/lib modules_install<\/p>\n<p>cd \/extra\/tmp\/chip\/LINUX<br \/>\ngit clone https:\/\/github.com\/NextThingCo\/RTL8723BS.git<br \/>\ncd RTL8723BS<br \/>\ngit checkout -b debian origin\/debian<br \/>\nfor i in debian\/patches\/0*; do echo $i; patch -p 1 &lt;$i ; done<\/p>\n<p>make -j\u00a05 CONFIG_PLATFORM_ARM_SUNxI=y ARCH=arm CROSS_COMPILE=\/usr\/bin\/arm-linux-gnueabihf- -C \/extra\/tmp\/chip\/LINUX\/CHIP-linux\/ M=$PWD CONFIG_RTL8723BS=m INSTALL_MOD_PATH=\/tmp\/lib<br \/>\nmake -j\u00a05 CONFIG_PLATFORM_ARM_SUNxI=y ARCH=arm CROSS_COMPILE=\/usr\/bin\/arm-linux-gnueabihf- -C \/extra\/tmp\/chip\/LINUX\/CHIP-linux\/ M=$PWD CONFIG_RTL8723BS=m INSTALL_MOD_PATH=\/tmp\/lib modules_install<\/p>\n<p>scp \/extra\/tmp\/chip\/LINUX\/CHIP-linux\/arch\/arm\/boot\/zImage root@$CHIP:\/boot\/vmlinuz-4.3.0NLE+<br \/>\nscp \/extra\/tmp\/chip\/LINUX\/CHIP-linux\/.config root@$CHIP:\/boot\/config-4.3.0NLE+<br \/>\nscp \/extra\/tmp\/chip\/LINUX\/CHIP-linux\/System.map root@$CHIP:\/boot\/System.map-4.3.0NLE+<br \/>\ncd \/tmp\/lib\/lib\/modules<br \/>\ntar cf &#8211; 4.3.0NLE+ | ssh root@$CHIP &lsquo;cd \/lib\/modules; tar xf -&lsquo;<br \/>\ncd ..\/firmware\/<br \/>\ntar cf &#8211; . | ssh root@$CHIP &lsquo;mkdir \/lib\/firmware\/4.3.0NLE+; cd \/lib\/firmware\/4.3.0NLE+; tar xf -&lsquo;<\/p>\n<p>rm -rf \/tmp\/tar\/<br \/>\nmkdir -p \/tmp\/tar\/boot<br \/>\ncp \/extra\/tmp\/chip\/LINUX\/CHIP-linux\/arch\/arm\/boot\/zImage    \/tmp\/tar\/boot\/vmlinuz-4.3.0NLE+<br \/>\n# cp \/extra\/tmp\/chip\/LINUX\/CHIP-linux\/arch\/arm\/boot\/zImage    \/tmp\/tar\/boot\/zImage<br \/>\ncp \/extra\/tmp\/chip\/LINUX\/CHIP-linux\/.config                 \/tmp\/tar\/boot\/config-4.3.0NLE+<br \/>\ncp \/extra\/tmp\/chip\/LINUX\/CHIP-linux\/System.map              \/tmp\/tar\/boot\/System.map-4.3.0NLE+<\/p>\n<p>mkdir -p \/tmp\/tar\/lib\/modules\/4.3.0NLE+<br \/>\nmkdir -p \/tmp\/tar\/lib\/firmware\/4.3.0NLE+<\/p>\n<p>cp -r \/tmp\/lib\/lib\/firmware\/*                               \/tmp\/tar\/lib\/firmware\/4.3.0NLE+<br \/>\ncp -r \/tmp\/lib\/lib\/modules                                  \/tmp\/tar\/lib\/<\/p>\n<p>cd \/tmp\/tar<br \/>\nrm \/tmp\/kernel.tar<br \/>\ntar -cf ..\/kernel.tar *<br \/>\ngzip ..\/kernel.tar<\/p>\n<p>rcp \/tmp\/kernel.tar.gz $CHIP:\/root\/<\/p>\n<p>sinon, \u00e0 l&rsquo;arrache :<br \/>\n<a href=\"http:\/\/snakenet.eu\/blog\/chip-recompiler-le-kernel\/481\/kernel-tar\/\" rel=\"attachment wp-att-504\">kernel.tar.gz<\/a><\/p>\n<p>wget -d &#8211;header=\u00a0\u00bbUser-Agent: Mozilla\/5.0 (Windows NT 6.0) AppleWebKit\/537.11 (KHTML, like Gecko) Chrome\/23.0.1271.97 Safari\/537.11&Prime; http:\/\/snakenet.eu\/blog\/wp-content\/uploads\/2016\/08\/kernel.tar.gz<br \/>\ncd \/<br \/>\ntar -zxf ~\/kernel.tar.gz<\/p>\n<p>### Tester le nouveau kernel sans tout casser : se connecter en UART et lors du uBOOT, appuyer sur une touche, puis : <\/p>\n<p>setenv boot_initrd &lsquo;mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload $fdt_addr_r \/boot\/sun5i-r8-chip.dtb; ubifsload 0x44000000 \/boot\/initrd.uimage; ubifsload $kernel_addr_r \/boot\/vmlinuz-4.3.0NLE+; bootz $kernel_addr_r 0x44000000 $fdt_addr_r&rsquo;<br \/>\nsetenv boot_noinitrd &lsquo;mtdparts; ubi part UBI; ubifsmount ubi0:rootfs; ubifsload $fdt_addr_r \/boot\/sun5i-r8-chip.dtb; ubifsload $kernel_addr_r \/boot\/vmlinuz-4.3.0NLE+; bootz $kernel_addr_r &#8211; $fdt_addr_r&rsquo;<\/p>\n<p>boot<\/p>\n<p>### Pour nettoyer les conneries de ce f* kernel : <\/p>\n<p>rm \/boot\/vmlinuz-4.3.0NLE+ \/boot\/config-4.3.0NLE+ \/boot\/System.map-4.3.0NLE+ \/lib\/firmware\/4.3.0NLE+ \/lib\/modules\/4.3.0NLE+<br \/>\ncp \/boot\/zImage.bak \/boot\/zImage<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Totalement inspir\u00e9 de http:\/\/www.raspibo.org\/wiki\/index.php\/Compile_the_Linux_kernel_for_Chip:_my_personal_HOWTO Pr\u00e9-requis indispensable : un debian SID (unstable) 32 bit. # Stocker l&rsquo;IP du chip pour automatiser le reste des commandes. # si scp ne fonctionne pas, installer openssh-client sur le chip et le PC CHIP=10.254.0.6 apt-get install git build-essential fakeroot kernel-package zlib1g-dev libncurses5-dev lzop apt-get install gcc-arm-linux-gnueabihf binutils-arm-linux-gnueabihf mkdir -p \/extra\/tmp\/chip\/LINUX [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68],"tags":[],"class_list":["post-481","post","type-post","status-publish","format-standard","hentry","category-c-h-i-p"],"_links":{"self":[{"href":"https:\/\/snakenet.eu\/blog\/wp-json\/wp\/v2\/posts\/481","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/snakenet.eu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/snakenet.eu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/snakenet.eu\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/snakenet.eu\/blog\/wp-json\/wp\/v2\/comments?post=481"}],"version-history":[{"count":12,"href":"https:\/\/snakenet.eu\/blog\/wp-json\/wp\/v2\/posts\/481\/revisions"}],"predecessor-version":[{"id":505,"href":"https:\/\/snakenet.eu\/blog\/wp-json\/wp\/v2\/posts\/481\/revisions\/505"}],"wp:attachment":[{"href":"https:\/\/snakenet.eu\/blog\/wp-json\/wp\/v2\/media?parent=481"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/snakenet.eu\/blog\/wp-json\/wp\/v2\/categories?post=481"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/snakenet.eu\/blog\/wp-json\/wp\/v2\/tags?post=481"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}