内核开发(0-环境搭建)

- qemu

ubuntu软件包安装:

$ sudo apt-get install qemu

源码编译安装:

$ git clone git://git.qemu-project.org/qemu.git

$ cd qemu

$ git checkout remotes/origin/stable-2.4 -b stable-2.4

- gcc

$ sudo apt-get install gcc-4.9-arm-linux-gnueabi

$ sudo apt-get install gcc-4.9-arm-linux-gnueabi-base

- linux kernel源码

$ wget https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.16.tar.xz

- busybox

$ wget http://www.busybox.NET/downloads/busybox-1.20.2.tar.bz2thorn@ubuntu:~/busybox-1.20.2

$ make defconfig

编译选择使用glibc动态库,因为静态库可能会出现一些未知的问题

# make menuconfigSettings  --->    Build Options  --->        [ ] Buildstaticbinary(nosharedlibs)

$ make CROSS_COMPILE=arm-linux-gnueabi-

$ make install CROSS_COMPILE=arm-linux-gnueabi-

编译时的错误

错误一:

loginutils/passwd.c:In function ‘passwd_main’:

loginutils/passwd.c:104:16:error: storage size of ‘rlimit_fsize’isn’t known

loginutils/passwd.c:188:2: warning: implicit declaration offunction ‘setrlimit’ [-Wimplicit-function-declaration]

loginutils/passwd.c:188:12: error: ‘RLIMIT_FSIZE’ undeclared(first use in this function)

loginutils/passwd.c:188:12: note: each undeclared identifier isreported>for each function it appears in

loginutils/passwd.c:104:16: warning: unused variable‘rlimit_fsize’ [-Wunused-variable]

改正:

sudo gedit busybox-1.19.4/include/libbb.h

添加头文件:#include

错误二:

util-linux/mkfs_ext2.c:51:27: fatal error: linux/ext2_fs.h:No such file or directory

改正:

出现这个错误是busybox版本导致的,只有busybox-1.19.4会出现这个问题,换成busybox-1.21.1,问题消失。 

- libguestfs

sudo apt-get install libguestfs-tools

- 编译内核

-- 生成config文件

make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm O=./out_vexpress_3_16 vexpress_defconfig

-- 配置内核

$ sudo apt-get install libncurses-dev

$ make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm O=./out_vexpress_3_16 menuconfig 

将System Type -->的Enable the L2x0 outer cache controller 取消

内核开发(0-环境搭建)_第1张图片

-- 编译

$ make CROSS_COMPILE=arm-linux-gnueabi- ARCH=arm O=./out_vexpress_3_16 zImage -j2

- 参考文献

1、从零使用qemu模拟器搭建arm运行环境

2、Qemu搭建ARM vexpress开发环境(一)

3、使用qemu模拟器搭建arm运行环境

4、TI-AM1808_LINUX开发笔记

你可能感兴趣的:(内核开发(0-环境搭建))