编译树莓派操作系统内核

首先在https://github.com/raspberrypi/linux/上下载最新的内核源代码,如当前最新的内核下载连接是:https://github.com/raspberrypi/linux/archive/rpi-3.6.y.zip

然后安装编译工具如gcc、make、patch等,可以使用apt-get install gcc make命令,再检查系统时间,如果时间不对,可以手动设置一下时间,也可以重新启动ntp服务,自动对时。将下载的内核文件放在随便找个目录放着,并用unzip解压它,

unzip rpi-3.2.27.zip

如果命令不成功则可能是没有安装unzip,可以使用apt-get install unzip命令安装就行了。

开始编译内核,首先使用以下命令对内核进行配置。

make menuconfig

载图太麻烦了,所以我直接用鼠标选了图,大家将就的看看吧。

需要说明的是在System Type这一项里,一定要选择合适的cpu也就是armBCM2708这个型号,其它的东西大家可以自己选择,需要什么用星号表示将这一项编译进内核,M表示编译成模块。

.config – Linux/arm 3.2.27 Kernel Configuration Arrow keys navigate the menu. selects submenus —>. Highlighted letters are hotkeys. Pressing includes, excludes, modularizes features. Press to exit, for Help, for Search. Legend: [*] built-in [ ] excluded module < > module capable [*] MMU-based Paged Memory Management Support ARM system type (Broadcom BCM2708 family) —> *** System MMU *** Broadcom BCM2708 Implementations —> *** Processor Type *** -*- Support ARM V6 processor *** Processor Features *** [*] Support Thumb user binaries [ ] Disable I-Cache (I-bit) [ ] Disable D-Cache (C-bit) [ ] Disable branch prediction [*] Use non-cacheable memory for DMA [ ] ARM errata: FSR write bit incorrect on a SWP to read-only memory -*- ARM errata: Invalidation of the Instruction Cache operation can fail [ ] ARM errata: Possible cache data corruption with hit-under-miss enabled