精华内容
下载资源
问答
  • ZYNQ跑系统 系列(二) petalinux方式移植linux

    万次阅读 多人点赞 2017-12-06 22:22:15
    移植linux之petalinux之前一篇博文中,提到了一种通用的传统移植方式,将linux移植到ZYNQ中的ARM芯片中。本文将针对xilinx的专用开发环境petalinux,进行安装、入门和开发

    移植linux之petalinux

    之前一篇博文中,提到了一种通用的传统移植方式,将linux移植到ZYNQ中的ARM芯片中。本文将针对xilinx的专用开发环境petalinux,进行入门和开发,本文petalinux的运行环境依然在虚拟机的linux系统里,即将体验petalinux相对于传统方式的便捷和强大之处

    一、安装petalinux

    • -1.安装虚拟机,在虚拟机里安装linux系统(ubuntu16)

      • 虚拟机里磁盘尽量留大点,建议60G,我的是80G
      • sudo passwd命令,设置超级用户su时的密码
      • 建议安装VMware Tools
      • 开发工具:vivado2017.1(Windows下) + petalinux 2017.1(Linux下)
    • 0.更新apt-get(可选,加速用,同传统方式移植那篇文章的第二节)

    • 1.安装petalinux的依赖环境
      安装petalinux的必要依赖环境,直接复制粘贴下面的命令行到shell中,系统自动下载安装下面的工具:

      sudo apt-get install build-essential vim tofrodos \
      iproute2 gawk gcc git make net-tools zlib1g-dev \
      libssl-dev flex bison libselinux1 libncurses5-dev \
      tftpd lib32z1 lib32ncurses5 libbz2-1.0:i386 \
      lib32stdc++6 xvfb chrpath socat autoconf libtool

    • 2.修改/bin/sh
      shell中输入:dpkg-reconfigure dash,在出现的界面中选择‘否’

    • 3.下载petalinux
      去官网下载petalinux-v2017.1-final-installer.run(文件8个G,上传不了)

    • 4.安装petalinux

      • 在一个用户目录下(我的是:home/hlf/mnt),用鼠标右键,新建一个文件夹petalinux
      • 在普通用户下(非root模式下,即命令行是:hlf@hlf-virtual-machine:~/mnt$这样的),shell中输入命令:./petalinux-v2017.1-final-installer.run ./petalinux
      • 经过漫长的等待,安装到一半的时候,提醒查看许可,按回车查看,按q退出,退出后输入y,回车,如此重复三次,才开始正式安装(这个步骤要很小心,如果没有输入y,就回车,就要重新了)
      • 安装的时候提示,提示有几个库没装,不过没关系,等petalinux安装完之后,再补也不迟,静候一直到安装完毕
        这里写图片描述
    • 5.补一些库的安装

      • 懒人直接只看这一点即可(可以跳过下面两点),把下面命令粘贴到shell中回车即可:

        apt-get install texinfo gcc-multilib libsdl1.2-dev libglib2.0-dev zlib1g:i386 libncurses5 libncurses5-dev libc6:i386 libstdc++6:i386 zlib1g:i386 libssl-dev tftpd tftp openbsd-inetd

      • 先安装刚刚安装时,提示缺少的库:

        apt-get install texinfo gcc-multilib libsdl1.2-dev libglib2.0-dev zlib1g:i386

      • 安装一些之后需要的库,全都安装了避免麻烦:

        • 在运行petalinux-config -c kernel会出现错误,需安装:
          apt-get install libncurses5 libncurses5-dev
        • 编译时可能会出现错误arm-xilinx-linux-gnueabi-gcc: Command not found,需安装:
          apt-get install libc6:i386 libstdc++6:i386 zlib1g:i386
        • 提示缺少zlib和openssl,需安装:
          apt-get install libssl-dev
        • 出现警告(警告而已,强迫症可以处理一下),提示No tftp server found - please refer to “PetaLinux SDK Installation Guide” for its impact and solution,需安装:
          apt-get install tftpd tftp openbsd-inetd,安装完成后,编辑一下/etc/inetd.conf里的东西:
          直接shell中输入gedit /etc/inetd.conf,打开了文件,并在文件最后一行增加:
          tftp dgram udp wait nobody /usr/sbin/tcpd /usr/sbin/in.tftpd /tftproot 然后保存并退出 ,之后再进行一些简单操作:
          mkdir /tftproot
          chmod 777 /tftproot
          /etc/init.d/openbsd-inetd restart
          输入netstat -an | more | grep udp命令,以确定成功(打印出udp 0 0 0.0.0.0:69 0.0.0.0:*
    • 6.验证是否安装成功
      source /home/hlf/mnt/petalinux/settings.sh
      成功定位不报错的话,基本是成功了的
      echo $PETALINUX
      命令行会打印出安装路径/home/hlf/mnt/petalinux

    二、搭建硬件环境

    • 1.新建工程,选择对应的芯片型号,并新建一个 BD 原理图文件(命名为system),然后添加一个ZYNQ Processing system的IP核,并设置好与硬件相符合的PS和PL时钟以及DDR型号
      这个步骤同传统方式移植那篇文章

    • 2.为了使PetaLinux正常的运行,需要分配一些硬件外设资源

      1.TTC模块(必须) ,如果有多个,Linux内核将会使用第一个。
      2.外部32MB存储空间(必须)
      3.UART模块(必须),控制台打印信息用,若用IP核的话,需中断信号连到PS
      4.非易失存储器(可选),如:QSPI Flash,SD/MMC
      5.以太网接口(可选),若用IP核或外部PHY的话,需中断信号连到PS

      本文硬件上,将在ZYNQ Processing system里启用TTC、UART、SD以及之后可能用到的USB、Ethernet(网口0在bank1,bank1电压要选1.8V,否则报错)
      这里写图片描述
      这里写图片描述

      预留好上述模块就可以了,
      这里写图片描述
      然后右键单击 Block 文件,文件选择 Generate the Output Products,然后右键单击 Block 文件,选择 Create a HDL wrapper,根据 Block 文件内容产生一个 HDL 的顶层文件,并选择让 vivado 自动完成

      经Vivado综合,实现后,在Vivado中导出硬件,输出PetaLinux所需要的硬件描述文件
      输出的文件就在“/(工程文件夹)/(工程名).sdk”这个文件夹下,这个文件夹下的system_wrapper.hdf待用

    三、搭建petalinux工程

    • 0.定位目录
      先在shell中找一个准备存放工程的地方,(我的是home/hlf/PRO),命令行cd home/hlf/PRO

    • 1.定位编译链
      根据安装petalinux的路径:
      source /home/hlf/mnt/petalinux/settings.sh

    • 2.创建petalinux工程
      将在PRO目录下面,创建一个工程:
      petalinux-create --type project --template zynq --name h1_petalinux_test
      h1_petalinux_test是工程名,该命令会自动在PRO文件夹里创建h1_petalinux_test文件夹

    • 3.引用刚才输出的硬件描述文件
      把之前导出的硬件描述文件system_wrapper.hdf拷贝到虚拟机中的h1_petalinux_test工程文件夹下,然后:
      petalinux-config --get-hw-description=/home/hlf/PRO/h1_petalinux_test
      会进入一个配置界面,在里面我们可以配置一些系统参数,主要的配置包括:启动方式,启动存储器分区表,启动文件名称等等,本文暂不对其修改(默认是从SD卡中启动),然后等待其配置(时间较长)

    • 4.获取文件夹权限
      在上一步完成后,输入命令sudo chmod -R 777 /home/hlf获取文件夹权限(工程文件夹和petalinux的安装文件夹),否则编译的时候,会发生错误

    • 目前为止,在shell中的命令既可以以超级用户su的身份运行也可以以普通用户的方式运行(建议全部都用普通用户的方式,免得切换),但是等下编译u-boot和kernel以及rootfs的时候,必须普通用户的身份运行命令行,否则会报错的

    • 5.编译u-boot
      注意:到此处的时候,不能再用超级用户了,要切换到普通用户下,之后的所有操作都在普通用户下
      普通用户的shell中输入petalinux-config -c u-boot(依然要事先输入source /home/hlf/mnt/petalinux/settings.sh命令),然后等待GUI出来,这里暂时不改动啥,直接save(save为u-boot.config,名字随便取但不要留空),然后继续等(新建工程要等的时间还是比较长的,后来就会好的)
      这里写图片描述

    • 6.编译kernel
      命令petalinux-config -c kernel,操作同上(save为kernel.config

    • 7.编译rootfs
      命令petalinux-config -c rootfs,操作同上(save为默认即可)

    • 8.设备树配置
      若要修改,直接在工程文件夹下,Ctr+F搜索.dts就可以找到相关文件,做出相应修改”
      暂时默认吧,不修改,按照它自动生成的设备树

    • 9.编译工程
      输入命令petalinux-build,等待即可,最后生成的文件在 image/linux

    • 10.生成BOOT.BIN
      把shell定位到image/linux目录下,执行命令
      petalinux-package --boot --format BIN --fsbl zynq_fsbl.elf --fpga system_wrapper.bit --u-boot,在文件夹下就可以发现,多了一个BOOT.BIN

    • 11.将如下文件拷入SD卡
      这里写图片描述

    • 12.开机
      将SD卡,插回,开机,串口打印信息为:

    U-Boot 2017.01 (Dec 06 2017 - 20:05:03 +0800)
    
    Board: Xilinx Zynq
    DRAM:  ECC disabled 1 GiB
    MMC:   sdhci@e0100000: 0 (SD)
    Using default environment
    
    ## Error: flags type check failure for "serverip" <= "AUTO" (type: i)
    himport_r: can't insert "serverip=AUTO" into hash table
    In:    serial
    Out:   serial
    Err:   serial
    Net:   ZYNQ GEM: e000b000, phyaddr ffffffff, interface rgmii-id
    PHY is not detected
    GEM PHY init failed
    No ethernet found.
    U-BOOT for h1_petalinux_test
    
    ZYNQ GEM: e000b000, phyaddr ffffffff, interface rgmii-id
    mdio_register: non unique device name 'eth0'
    ZYNQ GEM: e000b000, phyaddr ffffffff, interface rgmii-id
    mdio_register: non unique device name 'eth0'
    ZYNQ GEM: e000b000, phyaddr ffffffff, interface rgmii-id
    mdio_register: non unique device name 'eth0'
    ZYNQ GEM: e000b000, phyaddr ffffffff, interface rgmii-id
    mdio_register: non unique device name 'eth0'
    No ethernet found.
    ZYNQ GEM: e000b000, phyaddr ffffffff, interface rgmii-id
    mdio_register: non unique device name 'eth0'
    Hit any key to stop autoboot:  0
    Device: sdhci@e0100000
    Manufacturer ID: 41
    OEM: 3432
    Name: SD16G
    Tran Speed: 50000000
    Rd Block Len: 512
    SD version 3.0
    High Capacity: Yes
    Capacity: 7.5 GiB
    Bus Width: 4-bit
    Erase Group Size: 512 Bytes
    reading image.ub
    9470752 bytes read in 539 ms (16.8 MiB/s)
    ## Loading kernel from FIT Image at 10000000 ...
       Using 'conf@1' configuration
       Verifying Hash Integrity ... OK
       Trying 'kernel@0' kernel subimage
         Description:  Linux Kernel
         Type:         Kernel Image
         Compression:  uncompressed
         Data Start:   0x100000d4
         Data Size:    3740448 Bytes = 3.6 MiB
         Architecture: ARM
         OS:           Linux
         Load Address: 0x00008000
         Entry Point:  0x00008000
         Hash algo:    sha1
         Hash value:   0ea332944f4f3a57b6148e243370717e68305f55
       Verifying Hash Integrity ... sha1+ OK
    ## Loading ramdisk from FIT Image at 10000000 ...
       Using 'conf@1' configuration
       Trying 'ramdisk@0' ramdisk subimage
         Description:  ramdisk
         Type:         RAMDisk Image
         Compression:  uncompressed
         Data Start:   0x10394960
         Data Size:    5715407 Bytes = 5.5 MiB
         Architecture: ARM
         OS:           Linux
         Load Address: unavailable
         Entry Point:  unavailable
         Hash algo:    sha1
         Hash value:   ea6447a1589e48aa270804e584288cce35a013d5
       Verifying Hash Integrity ... sha1+ OK
    ## Loading fdt from FIT Image at 10000000 ...
       Using 'conf@1' configuration
       Trying 'fdt@0' fdt subimage
         Description:  Flattened Device Tree blob
         Type:         Flat Device Tree
         Compression:  uncompressed
         Data Start:   0x103914e8
         Data Size:    13254 Bytes = 12.9 KiB
         Architecture: ARM
         Hash algo:    sha1
         Hash value:   891d21220292064a5c6f8b11f8932ff240df21c0
       Verifying Hash Integrity ... sha1+ OK
       Booting using the fdt blob at 0x103914e8
    ZYNQ GEM: e000b000, phyaddr ffffffff, interface rgmii-id
    mdio_register: non unique device name 'eth0'
       Loading Kernel Image ... OK
       Loading Ramdisk to 07a8c000, end 07fff5cf ... OK
       Loading Device Tree to 07a85000, end 07a8b3c5 ... OK
    
    Starting kernel ...
    
    Uncompressing Linux... done, booting the kernel.
    Booting Linux on physical CPU 0x0
    Linux version 4.9.0-xilinx-v2017.1 (hlf@hlf-virtual-machine) (gcc version 6.2.1 20161016 (Linaro GCC 6.2-2016.11) ) #1 SMP PREEMPT Wed Dec 6 18:14:40 CST 2017
    CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
    CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    OF: fdt:Machine model: xlnx,zynq-7000
    bootconsole [earlycon0] enabled
    cma: Reserved 16 MiB at 0x3f000000
    Memory policy: Data cache writealloc
    percpu: Embedded 14 pages/cpu @ef7d3000 s25932 r8192 d23220 u57344
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260608
    Kernel command line: console=ttyPS0,115200 earlyprintk
    PID hash table entries: 4096 (order: 2, 16384 bytes)
    Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
    Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
    Memory: 1007764K/1048576K available (6144K kernel code, 202K rwdata, 1456K rodata, 1024K init, 229K bss, 24428K reserved, 16384K cma-reserved, 245760K highmem)
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
        vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
        lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
        pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
        modules : 0xbf000000 - 0xbfe00000   (  14 MB)
          .text : 0xc0008000 - 0xc0700000   (7136 kB)
          .init : 0xc0900000 - 0xc0a00000   (1024 kB)
          .data : 0xc0a00000 - 0xc0a32800   ( 202 kB)
           .bss : 0xc0a32800 - 0xc0a6be98   ( 230 kB)
    Preemptible hierarchical RCU implementation.
            Build-time adjustment of leaf fanout to 32.
            RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
    RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
    NR_IRQS:16 nr_irqs:16 16
    efuse mapped to f0802000
    slcr mapped to f0804000
    L2C: platform modifies aux control register: 0x72360000 -> 0x72760000
    L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000
    L2C-310 erratum 769419 enabled
    L2C-310 enabling early BRESP for Cortex-A9
    L2C-310 full line of zeros enabled for Cortex-A9
    L2C-310 ID prefetch enabled, offset 1 lines
    L2C-310 dynamic clock gating enabled, standby mode enabled
    L2C-310 cache controller enabled, 8 ways, 512 kB
    L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001
    zynq_clock_init: clkc starts at f0804100
    Zynq clock init
    sched_clock: 64 bits at 325MHz, resolution 3ns, wraps every 4398046511103ns
    clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4af477f6aa, max_idle_ns: 440795207830 ns
    Switching to timer-based delay loop, resolution 3ns
    clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 551318127 ns
    timer #0 at f080c000, irq=17
    Console: colour dummy device 80x30
    Calibrating delay loop (skipped), value calculated using timer frequency.. 650.00 BogoMIPS (lpj=3250000)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
    Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
    CPU: Testing write buffer coherency: ok
    CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
    Setting up static identity map for 0x100000 - 0x100058
    CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
    Brought up 2 CPUs
    SMP: Total of 2 processors activated (1300.00 BogoMIPS).
    CPU: All CPU(s) started in SVC mode.
    devtmpfs: initialized
    VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
    clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    pinctrl core: initialized pinctrl subsystem
    NET: Registered protocol family 16
    DMA: preallocated 256 KiB pool for atomic coherent allocations
    cpuidle: using governor menu
    hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
    hw-breakpoint: maximum watchpoint size is 4 bytes.
    zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0xf0880000
    zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
    vgaarb: loaded
    SCSI subsystem initialized
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    media: Linux media interface: v0.10
    Linux video capture interface: v2.00
    pps_core: LinuxPPS API ver. 1 registered
    pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
    PTP clock support registered
    EDAC MC: Ver: 3.0.0
    FPGA manager framework
    fpga-region fpga-full: FPGA Region probed
    Advanced Linux Sound Architecture Driver Initialized.
    clocksource: Switched to clocksource arm_global_timer
    NET: Registered protocol family 2
    TCP established hash table entries: 8192 (order: 3, 32768 bytes)
    TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
    TCP: Hash tables configured (established 8192 bind 8192)
    UDP hash table entries: 512 (order: 2, 16384 bytes)
    UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
    NET: Registered protocol family 1
    RPC: Registered named UNIX socket transport module.
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    Trying to unpack rootfs image as initramfs...
    Freeing initrd memory: 5584K (c7a8c000 - c8000000)
    hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
    futex hash table entries: 512 (order: 3, 32768 bytes)
    workingset: timestamp_bits=30 max_order=18 bucket_order=0
    jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
    bounce: pool size: 64 pages
    io scheduler noop registered
    io scheduler deadline registered
    io scheduler cfq registered (default)
    dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
    dma-pl330 f8003000.dmac:        DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
    e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 143, base_baud = 6250000) is a xuartps
    ▒console [ttyPS0] enabled
    console [ttyPS0] enabled
    bootconsole [earlycon0] disabled
    bootconsole [earlycon0] disabled
    xdevcfg f8007000.devcfg: ioremap 0xf8007000 to f086d000
    [drm] Initialized
    brd: module loaded
    loop: module loaded
    libphy: Fixed MDIO Bus: probed
    CAN device driver interface
    libphy: MACB_mii_bus: probed
    macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 144 (00:0a:35:00:1e:53)
    Generic PHY e000b000.etherne:00: attached PHY driver [Generic PHY] (mii_bus:phy_addr=e000b000.etherne:00, irq=-1)
    e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
    e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
    ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
    ehci-pci: EHCI PCI platform driver
    usbcore: registered new interface driver usb-storage
    mousedev: PS/2 mouse device common for all mice
    i2c /dev entries driver
    EDAC MC: ECC not enabled
    Xilinx Zynq CpuIdle Driver started
    sdhci: Secure Digital Host Controller Interface driver
    sdhci: Copyright(c) Pierre Ossman
    sdhci-pltfm: SDHCI platform and OF driver helper
    mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using DMA
    ledtrig-cpu: registered to indicate activity on CPUs
    usbcore: registered new interface driver usbhid
    usbhid: USB HID core driver
    NET: Registered protocol family 10
    sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
    NET: Registered protocol family 17
    can: controller area network core (rev 20120528 abi 9)
    NET: Registered protocol family 29
    can: raw protocol (rev 20120528)
    mmc0: Problem switching card into high-speed mode!
    mmc0: new SDHC card at address 0001
    can: broadcast manager protocol (rev 20161123 t)
    mmcblk0: mmc0:0001 SD16G 7.50 GiB
     mmcblk0: p1 p2
    can: netlink gateway (rev 20130117) max_hops=1
    Registering SWP/SWPB emulation handler
    hctosys: unable to open rtc device (rtc0)
    of_cfs_init
    of_cfs_init: OK
    ALSA device list:
      No soundcards found.
    Freeing unused kernel memory: 1024K (c0900000 - c0a00000)
    INIT: version 2.88 booting
    Starting udev
    udevd[755]: starting version 3.2
    random: udevd: uninitialized urandom read (16 bytes read)
    random: udevd: uninitialized urandom read (16 bytes read)
    random: udevd: uninitialized urandom read (16 bytes read)
    udevd[756]: starting eudev-3.2
    random: udevd: uninitialized urandom read (16 bytes read)
    Populating dev cache
    random: dd: uninitialized urandom read (512 bytes read)
    hwclock: can't open '/dev/misc/rtc': No such file or directory
    Wed Dec  6 10:24:47 UTC 2017
    hwclock: can't open '/dev/misc/rtc': No such file or directory
    Starting internet superserver: inetd.
    INIT: Entering runlevel: 5
    Configuring network interfaces... IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
    udhcpc (v1.24.1) started
    Sending discover...
    Sending discover...
    Sending discover...
    No lease, forking to background
    done.
    Starting Dropbear SSH server: random: dropbearkey: uninitialized urandom read (32 bytes read)
    Generating key, this may take a while...
    random: dropbearkey: uninitialized urandom read (32 bytes read)
    random: dropbearkey: uninitialized urandom read (32 bytes read)
    Public key portion is:
    ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCZcPRl7kGwAEL4U/yLvEVXBnbmVx8kgBHJpleEmJnE5bxZNrt5uUgRcuwEVhb/RZYNcq+random: dropbear: uninitialized urandom read (32 bytes read)
    OyiJ6e0M+e3FZDixMSUSsCjBxj2zi142fu0ssLdhmzd6TWi79AtkJCRxIFOE5VTPyaVq5tPvEdrzy6je+ukN4rvXTH+22+Kj4LwRC7xu41XpbXWpzK7oo2IHgP0KRcyPAXyI9x2QWPNsLbYj/wDta3n7GWjbnVxqrDbN8E/VejGxjL96zeKhclyvj6T2arkvfvsB3XYKfZlOMI7ozCtOyUfNhbjaFMVvqDq8hR63b2bCfjYmCwffkPJvh3hMElNGqQtl1V0gouF+oTy7D root@plnx_arm
    Fingerprint: md5 0c:53:86:51:85:23:31:f3:26:ed:92:fa:6e:b3:c0:7b
    dropbear.
    hwclock: can't open '/dev/misc/rtc': No such file or directory
    Starting syslogd/klogd: done
    Starting tcf-agent: random: tcf-agent: uninitialized urandom read (16 bytes read)
    OK
    
    PetaLinux 2017.1 plnx_arm /dev/ttyPS0
    
    plnx_arm login: root
    Password:
    root@plnx_arm:~# cd ..
    root@plnx_arm:/home# ls
    root
    root@plnx_arm:/home# cd ..
    root@plnx_arm:/# ls
    bin    dev    home   lib    mnt    root   sbin   tmp    var
    boot   etc    init   media  proc   run    sys    usr
    root@plnx_arm:/# echo "hello"
    hello
    root@plnx_arm:/#

    开机时登录的用户名和密码都是root
    可以看到正常开机了,连SD卡的文件系统都不需要自己做了,但是不自带python了

    这种基于petalinux方式移植linux的方法,到此流程也就走完了,至于更深的操作,还要在实践中,不断学习,至少现在看来,比传统方式移植方便了一些,而且移植的流程petalinux也都集成了的,好处还是挺多的,慢慢发掘他的强大之处

    展开全文
  • 前一阵子已经将U-boot移植好了,从今天开始,我们开始移植linux内核。移植的内核为3.4.2,移植的开发板为:jz2440开发板。 想看之前移植U-boot的记录,可以查看我的博客专栏,点击链接:点击查看U-boot移植教程 ...

    前一阵子已经将U-boot移植好了,从今天开始,我们开始移植linux内核。移植的内核为3.4.2,移植的开发板为:jz2440开发板。
    想看之前移植U-boot的记录,可以查看我的博客专栏,点击链接:点击查看U-boot移植教程

    首先我们从官网下载3.4.2内核,先解压内核拿到Lniux服务器:
    tar xjf linux-3.4.2.tar.bz2
    cd linux-3.4.2/

    然后修改Makefile,选择默认配置:
    vi Makefile
    找到下面这句话:

    ARCH            ?= $(SUBARCH)
    CROSS_COMPILE   ?= $(CONFIG_CROSS_COMPILE:"%"=%)

    改为:

    ARCH            ?= arm
    CROSS_COMPILE   ?= arm-linux-

    这里需要注意一点,交叉编译工具,我这里用的是4.3.2(有的交叉编译工具编译不通过)。
    然后选择默认配置:
    make s3c2410_defconfig
    然后:
    make uImage
    显示编译成功:编译成功
    然后将生成的映像文件拷贝到服务器的文件系统目录(这一步不是必须的,可以根据自己的实际情况,将映像文件烧写到开发板):
    cp arch/arm/boot/uImage /work/nfs_root/uImage_new

    然后将其烧写到开发板,这里就是在uboot启动界面输入命令了(烧写方法不唯一,我这里是用的nfs协议直接从服务器上下载内核映像文件):
    nfs 32000000 192.168.1.101:/work/nfs_root/uImage_new
    显示如下:
    烧写内核
    (注: 我在一开始用nfs挂载内核的的时候,出现如下错误:T T * ERROR: Cannot umount。
    解决办法:要在主机的/etc/hosts文件中加入:
    开发板ip nfs目录(我的是:/work/nfs_root)
    例如:192.168.1.103 /work/nfs_root/

    bootm 32000000
    串口显示乱码。很显然,虽然我们的内核已经启动,但是串口的设置,肯定没有设置好。

    通过分析uboot源码知,获取及其ID的方法为从环境变量中获取,或者使用默认的ID
    uboot的默认MACH ID:
    gd->bd->bi_arch_number = MACH_TYPE_SMDK2410; // 193
    如果s = getenv(“machid”);成功,则使用它
    否则使用默认的

    我们先自己在环境变量中设置:
    在UBOOT里:
    set machid 16a // smdk2440 mach-smdk2440.c

    set machid 7CF // mini2440 mach-mini2440.c
    (这个设置我测试了一下,不设置也可以启动内核)

    还需要更改一下环境变量:
    set bootargs console=ttySAC0,115200 root=dev/mtdblock3
    还有一个地方需要修改,如果我们使用的是 smdk2440的话,需要将arch\arm\mach-s3c24xx\mach-smdk2440.c中的

    s3c24xx_init_clocks(16934400);

    改为:

    s3c24xx_init_clocks(12000000);

    然后重新编译内核,挂载内核:
    nfs 32000000 192.168.1.101:/work/nfs_root/uImage_new
    bootm 32000000

    终于,我们的打印的是正常的字符了,但是内核还没有真正启动,还是有一些错误,今天就不写了,放到下一篇文章中继续解决。

    想一起探讨以及获得各种学习资源加我(有我博客中写的代码的原稿):
    qq:1126137994
    微信:liu1126137994
    可以共同交流关于嵌入式,操作系统,C++语言,C语言,数据结构等技术问题。

    展开全文
  • ZYNQ跑系统 系列(一) 传统方式移植linux

    万次阅读 多人点赞 2017-11-28 20:18:40
    移植linux之传统方式在ZYNQ开发时,有些情况下,为了降低开发的复杂性,或是提升系统运行的性能,在ARM上跑一个linux系统往往是一个不错的选择,而且linux系统一般集成了一些常用的成熟驱动,可以减少开发周期。...

    移植linux之传统方式


    在ZYNQ开发时,有些情况下,为了降低开发的复杂性,或是提升系统运行的性能,在ARM上跑一个linux系统往往是一个不错的选择,而且linux系统一般集成了一些常用的成熟驱动,可以减少开发周期。本章将通过传统u-boot、kernel方式,完成移植。该方式虽然繁琐复杂,但是毕竟是一种通用的移植方式。


    一、搭建硬件环境

    • 1.新建工程,并新建一个 BD 文件,然后添加一个ZYNQ Processing system的IP核,并设置好与硬件相符合的PS和PL时钟以及DDR型号
      这里写图片描述
      这里写图片描述
    • 2.添加一些必要外设
      这里写图片描述
      为了看到linux启动的实验现象,下面的外设是必备的:

      • SD:SD卡(用于从SD卡启动u-boot、kernel、PL以及文件系统)
      • UART:用于打印调试信息的串口

    • 3.右键单击 Block 文件,文件选择 Generate the Output Products

    • 4.右键单击 Block 文件,选择 Create a HDL wrapper,根据 Block 文件内容产生一个 HDL 的顶层文件,并选择让 vivado 自动完成
    • 5.并综合实现、生产.bit文件
    • 6.导出硬件(包含.bit),待启动SDK

    二、ARM上运行linux前的准备工作

    • -1.电脑上安装linux环境
    • 0.更新apt-get(可选,加速用)
      在linux系统中打开/etc/apt目录下找到sources.list文件
      将文件内容替换为
    deb-src http://archive.ubuntu.com/ubuntu xenial main restricted #Added by software-properties 
    deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted 
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted multiverse universe #Added by software-properties 
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted 
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted multiverse universe #Added by software-properties 
    deb http://mirrors.aliyun.com/ubuntu/ xenial universe 
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates universe 
    deb http://mirrors.aliyun.com/ubuntu/ xenial multiverse 
    deb http://mirrors.aliyun.com/ubuntu/ xenial-updates multiverse 
    deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse 
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse #Added by software-properties 
    deb http://archive.canonical.com/ubuntu xenial partner 
    deb-src http://archive.canonical.com/ubuntu xenial partner 
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted 
    deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted multiverse universe #Added by software-properties 
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security universe 
    deb http://mirrors.aliyun.com/ubuntu/ xenial-security multiverse 

    打开命令行执行apt-get update刷新列表

    • 1.安装相应环境
    #安装32位依赖库
    apt-get install lib32z1 lib32ncurses5 lib32stdc++6 libbz2-1.0:i386
    #安装 Openssl 库,实现网络的保密性和可靠性的数据传输,在编译u-boot时会用到
    apt-get install libssl-dev
    #安装设备树编译器工具
    apt-get install device-tree-compiler
    #安装此库,否则内核编译时make menuconfig等会报错
    apt-get install libncurses5-dev 
    #安装此库,否则内核编译报错
    sudo apt-get install u-boot-tools 
    • 2.安装vivado
      • 从官网下载WEB版的VIVADO Xilinx_Vivado_SDK_2017.1_0415_1_Lin64.bin(我已上传到:Xilinx_Vivado_SDK_2017.1_0415_1_Lin64.bin
      • 执行该.bin,安装方法以及界面都同WINDOWS版的VIVADO安装一样,运行该文件后首先通过GUI对安装进行配置
      • 配置到选择器件支持时,尽可能将不需要的器件勾选掉(减少下载的大小)
      • 配置完成后,等待下载,以及安装,即可
    • 3.下载
      https://github.com/Xilinx,直接下载官方u-boot和kernel(linux-xlnx-master.zip、u-boot-xlnx-master.tar.gz)
    • 4.编译u-boot
      • 定位编译环境source /opt/Xilinx/SDK/2017.1/settings64.sh
      • 进入u-boot目录cd /home/hlf/mnt/u-boot-xlnx-master
      • 打开GUI配置u-bootmake menuconfig,但是这个GUI是空白的配置,所以要先载入一下xilinx的默认配置,再做修改(如下)
      • 在menu中,按方向键选择load,回车,载入xinlinx默认配置文件(输入zynq_ax7010_defconfig的绝对路径,我的是/home/hlf/mnt/u-boot-xlnx-master/configs/zynq_ax7010_defconfig
        这里写图片描述
      • 然后将改动好的配置(本章不改动),再save到该路径,所需配置已保存到zynq_ax7010_defconfig文件里
      • 针对刚刚的配置开始编译u-boot:
        • make CROSS_COMPILE=arm-xilinx-linux-gnueabi- zynq_ax7010_defconfig#读配置
        • make CROSS_COMPILE=arm-xilinx-linux-gnueabi-#编译
        • #arm-xilinx-linux-gnueabi-objdump -h u-boot #查看 u-boot 文件的不同段的内存分配情况
          到这一步,把u-boot拷贝出来,并加后缀为u-boot.elf,待用
          这里写图片描述
    • 5.生成BOOT.bin
      • 启动SDK,新建一个FSBL模板,并在文件中#define FSBL_DEGUG_INFO以便看到调试信息,然后编译生成fsbl.elf
        这里写图片描述
      • 从SDK中将上述fsbl.elf、硬件的.bit文件、u-boot.elf打包成BOOT.bin
        这里写图片描述
    • 6.生成uImage
      • 进入目录 cd /home/hlf/mnt/linux-xlnx-master
      • 定位编译环境 source /opt/Xilinx/SDK/2017.1/settings64.sh
      • 打开GUI配置内核 make ARCH=arm menuconfig
      • 在GUI中load一下xilinx的默认配置,load的路径为/home/hlf/mnt/linux-xlnx-master/arch/arm/configs/xilinx_zynq_defconfig
      • 在GUI中进行相关设置后(本章不改动),save到xilinx_zynq_defconfig里(也可以自己选择)
      • make ARCH=arm xilinx_zynq_defconfig #读配置
      • make ARCH=arm CROSS_COMPILE=arm-xilinx-linux-gnueabi- uImage LOADADDR=0x00008000 #编译内核
      • 编译完成后,在linux-xlnx-master/arch/arm/boot目录下可以发现uImage文件,待用
    • 7.生成devicetree.dtb
      在linux-xlnx-master/arch/arm/boot/dts目录内新建或者找到zynq-7010.dts文件,内容为(注意一下串口和主频和硬件是否对应):
    /dts-v1/;
    /include/ "zynq-7000.dtsi"
    
    / {
        model = "HLF";
        compatible = "ALINX,zynq", "xlnx,zynq-7000";
    
        aliases {
            ethernet0 = &gem0;
            serial0 = &uart1;
            spi0 = &qspi;
            mmc0 = &sdhci0;
        };
    
        memory@0 {
            device_type = "memory";
            reg = <0x0 0x20000000>;
        };
    
        chosen {
            bootargs = "";
            stdout-path = "serial0:115200n8";
        };
    
        usb_phy0: phy0 {
            compatible = "usb-nop-xceiv";
            #phy-cells = <0>;
            reset-gpios = <&gpio0 46 1>;
        };
    };
    
    &clkc {
        ps-clk-frequency = <50000000>;
    };
    
    &gem0 {
        status = "okay";
        phy-mode = "rgmii-id";
        phy-handle = <&ethernet_phy>;
    
        ethernet_phy: ethernet-phy@0 {
            reg = <0>;
        };
    };
    
    &qspi {
        u-boot,dm-pre-reloc;
        status = "okay";
    };

    继续在linux-xlnx-master目录下运行命令:./scripts/dtc/dtc -I dts -O dtb -o ./arch/arm/boot/devicetree.dtb ./arch/arm/boot/dts/zynq-7010.dts
    然后在linux-xlnx-master/arch/arm/boot/目录下即可发现devicetree.dtb文件

    • 8.在SD中,建立文件系统
      • 下载linaro桌面文件系统(http://www.linaro.org/),我下载的是linaro-precise-ubuntu-desktop-20120923-436.tar.gz(文件500多M太大,我无法上传,所以自己去官网寻觅吧)
      • 将SD卡格式化分区,2G的FAT分区(分区命名为FAT),用于存放BOOT.bin 等文件,其余分区设为EXT4分区(分区命名为EXT),用于放置文件系统
      • 将下载的linaro解压到EXT分区中
      • cd ./binary/boot/filesystem.dir #到此目录下
      • rsync -av ./ /media/hlf/EXT #同步文件夹(路径根据实际情况)
    • 9.新建uEnv.txt
      此文件是为了写入环境变量bootargs
      在txt文件中写入bootargs=console=ttyPS0,115200n8 root=/dev/mmcblk0p2 rw noinitrd rootfstype=ext4 rootwait

    三、运行linux

    • 1.将FPGA设置为SD卡启动
    • 2.将devicetree.dtb、BOOT.bin、uEnv.txt、uImage等文件,拷贝到内存卡的FAT分区中
    • 3.FPGA上电,并插上串口,运行putty,设置好串口参数,工作正常时,打印出如下信息:
    U-Boot 2016.07 (Aug 23 2017 - 15:15:48 +0800)
    
    Model: Zynq ZYBO Development Board
    Board: Xilinx Zynq
    I2C:   ready
    DRAM:  ECC disabled 512 MiB
    MMC:   sdhci@e0100000: 0
    SF: Detected S25FL256S_64K with page size 256 Bytes, erase size 64 KiB, total 32 MiB
    In:    serial@e0001000
    Out:   serial@e0001000
    Err:   serial@e0001000
    Model: Zynq ZYBO Development Board
    Board: Xilinx Zynq
    Net:   ZYNQ GEM: e000b000, phyaddr 0, interface rgmii-id
    I2C EEPROM MAC address read failed
    eth0: ethernet@e000b000
    reading uEnv.txt
    93 bytes read in 13 ms (6.8 KiB/s)
    Importing environment from SD ...
    Hit any key to stop autoboot:  0
    Device: sdhci@e0100000
    Manufacturer ID: 41
    OEM: 3432
    Name: SD16G
    Tran Speed: 50000000
    Rd Block Len: 512
    SD version 3.0
    High Capacity: Yes
    Capacity: 7.5 GiB
    Bus Width: 4-bit
    Erase Group Size: 512 Bytes
    reading uEnv.txt
    93 bytes read in 13 ms (6.8 KiB/s)
    Loaded environment from uEnv.txt
    Importing environment from SD ...
    Copying Linux from SD to RAM...
    reading uImage
    3847608 bytes read in 229 ms (16 MiB/s)
    reading devicetree.dtb
    10471 bytes read in 23 ms (444.3 KiB/s)
    ## Booting kernel from Legacy Image at 02080000 ...
       Image Name:   Linux-4.6.0-xilinx
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    3847544 Bytes = 3.7 MiB
       Load Address: 00008000
       Entry Point:  00008000
       Verifying Checksum ... OK
    ## Flattened Device Tree blob at 02000000
       Booting using the fdt blob at 0x2000000
       Loading Kernel Image ... OK
       Loading Device Tree to 1eb0c000, end 1eb118e6 ... OK
    
    Starting kernel ...
    
    Booting Linux on physical CPU 0x0
    Linux version 4.6.0-xilinx (root@osrc-virtual-machine) (gcc version 4.9.2 (Sourcery CodeBench Lite 2015.05-17) ) #8 SMP PREEMPT Wed Aug 23 15:14:17 CST 2017
    CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
    CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    Machine model: Zynq Miz702n Development Board
    cma: Reserved 16 MiB at 0x1f000000
    Memory policy: Data cache writealloc
    percpu: Embedded 12 pages/cpu @debcd000 s19776 r8192 d21184 u49152
    Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
    Kernel command line:  console=ttyPS0,115200n8 root=/dev/mmcblk0p2 rw noinitrd rootfstype=ext4 rootwait
    PID hash table entries: 2048 (order: 1, 8192 bytes)
    Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
    Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
    Memory: 494528K/524288K available (5304K kernel code, 231K rwdata, 1844K rodata, 1024K init, 222K bss, 13376K reserved, 16384K cma-reserved, 0K highmem)
    Virtual kernel memory layout:
        vector  : 0xffff0000 - 0xffff1000   (   4 kB)
        fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
        vmalloc : 0xe0800000 - 0xff800000   ( 496 MB)
        lowmem  : 0xc0000000 - 0xe0000000   ( 512 MB)
        pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
        modules : 0xbf000000 - 0xbfe00000   (  14 MB)
          .text : 0xc0008000 - 0xc07fb004   (8141 kB)
          .init : 0xc0800000 - 0xc0900000   (1024 kB)
          .data : 0xc0900000 - 0xc0939da0   ( 232 kB)
           .bss : 0xc0939da0 - 0xc09716e8   ( 223 kB)
    Preemptible hierarchical RCU implementation.
            Build-time adjustment of leaf fanout to 32.
            RCU restricting CPUs from NR_CPUS=4 to nr_cpu_ids=2.
    RCU: Adjusting geometry for rcu_fanout_leaf=32, nr_cpu_ids=2
    NR_IRQS:16 nr_irqs:16 16
    efuse mapped to e0800000
    slcr mapped to e0802000
    L2C: platform modifies aux control register: 0x72360000 -> 0x72760000
    L2C: DT/platform modifies aux control register: 0x72360000 -> 0x72760000
    L2C-310 erratum 769419 enabled
    L2C-310 enabling early BRESP for Cortex-A9
    L2C-310 full line of zeros enabled for Cortex-A9
    L2C-310 ID prefetch enabled, offset 1 lines
    L2C-310 dynamic clock gating enabled, standby mode enabled
    L2C-310 cache controller enabled, 8 ways, 512 kB
    L2C-310: CACHE_ID 0x410000c8, AUX_CTRL 0x76760001
    zynq_clock_init: clkc starts at e0802100
    Zynq clock init
    sched_clock: 64 bits at 325MHz, resolution 3ns, wraps every 4398046511103ns
    clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4af477f6aa, max_idle_ns: 440795207830 ns
    Switching to timer-based delay loop, resolution 3ns
    clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 551318127 ns
    timer #0 at e080a000, irq=17
    Console: colour dummy device 80x30
    Calibrating delay loop (skipped), value calculated using timer frequency.. 650.00 BogoMIPS (lpj=3250000)
    pid_max: default: 32768 minimum: 301
    Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
    Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
    CPU: Testing write buffer coherency: ok
    CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
    Setting up static identity map for 0x100000 - 0x100058
    CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
    Brought up 2 CPUs
    SMP: Total of 2 processors activated (1300.00 BogoMIPS).
    CPU: All CPU(s) started in SVC mode.
    devtmpfs: initialized
    VFP support v0.3: implementor 41 architecture 3 part 30 variant 9 rev 4
    clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
    pinctrl core: initialized pinctrl subsystem
    NET: Registered protocol family 16
    DMA: preallocated 256 KiB pool for atomic coherent allocations
    cpuidle: using governor menu
    hw-breakpoint: found 5 (+1 reserved) breakpoint and 1 watchpoint registers.
    hw-breakpoint: maximum watchpoint size is 4 bytes.
    zynq-ocm f800c000.ocmc: ZYNQ OCM pool: 256 KiB @ 0xe0880000
    zynq-pinctrl 700.pinctrl: zynq pinctrl initialized
    vgaarb: loaded
    SCSI subsystem initialized
    usbcore: registered new interface driver usbfs
    usbcore: registered new interface driver hub
    usbcore: registered new device driver usb
    media: Linux media interface: v0.10
    Linux video capture interface: v2.00
    pps_core: LinuxPPS API ver. 1 registered
    pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
    PTP clock support registered
    EDAC MC: Ver: 3.0.0
    Advanced Linux Sound Architecture Driver Initialized.
    clocksource: Switched to clocksource arm_global_timer
    NET: Registered protocol family 2
    TCP established hash table entries: 4096 (order: 2, 16384 bytes)
    TCP bind hash table entries: 4096 (order: 3, 32768 bytes)
    TCP: Hash tables configured (established 4096 bind 4096)
    UDP hash table entries: 256 (order: 1, 8192 bytes)
    UDP-Lite hash table entries: 256 (order: 1, 8192 bytes)
    NET: Registered protocol family 1
    RPC: Registered named UNIX socket transport module.
    RPC: Registered udp transport module.
    RPC: Registered tcp transport module.
    RPC: Registered tcp NFSv4.1 backchannel transport module.
    hw perfevents: enabled with armv7_cortex_a9 PMU driver, 7 counters available
    futex hash table entries: 512 (order: 3, 32768 bytes)
    workingset: timestamp_bits=28 max_order=17 bucket_order=0
    jffs2: version 2.2. (NAND) (SUMMARY)  © 2001-2006 Red Hat, Inc.
    io scheduler noop registered
    io scheduler deadline registered
    io scheduler cfq registered (default)
    dma-pl330 f8003000.dmac: Loaded driver for PL330 DMAC-241330
    dma-pl330 f8003000.dmac:        DBUFF-128x8bytes Num_Chans-8 Num_Peri-4 Num_Events-16
    xilinx-vdma 43000000.dma: Xilinx AXI VDMA Engine Driver Probed!!
    e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 143, base_baud = 6250000) is a xuartps
    console [ttyPS0] enabled
    xdevcfg f8007000.devcfg: ioremap 0xf8007000 to e086e000
    [drm] Initialized drm 1.1.0 20060810
    Console: switching to colour frame buffer device 128x37
    brd: module loaded
    loop: module loaded
    m25p80 spi0.0: found s25fl256s1, expected n25q128a11
    m25p80 spi0.0: s25fl256s1 (32768 Kbytes)
    5 ofpart partitions found on MTD device spi0.0
    Creating 5 MTD partitions on "spi0.0":
    0x000000000000-0x000000100000 : "qspi-fsbl-uboot"
    0x000000100000-0x000000600000 : "qspi-linux"
    0x000000600000-0x000000620000 : "qspi-device-tree"
    0x000000620000-0x000000c00000 : "qspi-rootfs"
    0x000000c00000-0x000001000000 : "qspi-bitstream"
    CAN device driver interface
    gpiod_set_value: invalid GPIO
    libphy: MACB_mii_bus: probed
    macb e000b000.ethernet eth0: Cadence GEM rev 0x00020118 at 0xe000b000 irq 145 (00:0a:35:00:01:22)
    RTL8211E Gigabit Ethernet e000b000.etherne:00: attached PHY driver [RTL8211E Gigabit Ethernet] (mii_bus:phy_addr=e000b000.etherne:00, irq=-1)
    e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
    e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
    ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
    ehci-pci: EHCI PCI platform driver
    usbcore: registered new interface driver usb-storage
    e0002000.usb supply vbus not found, using dummy regulator
    ULPI transceiver vendor/product ID 0x0451/0x1507
    Found TI TUSB1210 ULPI transceiver.
    ULPI integrity check: passed.
    ci_hdrc ci_hdrc.0: EHCI Host Controller
    ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
    ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
    hub 1-0:1.0: USB hub found
    hub 1-0:1.0: 1 port detected
    mousedev: PS/2 mouse device common for all mice
    i2c /dev entries driver
    EDAC MC: ECC not enabled
    Xilinx Zynq CpuIdle Driver started
    sdhci: Secure Digital Host Controller Interface driver
    sdhci: Copyright(c) Pierre Ossman
    sdhci-pltfm: SDHCI platform and OF driver helper
    mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using DMA
    mmc0: Problem switching card into high-speed mode!
    mmc1: SDHCI controller on e0101000.sdhci [e0101000.sdhci] using DMA
    ledtrig-cpu: registered to indicate activity on CPUs
    usbcore: registered new interface driver usbhid
    usbhid: USB HID core driver
    mmc0: new SDHC card at address 0001
    NET: Registered protocol family 10
    sit: IPv6 over IPv4 tunneling driver
    mmcblk0: mmc0:0001 SD16G 7.50 GiB
    NET: Registered protocol family 17
    can: controller area network core (rev 20120528 abi 9)
    NET: Registered protocol family 29
    can: raw protocol (rev 20120528)
    can: broadcast manager protocol (rev 20120528 t)
    can: netlink gateway (rev 20130117) max_hops=1
    Registering SWP/SWPB emulation handler
    hctosys: unable to open rtc device (rtc0)
    ALSA device list:
      No soundcards found.
     mmcblk0: p1 p2
    mmc1: new high speed MMC card at address 0001
    mmcblk1: mmc1:0001 P1XXXX 7.20 GiB
    EXT4-fs (mmcblk0p2): recovery complete
    EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
    mmcblk1boot0: mmc1:0001 P1XXXX partition 1 2.00 MiB
    VFS: Mounted root (ext4 filesystem) on device 179:2.
    mmcblk1boot1: mmc1:0001 P1XXXX partition 2 2.00 MiB
    mmcblk1rpmb: mmc1:0001 P1XXXX partition 3 128 KiB
    devtmpfs: mounted
    Freeing unused kernel memory: 1024K (c0800000 - c0900000)
    init: hwclock main process (706) terminated with status 1e
    init: ureadahead main process (707) terminated with status 5
    modprobe: FATAL: Could not load /lib/modules/4.6.0-xilinx/modules.dep: No such file or directory
    
    modprobe: FATAL: Could not load /lib/modules/4.6.0-xilinx/modules.dep: No such file or directory
    
     * Starting mDNS/DNS-SD daemon                                           [ OK ]
     * Starting bluetooth daemon                                             [ OK ]
     * Starting configure network device security                            [ OK ]
     * Starting configure network device security                            [ OK ]
     * Starting configure network device security                            [ OK ]
     * Starting Mount network filesystems                                    [ OK ]
     * Starting Upstart job to start rpcbind on boot only                    [ OK ]
     * Starting configure network device                                     [ OK ]
     * Starting configure network device                                     [ OK ]
     * Starting Failsafe Boot Delay                                          [ OK ]
     * Stopping Upstart job to start rpcbind on boot only                    [ OK ]
     * Starting bluetooth daemon                                             [ OK ]
     * Stopping Mount network filesystems                                    [ OK ]
     * Starting NFSv4 id <-> name mapper                                     [ OK ]
     * Starting bluetooth daemon                                             [ OK ]
     * Starting Bridge socket events into upstart                            [ OK ]
     * Starting bluetooth daemon                                             [ OK ]
     * Stopping cold plug devices                                            [ OK ]
     * Stopping log initial device creation                                  [ OK ]
     * Starting configure network device security                            [ OK ]
     * Starting configure virtual network devices                            [ OK ]
     * Starting save udev log and update rules                               [ OK ]
     * Stopping save udev log and update rules                               [ OK ]
     * Starting RPC portmapper replacement                                   [ OK ]
     * Stopping configure virtual network devices                            [ OK ]
     * Starting NFSv4 id <-> name mapper                                     [ OK ]
     * Starting bluetooth daemon                                             [ OK ]
     * Starting Start this job to wait until rpcbind is started or fails to s[ OK ]
     * Stopping rpcsec_gss daemon                                            [ OK ]
     * Stopping Start this job to wait until rpcbind is started or fails to s[ OK ]
     * Starting NFSv4 id <-> name mapper                                     [ OK ]
     * Starting CUPS printing spooler/server                                 [ OK ]
     * Starting NSM status monitor                                           [ OK ]
     * Starting configure network device                                     [ OK ]
     * Stopping Failsafe Boot Delay                                          [ OK ]
     * Starting System V initialisation compatibility                        [ OK ]
     * Starting modem connection manager                                     [ OK ]
     * Starting configure network device security                            [ OK ]
     * Starting NFSv4 id <-> name mapper                                     [ OK ]
     * Starting bluetooth daemon                                             [ OK ]
     * Starting bluetooth daemon                                             [ OK ]
     * Starting bluetooth daemon                                             [ OK ]
     * Starting bluetooth daemon                                             [ OK ]
    speech-dispatcher disabled; edit /etc/default/speech-dispatcher
    
    saned disabled; edit /etc/default/saned
     * Stopping System V initialisation compatibility                        [ OK ]
     * Starting network connection manager                                   [ OK ]
     * Starting bluetooth daemon                                             [ OK ]
     * Starting bluetooth daemon                                             [fail]
     * Starting automatic crash report generation                            [ OK ]
     * Starting LightDM Display Manager                                      [ OK ]
     * Starting anac(h)ronistic cron                                         [ OK ]
     * Starting save kernel messages                                         [ OK ]
     * Starting regular background program processing daemon                 [ OK ]
     * Stopping bluetooth daemon                                             [ OK ]
     * Stopping System PulseAudio sound server                               [ OK ]
     * Starting NFSv4 id <-> name mapper                                     [ OK ]
     * Starting crash report submission daemon                               [ OK ]
    Last login: Thu Jan  1 00:01:10 UTC 1970 on tty1
     * Stopping save kernel messages                                         [ OK ]
     * Starting NFSv4 id <-> name mapper                                     [ OK ]
    cat: /var/lib/update-notifier/fsck-at-reboot: No such file or directory
    run-parts: /etc/update-motd.d/98-fsck-at-reboot exited with return code 1
    Welcome to Linaro 12.09 (GNU/Linux 4.6.0-xilinx armv7l)
    
     * Documentation:  https://wiki.linaro.org/
    
    568 packages can be updated.
    325 updates are security updates.
    
    root@linaro-ubuntu-desktop:~#
    • 4.就可以在putty中,对linux系统进行操作了
      一些基础的linux操作,都可以在命令行里运行了,例如:浏览命令ls、网络测试命令ping,甚至如果前期加了网络外设的话,可以直接插网线运行apt-get,linaro文件系统中自带了python,在命令行里,输入python即可体验

    传统方法在ZYNQ上移植linux到此就算初步完成了,之后会体验xilinx的专用开发环境petalinux的强大效果

    • 5.当然还是要体验一把helloworld了
      在电脑linux环境中,创建一个hello.c:
    #include <stdio.h>
    int main()
    {
        printf("hello hlf\n");
        return 0;
    }

    在hello.c路径下,生成可执行文件:

    cd /home/hlf/mnt/zynq_pro #hello.c所在目录
    source /opt/Xilinx/SDK/2017.1/settings64.sh #定位
    arm-xilinx-linux-gnueabi-gcc hello.c -o hello -static #生成执行文件

    将ZYNQ关机,取出SD卡
    将生成的hello执行文件,拷贝到SD的EXT分区下
    插上SD卡,重新对ZYNQ的linux开机后
    找到刚刚拷贝的hello文件,并执行,可以在putty中看到相应的结果

    这种通用的传统方法在ZYNQ上移植linux完成,即可在此基础上对linux进行使用了。

    展开全文
  • 使用cygwin移植Linux的项目到Windows下之总结 关键字: cygwin,MinGW,移植,Linux,Windows 一、why  接到一个任务,把公司的某个在Linux下开发的项目(也就是一个程序啦)移植到Windows下,使得其可以在...
    使用cygwin移植Linux的项目到Windows下之总结
    关键字: cygwin,MinGW,移植,Linux,Windows

    一、why
        接到一个任务,把公司的某个在Linux下开发的项目(也就是一个程序啦)移植到Windows下,使得其可以在Windows下运行,并且运行的结果当然要是正确的啦,何谓正确,当然就是和Linux运行结果比对,一样就行。
    二、难在何处
        难就难在如何在Windows下编译通过。假设你在Linux下开发了一个这样的程序:
        #include<stdio.h>
        int main()
        {
            printf("Hello World\n");
            return 0;
        }
        那我表示移植Windows下毫无压力,因为此程序中并没有使用Linux独有的API。但是当你的程序中使用了Linux独有的API时,那移植起来就有很多工作量了。
    三、基本思想
        做最坏的打算,你的程序里面用了很多Linux独有的API(其实你也不能说全哪些是Linux独有的API),然后移植到Windows下,编译的时候报错:找不到xxx.h的头文件,很明显此xxx.h头文件在Windows中是没有的,进而该头文件中声明的某些函数也是Windows没有的,或者Windows下类似的API不是放在这个头文件中声明的。
        此时,你考虑注释掉这个#include<xxx.h>,接下来再编译,不出意外应该是报错:某某函数未定义。那么这下就找到了xxx.h中被引用的函数了。于是下一步,你应该考虑是否Windows下有相对应的函数来完成类似的工作,如果你对Windows不熟,不好意思,只能上网查啦。MSDN是个好去处。
        假设你找到了Windows下对应的函数,尝试更换#include<xxx.h>,改成#include<yyy.h>(yyy.h是Windows下对应的那个API的声明头文件),然后下面调用的地方也相应的做些小修改。然后再验证结果是否正确。
        假设你找不到Windows下对应的函数,不好意思,你杯具了。你得自己或者从网上找资料来用Windows的环境来构造一个新的API,情况一般会很麻烦,一般会让人感到沮丧。
    四、新的希望
        让我们停下来想想,Linux下有这么多好用的东西,很多东西人们都想移植到Windows下,只是你一个人碰到这个问题吗?答案是否定的,已经有无数的人们遇到这个问题了。或许你又在想,有没有一种工具,利用Windows的一些函数来实现Linux独有的API吗?恭喜你,真有!
        下面请cygwin隆重出场。
    五、什么是cygwin
        与其我在这介绍cygwin是什么,还不如直接看一下百科全书,当然啦,不是百度百科,是wiki百科。http://zh.wikipedia.org/wiki/Cygwin 
    六、cygwin怎么用
        这就是重点了,下面说说使用过程吧,亲测。
        下载cygwin,安装cygwin,这个就不多说了。。。ps:在安装cygwin的时候,如果不懂的话就全选了,但是代价是起码10G+的硬盘空间,而且不知道要装多久,我挂了两天机。
        安装完之后,记得把C:\cygwin\bin添加到环境变量PATH中去,然后就启动cygwin,看到一个shell界面(小黑框),然后把项目放到/home/michael下,然后进入到对应的目录,make。很神奇,就这样通过了。。。然后最好是把Makefile的TARGET改成xxx.exe,然后你试试,把xxx.exe拖出来双击运行或者放cmd里面加上参数运行,是不是成功了?

    转自:https://my.oschina.net/michaelyuanyuan/blog/68615

    展开全文
  • 项目中用到的swt包为windows版,移植linux环境后发现换了linux版的包还是报错,比对后发现windows版比linux版多一个ole.win32的包。求问怎么替换,(代码中有调用到win32这个包)
  • 开发板X210V3S移植linux3.2内核

    千次阅读 2017-02-10 16:31:27
    买了开发板一直想把uboot和kernel都换掉,开发板自带的kernel版本是2.6.35,现在更换成linux3.2.17,因为想使用设备树,移植linux3.0以上的版本可谓是一波三折,到现在还没有搞明白为什么有的版本一下子就能移植成功...
  • 移植linux之SDsoc 想让ZYNQ上跑个linux系统,除了之前的两篇文章中的传统方式和petalinux方式外,还有一种更简单快捷的SDsoc,xilinx的SDx系列开发工具主要是面向软件开发人员和系统工程师,加快应用的开发,让软件...
  • 移植linux 3.0.2到2440

    千次阅读 2011-09-08 13:29:06
    移植linux 3.0.2到2440   一、内核源码修改 2 1.修改顶层Makefile文件 2 2,修改机器码 2 3. 修改时钟,不修改超级终端中会出现乱码 2 4.修改对nand的分区信息。 2 5.修改nand Flash的校验方式,去掉ECC...
  • Xilinx zynq-7000系列FPGA移植Linux操作系统详细教程 一:前言 最近手上压了一块米联客的Miz7035,一块xilinx zynq-7000系列的开发板,想着正好学习一下linux在ARM9上的移植,网上基本都是ZC702、zed的教程,这...
  • iTop4412移植Linux4.17内核

    千次阅读 2018-11-14 13:57:02
    参考iTop-4412 SCP 精英版 linux-4.14.12 内核移植 个人仓库Github-Linux4.17 fork下载即用
  • Linux version 3.16.57 (run@ubuntu) (gcc version 5.4.1 20160919 (release) [ARM/embedded-5-branch revision 240496] (GNU Tools for ARM Embedded Processors) ) #1 PREEMPT Sat Aug 25 15:28:17 CST 2018 ...
  • S3C6410移植linux kernel 2.6.36步骤

    千次阅读 2012-06-16 17:56:15
    S3C6410移植linux kernel 2.6.36步骤 Author: Xiaoyong Wen, wen_kernel@163.com Data: 2012-6-16   Version history Index Version Author Date Comment 1 V1.0.0
  • 最近要移植linux3.7.4系统到itop4412开发板,好长时间没有移植系统了,今天弄了一下,都感觉手生了。 首先先编译一下内核试下,然后再慢慢移植各驱动 1.下载linux内核源码 2.进入内核源码目录,修改makefile中的...
  • 如何移植Linux系统到FPGA平台

    千次阅读 2017-03-20 13:31:12
    鉴于越来越多使用者将Linux移植到晶心平台(Andes Embedded)上(AndesCore N12或N10),本文的目的在协助使用者快速、有效率的将Linux 移植到自建的FPGA板子上(CPU是AndesCore 的 N12或N10)。笔者曾协助多家公司工程 ...
  • 是不是cpu主频够高,带MMU,都可以移植linux/wince 比如arm9/arm11 , 为什么stm32只能移植μCos 类似操作系统
  • 如何在16位单片机上移植linux

    千次阅读 2012-04-05 20:31:15
    一直以来,linux被认为是个32位的“现代化”操作系统,一般也没有人在8位、16位单片机上面去移植linux。但是,从原理上来讲,从任意位数的单片机,都是可以运行linux的——本质上就是个操作系统么,既然ucos可以,为...
  • STM32 移植Linux内核

    千次阅读 2019-08-22 22:36:44
    Install arm toolchain:arm-2010q1-189-arm-uclinuxeabi-i686-pc …. uncompress first and move the directory to /usr/bin ...tar jxvf arm-2010q1-189-arm-uclinuxeabi-i686-pc-linux-gnu.tar.bz2 mv arm-20...
  • S3C2440移植linux3.4.2内核之内核裁剪

    千次阅读 多人点赞 2020-05-04 23:06:24
    移植Linux3.4.2内核其他文章链接: S3C2440移植linux3.4.2内核之内核框架介绍及简单修改 S3C2440移植linux3.4.2内核之修改分区以及制作根文件系统 S3C2440移植linux3.4.2内核之支持YAFFS文件系统 S3C2440移植linux...
  • 初学者如何移植linux驱动

    千次阅读 2014-12-01 11:13:30
    刚刚接触到linux驱动开发,一定要先亲自移植几个驱动,才能及时发现问题。通过查找资料解决,可以逐步提高自己的能力。那么刚刚移植驱动需要如何下手呢? 1.搭建好框架 linux设备驱动开发,基本都是在框架基础上进行...
  • 一般移植LCD到Linux开发平台有两种选择,一种是编写自己的LCD驱动程序并嵌入到Linux内核,另一种是根据自己所使用开发平台的硬件手册直接修改内核里面相关的代码。后一种方法比前一种方法简单一些,下面就以JZ2440 ...
  • S3C2440移植linux3.4.2内核之支持YAFFS文件系统

    千次阅读 多人点赞 2020-05-04 23:05:06
    上一节S3C2440移植linux3.4.2内核之修改分区以及制作根文件系统我们构建了根文件系统,这节我们修改内核支持yaffs2文件系统 文章目录 获取yaffs2源码并给内核打补丁 编译内核make uImage 修改yaffs2源码 移植Linux...
  • 之前在Linux3.0.35内核移植过按键的信息,请点击链接查看:3.0.35内核移植 本篇文章记录在IMX6开发板移植4.1.15内核时,添加矩阵按键的设备树信息。 1、具体添加的设备树信息 下面是我们的开发板中按键与核心板的...
  • 基于Linux2.6.22.6 1、相关常识  ①VERSION = 2 PATCHLEVEL=6  主版本号,稳定版本用偶数来表示,每隔2~~3年出现一个稳定版  ②SUBLEVEL=22  次版本号,每隔1~~2个月一更新  ③EXTRAVERSION = .6  扩展...
  • 现有linux系统,由硬盘sda运行,想将其整体拷贝至硬盘sdb,并由sdb启动系统,如何做? 两种方案,第一种方案tar命令压缩拷贝;第二种方案,linux dd命令直接拷贝。 1、第一种方案,tar压缩备份恢复 tar压缩备份后,...
  • Stm32f429移植linux4.13.12

    千次阅读 2018-08-11 15:42:21
    介绍两种移植方法 第一种:AFboot + Linux4.13.12 + Stm32_mini_rootfs.cpio.bz2 第二种:u-boot-2016.03 + Linux4.13.12 + Stm32_mini_rootfs.cpio.bz2   硬件平台:stm32f429-discovery 软件平台:ubuntu-...
  • Zynq 7000系列的FPGA,已经不再是单纯的FPGA,而是强大的SoC。...这里以移植linux系统为例,说说怎么修改linux系统的根文件系统。  在成功的移植linux系统之后,会有一个根文件系统uramdisk.image.gz,它以压...
  • 今天记录一下项目中的关于LVDS显示屏的驱动程序的分析与移植。因为驱动源码厂家已经提供好,我们需要做的就是读懂驱动程序的代码,以及平台层的匹配过程,以及如何在uboot中获取lvds参数,来匹配你的具体显示屏的...
  • rt,仍需要Android的recovery吗?如何制作镜像?烧写?一点思路都没有,希望大神点拨。
  • USB摄像头驱动的移植 linux

    千次阅读 2011-11-24 21:22:58
    USB摄像头驱动的移植 一、驱动程序中的重要数据结构  Linux系统下,USB设备驱动程序完全符合通用设备驱动的准则,不同的是Linux操作系统中有一个叫做“USB CORE”的子系统,它的作用是提供支持USB设备驱动程序的...
  • 移植Linux2.6.22.2到博创2410-S(s3c2410A)(补:LCD(SHARP LQ080V3DG01)驱动移植) 前段时间移植完了Linux2.6.22.2,开发要用的基本功能都有了。【置顶】移植Linux2.6.22.2到博创2410-S(s3c2410A)(1) 【置顶】移植...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 208,133
精华内容 83,253
关键字:

移植linux

linux 订阅