树莓派Rpi编译更换 内核
来源:互联网 发布:打开钱箱的软件 编辑:程序博客网 时间:2024/04/30 11:40
http://www.shumeipai.net/thread-20933-1-1.html
http://www.kissthink.com/archive/--2959.html
1、获取最新内核源码以及工具链
$ git clone https://github.com/raspberrypi/linux.git$ git clone https://github.com/raspberrypi/tools.git官方资源:https://github.com/raspberrypi
git clone 完成之后:
$ ls -l
total 8K
drwxr-xr-x 25 root root 4.0K Jun 21 11:21 linux/
drwxr-xr-x 8 root root 4.0K Jun 20 20:48 tools/
2、编译内核及模块
A、设置环境变量,添加交叉编译工具链的路径
export PATH=$PATH:/root/wk/raspberry/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin 验证环境变量是否正常
$ whereis arm-bcm2708hardfp-linux-gnueabi-gcc
arm-bcm2708hardfp-linux-gnueabi-gcc: /root/wk/raspberry/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/arm-bcm2708hardfp-linux-gnueabi-gcc
B、修改Makefile
$ cd linux
$ vi Makefile
将
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
改为
ARCH ?= arm
CROSS_COMPILE ?= arm-bcm2708hardfp-linux-gnueabi-
C、查看内核版本
$ make kernelrelease
3.12.22+
后面这个加号很别扭,试图去掉:
$ vi scripts/setlocalversion
注释第55行
即:
54 if $short; then
55 echo "+"
56 return
57 fi
改为
54 if $short; then
55 # echo "+"
56 return
57 fi
$ make kernelrelease
3.12.22
D、编译内核及模块
$ cp arch/arm/configs/bcmrpi_defconfig .config
$ make menuconfig
$ make -j 4
$ make modules –j 4
E、生成内核img,打包内核模块,并拷贝到树莓派上
$ cd tools/mkimage/
$ python2 ./imagetool-uncompressed.py ../../linux/arch/arm/boot/Image
$ ls kernel.img -l
-rw-r--r-- 1 root root 6.0M Jun 21 11:16 kernel.img打包内核模块
$ tar -cjvf modules.tar.bz2 /root/wk/raspberry/image/modules
将modules.tar.bz2 和 kernel.img 拷贝到树莓派
3、在树莓派上更换内核及模块
$ ls -l
总用量 16924
-rw-r--r-- 1 pi pi 6289676 6月 21 2014 kernel.img
-rw-r--r-- 1 pi pi 11027407 6月 21 2014 modules.tar.bz2
换内核
$ mv kernel.img /boot/kernel_3.12.22.imag修改config.txt,指定使用的内核版本
$ vi /boot/config.txt 最后一行添加:
kernel=kernel_3.12.22.imag
换内核模块
$ tar -xjvm modules.tar.bz2
$ mv root/wk/raspberry/image/modules/lib/modules/3.12.22/ /lib/modules/
生成内核模块的依赖
$ depmod -a -v 3.12.22
4、验证内核及模块是否更换正常
重启前记录内核版本
$ uname -a
Linux raspberrypi 3.10.25+ #622 PREEMPT Fri Jan 3 18:41:00 GMT 2014 armv6l GNU/Linux
重启之后
$ uname -a
Linux raspberrypi 3.12.22 #1 PREEMPT Fri Jun 20 21:14:17 UTC 2014 armv6l GNU/Linux
$ lsmod
Module Size Used by
snd_bcm2835 18169 0
snd_soc_bcm2708_i2s 5486 0
regmap_mmio 2818 1 snd_soc_bcm2708_i2s
snd_soc_core 128254 1 snd_soc_bcm2708_i2s
snd_compress 8168 1 snd_soc_core
regmap_i2c 1657 1 snd_soc_core
snd_pcm_dmaengine 5481 1 snd_soc_core
regmap_spi 1913 1 snd_soc_core
snd_pcm 81542 3 snd_bcm2835,snd_soc_core,snd_pcm_dmaengine
snd_page_alloc 5168 1 snd_pcm
snd_seq 54581 0
snd_seq_device 6485 1 snd_seq
snd_timer 20353 2 snd_pcm,snd_seq
leds_gpio 2055 0
led_class 4119 1 leds_gpio
snd 61526 7 snd_bcm2835,snd_soc_core,snd_timer,snd_pcm,snd_seq,snd_seq_device,snd_compress
0 0
- 树莓派Rpi编译更换 内核
- Rpi内核编译中的问题
- Ubuntu编译、更换、删除内核
- 树莓派RPi.GPIO使用手册
- rpi
- 更换内核
- 用ECLIPSE编译RPI QEMU的kernel
- ubuntu中linux内核的编译、更换与使用
- Linux编译+更换3.4版本内核教程 [复制链接]
- RPI的入门教程(树莓派)
- 树莓派(RPi) CentOS7安装Nginx
- 【RPi树莓派使用指南】树莓派串口通信介绍
- 【RPi树莓派使用指南】GPIO驱动方法
- 树莓派(RPi) CentOS7安装配置PHP7
- linux 更换内核
- 更换内核的问题
- Ubuntu更换内核方法
- Ubuntu更换内核方法
- 16个使用精美字体的欧美网页设计欣赏
- ARC在IBOutlet属性中的使用
- iOS-Core-Animation之十五----图层性能
- SQL0010N does not have an ending string delimiter
- codeforces--55D--Beautiful numbers(数位dp,dfs+记忆化)
- 树莓派Rpi编译更换 内核
- (转载)linux命令之三十五wc命令
- SNMPv1原理
- 我的blog
- [学习笔记]学习主题模型(Topic Model)和PLSA( probabilistic latent semantic analysis)
- Linux串口(serial、uart)驱动程序设计
- MySQL事务隔离级别详解
- AFNetworking上传遇到的小问题
- linux初级:用useradd SB2,来建立新账户时,显示 bash:useradd:command not found的解决方法