{"id":20,"date":"2013-12-12T03:50:00","date_gmt":"2013-12-12T03:50:00","guid":{"rendered":"https:\/\/robertrath.com\/gadgetzone\/archives\/20-cross-compiling-the-raspberrypi-linux-kernel.html"},"modified":"2017-12-23T00:29:58","modified_gmt":"2017-12-23T00:29:58","slug":"cross-compiling-the-raspberrypi-linux-kernel","status":"publish","type":"post","link":"https:\/\/robertrath.com\/gadgetzone\/archives\/20-cross-compiling-the-raspberrypi-linux-kernel.html","title":{"rendered":"Cross Compiling The RaspberryPi Linux Kernel"},"content":{"rendered":"<!-- s9ymdb:9 --><img loading=\"lazy\" decoding=\"async\" class=\"serendipity_image_left\" width=\"115\" height=\"128\" src=\"\/gadgetzone\/uploads\/Images\/raspberry_gears.png\" alt=\"\" \/><br \/>\n<br \/>\nThese are a jumbled set of notes as I worked my way through downloading and building the Pi linux kernel from source code.<br \/>\n<br \/>\n<strong>References<\/strong><br \/>\n<br \/>\n#ref: http:\/\/blog.eihis.com\/?p=423<br \/>\n#ref: http:\/\/simonthepiman.com\/how_to_setup_windows_file_server.php<br \/>\n#ref: http:\/\/www.raspberrypi.org\/phpBB3\/viewtopic.php?f=66&amp;t=57401<br \/>\n#ref: http:\/\/elinux.org\/RPi_Kernel_Compilation#Get_the_kernel_source<br \/>\n<br \/>\n<strong>On Pi<\/strong><br \/>\n<br \/>\napt-get update<br \/>\napt-get dist-upgrade<br \/>\napt-get install build-essential<br \/>\napt-get install module-assistant<br \/>\nm-a prepare<br \/>\nwget http:\/\/blog.eihis.com\/wp-content\/uploads\/2013\/07\/linux-headers-3611_3611-2_armhf.deb<br \/>\ndpkg -i http:\/\/blog.eihis.com\/wp-content\/uploads\/2013\/07\/linux-headers-3611_3611-2_armhf.deb<br \/>\nln -s \/usr\/src\/linux-headers-3.6.11+ \/lib\/modules\/3.6.11+\/src<br \/>\nln -s \/usr\/src\/linux-headers-3.6.11+ \/lib\/modules\/3.6.11+\/build<br \/>\napt-get install samba<br \/>\napt-get install samba-common-bin<br \/>\nm-a prepare<br \/>\n<br \/>\n<strong>On Ubuntu<\/strong><br \/>\n<br \/>\ngit clone -b rpi-3.10.y https:\/\/github.com\/raspberrypi\/linux.git<br \/>\ncd linux<br \/>\ngit checkout master<br \/>\ngit checkout rpi-3.6.y<br \/>\nexport KERNEL_SRC=\/home\/robert\/raspberry-pi\/src\/linux\/<br \/>\ncd \/home\/robert\/raspberry-pi\/<br \/>\ngit clone https:\/\/github.com\/raspberrypi\/tools<br \/>\nexport CCPREFIX=\/home\/robert\/raspberry-pi\/tools\/arm-bcm2708\/arm-bcm2708-linux-gnueabi\/bin\/arm-bcm2708-linux-gnueabi-<br \/>\ncd \/home\/robert\/raspberry-pi\/src\/linux\/<br \/>\nmake mrproper<br \/>\nscp root@192.168.10.31:\/proc\/config.gz .\/<br \/>\ngunzip config<br \/>\nmv config .config<br \/>\nmake ARCH=arm CROSS_COMPILE=${CCPREFIX} oldconfig<br \/>\nmake ARCH=arm CROSS_COMPILE=${CCPREFIX} menuconfig<br \/>\nexport MODULES_TEMP=\/home\/robert\/raspberry-pi\/modules\/<br \/>\nmake ARCH=arm CROSS_COMPILE=${CCPREFIX} INSTALL_MOD_PATH=${MODULES_TEMP} modules_install<br \/>\ncd \/home\/robert\/raspberry-pi\/tools\/mkimage<br \/>\n.\/imagetool-uncompressed.py ${KERNEL_SRC}\/arch\/arm\/boot\/zImage<br \/>\ncd \/home\/robert\/raspberry-pi\/modules\/lib\/<br \/>\ntar -czvpf firmware+modules.tar.gz .\/firmware .\/modules <br \/>\nscp firmware+modules.tar.gz root@192.168.10.31:\/lib\/<br \/>\n<br \/>\n<strong>On Pi<\/strong><br \/>\n<br \/>\ncd \/boot<br \/>\nmv kernel.img kernel_original.img<br \/>\nmv fixup.dat fixup_original.dat<br \/>\nmv start.elf start_original.elf<br \/>\nmv bootcode.bin bootcode_original.bin<br \/>\ncd \/opt<br \/>\ntar -czvpf vc_original.tar.gz .\/vc<br \/>\nrm -fR vc<br \/>\ncd \/lib<br \/>\ntar -czvpf firmware+modules_original.tar.gz .\/firmware .\/modules <br \/>\ntar -xzvpf firmware+modules.tar.gz <br \/>\n<br \/>\n<strong>On Host<\/strong><br \/>\n<br \/>\ncd \/home\/robert\/raspberry-pi\/<br \/>\ngit clone https:\/\/github.com\/raspberrypi\/firmware<br \/>\ncd \/home\/robert\/raspberry-pi\/firmware<br \/>\ngit checkout next # d4f5315cfac4e was current on my pi before being overwrit<br \/>\ncd \/home\/robert\/raspberry-pi\/firmware\/boot<br \/>\nscp bootcode.bin fixup.dat start.elf root@192.168.10.31:\/boot\/<br \/>\n<br \/>\ncd \/home\/robert\/raspberry-pi\/tools\/mkimage<br \/>\nscp kernel.img root@192.168.10.31:\/boot\/<br \/>\n${CCPREFIX}gcc -v 2&gt;&amp;1 | grep hard # check for hard float, even though came back as soft it looks like the board need hard!<br \/>\ncd \/home\/robert\/raspberry-pi\/firmware\/hardfp\/opt<br \/>\ntar -czvpf vc-hard.tar.gz .\/vc<br \/>\nscp vc-hard.tar.gz root@192.168.10.31:\/opt\/<br \/>\n<br \/>\n<strong>On Pi<\/strong><br \/>\n<br \/>\ncd \/opt<br \/>\ntar -xzvpf vc-hard.tag.gz <br \/>\n <br \/>\n<strong>Update<\/strong><br \/>\n<br \/>\n# I packaged up the linux kernel source and moved them to the pi and compiled locally<br \/>\n<br \/>\n<strong>On Host<\/strong><br \/>\n<br \/>\ncd \/home\/robert\/raspberry-pi\/src<br \/>\ntar -czvpf linux.tar.gz .\/linux<br \/>\nmkdir tmp<br \/>\ncd tmp<br \/>\ntar -xzvpf ..\/linux.tar.gz<br \/>\ncd linux<br \/>\nmake mrproper<br \/>\nrm -fR .\/.git<br \/>\nrm .\/.gitignore<br \/>\ncd ..<br \/>\ntar -czvpf linux.tar.gz .\/linux<br \/>\nscp linux.tar.gz root@192.168.10.31:\/usr\/src\/<br \/>\n<br \/>\n<strong>On Pi<\/strong><br \/>\n<br \/>\ncd \/usr\/src<br \/>\nrm linux<br \/>\ntar -xzvpf ..\/linux.tar.gz<br \/>\ncd linux<br \/>\ncp \/proc\/config.gz .config.gz<br \/>\ngunzip .config.gz<br \/>\napt-get install ncurses-dev<br \/>\nmake oldconfig<br \/>\nmake menuconfig<br \/>\nmake # commenced at 12:52 (13:10 for cross host)<br \/>\n<br \/>\n &#8230; Robert<br \/>\n<br \/>\n<br \/>\n","protected":false},"excerpt":{"rendered":"<p>These are a jumbled set of notes as I worked my way through downloading and building the Pi linux kernel from source code. References #ref: http:\/\/blog.eihis.com\/?p=423 #ref: http:\/\/simonthepiman.com\/how_to_setup_windows_file_server.php #ref: http:\/\/www.raspberrypi.org\/phpBB3\/viewtopic.php?f=66&amp;t=57401 #ref: http:\/\/elinux.org\/RPi_Kernel_Compilation#Get_the_kernel_source On Pi apt-get update apt-get dist-upgrade apt-get install build-essential apt-get install module-assistant m-a prepare wget http:\/\/blog.eihis.com\/wp-content\/uploads\/2013\/07\/linux-headers-3611_3611-2_armhf.deb dpkg -i http:\/\/blog.eihis.com\/wp-content\/uploads\/2013\/07\/linux-headers-3611_3611-2_armhf.deb ln -s \/usr\/src\/linux-headers-3.6.11+ \/lib\/modules\/3.6.11+\/src &#8230; <a title=\"Cross Compiling The RaspberryPi Linux Kernel\" class=\"read-more\" href=\"https:\/\/robertrath.com\/gadgetzone\/archives\/20-cross-compiling-the-raspberrypi-linux-kernel.html\" aria-label=\"Read more about Cross Compiling The RaspberryPi Linux Kernel\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-20","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/robertrath.com\/gadgetzone\/wp-json\/wp\/v2\/posts\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/robertrath.com\/gadgetzone\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/robertrath.com\/gadgetzone\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/robertrath.com\/gadgetzone\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/robertrath.com\/gadgetzone\/wp-json\/wp\/v2\/comments?post=20"}],"version-history":[{"count":0,"href":"https:\/\/robertrath.com\/gadgetzone\/wp-json\/wp\/v2\/posts\/20\/revisions"}],"wp:attachment":[{"href":"https:\/\/robertrath.com\/gadgetzone\/wp-json\/wp\/v2\/media?parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/robertrath.com\/gadgetzone\/wp-json\/wp\/v2\/categories?post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/robertrath.com\/gadgetzone\/wp-json\/wp\/v2\/tags?post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}