Chinaunix首页 | 论坛 | 博客
  • 博客访问: 619692
  • 博文数量: 75
  • 博客积分: 988
  • 博客等级: 准尉
  • 技术积分: 1269
  • 用 户 组: 普通用户
  • 注册时间: 2011-05-10 15:44
文章分类

全部博文(75)

文章存档

2022年(1)

2019年(1)

2018年(1)

2016年(9)

2015年(7)

2013年(6)

2012年(40)

2011年(10)

分类: LINUX

2016-12-16 18:08:05

linux源码下载 https://github.com/digilent/linux-digilent-dev由于我网速慢,就不用git下载了,用之前下好的zip文件,进入到解压好的linux源码目录。
这里直接解压会有问题,因为那个zip软件固有的问题,导致解压的时候出问题,一般这个时候不注意是看不出来的,在编译的时候就会显现出来,一般为文件名太长。
symlink error: File name too long这是解压的时候报出来的,这个一般不注意看不出来的。下面是我make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- distclean时的报错。
./scripts/Makefile.clean:17: fs/jffs2/Makefile: File name too long
make[2]: stat: fs/jffs2/Makefile: File name too long
make[2]: *** No rule to make target `fs/jffs2/Makefile'.  Stop.
make[1]: *** [fs/jffs2] Error 2
make: *** [_clean_fs] Error 2
解决方案
sudo apt-get install p7zip-full
然后我们移除之前解压的
cd ..
sudo rm linux-Digilent-Dev-master -rf
然后重新解压
sudo 7za x linux-Digilent-Dev-master.zip这回在最后面明显可以看成功了。
Everything is Ok

Folders: 3099
Files: 48202
Size:       543729967
Compressed: 155387692
进入源码
make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- distclean
make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- xilinx_zynq_defconfig
make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi-开始编译。等待中。。。。。
这样生成的是zImage
make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- uImage来生成一下uImage,为什么要生成,后面讲。
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h' is up to date.
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
  CHK     kernel/config_data.h
  Kernel: arch/arm/boot/Image is ready
  Kernel: arch/arm/boot/zImage is ready
multiple (or no) load addresses:
This is incompatible with uImages
Specify LOADADDR on the commandline to build an uImage
make[1]: *** [arch/arm/boot/uImage] Error 1
make: *** [uImage] Error 2
报错的,没有LOADADDR,这个是指内核载入的地址,这个我们可以先从u-boot那个zynq-common.h文件里面找到。0x2080000
make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- LOADADDR=0x2080000 uImage继续报错。
"mkimage" command not found - U-Boot images will not be built
make[1]: *** [arch/arm/boot/uImage] Error 1
make: *** [uImage] Error 2
sudo apt-get install u-boot-tools
然后再执行即可生成uImage.
Image Name:   Linux-3.18.0-xilinx
Created:      Sat Dec 17 08:46:36 2016
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    3447992 Bytes = 3367.18 kB = 3.29 MB
Load Address: 02080000
Entry Point:  02080000
  Image arch/arm/boot/uImage is ready
生成dtb.
dtc -I dts -O dtb -o devicetree.dtb zynq-zed.dts

上面Dtc编译器有几个选项和参数:
-I是输入文件格式,在本文中是dts
-O是目标文件格式,在本文中是dtb
-o是目标文件路径

最后一个参数是输入文件路径
编译之后会在目标文件路径生成一个dtb文件,这个文件名必须按照前面uboot默认配置中的文件进行命名,本文中是devicetree.dtb。
至此,内核这部分基本完成!











阅读(4471) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~