Zedboard上运行Linaro系统(三):编译内核和设备树

转载请注明 ,文章地址:http://blog.csdn.net/yake827/article/details/51980181

内核和设备树的实现依靠官方提供的代码,步骤如下:

1.下载内核

$ git clone https://github.com/Xilinx/linux-xlnx.git

$ cd linux

2.为方便管理,内核版本统一使用xilinx-v15.2

$ git checkout -bxilinx-v15.2

3.配置编译器环境

$ export ARCH=arm

$ export CROSS_COMPILE=arm-xilinx-linux-gnueabi-

4.配置内核环境

$make xilinx_zynq_defconfig

5.编译uImage内核程序,首先要把mkimage程序加载进去

$sudo apt-get install u-boot-tools

$ make uImage LOADADDR=0x00008000

编译完成后生成的uimage就是我们需要的内核映像程序。

6.编译设备树device tree

首先在arch/arm/boot/dts/zynq-zed.dtsi中更改bootargs,改为:

// bootargs ="console=ttyPS0,115200 root=/dev/ram rw initrd=0x1100000,33Mip=:::::eth0:dhcp earlyprintk";

bootargs ="console=ttyPS0,115200 root=/dev/mmcblk0p2 rw earlyprintk rootfstype=ext4rootwait devtmpfs.mount=0";

完成这一步之后,linux就变为从SD卡的第二分区中挂载根文件系统。

接下来在内核中编译设备树文件。

$./scripts/dtc/dtc –I dts –O dtb -o  devicetree.dtb arch/arm/boot/dts/zynq-zed.dts

编译出来的devicetree.dtb就是我们需要的设备树文件。

猜你喜欢

转载自blog.csdn.net/yake827/article/details/52036703