ZYNQ跑系统 系列(一) 传统方式移植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 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

打开命令行执行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 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 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";
};
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49

继续在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 <[email protected]>
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:~#
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 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;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

在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 #生成执行文件
  • 1
  • 2
  • 3

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

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

猜你喜欢

转载自blog.csdn.net/wlf_go/article/details/86151860
今日推荐