由于我的串口有问题,得先上电板子,插串口线,然后开minicom ,一顿狂点回车,才能看到uboot的打印信息,petalinux的工程目录目前还不是很熟悉,配置什么的得挨个文件夹找。
uboot环境变量信息
Zynq> printenv
autoload=no
baudrate=115200
boot_img=BOOT.BIN
bootcmd=run default_bootcmd
bootdelay=4
bootenvsize=0x20000
bootenvstart=0x500000
bootsize=0x500000
bootstart=0x0
clobstart=0x10000000
console=console=ttyPS0,115200
cp_kernel2ram=sf probe 0 && sf read ${netstart} ${kernelstart} ${kernelsize}
default_bootcmd=run cp_kernel2ram && bootm ${netstart}
dtb_img=system.dtb
dtbnetstart=0x11800000
eraseenv=sf probe 0 && sf erase ${bootenvstart} ${bootenvsize}
ethaddr=00:0a:35:00:1e:53
fault=echo ${img} image size is greater than allocated place - partition ${img} is NOT UPDATED
fdtcontroladdr=1ffda140
install_boot=sf probe 0 && sf erase ${bootstart} ${bootsize} && sf write ${clobstart} ${bootstart} ${filesize}
install_jffs2=sf probe 0 && sf erase ${jffs2start} ${jffs2size} && sf write ${clobstart} ${jffs2start} ${filesize}
install_kernel=sf probe 0 && sf erase ${kernelstart} ${kernelsize} && sf write ${clobstart} ${kernelstart} ${filesize}
jffs2_img=rootfs.jffs2
kernel_img=image.ub
kernelsize=0xa80000
kernelstart=0x520000
load_boot=tftpboot ${clobstart} ${boot_img}
load_dtb=tftpboot ${clobstart} ${dtb_img}
load_jffs2=tftpboot ${clobstart} ${jffs2_img}
load_kernel=tftpboot ${clobstart} ${kernel_img}
loadaddr=0x10000000
nc=setenv stdout nc;setenv stdin nc;
netboot=tftpboot ${netstart} ${kernel_img} && bootm
netstart=0x10000000
psserial0=setenv stdout ttyPS0;setenv stdin ttyPS0
serial=setenv stdout serial;setenv stdin serial
serverip=192.168.100.14
test_crc=if imi ${clobstart}; then run test_img; else echo ${img} Bad CRC - ${img} is NOT UPDATED; fi
test_img=setenv var "if test ${filesize} -gt ${psize}; then run fault; else run ${installcmd}; fi"; run var; setenv var
update_boot=setenv img boot; setenv psize ${bootsize}; setenv installcmd "install_boot"; run load_boot test_img; setend
update_dtb=setenv img dtb; setenv psize ${dtbsize}; setenv installcmd "install_dtb"; run load_dtb test_img; setenv imgd
update_jffs2=setenv img jffs2; setenv psize ${jffs2size}; setenv installcmd "install_jffs2"; run load_jffs2 test_img; d
update_kernel=setenv img kernel; setenv psize ${kernelsize}; setenv installcmd "install_kernel"; run load_kernel test_d
Environment size: 2401/131068 bytes
出现的错误如下
zynq> bootm
Wrong Image Format for bootm command
ERROR: can't get kernel image!
Zynq> run bootcmd
SF: Detected S25FL256S_64K with page size 256 Bytes, erase size 64 KiB, total 32 MiB
device 0 offset 0x520000, size 0xa80000
SF: 11010048 bytes @ 0x520000 Read: OK
Wrong Image Format for bootm command
ERROR: can't get kernel image!
网上找到相关的出错信息解释是image.ub zimage,uimage的区别,实际上根本就是这个问题,国外的帖子上找到两个贴近的说法是
Yes, so In Boot mode, It was QSPI for the default petalinux u-boot configuration.
by changing it with petalinux-config, the design worked
Thanks for the guide.
启动模式选择错误,我是最小系统,只有一个qspi怎么可能会有其他的启动模式可选。
Figured out the problem,
I had misremembered how the system configuration settings needed to be set. In my application i was wanting to boot from the sd card(boot.bin and image.ub)
To do that the settings i needed were:
System boot device from QSPI FLASH to SD Card
Root filesystem type from SD Card to Initramfs
After that it rebuilt just fine again.
我又去petalinux-config了一遍,没错啊,真的没错。
串口波特率不稳定无信息或者乱码就找了很久,启动的问题一开始怀疑是镜像的生成问题petalinux-build。今天早上来可一个网友聊了一下,根本就是不可能是镜像生成有问题。网友是win的开发环境,我要开发驱动所以,选择了linux环境,我是完全依赖petalinux TOOL来完成全部工作,网友是,SDK生成BOOT.bin 然后虚拟机linux petalinux生成的,image.ub直接flash到qspi的0x520000地址启动的。然后我就直接用SDK镜像生成工具去生成镜像,在串口保证可以有打印信息的时候尝试竟然可以了,大笑,发现可以插入表情。
Welcome to minicom 2.7
OPTIONS: I18n
Compiled on Feb 7 2016, 13:37:27.
Port /dev/ttyUSB0, 10:24:29
Press CTRL-A Z for help on special keys
0
SF: Detected S25FL256S_64K with page size 256 Bytes, erase size 64 KiB, total 3B
device 0 offset 0x520000, size 0xa80000
SF: 11010048 bytes @ 0x520000 Read: OK
## 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: 3828096 Bytes = 3.7 MiB
Architecture: ARM
OS: Linux
Load Address: 0x00008000
Entry Point: 0x00008000
Hash algo: sha1
Hash value: 9b64cf300f4ebe377d810182f923402ba594de5c
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: 0x103aa08c
Data Size: 5204178 Bytes = 5 MiB
Architecture: ARM
OS: Linux
Load Address: unavailable
Entry Point: unavailable
Hash algo: sha1
Hash value: 84e6129321a9e7a0ef871ee0546db55d215b605c
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: 0x103a6b48
Data Size: 13457 Bytes = 13.1 KiB
Architecture: ARM
Hash algo: sha1
Hash value: 67761b9596a8c2cede3dfc7b53a03a66d72edee5
Verifying Hash Integrity ... sha1+ OK
Booting using the fdt blob at 0x103a6b48
ZYNQ GEM: e000b000, phyaddr -1, interface rgmii-id
mdio_register: non unique device name 'gem'
Loading Kernel Image ... OK
Loading Ramdisk to 07b09000, end 07fff8d2 ... OK
Loading Device Tree to 07b02000, end 07b08490 ... OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 4.6.0-xilinx (vision@vision-ThinkPad-T440s) (gcc version 5.2.1 207
CPU: ARMv7 Processor [413fc090] revision 0 (ARMv7), cr=18c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: minilinux
bootconsole [earlycon0] enabled
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,115200 earlyprintk
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: 489440K/524288K available (5286K kernel code, 230K rwdata, 1848K rodata)
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 - 0xc07f793c (8127 kB)
.init : 0xc0800000 - 0xc0900000 (1024 kB)
.data : 0xc0900000 - 0xc0939ba0 ( 231 kB)
.bss : 0xc0939ba0 - 0xc09713a4 ( 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 333MHz, resolution 3ns, wraps every 4398046511103ns
clocksource: arm_global_timer: mask: 0xffffffffffffffff max_cycles: 0x4ce07af02s
Switching to timer-based delay loop, resolution 3ns
clocksource: ttc_clocksource: mask: 0xffff max_cycles: 0xffff, max_idle_ns: 537s
timer #0 at e080a000, irq=17
Console: colour dummy device 80x30
Calibrating delay loop (skipped), value calculated using timer frequency.. 666.)
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 (1333.33 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: 191s
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@>
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.
Trying to unpack rootfs image as initramfs...
Freeing initrd memory: 5084K (c7b09000 - 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=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_Eve6
e0001000.serial: ttyPS0 at MMIO 0xe0001000 (irq = 143, base_baud = 6249999) is s
�console [ttyPS0] enabled
console [ttyPS0] enabled
bootconsole [earlycon0] disabled
bootconsole [earlycon0] disabled
xdevcfg f8007000.devcfg: ioremap 0xf8007000 to e086c000
[drm] Initialized drm 1.1.0 20060810
brd: module loaded
loop: module loaded
m25p80 spi0.0: found s25fl256s1, expected m25p80
m25p80 spi0.0: s25fl256s1 (32768 Kbytes)
4 ofpart partitions found on MTD device spi0.0
Creating 4 MTD partitions on "spi0.0":
0x000000000000-0x000000500000 : "boot"
0x000000500000-0x000000520000 : "bootenv"
0x000000520000-0x000000fa0000 : "kernel"
0x000000fa0000-0x000002000000 : "spare"
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 ()
Generic PHY e000b000.etherne:00: attached PHY driver [Generic PHY] (mii_bus:phy)
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
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 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)
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.
Freeing unused kernel memory: 1024K (c0800000 - c0900000)
INIT: version 2.88 booting
random: dd urandom read with 0 bits of entropy available
Tue Apr 25 12:02:29 UTC 2017
Starting internet superserver: inetd.
INIT: Entering runlevel: 5
Configuring network interfaces... IPv6: ADDRCONF(NETDEV_UP): eth0: link is not y
udhcpc (v1.24.1) started
Sending discover...
Sending discover...
Sending discover...
No lease, forking to background
done.
Starting Dropbear SSH server: Generating key, this may take a while...
Public key portion is:
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC9/fiGZc1h4Wa+AygQ9dKHn3OtwIVoDUmlat2t/pDm
Fingerprint: md5 64:ca:f1:7a:ec:8d:f7:87:23:00:a7:c9:c9:5f:25:a5
dropbear.
Starting syslogd/klogd: done
Starting tcf-agent: OK
PetaLinux 2016.4 plnx_arm /dev/ttyPS0
plnx_arm login:
账户root 密码root 登录
plnx_arm login: root
Password:
root@plnx_arm:~# ls
然后就懵逼在这里,什么都没有?我记得15.4的时候有来着,看内核打印信息,显示ramdisk,后来又是initramfs的,搞不懂,但是什么都没,怎么打开设备啊
先不考虑这个新问题,老问题就是petalinux-package这个工具build目录找到一个bif文件
the_ROM_image:
{
[bootloader] /tmp/tmp.JFHIzfyuYU/zynq_fsbl.elf
/tmp/tmp.JFHIzfyuYU/minisystem_wrapper.bit
/tmp/tmp.JFHIzfyuYU/u-boot.elf
[, load=0x520000, partition_owner=uboot] /tmp/tmp.JFHIzfyuYU/image.ub
}
SDK生成的bif文件
the_ROM_image:
{
[bootloader]/home/vision/workspace/minilinux/images/linux/zynq_fsbl.elf
/home/vision/workspace/minilinux/images/linux/minisystem_wrapper.bit
/home/vision/workspace/minilinux/images/linux/u-boot.elf
[offset = 0x520000]/home/vision/workspace/minilinux/images/linux/image.ub
}
是不是哪里设置错了,还是petalinux-package的时候可以指定偏移地址,还是一开始就是默认内核是tftp下载到qspi里?总之纠结的事情又多了一件。
直接pwd,我在家目录里面
root@plnx_arm:~# ls
root@plnx_arm:~# pwd
/home/root
root@plnx_arm:~# 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:/#
用ubuntu用习惯了,真是一路犯着二前行,接下来去找petalinux-package的配置的东西,总之哪里一定可以设置。