kernelbuild


如果有需要,patch内核:
下载补丁:

wget https://www.kernel.org/pub/linux/kernel/projects/rt/3.18/patch-3.18.17-rt14.patch.gz   // 注意patch和patchs

cd linux    //内核源码根目录
zcat ../patch-3.18.17-rt14.patch.gz | patch -p1     //打补丁,如果.bz2压缩格式则使用 bzcat ;在源码根目录的上层目录,则patch -p0 < patch/rpi-3.2.27-xenomai.patch
//或者 
cd $linux_tree
patch -p1 < rpi-linux-3.2.21-xenomai-2.6.1.patch

在现有系统上修改配置:

make mrproper   //清理一下
scp pi@raspberrypi:/proc/config.gz .    //复制现有系统的配置文件

gunzip -c config.gz > .config

ARCH=arm CROSS_COMPILE=${CCPREFIX} make oldconfig  //使配置生效

//根据需要修改.config文件,或者 make menuconfig

ARCH=arm CROSS_COMPILE=${CCPREFIX} make oldconfig

ARCH=arm CROSS_COMPILE=${CCPREFIX} make -jx        // build kernel,多核系统

mkdir module_build_directory
INSTALL_MOD_PATH=module_build_directory make modules_install        // build modules

复制新的内核到sd卡(树莓派2)

Copy arch/arm/boot/Image to /boot/kernel7.img on SD card.
Copy arch/arm/boot/dts/bcm2709-rpi-2-b.dtb to /boot/bcm2709-rpi-2-b.dtb on SD card
Copy (merge if necessary) kernel-rt/lib to / on SD card.

 

cd linux/arch/arm/boot
scp Image pi@raspberrypi:/tmp
scp dtb/bcm2709-rpi-2-b.dtb pi@raspberrypi:/tmp

cd module_build_directory
tar czf modules.tgz *
scp modules.tgz pi@raspberrypi:/tmp

// ssh to raspberry
ssh pi@your_ip_address_to_rasp
cd /
sudo mv /tmp/Image /boot/kernel7.img        // 忽略属性不同的信息
scp mv /tmp/bcm2709-rpi-2-b.dtb /boot/bcm2709-rpi-2-b.dtb   
sudo tar xzf /tmp/modules.tgz           // 解压后可以通过ls /lib/modules查看

关于内核配置

Symbol(s) Description:
[ ], [*]    Options in square brackets can be activated or deactivated. The asterisk marks the menu entry as activated. The value can be changed with the space key. It is also possible to press Y key (Yes) to activate or N key (No) to deactivate the selected entry.

If the option is activated, the selected feature/driver will be built into the kernel and will always be available at boot time.

< >, , <*>   Options in angle brackets can be activated or deactivated, but also activated as module (indicated by a M). The values can be modified by pressing Y/N keys as before or by pressing the M key to activate the feature/driver as a module.

See the Kernel Modules article for differentiation.

{M}, {*}    Options in curly brackets can be activated or activated as module but not be deactivated. This happens because another feature/driver is dependent on this feature.
-M-, -*-    Options between hyphens are activated in the shown way by another feature/driver. There is no choice.
Tag Description:
(NEW)   This driver is new in the kernel and is maybe not stable enough.
(EXPERIMENTAL)  This driver is experimental and most likely not stable enough.
(DEPRECATED)    This driver is deprecated and not needed for most systems.
(OBSOLETE)  This driver is obsolete and should not be activated.

相关内容

    暂无相关文章