xilinx qemu


root@x86:/home/ubuntu# tunctl  -t qtap -u $(whoami) 
Set 'qtap' persistent and owned by uid 0
root@x86:/home/ubuntu# ip link set dev qtap up
root@x86:/home/ubuntu# ip addr add 169.254.1.1/16 dev qtap
root@x86:/home/ubuntu/Qemu# ./arm-softmmu/qemu-system-arm -M xilinx-zynq-a9 -m 1024 -serial null -serial mon:stdio  -kern-dtb ./xilinx_zynq.dtb -smp 1 -nographic -kernel kernel/zImage  -initrd filesystem/ramdisk.img  -net tap,ifname=qtap,script=no,downscript=no   -net nic,model=cadence_gem,macaddr=0e:b0:ba:5e:ba:12 
ram size=40000000
error reading QSPI block device
error no mtd drive for nand flash
a0mpcore_priv: smp_priv_base f8f00000
error no sd drive for sdhci controller (0)
error no sd drive for sdhci controller (1)
Number of configured NICs 0x1
ram_size 40000000, board_id d32, loader_start 0
Uncompressing Linux... done, booting the kernel.
Linux version 3.0.0-01282-g90e010b-dirty (linnj@xsjlinnj40) (gcc version 4.5.2 (Sourcery CodeBench Lite 2011.07-57) ) #289 SMP PREEMPT Tue Feb 14 09:54:05 PST 2012
CPU: ARMv7 Processor [410fc090] revision 0 (ARMv7), cr=10c5387d
CPU: VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: Xilinx Zynq Platform, model: Xilinx Zynq EP107
bootconsole [earlycon0] enabled
Memory policy: ECC disabled, Data cache writealloc
PERCPU: Embedded 7 pages/cpu @c0610000 s4928 r8192 d15552 u32768
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 60928
Kernel command line: console=ttyPS0,115200 root=/dev/ram rw initrd=0x800000,8M earlyprintk ip=:::::eth0:dhcp
PID hash table entries: 1024 (order: 0, 4096 bytes)
Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
Memory: 240MB = 240MB total
Memory: 231104k/231104k available, 31040k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    DMA     : 0xffc00000 - 0xffe00000   (   2 MB)
    vmalloc : 0xd0800000 - 0xe0000000   ( 248 MB)
    lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
    pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
    modules : 0xbf000000 - 0xbfe00000   (  14 MB)
      .init : 0xc0008000 - 0xc002c000   ( 144 kB)
      .text : 0xc002c000 - 0xc03c9428   (3702 kB)
      .data : 0xc03ca000 - 0xc03f25a0   ( 162 kB)
       .bss : 0xc03f25c4 - 0xc040a3cc   (  96 kB)
Preemptible hierarchical RCU implementation.
        Verbose stalled-CPUs detection is disabled.
NR_IRQS:246
Xilinx, no compatible timer found, using default
xlnx,ps7-ttc-1.00.a #0 at 0xd0800000, irq=43
Error, no clock-frequency specified for timer
Console: colour dummy device 80x30
Calibrating delay loop... 1047.75 BogoMIPS (lpj=5238784)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
hw perfevents: enabled with ARMv7 Cortex-A9 PMU driver, 1 counters available
Brought up 1 CPUs
SMP: Total of 1 processors activated (1047.75 BogoMIPS).
devtmpfs: initialized
NET: Registered protocol family 16
L2x0 series cache controller enabled
l2x0: 8 ways, CACHE_ID 0x00000000, AUX_CTRL 0x72060000, Cache size: 524288 B
registering platform device 'pl330' id 0
registering platform device 'arm-pmu' id 0
SRAM at 0xE4000000 mapped to 0xD0880000
hw-breakpoint: debug architecture 0x0 unsupported.
bio: create slab 0> at 0
xgpiops e000a000.gpio: gpio at 0xe000a000 mapped to 0xd080a000
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource xttcpss_timer1
NET: Registered protocol family 2
IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
TCP established hash table entries: 8192 (order: 4, 65536 bytes)
TCP bind hash table entries: 8192 (order: 4, 98304 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP reno registered
UDP hash table entries: 128 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 128 (order: 0, 4096 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...
rootfs image is not initramfs (junk in compressed archive); looks like an initrd
Freeing initrd memory: 8192K
PMU: registered new PMU device of type 0
xscugtimer xscugtimer.0: ioremap f8f00200 to d080c200 with size 400
pl330 dev 0 probe success
JFFS2 version 2.2. (NAND) (SUMMARY)  ? 2001-2006 Red Hat, Inc.
msgmni has been set to 467
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
e0001000.uart: ttyPS0 at MMIO 0xe0001000 (irq = 82) is a xuartps
console [ttyPS0] enabled, bootconsole disabled
console [ttyPS0] enabled, bootconsole disabled
e0000000.uart: ttyPS1 at MMIO 0xe0000000 (irq = 59) is a xuartps
xdevcfg f8007000.devcfg: ioremap f8007000 to d0864000 with size 1000
brd: module loaded
loop: module loaded
e2000000.nor: Found 1 x8 devices at 0x0 in 8-bit bank. Manufacturer ID 0x000066 Chip ID 0x000022
NOR chip too large to fit in mapping. Attempting to cope...
Amd/Fujitsu Extended Query Table at 0x0031
  Amd/Fujitsu Extended Query version 1.0.
e2000000.nor: CFI contains unrecognised boot bank location (0). Assuming bottom.
number of CFI chips: 1
Reducing visibility of 65536KiB chip to 32768KiB
Creating 7 MTD partitions on "e2000000.nor":
0x000000000000-0x000000080000 : "nor-fsbl"
0x000000080000-0x000000100000 : "nor-u-boot"
0x000000100000-0x000000600000 : "nor-linux"
0x000000600000-0x000000620000 : "nor-device-tree"
0x000000620000-0x000000f00000 : "nor-user"
0x000000f00000-0x000001000000 : "nor-scratch"
0x000001000000-0x000002000000 : "nor-rootfs"
NAND device: Manufacturer ID: 0x20, Chip ID: 0xaa (ST Micro NAND 256MiB 1,8V 8-bit)
Bad block table not found for chip 0
Bad block table not found for chip 0
Scanning device for bad blocks
Xilinx_PSS_NAND e1000000.nand: found 8 partitions in device tree
Creating 8 MTD partitions on "xilinx_nand":
0x000000000000-0x000000100000 : "nand-fsbl"
0x000000100000-0x000000200000 : "nand-u-boot"
0x000000200000-0x000000700000 : "nand-linux"
0x000000700000-0x000000720000 : "nand-device-tree"
0x000000720000-0x000000800000 : "nand-user"
0x000000800000-0x000000900000 : "nand-scratch"
0x000000900000-0x000008900000 : "nand-rootfs"
0x000008900000-0x000010000000 : "nand-bitstreams"
Xilinx_PSS_NAND e1000000.nand: at 0xE000E000 mapped to 0xD4000000
GEM: BASEADDRESS hw: e000b000 virt: d0868000
XEMACPS mii bus: probed
GEM: MAC addr 00:00:00:00:00:00
xemacps e000b000.eth: invalid address, use assigned
MAC updated 3a:51:de:ef:9c:29
eth0, pdev->id -1, baseaddr 0xe000b000, irq 54
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
xusbps-ehci xusbps-ehci.0: Xilinx PS USB EHCI Host Controller
xusbps-ehci xusbps-ehci.0: new USB bus registered, assigned bus number 1
xusbps-ehci xusbps-ehci.0: irq 76, io mem 0x00000000
xusbps-ehci xusbps-ehci.0: USB 2.0 started, EHCI 0.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 0 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
Xilinx PS USB Device Controller driver (Apr 01, 2011)
mousedev: PS/2 mouse device common for all mice
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
mmc0: SDHCI controller on e0100000.sdhci [e0100000.sdhci] using ADMA
mmc1: SDHCI controller on e0101000.sdhci [e0101000.sdhci] using ADMA
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP cubic registered
NET: Registered protocol family 17
VFP support v0.3: implementor 41 architecture 3 part 40 variant 0 rev 0
Registering SWP/SWPB emulation handler
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
GEM: lp->tx_bd ffdfb000 lp->tx_bd_dma 0ddda000 lp->tx_skb cdd4ed80
GEM: lp->rx_bd ffdfc000 lp->rx_bd_dma 0ddd9000 lp->rx_skb cdd4ec80
GEM: MAC 0xefde513a, 0x0000299c, 3a:51:de:ef:9c:29
GEM: phydev cde19400, phydev->phy_id 0x1410cc2, phydev->addr 0x17
eth0, phy_addr 0x17, phy_id 0x01410cc2
eth0, attach [Marvell 88E1111] phy driver
GEM: mc addr 0x1:0x0:0x5e:0x0:0x0:0x1
Sending DHCP requests ...... timed out!
GEM: mc addr 0x1:0x0:0x5e:0x0:0x0:0x1
IP-Config: Reopening network devices...
GEM: lp->tx_bd ffdfb000 lp->tx_bd_dma 0ddd9000 lp->tx_skb cdd4ec80
GEM: lp->rx_bd ffdfc000 lp->rx_bd_dma 0ddda000 lp->rx_skb cdd4ed80
GEM: MAC 0xefde513a, 0x0000299c, 3a:51:de:ef:9c:29
GEM: phydev cde19400, phydev->phy_id 0x1410cc2, phydev->addr 0x17
eth0, phy_addr 0x17, phy_id 0x01410cc2
eth0, attach [Marvell 88E1111] phy driver          ------------phy
GEM: mc addr 0x1:0x0:0x5e:0x0:0x0:0x1
Sending DHCP requests ...... timed out!
GEM: mc addr 0x1:0x0:0x5e:0x0:0x0:0x1
IP-Config: Auto-configuration of network failed.
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 8192KiB [1 disk] into ram disk... done.
VFS: Mounted root (ext2 filesystem) on device 1:0.
devtmpfs: mounted
Starting rcS...
++ Mounting filesystem
++ Setting up mdev
++ Starting telnet daemon
++ Starting http daemon
++ Starting ftp daemon
++ Starting dropbear (ssh) daemon
rcS Complete
zynq> ip a
1: lo:  mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0:  mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether 3a:51:de:ef:9c:29 brd ff:ff:ff:ff:ff:ff
zynq> ip addr add 169.254.1.2/16  dev eth0
zynq> ping 169.254.1.1
PING 169.254.1.1 (169.254.1.1): 56 data bytes
ping: sendto: Network is unreachable
zynq> route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
zynq> ip a
1: lo:  mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0:  mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether 3a:51:de:ef:9c:29 brd ff:ff:ff:ff:ff:ff
    inet 169.254.1.2/16 scope global eth0
zynq> ip link set eth0 up
GEM: lp->tx_bd ffdfb000 lp->tx_bd_dma 0de80000 lp->tx_skb cdd4e980
GEM: lp->rx_bd ffdfc000 lp->rx_bd_dma 0de5a000 lp->rx_skb cdd4ea80
GEM: MAC 0xefde513a, 0x0000299c, 3a:51:de:ef:9c:29
GEM: phydev cde19400, phydev->phy_id 0x1410cc2, phydev->addr 0x17
eth0, phy_addr 0x17, phy_id 0x01410cc2
eth0, attach [Marvell 88E1111] phy driver
GEM: mc addr 0x1:0x0:0x5e:0x0:0x0:0x1
zynq> ip a
1: lo:  mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
2: eth0:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 3a:51:de:ef:9c:29 brd ff:ff:ff:ff:ff:ff
    inet 169.254.1.2/16 scope global eth0
zynq> ping 169.254.1.1
PING 169.254.1.1 (169.254.1.1): 56 data bytes
64 bytes from 169.254.1.1: seq=0 ttl=64 time=11.476 ms
64 bytes from 169.254.1.1: seq=1 ttl=64 time=0.820 ms
64 bytes from 169.254.1.1: seq=2 ttl=64 time=0.000 ms
64 bytes from 169.254.1.1: seq=3 ttl=64 time=0.000 ms
64 bytes from 169.254.1.1: seq=4 ttl=64 time=0.000 ms
64 bytes from 169.254.1.1: seq=5 ttl=64 time=0.000 ms
64 bytes from 169.254.1.1: seq=6 ttl=64 time=0.000 ms
^C
--- 169.254.1.1 ping statistics ---
7 packets transmitted, 7 packets received, 0% packet loss
round-trip min/avg/max = 0.000/1.756/11.476 ms
zynq> 

 

qemu-system-arm -M xilinx-zynq-a9 -serial /dev/null -serial mon:stdio -display none -kernel Prebuilt_functional/uImage -dtb Prebuilt_functional/my_devicetree.dtb --initrd Prebuilt_functional/umy_ramdisk.image.gz  -net tap,ifname=qtap,script=no,downscript=no   -net nic,model=cadence_gem,macaddr=0e:b0:ba:5e:ba:12
qemu-system-arm: warning: nic cadence_gem.1 has no peer

PetaLinux 2016.4 zedboard-zynq7 /dev/ttyPS0

zedboard-zynq7 login: root
root@zedboard-zynq7:~# ip a
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: tunl0@NONE:  mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/ipip 0.0.0.0 brd 0.0.0.0
root@zedboard-zynq7:~# ip a sh qtap
Device "qtap" does not exist.
root@zedboard-zynq7:~# ip a sh qtap
Device "qtap" does not exist.
root@zedboard-zynq7:~# ethool -i tunlo
-sh: ethool: command not found
root@zedboard-zynq7:~# ethtool -h
-sh: ethtool: command not found
root@zedboard-zynq7:~# uname -a
Linux zedboard-zynq7 5.4.0-axiom+ #5 SMP PREEMPT Wed Jul 1 14:42:53 CEST 2020 armv7l GNU/Linux
root@zedboard-zynq7:~# gcc verion
-sh: gcc: command not found
root@zedboard-zynq7:~# ls
root@zedboard-zynq7:~# ls /usr/bin/
[                    cmp                  free                 lastb.sysvinit       nslookup             sha1sum              top                  wall
[[                   cut                  ftpget               less                 od                   sha256sum            tr                   wall.sysvinit
awk                  dbclient             ftpput               logger               openvt               sha512sum            traceroute           wc
basename             dc                   fuser                logname              passwd               shuf                 tty                  wget
bashbug              deallocvt            groups               lspci                patch                sort                 uniq                 which
bunzip2              diff                 hd                   lsusb                printf               ssh                  unlink               who
bzcat                dirname              head                 md5sum               readlink             strings              unzip                whoami
candump              du                   hexdump              mesg                 realpath             tail                 update-alternatives  xargs
canecho              dumpleases           id                   mesg.sysvinit        renice               tee                  uptime               yes
cansend              env                  killall              microcom             reset                telnet               users
cansequence          expr                 last                 mkfifo               resize               test                 utmpdump
chvt                 find                 last.sysvinit        nc                   scp                  tftp                 utmpdump.sysvinit
clear                flock                lastb                nohup                seq                  time                 vlock
root@zedboard-zynq7:~# ls /lib/
ld-2.21.so               libc-2.21.so             libm-2.21.so             libnss_dns-2.21.so       libresolv-2.21.so        libutil-2.21.so          modules
ld-linux-armhf.so.3      libc.so.6                libm.so.6                libnss_dns.so.2          libresolv.so.2           libutil.so.1
libBrokenLocale-2.21.so  libcrypt-2.21.so         libnsl-2.21.so           libnss_files-2.21.so     librt-2.21.so            libuuid.so.1
libBrokenLocale.so.1     libcrypt.so.1            libnsl.so.1              libnss_files.so.2        librt.so.1               libuuid.so.1.3.0
libanl-2.21.so           libdl-2.21.so            libnss_compat-2.21.so    libpthread-2.21.so       libtinfo.so.5            libz.so.1
libanl.so.1              libdl.so.2               libnss_compat.so.2       libpthread.so.0          libtinfo.so.5.9          libz.so.1.2.8
root@zedboard-zynq7:~# find / -name ethtool
root@zedboard-zynq7:~# 

 

编译

apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi

ethtool

root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu/ethtool-4.17# ./configure  --host=arm-linux CC=arm-linux-gnueabi-gcc  LDFLAGS=-static                       
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for arm-linux-strip... no
checking for strip... strip
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for arm-linux-gcc... arm-linux-gnueabihf-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether arm-linux-gnueabihf-gcc accepts -g... yes
checking for arm-linux-gnueabihf-gcc option to accept ISO C89... none needed
checking whether arm-linux-gnueabihf-gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of arm-linux-gnueabihf-gcc... gcc3
checking how to run the C preprocessor... arm-linux-gnueabihf-gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking whether arm-linux-gnueabihf-gcc needs -traditional... no
checking whether  defines big-endian types... yes
checking for ANSI C header files... yes
checking for socket... yes
checking for strtol... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating ethtool.spec
config.status: creating ethtool.8
config.status: creating ethtool-config.h
config.status: executing depfiles commands
root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu/ethtool-4.17# make -j20
make  all-am
make[1]: Entering directory '/home/ubuntu/ethtool-4.17'
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT ethtool.o -MD -MP -MF .deps/ethtool.Tpo -c -o ethtool.o ethtool.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT rxclass.o -MD -MP -MF .deps/rxclass.Tpo -c -o rxclass.o rxclass.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT amd8111e.o -MD -MP -MF .deps/amd8111e.Tpo -c -o amd8111e.o amd8111e.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT de2104x.o -MD -MP -MF .deps/de2104x.Tpo -c -o de2104x.o de2104x.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT e100.o -MD -MP -MF .deps/e100.Tpo -c -o e100.o e100.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT e1000.o -MD -MP -MF .deps/e1000.Tpo -c -o e1000.o e1000.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT et131x.o -MD -MP -MF .deps/et131x.Tpo -c -o et131x.o et131x.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT igb.o -MD -MP -MF .deps/igb.Tpo -c -o igb.o igb.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT fec_8xx.o -MD -MP -MF .deps/fec_8xx.Tpo -c -o fec_8xx.o fec_8xx.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT ibm_emac.o -MD -MP -MF .deps/ibm_emac.Tpo -c -o ibm_emac.o ibm_emac.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT ixgb.o -MD -MP -MF .deps/ixgb.Tpo -c -o ixgb.o ixgb.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT ixgbe.o -MD -MP -MF .deps/ixgbe.Tpo -c -o ixgbe.o ixgbe.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT natsemi.o -MD -MP -MF .deps/natsemi.Tpo -c -o natsemi.o natsemi.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT pcnet32.o -MD -MP -MF .deps/pcnet32.Tpo -c -o pcnet32.o pcnet32.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT realtek.o -MD -MP -MF .deps/realtek.Tpo -c -o realtek.o realtek.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT tg3.o -MD -MP -MF .deps/tg3.Tpo -c -o tg3.o tg3.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT marvell.o -MD -MP -MF .deps/marvell.Tpo -c -o marvell.o marvell.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT vioc.o -MD -MP -MF .deps/vioc.Tpo -c -o vioc.o vioc.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT smsc911x.o -MD -MP -MF .deps/smsc911x.Tpo -c -o smsc911x.o smsc911x.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT at76c50x-usb.o -MD -MP -MF .deps/at76c50x-usb.Tpo -c -o at76c50x-usb.o at76c50x-usb.c
mv -f .deps/at76c50x-usb.Tpo .deps/at76c50x-usb.Po
mv -f .deps/vioc.Tpo .deps/vioc.Po
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT sfc.o -MD -MP -MF .deps/sfc.Tpo -c -o sfc.o sfc.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT stmmac.o -MD -MP -MF .deps/stmmac.Tpo -c -o stmmac.o stmmac.c
mv -f .deps/fec_8xx.Tpo .deps/fec_8xx.Po
mv -f .deps/tg3.Tpo .deps/tg3.Po
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT sff-common.o -MD -MP -MF .deps/sff-common.Tpo -c -o sff-common.o sff-common.c
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT sfpid.o -MD -MP -MF .deps/sfpid.Tpo -c -o sfpid.o sfpid.c
mv -f .deps/ixgb.Tpo .deps/ixgb.Po
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT sfpdiag.o -MD -MP -MF .deps/sfpdiag.Tpo -c -o sfpdiag.o sfpdiag.c
mv -f .deps/amd8111e.Tpo .deps/amd8111e.Po
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT ixgbevf.o -MD -MP -MF .deps/ixgbevf.Tpo -c -o ixgbevf.o ixgbevf.c
mv -f .deps/e100.Tpo .deps/e100.Po
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT tse.o -MD -MP -MF .deps/tse.Tpo -c -o tse.o tse.c
mv -f .deps/smsc911x.Tpo .deps/smsc911x.Po
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT vmxnet3.o -MD -MP -MF .deps/vmxnet3.Tpo -c -o vmxnet3.o vmxnet3.c
mv -f .deps/ibm_emac.Tpo .deps/ibm_emac.Po
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT qsfp.o -MD -MP -MF .deps/qsfp.Tpo -c -o qsfp.o qsfp.c
mv -f .deps/et131x.Tpo .deps/et131x.Po
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT fjes.o -MD -MP -MF .deps/fjes.Tpo -c -o fjes.o fjes.c
mv -f .deps/stmmac.Tpo .deps/stmmac.Po
arm-linux-gnueabihf-gcc -DHAVE_CONFIG_H -I.    -Wall -g -O2 -MT lan78xx.o -MD -MP -MF .deps/lan78xx.Tpo -c -o lan78xx.o lan78xx.c
mv -f .deps/e1000.Tpo .deps/e1000.Po
mv -f .deps/realtek.Tpo .deps/realtek.Po
mv -f .deps/ixgbevf.Tpo .deps/ixgbevf.Po
mv -f .deps/pcnet32.Tpo .deps/pcnet32.Po
mv -f .deps/fjes.Tpo .deps/fjes.Po
mv -f .deps/marvell.Tpo .deps/marvell.Po
mv -f .deps/tse.Tpo .deps/tse.Po
mv -f .deps/sfpdiag.Tpo .deps/sfpdiag.Po
mv -f .deps/sff-common.Tpo .deps/sff-common.Po
mv -f .deps/lan78xx.Tpo .deps/lan78xx.Po
mv -f .deps/sfc.Tpo .deps/sfc.Po
mv -f .deps/vmxnet3.Tpo .deps/vmxnet3.Po
mv -f .deps/sfpid.Tpo .deps/sfpid.Po
mv -f .deps/igb.Tpo .deps/igb.Po
mv -f .deps/de2104x.Tpo .deps/de2104x.Po
mv -f .deps/qsfp.Tpo .deps/qsfp.Po
mv -f .deps/rxclass.Tpo .deps/rxclass.Po
mv -f .deps/natsemi.Tpo .deps/natsemi.Po
mv -f .deps/ixgbe.Tpo .deps/ixgbe.Po
mv -f .deps/ethtool.Tpo .deps/ethtool.Po
arm-linux-gnueabihf-gcc -Wall -g -O2  -static -o ethtool ethtool.o rxclass.o amd8111e.o de2104x.o e100.o e1000.o et131x.o igb.o fec_8xx.o ibm_emac.o ixgb.o ixgbe.o natsemi.o pcnet32.o realtek.o tg3.o marvell.o vioc.o smsc911x.o at76c50x-usb.o sfc.o stmmac.o sff-common.o sfpid.o sfpdiag.o ixgbevf.o tse.o vmxnet3.o qsfp.o fjes.o lan78xx.o -lm 
make[1]: Leaving directory '/home/ubuntu/ethtool-4.17'
root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu/ethtool-4.17# 
root@x86:/home/ubuntu/QEMU_CPUFreq_Zynq/Prebuilt_functional# mkimage -A arm -T ramdisk -C gzip -d ramdisk.gz ramdisk.img.gz 
Image Name:   
Created:      Tue Mar 29 17:48:29 2022
Image Type:   ARM Linux RAMDisk Image (gzip compressed)
Data Size:    8727782 Bytes = 8523.22 KiB = 8.32 MiB
Load Address: 00000000
Entry Point:  00000000
root@x86:/home/ubuntu/QEMU_CPUFreq_Zynq/Prebuilt_functional# cd ..
root@x86:/home/ubuntu/QEMU_CPUFreq_Zynq# qemu-system-arm -M xilinx-zynq-a9 -serial /dev/null -serial mon:stdio -display none -kernel Prebuilt_functional/uImage -dtb Prebuilt_functional/my_devicetree.dtb --initrd Prebuilt_functional/ramdisk.img.gz  -net tap,ifname=qtap,script=no,downscript=no   -net nic,model=cadence_gem,macaddr=0e:b0:ba:5e:ba:12  
qemu-system-arm: warning: nic cadence_gem.1 has no peer

PetaLinux 2016.4 zedboard-zynq7 /dev/ttyPS0

zedboard-zynq7 login: root
root@zedboard-zynq7:~# ethtool -h
ethtool version 4.17
Usage:
        ethtool DEVNAME Display standard information about device
        ethtool -s|--change DEVNAME     Change generic options
                [ speed %d ]
                [ duplex half|full ]
                [ port tp|aui|bnc|mii|fibre ]
                [ mdix auto|on|off ]
                [ autoneg on|off ]
                [ advertise %x ]
                [ phyad %d ]
                [ xcvr internal|external ]
                [ wol p|u|m|b|a|g|s|d... ]
                [ sopass %x:%x:%x:%x:%x:%x ]
VIVADO_VERSION             ?= 2019.2
CROSS_COMPILE              ?= arm-linux-gnueabihf-
DEVICE_TREE_INCLUDE ?= zynq-7000

TOOLCHAIN = $(shell which $(CROSS_COMPILE)gcc)
TOOLCHAIN2= $(shell dirname $(TOOLCHAIN))
TOOLCHAIN_PATH = $(shell dirname $(TOOLCHAIN2))
NCORES = $(shell grep -c ^processor /proc/cpuinfo)
VIVADO_SETTINGS ?= /opt/Xilinx/Vivado/$(VIVADO_VERSION)/settings64.sh
VSUBDIRS = buildroot linux u-boot-xlnx

build:
    mkdir -p $@

build/hwdef:
    mkdir -p $@

build/device-tree:
    mkdir -p $@

%: build/%d
    cp $< $@

### u-boot ###

u-boot-xlnx/u-boot u-boot-xlnx/tools/mkimage:
    make -j$(NCORES) -C u-boot-xlnx ARCH=arm zynq_coraz7_defconfig
    make -j$(NCORES) -C u-boot-xlnx ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE)

.PHONY: u-boot-xlnx/u-boot

build/u-boot.elf: u-boot-xlnx/u-boot | build
    cp $< $@

### linux ###

linux-xlnx/arch/arm/boot/zImage:
    make -C linux-xlnx ARCH=arm xilinx_zynq_defconfig
    make -C linux-xlnx -j $(NCORES) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage UIMAGE_LOADADDR=0x8000

.PHONY: linux-xlnx/arch/arm/boot/zImage

build/zImage: linux-xlnx/arch/arm/boot/zImage | build
    cp $< $@

# linux/arch/arm/boot/zImage:
#     make -C linux ARCH=arm multi_v7_defconfig
#     make -C linux -j $(NCORES) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) zImage UIMAGE_LOADADDR=0x8000
#
# .PHONY: linux/arch/arm/boot/zImage
#
# build/zImage: linux/arch/arm/boot/zImage | build
#     cp $< $@

### device tree ###

build/zynq.dtb: build/device-tree
    #bash -c "cd hdl && xsct get_device_tree.tcl"
    cpp -nostdinc -I include -I arch -undef -x assembler-with-cpp hdl/system-top.dts hdl/system-top.dts.preprocessed
    #cpp -nostdinc -I include -I arch -undef -x assembler-with-cpp u-boot-xlnx/arch/arm/dts/zynq-coraz7.dts hdl/system-top.dts.preprocessed
    dtc -O dtb -o $@ hdl/system-top.dts.preprocessed

### buildroot ###

buildroot/output/images/rootfs.cpio.gz:
    make -C buildroot ARCH=arm zynq_defconfig
    make -C buildroot TOOLCHAIN_EXTERNAL_INSTALL_DIR=$(TOOLCHAIN_PATH) ARCH=arm CROSS_COMPILE=$(CROSS_COMPILE) all

.PHONY: buildroot/output/images/rootfs.cpio.gz

build/rootfs.cpio.gz: buildroot/output/images/rootfs.cpio.gz | build
    cp $< $@

### Hardware Defintions ###

build/hwdef/system_top.xsa: build/hwdef
    bash -c "source ${VIVADO_SETTINGS} && cd hdl && vivado -mode batch -source build_hdl_project.tcl -notrace -nolog -nojournal && cd .."
    cp hdl/design_1_wrapper.xsa $@

build/system_top.bit: build/hwdef/system_top.xsa | build/hwdef
    cp hdl/design_1_wrapper.bit $@

build/fsbl.elf: build/hwdef/system_top.xsa | build/hwdef
    bash -c "source $(VIVADO_SETTINGS) && cd hdl && xsct build_fsbl.tcl"
    cp hdl/fsbl.elf $@

build/image.ub: u-boot-xlnx/tools/mkimage build/zImage build/rootfs.cpio.gz build/system_top.bit build/zynq.dtb
    u-boot-xlnx/tools/mkimage -f scripts/zynq.its $@

build/boot.bin: build/fsbl.elf build/system_top.bit build/u-boot.elf
    echo img:{[bootloader] $^} > build/boot.bif
    bash -c "source $(VIVADO_SETTINGS) && bootgen -image build/boot.bif -w -o $@"

### Utilities ###
build/uImage: build/zImage u-boot-xlnx/tools/mkimage
    u-boot-xlnx/tools/mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n "Linux Kernel" -d build/zImage $@

build/uramdisk.image.gz: build/rootfs.cpio.gz u-boot-xlnx/tools/mkimage
    u-boot-xlnx/tools/mkimage -A arm -T ramdisk -C gzip -d build/rootfs.cpio.gz $@

build/devicetree.dtb: build/zynq.dtb
    cp $< $@

编译内核

root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu# cp  QEMU_CPUFreq_Zynq/my_device_defconfig linux-xlnx/arch/arm/configs
root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu# ls  linux-xlnx/arch/arm/configs
am200epdkit_defconfig     corgi_defconfig         hisi_defconfig        mainstone_defconfig      netwinder_defconfig   realview_defconfig   stm32_defconfig
aspeed_g4_defconfig       davinci_all_defconfig   imote2_defconfig      milbeaut_m10v_defconfig  nhk8815_defconfig     rpc_defconfig        sunxi_defconfig
aspeed_g5_defconfig       dove_defconfig          imx_v4_v5_defconfig   mini2440_defconfig       omap1_defconfig       s3c2410_defconfig    tct_hammer_defconfig
assabet_defconfig         dram_0x00000000.config  imx_v6_v7_defconfig   mmp2_defconfig           omap2plus_defconfig   s3c6400_defconfig    tegra_defconfig
at91_dt_defconfig         dram_0xc0000000.config  integrator_defconfig  moxart_defconfig         orion5x_defconfig     s5pv210_defconfig    trizeps4_defconfig
axm55xx_defconfig         dram_0xd0000000.config  iop32x_defconfig      mps2_defconfig           oxnas_v6_defconfig    sama5_defconfig      u8500_defconfig
badge4_defconfig          ep93xx_defconfig        ixp4xx_defconfig      multi_v4t_defconfig      palmz72_defconfig     sama7_defconfig      versatile_defconfig
bcm2835_defconfig         eseries_pxa_defconfig   jornada720_defconfig  multi_v5_defconfig       pcm027_defconfig      shannon_defconfig    vexpress_defconfig
cerfcube_defconfig        exynos_defconfig        keystone_defconfig    multi_v7_defconfig       pleb_defconfig        shmobile_defconfig   vf610m4_defconfig
clps711x_defconfig        ezx_defconfig           lart_defconfig        mv78xx0_defconfig        pxa168_defconfig      simpad_defconfig     viper_defconfig
cm_x300_defconfig         footbridge_defconfig    lpc18xx_defconfig     mvebu_v5_defconfig       pxa255-idp_defconfig  socfpga_defconfig    vt8500_v6_v7_defconfig
cns3420vb_defconfig       gemini_defconfig        lpc32xx_defconfig     mvebu_v7_defconfig       pxa3xx_defconfig      spear13xx_defconfig  xcep_defconfig
colibri_pxa270_defconfig  h3600_defconfig         lpd270_defconfig      mxs_defconfig            pxa910_defconfig      spear3xx_defconfig   xilinx_zynq_defconfig
colibri_pxa300_defconfig  h5000_defconfig         lubbock_defconfig     my_device_defconfig      pxa_defconfig         spear6xx_defconfig   zeus_defconfig
collie_defconfig          hackkit_defconfig       magician_defconfig    neponset_defconfig       qcom_defconfig        spitz_defconfig
root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu# ls  linux-xlnx/arch/arm/configs/my_device_defconfig 
linux-xlnx/arch/arm/configs/my_device_defconfig
root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu# cd linux-xlnx
root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu/linux-xlnx# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- my_device_defconfig                                  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  LEX     scripts/kconfig/lexer.lex.c
  YACC    scripts/kconfig/parser.tab.[ch]
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  HOSTLD  scripts/kconfig/conf
arch/arm/configs/my_device_defconfig:5303:warning: symbol value '1' invalid for KASAN_STACK
#
# configuration written to .config
#
 CC      arch/arm/boot/compressed/misc.o
  CC      arch/arm/boot/compressed/decompress.o
  CC      arch/arm/boot/compressed/string.o
  SHIPPED arch/arm/boot/compressed/hyp-stub.S
  CC      arch/arm/boot/compressed/fdt_rw.o
  CC      arch/arm/boot/compressed/fdt_ro.o
  CC      arch/arm/boot/compressed/fdt_wip.o
  CC      arch/arm/boot/compressed/fdt.o
  CC      arch/arm/boot/compressed/fdt_check_mem_start.o
  SHIPPED arch/arm/boot/compressed/lib1funcs.S
  SHIPPED arch/arm/boot/compressed/ashldi3.S
  SHIPPED arch/arm/boot/compressed/bswapsdi2.S
  AS      arch/arm/boot/compressed/hyp-stub.o
  AS      arch/arm/boot/compressed/lib1funcs.o
  AS      arch/arm/boot/compressed/ashldi3.o
  AS      arch/arm/boot/compressed/bswapsdi2.o
  AS      arch/arm/boot/compressed/piggy.o
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
  UIMAGE  arch/arm/boot/uImage
Image Name:   Linux-5.15.0-axiom
Created:      Tue Mar 29 17:58:45 2022
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    3608880 Bytes = 3524.30 KiB = 3.44 MiB
Load Address: 00008000
Entry Point:  00008000
  Kernel: arch/arm/boot/uImage is ready
root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu/linux-xlnx# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- my_device_defconfig UIMAGE_LOADADDR=0x8000 uImage -j20
 qemu-system-arm -M xilinx-zynq-a9 -serial /dev/null -serial mon:stdio -display none -kernel my.uImage -dtb Prebuilt_functional/my_devicetree.dtb --initrd Prebuilt_functional/ramdisk.img.gz  -net tap,ifname=qtap,script=no,downscript=no   -net nic,model=cadence_gem,macaddr=0e:b0:ba:5e:ba:12 

Public key portion is:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCulUj4Vfrydu84CO6zdoALGO5RnX5oMU/Wzu8uosrpA+gpT6WXK+5O12gJoaJrKgcLqMcHn7krDC18gEsPU/8QqRkABjdg3UFTZQrhMiV8mhFt+RRRKt0uvjevP2iPcyjEnwTWFrjfooZjHdyRXlYeXQBKAbK2ePEGPWUgSP1HCeLdaLVxk3/Zw/oTfyFY9Ni5kUGspVyDGV27MbJ4CUHrufItcHaWNqeU8o/MREAbl9hGKKExTSn3qyaWJB0NRw9Fa5iUiG5HgrVaBFiZyQWSjyBrAJMg1KM0DhwjKtZwyG8TzRBPkIxYwOTFgy0UZIvG07/5kKx+PaAoRYtiH5S3 root@zedboard-zynq7
Fingerprint: md5 a0:b6:01:44:58:05:5d:ad:b6:6e:f1:72:96:c6:90:0a
dropbear.
Starting syslogd/klogd: done
Starting tcf-agent: [    6.461027] urandom_read: 2 callbacks suppressed
[    6.461991] random: tcf-agent: uninitialized urandom read (16 bytes read)
OK

PetaLinux 2016.4 zedboard-zynq7 /dev/ttyPS0

zedboard-zynq7 login: root
root@zedboard-zynq7:~# ip a
[   11.163737] random: fast init done
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: tunl0@NONE:  mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/ipip 0.0.0.0 brd 0.0.0.0
root@zedboard-zynq7:~# 

 添加网络模块

 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig

 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig

tap

phy

 phy

zedboard-zynq7 login: root
root@zedboard-zynq7:~# ip a
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0:  mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 0e:b0:ba:5e:ba:12 brd ff:ff:ff:ff:ff:ff
3: tunl0@NONE:  mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/ipip 0.0.0.0 brd 0.0.0.0
root@zedboard-zynq7:~# ip[   11.637328] random: fast init done

Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
       ip [ -force ] -batch filename
where  OBJECT := { link | address | addrlabel | route | rule | neighbor | ntable |
                   tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |
                   netns | l2tp | fou | tcp_metrics | token | netconf }
       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
                    -h[uman-readable] | -iec |
                    -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } |
                    -4 | -6 | -I | -D | -B | -0 |
                    -l[oops] { maximum-addr-flush-attempts } | -br[ief] |
                    -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |
                    -rc[vbuf] [size] | -n[etns] name | -a[ll] | -c[olor]}
root@zedboard-zynq7:~# ip a add  169.254.1.2/16 dev eth0
root@zedboard-zynq7:~# ping 169.254.1.1
PING 169.254.1.1 (169.254.1.1): 56 data bytes
64 bytes from 169.254.1.1: seq=0 ttl=64 time=8.194 ms
64 bytes from 169.254.1.1: seq=1 ttl=64 time=3.819 ms
64 bytes from 169.254.1.1: seq=2 ttl=64 time=1.699 ms
^C
--- 169.254.1.1 ping statistics ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 1.699/4.570/8.194 ms
root@zedboard-zynq7:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 eth0
root@zedboard-zynq7:~# ip 
Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
       ip [ -force ] -batch filename
where  OBJECT := { link | address | addrlabel | route | rule | neighbor | ntable |
                   tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |
                   netns | l2tp | fou | tcp_metrics | token | netconf }
       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
                    -h[uman-readable] | -iec |
                    -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } |
                    -4 | -6 | -I | -D | -B | -0 |
                    -l[oops] { maximum-addr-flush-attempts } | -br[ief] |
                    -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |
                    -rc[vbuf] [size] | -n[etns] name | -a[ll] | -c[olor]}
root@zedboard-zynq7:~# ip  a
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
2: eth0:  mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 0e:b0:ba:5e:ba:12 brd ff:ff:ff:ff:ff:ff
    inet 169.254.1.2/16 scope global eth0
       valid_lft forever preferred_lft forever
3: tunl0@NONE:  mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/ipip 0.0.0.0 brd 0.0.0.0
root@zedboard-zynq7:~# 
root@zedboard-zynq7:~# ethtool -i eth0
driver: macb
version: 5.15.0-axiom
firmware-version: 
expansion-rom-version: 
bus-info: e000b000.ethernet
supports-statistics: yes
supports-test: no
supports-eeprom-access: no
supports-register-dump: yes
supports-priv-flags: no
root@zedboard-zynq7:~# 

更改设备树。添加phy类型(可以不需要)

Tue Dec 13 06:02:38 UTC 2016
Starting internet superserver: inetd.
INIT: Entering runlevel: 5
Configuring network interfaces... [    5.830667] macb e000b000.ethernet eth0: PHY [e000b000.ethernet-ffffffff:00] driver [Marvell 88E1111] (irq=POLL)
[    5.834982] macb e000b000.ethernet eth0: configuring for phy/rgmii-id link mode
[    5.836602] Marvell 88E1111 e000b000.ethernet-ffffffff:00: Downshift occurred from negotiated speed 1Gbps to actual speed 100Mbps, check cabling!
[    5.837270] macb e000b000.ethernet eth0: unable to generate target frequency: 25000000 Hz
[    5.853327] macb e000b000.ethernet eth0: Link is Up - 100Mbps/Full - flow control tx
udhcpc (v1.24.1) started
udhcpc: socket: Address family not supported by protocol
Starting Dropbear SSH server: [    6.044237] random: dropbearkey: uninitialized urandom read (32 bytes read)
Generating key, this may take a while...
[    6.049811] random: dropbearkey: uninitialized urandom read (32 bytes read)
[    6.293022] random: dropbearkey: uninitialized urandom read (32 bytes read)
Public key portion is:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCsq33O7LEvVXySw2GUATdq+1IHu1jMvzLhbsvMkpj+/wdWVXm2p4cm+oxgXmJp6sLKrWxYc1LxSLqKbJ8vewIFULu/tETJ2yVy0lj2ovNEmC/UVOd5ZYxcYftWAwv3IF1LvI/HqJ3FN31zCWnxqD2tb5O57j84FXnkE9ad+vnL23VTLOZXYF80LoFVjfJRJe8I2Hj/pOnyEHA4gD/8MupR9WrJBlv17UPOarjhr8hJDU6vPvw4w3Cc1kBrU8ATjme5Xl6/66OyLLoFlVshOKDilb4GMvKQODiGi29DkU736Pn8lsY4s8ItQGZjYT23zGQR1uaeLKx4zBpoiHUMij5F root@zedboard-zynq7
Fingerprint: md5 74:d6:cd:c2:80:df:16:e0:02:bb:6c:f0:2b:27:4d:76
[    6.346056] random: dropbear: uninitialized urandom read (32 bytes read)
dropbear.
Starting syslogd/klogd: done
Starting tcf-agent: [    6.596408] random: tcf-agent: uninitialized urandom read (16 bytes read)
OK

PetaLinux 2016.4 zedboard-zynq7 /dev/ttyPS0

zedboard-zynq7 login: [   11.599136] random: fast init done
ethernet@e000b000 {
                        compatible = "cdns,zynq-gem", "cdns,gem";
                        reg = <0xe000b000 0x1000>;
                        status = "okay";
                        interrupts = <0x0 0x16 0x4>;
                        clocks = <0x1 0x1e 0x1 0x1e 0x1 0xd>;
                        clock-names = "pclk", "hclk", "tx_clk";
                        #address-cells = <0x1>;
                        #size-cells = <0x0>;
                        interrupt-parent = <0x4>;
                        phy-mode = "rgmii-id";
                        phy-handle = <0x5>;

                        phy@0 {
                                compatible = "marvell,88e1111";
                                device_type = "ethernet-phy";
                                reg = <0x0>;
                                linux,phandle = <0x5>;
                                phandle = <0x5>;
                        };
                };

 smp

root@x86:/home/ubuntu/QEMU_CPUFreq_Zynq# ls
ethtool  my_device_defconfig  my_devicetree.dts  my.uImage  my_zynq_defconfig  Prebuilt_functional  README.md
root@x86:/home/ubuntu/QEMU_CPUFreq_Zynq# qemu-system-arm -M xilinx-zynq-a9 -serial /dev/null -serial mon:stdio -display none -smp 4  -kernel my.uImage -dtb Prebuilt_functional/my_devicetree.dtb --initrd Prebuilt_functional/ramdisk.img.gz  -net tap,ifname=qtap,script=no,downscript=no   -net nic,model=cadence_gem,macaddr=0e:b0:ba:5e:ba:12 
qemu-system-arm: Invalid SMP CPUs 4. The max CPUs supported by machine 'xilinx-zynq-a9' is 1
root@x86:/home/ubuntu/QEMU_CPUFreq_Zynq# 

Compile Xilinx QEMU

root@x86:/home/ubuntu/qemu# ./configure --target-list="arm-softmmu,aarch64-softmmu,microblazeel-softmmu" --enable-fdt --disable-kvm --disable-xen

ERROR: glib-2.48 gthread-2.0 is required to compile QEMU

root@x86:/home/ubuntu/qemu# ppt install -y libglib2.0-dev
# ERROR: glib-2.48 gthread-2.0 is required to compile QEMU
$ sudo apt install -y libglib2.0-dev

# ERROR: pixman >= 0.21.8 not present.
#        Please install the pixman devel package.
$ sudo apt install -y libpixman-1-dev

Set the Patch

diff --git a/hw/misc/zynq_slcr.c b/hw/misc/zynq_slcr.c
-    s->regs[R_ARM_PLL_CTRL]   = 0x0001A008;
+    s->regs[R_ARM_PLL_CTRL]   = 0x00014008;

./configure --target-list="arm-softmmu,aarch64-softmmu,microblazeel-softmmu" --enable-fdt --disable-kvm --disable-xen

交叉编译工具

Install the Cross Compilers, utilities, etc.
Install the GCC, G++ cross compilers and support programs by typing:

sudo apt-get install libc6-armel-cross libc6-dev-armel-cross binutils-arm-linux-gnueabi libncurses5-dev build-essential bison flex libssl-dev bc
If you are using an Acqua or RoadRunner board:

sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
If you are using an Arietta, Aria or FOX G20 board:

sudo apt-get install gcc-arm-linux-gnueabi g++-arm-linux-gnueabi
Now you are ready to cross-compile on your PC all the source available for the Acme Boards based on Microchip MPUs.
root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu/buildroot# cp my_zynq_defconfig configs/
root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu/buildroot# cd -
/home/ubuntu
root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu# make -C buildroot ARCH=arm my_zynq_defconfig
make: Entering directory '/home/ubuntu/buildroot'
mkdir -p /home/ubuntu/buildroot/output/build/buildroot-config/lxdialog
PKG_CONFIG_PATH="" make CC="/usr/bin/gcc" HOSTCC="/usr/bin/gcc" \
    obj=/home/ubuntu/buildroot/output/build/buildroot-config -C support/kconfig -f Makefile.br conf
make[1]: Entering directory '/home/ubuntu/buildroot/support/kconfig'
/usr/bin/gcc -DCURSES_LOC="" -DLOCALE  -I/home/ubuntu/buildroot/output/build/buildroot-config -DCONFIG_=\"\"  -MM *.c > /home/ubuntu/buildroot/output/build/buildroot-config/.depend 2>/dev/null || :
/usr/bin/gcc -DCURSES_LOC="" -DLOCALE  -I/home/ubuntu/buildroot/output/build/buildroot-config -DCONFIG_=\"\"   -c conf.c -o /home/ubuntu/buildroot/output/build/buildroot-config/conf.o
/usr/bin/gcc -DCURSES_LOC="" -DLOCALE  -I/home/ubuntu/buildroot/output/build/buildroot-config -DCONFIG_=\"\"  -I. -c /home/ubuntu/buildroot/output/build/buildroot-config/zconf.tab.c -o /home/ubuntu/buildroot/output/build/buildroot-config/zconf.tab.o
/usr/bin/gcc -DCURSES_LOC="" -DLOCALE  -I/home/ubuntu/buildroot/output/build/buildroot-config -DCONFIG_=\"\"   /home/ubuntu/buildroot/output/build/buildroot-config/conf.o /home/ubuntu/buildroot/output/build/buildroot-config/zconf.tab.o  -o /home/ubuntu/buildroot/output/build/buildroot-config/conf
rm /home/ubuntu/buildroot/output/build/buildroot-config/zconf.tab.c
make[1]: Leaving directory '/home/ubuntu/buildroot/support/kconfig'
#
# configuration written to /home/ubuntu/buildroot/.config
#
make: Leaving directory '/home/ubuntu/buildroot'
root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu# 
root@ubuntu-Precision-3650-Tower-China-HDD-Protection:/home/ubuntu# make -C buildroot TOOLCHAIN_EXTERNAL_INSTALL_DIR=/usr/bin/ ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-  all -j20
make: Entering directory '/home/ubuntu/buildroot'
*** Configuration arm-buildroot-linux-uclibc not supported
os