[解读]U-boot启动

启动过程
u-boot信息
hisilicon # reset
resetting ...

U-Boot 2010.06 (Mar 10 2015 - 15:17:40)

NAND:  Check nand flash controller v610. found
Special NAND id table Version 1.36
Nand ID: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
No NAND device found!!!
0 MiB
Check spi flash controller v350... Found
Spi(cs1) ID: 0xC2 0x20 0x19 0xC2 0x20 0x19
Spi(cs1): Block:64KB Chip:32MB Name:"MX25L 256/257 35 E/F"
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
hisilicon # printenv
bootdelay=1
baudrate=115200
ethaddr=00:00:23:34:45:66
bootfile="uImage"
filesize=4B40D0
fileaddr=82000000
netmask=255.255.255.0
ipaddr=192.168.1.10
serverip=192.168.1.50
bootcmd=sf probe 0;sf read 0x82000000 0x100000 0x300000;bootm 0x82000000
bootargs=mem=256M console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=jffs2 mtdparts=hi_sfc:1M(boot),3M(kernel),27M(rootfs)
stdin=serial
stdout=serial
stderr=serial
verify=n
ver=U-Boot 2010.06 (Mar 10 2015 - 15:17:40)

Environment size: 463/262140 bytes
信息解读:

常用u-boot命令解析,获取:
  1. 环境变量

下面针对Hi3516A的升级文档来解析:
  1. sf probe 0含义,测试
sf probe 0——32768 KiB hi_sfc at 0:0 is now current device
sf probe 1——32768 KiB hi_sfc at 0:1 is now current device
勘测与初始化sf
可见,返回sf设备的大小、名字;这样我们下面就可以根据此信息来进行mtd分区
  1. mw.b 82000000 ff 100000,解析:
用指定数据(0xff)填充内存(从0x82000000地址开始,共填充100000个“单元”,每个单元为bit)(内存是指Flash),相当于初始化的作用
也有其子类命令,mw.[b/w/l]
  1. tftp 0x82000000 u-boot-hi3516a.bin
从tftp服务器里面下载文件(u-boot-hi3516a.bin)到起始地址为(0x82000000)的内存里面(这内存是指SDRAM内存,也就是DDR,毕竟还没有真正的写入Flash)。
对应:本起始地址一定是跟上面2的地址一致,不然不能完全覆盖
  1. sf erase 0 100000
重新将Flash的内存擦除,擦除位置是从0x0地址开始,连续擦除100000个单元
对应:单元大小如同2所指定的大小,也就是bit,同时,擦除单元数量一定是2所指定的大小,也就是100000
  1. sf write 82000000 0 100000
该命令:起始地址 偏移地址 写入大小,写入对象是Flash内存(此时,真正地把镜像写到Flash里面)
对应:起始地址、单元数量、其单元大小都是2所指定
3516A板卡烧写解析
3158E烧录命令解析

在前,还需要配置tftp服务器
setenv ipaddr 192.168.1.168
setenv serverip 192.168.1.xxx
saveenv
测试网络
ping 192.168.1.xxx
返回
ETH0: PHY(phyaddr=1, rgmii) link UP: DUPLEX=FULL : SPEED=100M
MAC:   00-00-23-34-45-66
host 192.168.1.106 is alive


备注:
  1. u-boot中添加mtdparts支持以及linux的分区设置,获取

备注:
  1. 《嵌入式开发教程 下册》10.5.2 u-boot的启动介绍,了解两个启动阶段
  2. mkenvimage:用于生成u-boot环境二进制映像的工具,获取:
    1. 为何可以在u-boot中设置参数(一般放在闪存的特定位置),利用引导程序传递给内核
    2. mkimage提供生成u-boot格式的文件,mkenvimage提供环境变量设置

进入系统后
查看当前系统mtd分区:
~ # cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00010000 "boot"
mtd1: 00300000 00010000 "kernel"
mtd2: 01b00000 00010000 "rootfs"
信息解读:

使用Linux管理闪存存储,获取:
  1. Flash缺点:相对机械硬盘而言价格贵、写入限制(块搽除)、有限次数写入
  2. cpu直接在nor中启动代码,加载方便;nand只能复制到ram再执行
  3. Linux的MTD分区,示意图(也就是hi3516a烧录的地址区域分区),指定地址和大小
  4. 实际上3的分区并不是闪存设备规定的,而是在内核定义的,结构体示意图(u-boot烧录地址的分区,将覆盖原有的地址和大小)
  5. 获取要分区的MTD设备的名称,用于指定闪存块
  6. 内核启动参数mtdparts(u-boot中设置,通过引导程序传递给内核更改),利用到5的设备名称,和3的地址和大小
  7. /proc/mtd查看分区情况
用于Linux的内存技术设备(MTD)子系统,获取
  1. MTD既不是块设备也不是字符设备
  2. 块设备与MTD设备的区别:块设备仅有读、写两个操作,MTD设备有读、写、擦除三个操作;块大小,前者小,后者大

Nand Flash和NorFlash,获取
  1. 硬件的差别,可以不看。

查看系统当前挂载的文件系统
~ # cat /proc/mounts
rootfs / rootfs rw 0 0
/dev/root / jffs2 rw,relatime 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
tmpfs /dev tmpfs rw,relatime 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0

或者

~ # mount
rootfs on / type rootfs (rw)
/dev/root on / type jffs2 (rw,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /dev type tmpfs (rw,relatime)
devpts on /dev/pts type devpts (rw,relatime,mode=600)

这里是完整的启动信息:
~ # reboot
~ # umount: can't remount tmpfs read-only
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
RequestRestarting system.

U-Boot 2010.06 (Mar 10 2015 - 15:17:40)

NAND:  Check nand flash controller v610. found
Special NAND id table Version 1.36
Nand ID: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
No NAND device found!!!
0 MiB
Check spi flash controller v350... Found
Spi(cs1) ID: 0xC2 0x20 0x19 0xC2 0x20 0x19
Spi(cs1): Block:64KB Chip:32MB Name:"MX25L 256/257 35 E/F"
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
32768 KiB hi_sfc at 0:0 is now current device

## Booting kernel from Legacy Image at 82000000 ...
   Image Name:   Linux-3.4.35
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2957512 Bytes = 2.8 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0
Linux version 3.4.35 (pub@BVT-SDK-SERVER3) (gcc version 4.8.3 20131202 (prerelease) (Hisilicon_v300) ) #1 Tue Mar 10 15:18:43 HKT 2015
CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: hi3516a
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
Kernel command line: mem=256M console=ttyAMA0,115200 root=/dev/mtdblock2 rootfstype=jffs2 mtdparts=hi_sfc:1M(boot),3M(kernel),27M(rootfs)
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: 256MB = 256MB total
Memory: 254024k/254024k available, 8120k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xd0800000 - 0xff000000   ( 744 MB)
    lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
    modules : 0xbf000000 - 0xc0000000   (  16 MB)
      .text : 0xc0008000 - 0xc053e000   (5336 kB)
      .init : 0xc053e000 - 0xc0560364   ( 137 kB)
      .data : 0xc0562000 - 0xc0591780   ( 190 kB)
       .bss : 0xc05917a4 - 0xc05b09f8   ( 125 kB)
SLUB: Genslabs=11, HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
NR_IRQS:128
sched_clock: 32 bits at 49MHz, resolution 20ns, wraps every 86767ms
Console: colour dummy device 80x30
Calibrating delay loop... 1196.85 BogoMIPS (lpj=5984256)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Initializing cgroup subsys freezer
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0x80413998 - 0x804139f0
dummy:
NET: Registered protocol family 16
Serial: AMBA PL011 UART driver
uart:0: ttyAMA0 at MMIO 0x20080000 (irq = 40) is a PL011 rev2
console [ttyAMA0] enabled
uart:1: ttyAMA1 at MMIO 0x20090000 (irq = 41) is a PL011 rev2
bio: create slab at 0
SCSI subsystem initialized
hi-spi-master hi-spi-master.0: with 1 chip select slaves attached
hi-spi-master hi-spi-master.1: with 3 chip select slaves attached
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource timer0
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: 3, 32768 bytes)
TCP: Hash tables configured (established 8192 bind 8192)
TCP: reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (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.
VFS: Disk quotas dquot_6.5.2
Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
squashfs: version 4.0 (2009/01/31) Phillip Lougher
NFS: Registering the id_resolver key type
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
fuse init (API version 7.18)
SGI XFS with security attributes, large block/inode numbers, no debug enabled
msgmni has been set to 496
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
io scheduler noop registered
io scheduler deadline registered (default)
io scheduler cfq registered
brd: module loaded
Spi id table Version 1.22
Spi(cs1) ID: 0xC2 0x20 0x19 0xC2 0x20 0x19
SPI nor flash boot mode is 3 Bytes
Spi(cs1):
Block:64KB
Chip:32MB
Name:"MX25L 256/257 35 E/F"
spi size: 32MB
chip num: 1
3 cmdlinepart partitions found on MTD device hi_sfc
3 cmdlinepart partitions found on MTD device hi_sfc
Creating 3 MTD partitions on "hi_sfc":
0x000000000000-0x000000100000 : "boot"
0x000000100000-0x000000400000 : "kernel"
0x000000400000-0x000001f00000 : "rootfs"
Found Nand Flash Controller V610.
Nand ID: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
No NAND device found
Higmac dma_sg_phy: 0x8fa40000
higmac_mdio_bus: probed
ETH0: rgmii, phy_addr=1, mii_name=mdio0
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
hiusb-ehci hiusb-ehci.0: HIUSB EHCI
hiusb-ehci hiusb-ehci.0: new USB bus registered, assigned bus number 1
hiusb-ehci hiusb-ehci.0: irq 53, io mem 0x100b0000
hiusb-ehci hiusb-ehci.0: USB 0.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
hiusb-ohci hiusb-ohci.0: HIUSB OHCI
hiusb-ohci hiusb-ohci.0: new USB bus registered, assigned bus number 2
hiusb-ohci hiusb-ohci.0: irq 54, io mem 0x100a0000
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
mousedev: PS/2 mouse device common for all mice
i2c /dev entries driver
hisi_i2c hisi_i2c.0: Hisilicon [i2c-0] probed!
hisi_i2c hisi_i2c.1: Hisilicon [i2c-1] probed!
hisi_i2c hisi_i2c.2: Hisilicon [i2c-2] probed!
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
NET: Registered protocol family 15
lib80211: common routines for IEEE802.11 drivers
Registering the dns_resolver key type
VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
VFS: Mounted root (jffs2 filesystem) on device 31:2.
Freeing init memory: 136K

            _ _ _ _ _ _ _ _ _ _ _ _
            \  _  _   _  _ _ ___
            / /__/ \ |_/
           / __   /  -  _ ___
          / /  / /  / /
  _ _ _ _/ /  /  \_/  \_ ______
___________\___\__________________

[RCS]: /etc/init.d/S00devs
[RCS]: /etc/init.d/S01udev
Not recognise ACTION:change
Not recognise ACTION:change
[RCS]: /etc/init.d/S80network
mmz_start: 0x90000000, mmz_size: 768M
Hisilicon Media Memory Zone Manager
Module himedia: init ok
load sys.ko for Hi3516A...OK!
Load tde.ko ...OK!
load region.ko ....OK!
load vgs.ko for Hi3516A...OK!
ISP Mod init!
load viu.ko for Hi3516A...OK!
load vpss.ko ....OK!
load vou.ko ....OK!
Load hifb.ko OK!
load rc.ko for Hi3516A...OK!
load venc.ko for Hi3516A...OK!
load chnl.ko for Hi3516A...OK!
load h264e.ko for Hi3516A...OK!
load h265e.ko for Hi3516A...OK!
load jpege.ko for Hi3516A...OK!
load vda.ko ....OK!
ive mod init success!
Terminator_Off, reg07 = 0c
InitHDMIRX(FALSE): reg07 = 00, ucCurrentHDMIPort = 0
RDROM_Reset()
Terminator_Off, reg07 = 0c
RX VState VSTATE_PwrOff -> VSTATE_SWReset
==== Your input Sensor type is bt1120 ====
acodec inited!
insert audio
==== Your input Sensor type is bt1120 ====
mipi_init
init phy power successful!
load hi_mipi driver successful!
Auto login as root ...
Jan  1 00:00:04 login[1040]: root login on 'ttyS000'
Welcome to HiLinux.
None of nfsroot found in cmdline.
~ # Terminator_On, reg07 = 00
完整信息解读:

你可能感兴趣的:(Linux,点滴中的linux,u-boot,linux,C)