{"id":49,"date":"2012-03-12T14:30:55","date_gmt":"2012-03-12T14:30:55","guid":{"rendered":"http:\/\/rglinuxtech.com\/?p=49"},"modified":"2012-03-12T14:30:55","modified_gmt":"2012-03-12T14:30:55","slug":"compiling-the-pi-kernel-my-way","status":"publish","type":"post","link":"https:\/\/rglinuxtech.com\/?p=49","title":{"rendered":"Compiling the Pi Kernel..  My Way.."},"content":{"rendered":"<p>This is how I compile ARM kernels.\u00a0 There are other ways of doing this, but this works, for me..<\/p>\n<p>First &#8211; I should mention &#8211; Read the Wicki!\u00a0\u00a0\u00a0 This is at http:\/\/elinux.org\/R-Pi_Hub<\/p>\n<p>After getting the &#8216;forked&#8217; kernel I then had to obtain a suitable config file, which included the necessary extra items for the Pi Broadcom chipset..\u00a0\u00a0 Brief details are on the RPi wiki, at http:\/\/elinux.org\/RPi_Kernel_Compilation.<\/p>\n<p>According to the details elsewhere in the Wicki, the LAN chipset is SMSC LAN9512, and this is already selected, as &#8216;SMSC LAN95XX based USB 2.0 10\/100 ethernet devices&#8217; under &#8216;USB Network Adapters&#8217;..<\/p>\n<p>Using the armv7xx cross-compiler already mentioned in an earlier post, the compilation was straightforward, and I then created the uImage boot image using # make uImage..<\/p>\n<p>I &#8211; personally &#8211; didn&#8217;t use the method for cross-compilation mentioned in the Wicki, but instead modified the top-level Makefile, as I wanted the modules etc. to be resident in a local directory..<\/p>\n<p><!--more--><\/p>\n<p>First, unpack the kernel source (from github..) in its own directory (raspberrypi-319 in the example below..).<br \/>\nI changed the unpacked kernel source directory name to something more appropriate (linux-3.1.9pi in the example below)<br \/>\nThen create a &#8216;lib&#8217; (sub)directory there.<\/p>\n<p>Then edit the Makefile, as follows (changing the armvxx&#8230;&#8230;. description to suite your particular cross-compiler installation, if different..)<\/p>\n<pre>around line 195:\n change:\n ARCH\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ?= $(SUBARCH)\n CROSS_COMPILE\u00a0\u00a0 ?= $(CONFIG_CROSS_COMPILE:\"%\"=%)\n to:\n ARCH\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ?= arm\n CROSS_COMPILE\u00a0\u00a0 ?= armv7l-mandriva-linux-gnueabi-\n\n-------------------------------------------------^\nDon't forget the dash at the end, so the script will find\nthe correct version of gcc..\n\nTo install modules etc. locally - under the ..\/lib directory,\nedit\u00a0 Makefile:\n\naround line 681:\n\u00a0change:\n export\u00a0\u00a0 \u00a0INSTALL_PATH ?= \/boot\n to:\n export\u00a0\u00a0 \u00a0INSTALL_PATH ?= ..\/boot\n and add:\n export\u00a0\u00a0 \u00a0INSTALL_MOD_PATH ?= ..\/\n- then run\u00a0\u00a0 # make xconfig\u00a0\u00a0 (or whatever you prefer...)\n # make\n and..\u00a0\u00a0 # make modules_install<\/pre>\n<p>Do Not run # make install!<\/p>\n<p>Update:<\/p>\n<p>The Pi uses a kernel.img file, along with some binary &#8216;firmware&#8217; files (for the GPU) and config files, residing in the fat partition.\u00a0\u00a0\u00a0\u00a0 More details of this &#8211; and how to create the\u00a0 kernel.img\u00a0 file, will be in a separate post..<\/p>\n<p>So, the whole kernel (compiled) source \/ lib \/ kernel.img package directory structure looks like:<\/p>\n<pre>raspberrypi-319\u00a0 \n |\u00a0\u00a0 |     |\n |\u00a0\u00a0 |    tools (containing kernel.img file)\n |   |\n |   linux-3.1.9pi (containing compiled kernel source)\n |\n lib (containing modules and firmware directories created by the\n      kernel compilation)<\/pre>\n<p>Then just tar up the raspberrypi-319 directory and contents, and ftp it to the Pi, then untar, and copy\/move the bits to their correct destination, and copy the kernel.img file to the (FAT) partition, to be accessed by the bootloader&#8230;.<\/p>\n<p>Of course, I now have to wait for the Raspberry Pi hardware to arrive, to test this!<\/p>\n<p><strong>Usual disclaimer \u2013 This worked on my system\u00a0 It may not on yours. If you are unsure how to do all this \u2013 Don\u2019t!<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is how I compile ARM kernels.\u00a0 There are other ways of doing this, but this works, for me.. First &#8211; I should mention &#8211; Read the Wicki!\u00a0\u00a0\u00a0 This is at http:\/\/elinux.org\/R-Pi_Hub After getting the &#8216;forked&#8217; kernel I then had to obtain a suitable config file, which included the necessary extra items for the Pi Broadcom chipset..\u00a0\u00a0 <span class=\"excerpt-dots\">&hellip;<\/span> <a class=\"more-link\" href=\"https:\/\/rglinuxtech.com\/?p=49\"><span class=\"more-msg\">Continue reading &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[11,14,16,21],"tags":[120,132,154,1173,242,313],"class_list":["post-49","post","type-post","status-publish","format-standard","hentry","category-hacks","category-kernel","category-linux-arm","category-raspberry-pi","tag-compile","tag-cross-compiler","tag-fedora-2","tag-kernel","tag-linux","tag-raspberry-pi-2"],"_links":{"self":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/49","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=49"}],"version-history":[{"count":0,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=\/wp\/v2\/posts\/49\/revisions"}],"wp:attachment":[{"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=49"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=49"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rglinuxtech.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=49"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}