petalinux编译zynq的linux

 首先要在vivado里建立工程。

工程建立完成  一般流程  综合,实现,比特流

综合后如果有引出的模块要分配外接的管脚。

生成比特流后导入到SDK就可以了

这时候工程已经有bit流文件 和hdf硬件顶层设计文件。

source一下petalinux的环境

使用petatlinux建立工程,petalinux-creat  --type project --template zynq --new 文件名

就会在当前目录先建立文件名的文件夹

cd到文件夹

petalinux-config --get-hw-description=<hdf文件的路径>

然后开始配置:

petalinux-config -c u-boot  

--Device Drivers     DMA Support  --->   [*] Enable Driver Model for DMA drivers   

FPGA support  --->    [*] Enable Xilinx FPGA drivers                                   │ │  

  │ │    [*]   Enable Xilinx FPGA driver for ZynqMP  

    I2C support  --->         [*] Enable Driver Model for I2C drivers   

  [*] Network device support  --->                                         [*]   Xilinx AXI Ethernet                                        │ │  
  │ │    [*]   Xilinx Ethernetlite                                        │ │  

  │ │    [*]   Xilinx Ethernet GEM 

 [*] USB support  --->    

 petalinux-config -c kernel

 [*] Networking support  --->           Networking options  --->               [*]     IP: DHCP support                                         │ │  
  │ │    [ ]     IP: BOOTP support                                        │ │  

  │ │    [*]     IP: RARP support 

petalinux-config -c rootfs

        Filesystem Packages   --->   

  libs   --->     ffmpeg   --->    [*] ffmpeg   

     console   --->      utils   --->        file   --->    [*] file  

    console   --->        utils   --->       unzip   --->     [*] unzip  

    console   --->         utils   --->         vim   --->      [*] vim    

$ petalinux-package --boot --fsbl --fpga --u-boot

zynq> flashcp -v BOOT.BIN /dev/mtd0 zynq> flashcp -v uImage /dev/mtd1 zynq> flashcp -v devicetree.dtb /dev/mtd2 zynq> flashcp -v uramdisk.image.gz /dev/mtd3



fatload mmc 0 0x1000000 image.ub

bootm 0x1000000


You can find all the modules in this directory:build/tmp/work/plnx_aarch64-xilinx-linux/linux-xlnx/4.9-xilinx-v2017.3+gitAUTOINC+f1b1e077d6-r0/image/lib/modules/4.9.0-xilinx-v2017.3/

 

it should list your modules with  "find -name *.ko "  command also.



添加脚本:

 

Re: how to add or modify petalinux 2016.4 yocto kernel source or devictree source?

 

and for the kernel modify

 

after build the kernel you will find the source code in the 

<plnx-proj-root>/build/tmp/work-shared/plnx_arm/kernel-source

 

1. modify the code source in the <plnx-proj-root>/build/tmp/work-shared/plnx_arm/kernel-source

for example: drivers/w1/masters/w1-gpio.c

 

2. in the  <plnx-proj-root>/build/tmp/work-shared/plnx_arm/kernel-source do like this

git add file1(like:drivers/w1/masters/w1-gpio.c) file2 ...

 

3. give a pacth tile

git commit -s -m 'your commit title'

 

4.create the pacth

git format-patch -1

    #and then you will see the .pacth in you current directory.

 

5. copy this .pacth to the <plnx-proj-root>/project-spec/meta-user/recipes-kernel/linux/linux-xlnx/

and add the linux-xlnx_%.bbappend file in the <plnx-proj-root>/project-spec/meta-user/recipes-kernel/linux/ 

like:
SRC_URI_append = " file://xxxx.patch"

FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"



猜你喜欢

转载自blog.csdn.net/sinat_36371321/article/details/79897174