1:项目需求
GV9531
有两颗CPU
分别是CK810
与CK860
,异构CPU
启动时必须有一个Core
作为Master
,一个作为Slave
。用Master
启动Slave
才能完成整个芯片的启动。
2:初识Image
Linux Image
作为Kernel
编译出来的第二级镜像(第一级镜像为vmLinux 文件
),Image
镜像是Kernel
文件 Binary file
.在外网上查到这么一句话:Image: The generic Linux kernel binary image file
.其加载地址与链接地址应该相同,因为Image
是二进制文件,CPU
可以直接执行的文件,所以加载地址应该核链接地址相同,PC
指针直接跳转到加载地址直接执行。此文件由编译器的Objdump
工具产生,本质上此文件包含符号表,删除无用信息之后的重定向信息二进制数。
参考资料: https://programmersought.com/article/54203146457/#kernel_Image_24
3:Master加载Slave
CK810 Slave
与CK860 Master
共用Bootroom
与uBoot
,Bootrom
加载uBoot
,然后开始运行uBoot
,uBoot
从存储介质(如SD卡或者Flash) 加载CK860
与CK810
的镜像,最后设置CK810
的PC
运行的地址开始run
。
polaris.h
文件定义了uBoot
的配置信息,包括**CK810
** 的Image
的存放地址,DTB
的存放地址。CONFIG_BOOTCOMMAND
配置信息如下:
#define CONFIG_BOOTCOMMAND \
"mmc rescan;" \
"if mmc dev ${sddev}; then " \
"if test ${boot_810} = yes || test ${boot_810} = try; then " \
"if run sd_load810img; then " \
"run sd_load810fdt; " \
"fi; " \
"else " \
"echo no csky 810 boot; " \
"fi;" \
"if run sd0_loadimg; then " \
"run sd0boot; " \
"fi; " \
"elif mmc dev ${emmcdev}; then " \
"echo Booting from eMMC ...; " \
"mmc read ${dtb_load_addr_phys} ${dtb_start_sector} ${dtb_size_sectors} ; " \
"mmc read ${linux_load_addr_phys} ${linux_start_sector} ${linux_size_sectors} ; " \
"bootm ${linux_load_addr_virt} - ${dtb_load_addr_virt}; \n" \
"elif nand info; then " \
"if run nand_loadimg; then " \
"run nandboot; " \
"fi; " \
"else echo No available boot device ...; fi"
环境变量初始化宏CONFIG_EXTRA_ENV_SETTINGS
定义如下:
/* Initial environment variables */
#define CONFIG_EXTRA_ENV_SETTINGS \
"kernel_img=uImage\0" \
"dtb_start_sector=0x1000\0" /* DTB start sector in eMMC -> 2MB */ \
"dtb_size_sectors=0x400\0" /* DTB size in sectors in eMMC -> 512K */ \
"linux_start_sector=0x2000\0" /* Linux start sector in eMMC-> 4MB */ \
"linux_size_sectors=0xA000\0" /* Linux size in sectors in eMMC -> 20MB */ \
"linux_load_addr_phys=0x10000000\0" \
"linux_load_addr_virt=0x90000000\0" \
"fdt_file=boya_ck860.dtb\0" \
"dtb_load_addr_phys=0x05000000\0" \
"dtb_load_addr_virt=0x85000000\0" \
"dtb_load_addr_phys_810=0x25000000\0" \
"linux_load_addr_phys_810=0x20000000\0" \
"boot_810=try\0" \
"boot_fdt=try\0" \
"sddev=0\0" \
"sdpart=" __stringify(CONFIG_SYS_MMC_IMG_LOAD_PART) "\0" \
"mmcautodetect=yes\0" \
"mtdparts=" MTDPARTS_DEFAULT "\0" \
"nand_loadimg=nand read ${linux_load_addr_virt} kernel 0xf00000\0" \
"nand_loadfdt=nand read ${dtb_load_addr_virt} dtb 0x8000\0" \
"sd0_loadimg=fatload mmc 0:${sdpart} ${linux_load_addr_phys} ${kernel_img}\0" \
"sd0_loadfdt=fatload mmc 0:${sdpart} ${dtb_load_addr_phys} ${fdt_file}\0" \
"sd1_loadimg=fatload mmc 1:${sdpart} ${linux_load_addr_phys} ${kernel_img}\0" \
"sd1_loadfdt=fatload mmc 1:${sdpart} ${dtb_load_addr_phys} ${fdt_file}\0" \
"sf_loadimg=sf read 0x10000000 0xa0000 0xf60000\0" \
"sf_loadfdt=sf read 0x05000000 0x60000 0x40000\0" \
"sd_load810img=fatload mmc ${sddev}:${sdpart} ${linux_load_addr_phys_810} gv9531_CK810_Image\0" \
"sd_load810fdt=fatload mmc ${sddev}:${sdpart} ${dtb_load_addr_phys_810} gv9531_CK810.dtb\0" \
"sd0boot=echo Booting from SD0 ...; " \
"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
"if run sd0_loadfdt; then " \
"bootm ${linux_load_addr_virt} - ${dtb_load_addr_virt}; \n" \
"else " \
"echo WARN: Cannot load the DTB; " \
"fi; " \
"else " \
"echo wait for boot; " \
"fi;\0" \
"sd1boot=echo Booting from SD1 ...; " \
"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
"if run sd1_loadfdt; then " \
"bootm ${linux_load_addr_virt} - ${dtb_load_addr_virt}; \n" \
"else " \
"echo WARN: Cannot load the DTB; " \
"fi; " \
"else " \
"echo wait for boot; " \
"fi;\0" \
"sfboot=echo Booting from SPI Nor by boya ...; " \
"if run sf_loadfdt; then " \
"bootm 0x90000000; \n" \
"else " \
"echo WARN: Cannot load the DTB; " \
"fi;\0" \
"nandboot=echo Booting from SPI NAND ...; " \
"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
"if run nand_loadfdt; then " \
"bootm ${linux_load_addr_virt} - ${dtb_load_addr_virt}; \n" \
"else " \
"echo WARN: Cannot load the DTB; " \
"fi; " \
"else " \
"echo wait for boot; " \
"fi;\0" \
从配置文件看出来CK810 Image
和DTB
分别被uBoot
加载到了物理地址:0x20000000
和0x25000000
的地方;配置项如下:
"dtb_load_addr_phys_810=0x25000000\0" \
"linux_load_addr_phys_810=0x20000000\0" \
这个加载地址必须与Linux Kernel
的配置DRAM Start address
相同,否则会有问题;
因为加载的是
Image
所以加载的地址和运行地址必须一样,目前Image
没有压缩比较大,以后要经过压缩后的文件,比较小点。
-
疑惑点:
为什么这个配置地址是物理地址而不是虚拟地址,理论上CPU MMU
开启之后这个地址应该是虚拟地址,这边配置成物理地址竟然可以正常搬运,比较奇怪,后面研究。
4:Image---head.S 文件的更改
由于CK810
与CK860
是两个不同的CPU
,两者无法相互配置,所以配置CK810 CPU
的任务需要CK810 Kernel
自行配置,故需要更改CK810 head.S
文件完成CK810 CPU
的配置,具体配置项有:
配置MMU
配置Cache
配置Prefetch
配置Kernel DTB entry
更改后的对比如下图所示:
这段代码必须要加否则
CPU
无法得到正确的配置,不会工作在正常的模式下。
5:曲折的过程
以上所有的配置完成之后,uBoot
启动CK810
与CK860
的Mirro Image
但是只有一个核能正常启动,另外一个核启动到一半就挂死,如果uBoot
单独启动CK810
或者CK860
是没有任何问题的。 启动Log
信息如下:
[11-02-14:10:29][ 0.000000] Linux version 4.9.56 (yanyh@hwlnx01) (gcc version 6.3.0 (Buildroot 2019.08-git-g9028bb4-dirty) ) #12 Mon Nov 2 13:59:40 CST 2020
[11-02-14:10:29][ 0.000000] Phys. mem: 512MB
[11-02-14:10:29][ 0.000000] On node 0 totalpages: 131072
[11-02-14:10:29][ 0.000000] free_area_init_node: node 0, pgdat 8151e7f0, node_mem_map 9fc00000
[11-02-14:10:29][ 0.000000] Normal zone: 1024 pages used for memmap
[11-02-14:10:29][ 0.000000] Normal zone: 0 pages reserved
[11-02-14:10:29][ 0.000000] Normal zone: 131072 pages, LIFO batch:31
[11-02-14:10:29][ 0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[11-02-14:10:29][ 0.000000] pcpu-alloc: [0] 0
[11-02-14:10:29][ 0.000000] Built 1 zonelists in Zone order, mobility grouping on. Total pages: 130048
[11-02-14:10:29][ 0.000000] Kernel command line: console=ttyS0,115200 rdinit=/sbin/init root=/dev/ram0
[11-02-14:10:29][ 0.000000] PID hash table entries: 2048 (order: 1, 8192 bytes)
[11-02-14:10:29][ 0.000000] Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
[11-02-14:10:29][ 0.000000] Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
[11-02-14:10:29][ 0.000000] Sorting __ex_table...
[11-02-14:10:29][ 0.000000] initrd not found or empty
[11-02-14:10:29][ 0.000000] - disabling initrd
[11-02-14:10:29][ 0.000000] Memory: 497820K/524288K available (19308K kernel code, 203K rwdata, 1984K rodata, 14304K init, 287K bss, 26468K reserved, 0K cma-reserved, 0K highmem)
[11-02-14:10:29][ 0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[11-02-14:10:29][ 0.000000] NR_IRQS:128
[11-02-14:10:29][ 0.000000] sched_clock: 32 bits at 250 Hz, resolution 4000000ns, wraps every 8589934590000000ns
[11-02-14:10:29][ 0.000000] Console: colour dummy device 80x25
[11-02-14:10:29][ 0.024000] Calibrating delay loop... 505.34 BogoMIPS (lpj=1010688)
[11-02-14:10:29][ 0.028000] pid_max: default: 32768 minimum: 301
[11-02-14:10:29][ 0.028000] Security Framework initialized
[11-02-14:10:29][ 0.028000] Yama: becoming mindful.
[11-02-14:10:29][ 0.028000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[11-02-14:10:29][ 0.028000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[11-02-14:10:29][ 0.028000] ASID allocator initialised with 256 entries
[11-02-14:10:29][ 0.028000] devtmpfs: initialized
[11-02-14:10:29][ 0.032000] evm: security.ima
[11-02-14:10:29][ 0.032000] evm: security.capability
[11-02-14:10:29][ 0.032000] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[11-02-14:10:29][ 0.032000] futex hash table entries: 256 (order: -1, 3072 bytes)
[11-02-14:10:29][ 0.032000] NET: Registered protocol family 16
[11-02-14:10:29][ 0.032000] DMA: preallocated 256 KiB pool for atomic coherent allocations
[11-02-14:10:29][ 0.032000] DMA: vaddr: 0xc000e000 phy: 0x3f480000,
[11-02-14:10:29][ 0.044000] vgaarb: loaded
[11-02-14:10:29][ 0.044000] SCSI subsystem initialized
[11-02-14:10:29][ 0.044000] usbcore: registered new interface driver usbfs
[11-02-14:10:29][ 0.044000] usbcore: registered new interface driver hub
[11-02-14:10:29][ 0.044000] usbcore: registered new device driver usb
[11-02-14:10:29][ 0.044000] Linux video capture interface: v2.00
[11-02-14:10:29][ 0.044000] pps_core: LinuxPPS API ver. 1 registered
[11-02-14:10:29][ 0.044000] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti giometti@linux.it
[11-02-14:10:29][ 0.044000] PTP clock support registered
[11-02-14:10:29][ 0.048000] VFS: Disk quotas dquot_6.6.0
[11-02-14:10:29][ 0.048000] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[11-02-14:10:29][ 0.068000] NET: Registered protocol family 2
[11-02-14:10:29][ 0.068000] TCP established hash table entries: 4096 (order: 2, 16384 bytes)
[11-02-14:10:30][ 0.068000] TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
[11-02-14:10:30][ 0.068000] TCP: Hash tables configured (established 4096 bind 4096)
[11-02-14:10:30][ 0.068000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[11-02-14:10:30][ 0.068000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[11-02-14:10:30][ 0.068000] NET: Registered protocol family 1
[11-02-14:10:30][ 0.072000] RPC: Registered named UNIX socket transport module.
[11-02-14:10:30][ 0.072000] RPC: Registered udp transport module.
[11-02-14:10:30][ 0.072000] RPC: Registered tcp transport module.
[11-02-14:10:30][ 0.072000] RPC: Registered tcp NFSv4.1 backchannel transport module.
[11-02-14:10:30][ 0.072000] PCI: CLS 0 bytes, default 32
[11-02-14:10:30][ 1.024000] random: fast init done
[11-02-14:10:30][ 1.956000] audit: initializing netlink subsys (disabled)
[11-02-14:10:30][ 1.956000] audit: type=2000 audit(1.956:1): initialized
[11-02-14:10:30][ 1.956000] workingset: timestamp_bits=30 max_order=17 bucket_order=0
[11-02-14:10:30][ 1.968000] NFS: Registering the id_resolver key type
[11-02-14:10:30][ 1.968000] Key type id_resolver registered
[11-02-14:10:30][ 1.968000] Key type id_legacy registered
[11-02-14:10:30][ 1.968000] ntfs: driver 2.1.32 [Flags: R/O].
[11-02-14:10:30][ 1.968000] romfs: ROMFS MTD (C) 2007 Red Hat, Inc.
[11-02-14:10:30][ 1.968000] fuse init (API version 7.26)
[11-02-14:10:30][ 1.968000] 9p: Installing v9fs 9p2000 file system support
[11-02-14:10:30][ 1.972000] Key type asymmetric registered
[11-02-14:10:30][ 1.972000] Asymmetric key parser 'x509' registered
[11-02-14:10:30][ 1.972000] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[11-02-14:10:30][ 1.972000] io scheduler noop registered
[11-02-14:10:30][ 1.972000] io scheduler deadline registered (default)
[11-02-14:10:30][ 1.976000] io scheduler cfq registered
[11-02-14:10:30][ 1.976000] ipmi message handler version 39.2
[11-02-14:10:30][ 2.108000] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[11-02-14:10:30][ 2.112000] console [ttyS0] disabled
[11-02-14:10:30][ 2.112000] f8007000.serial: ttyS0 at MMIO 0xf8007000 (irq = 48, base_baud = 1500000) is a 16550A
[11-02-14:10:30][ 2.428000] console [ttyS0] enabled
[11-02-14:10:30][ 2.432000] [drm] Initialized
[11-02-14:10:30][ 2.464000] brd: module loaded
[11-02-14:10:30][ 2.476000] loop: module loaded
[11-02-14:10:30][ 2.480000] libphy: Fixed MDIO Bus: probed
[11-02-14:10:30][ 2.484000] usbcore: registered new interface driver r8152
[11-02-14:10:30][ 2.488000] usbcore: registered new interface driver asix
[11-02-14:10:30][ 2.492000] usbcore: registered new interface driver ax88179_178a
[11-02-14:10:30][ 2.496000] usbcore: registered new interface driver cdc_ether
[11-02-14:10:30][ 2.500000] usbcore: registered new interface driver net1080
[11-02-14:10:30][ 2.504000] usbcore: registered new interface driver cdc_subset
[11-02-14:10:30][ 2.508000] usbcore: registered new interface driver zaurus
[11-02-14:10:30][ 2.512000] usbcore: registered new interface driver cdc_ncm
[11-02-14:10:30][ 2.548000] dwc2 f6000000.usb_otg: DWC OTG Controller
[11-02-14:10:30][ 2.552000] dwc2 f6000000.usb_otg: new USB bus registered, assigned bus number 1
[11-02-14:10:30][ 2.556000] dwc2 f6000000.usb_otg: irq 15, io mem 0x00000000
[11-02-14:10:30][ 2.560000] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[11-02-14:10:30][ 2.564000] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[11-02-14:10:30][ 2.568000] usb usb1: Product: DWC OTG Controller
[11-02-14:10:30][ 2.572000] usb usb1: Manufacturer: Linux 4.9.56 dwc2_hsotg
[11-02-14:10:30][ 2.576000] usb usb1: SerialNumber: f6000000.usb_otg
[11-02-14:10:30][ 2.580000] hub 1-0:1.0: USB hub found
[11-02-14:10:30][ 2.584000] hub 1-0:1.0: 1 port detected
[11-02-14:10:30][ 2.588000] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[11-02-14:10:30][ 2.592000] ehci-pci: EHCI PCI platform driver
[11-02-14:10:30][ 2.596000] ehci-platform: EHCI generic platform driver
[11-02-14:10:30][ 2.600000] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[11-02-14:10:30][ 2.604000] ohci-pci: OHCI PCI platform driver
[11-02-14:10:30][ 2.608000] usbcore: registered new interface driver usb-storage
[11-02-14:10:30][ 2.612000] mousedev: PS/2 mouse device common for all mice
[11-02-14:10:30][ 2.616000] usbcore: registered new interface driver uvcvideo
[11-02-14:10:30][ 2.620000] USB Video Class driver (1.1.1)
[11-02-14:10:30][ 2.624000] ledtrig-cpu: registered to indicate activity on CPUs
[11-02-14:10:30][ 2.632000] usbcore: registered new interface driver usbhid
[11-02-14:10:30][ 2.636000] usbhid: USB HID core driver
[11-02-14:10:30][ 2.640000] NET: Registered protocol family 17
[11-02-14:10:30][ 2.644000] 9pnet: Installing 9P2000 support
[11-02-14:10:30][ 2.648000] Key type dns_resolver registered
[11-02-14:10:30][ 2.712000] Key type trusted registered
[11-02-14:10:30][ 2.824000] Key type encrypted registered
[11-02-14:10:30][ 2.828000] ima: No TPM chip found, activating TPM-bypass!
[11-02-14:10:30][ 2.832000] evm: HMAC attrs: 0x1
[11-02-14:10:30][ 2.836000] ttyS0 - failed to request DMA
[11-02-14:10:30][ 2.844000] Freeing unused kernel memory: 14304k freed
[11-02-14:10:30][ 2.848000] This architecture does not have kernel memory protection.
[11-02-14:10:30][ 2.972000] usb 1-1: new high-speed USB device number 2 using dwc2
[11-02-14:10:30]Starting syslogd: OK
[11-02-14:10:30]Starting klogd: OK
[11-02-14:10:30][ 3.188000] usb 1-1: New USB device found, idVendor=0b95, idProduct=772b
[11-02-14:10:30][ 3.192000] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[11-02-14:10:30][ 3.196000] usb 1-1: Product: AX88772C
[11-02-14:10:30][ 3.200000] usb 1-1: Manufacturer: ASIX Elec. Corp.
[11-02-14:10:30][ 3.204000] usb 1-1: SerialNumber: 53A82D
[11-02-14:10:31]Starting mdev... OK
[11-02-14:10:31][ 3.376000] Unable to handle kernel paging request at virtual address 0x00000000, pc: 0x80ebd734
[11-02-14:10:31][ 3.380000] Oops: 00000000
[11-02-14:10:31][ 3.384000]
[11-02-14:10:31][ 3.384000] CURRENT PROCESS:
[11-02-14:10:31][ 3.384000]
[11-02-14:10:31][ 3.388000] COMM=find PID=99
[11-02-14:10:31][ 3.392000] TEXT=00008000-000e9c6c DATA=000eaf14-000eb165 BSS=000eb165-0010d000
[11-02-14:10:31][ 3.396000] USER-STACK=7f827e90 KERNEL-STACK=9c8703e0
[11-02-14:10:31][ 3.396000]
[11-02-14:10:31][ 3.400000] PC: 0x80ebd734 (find_inode_fast+0x28/0x84)
[11-02-14:10:31][ 3.404000] LR: 0x80ebe5ba (iget_locked+0x62/0x16c)
[11-02-14:10:31][ 3.408000] SP: 0x9c8b9ca4
[11-02-14:10:31][ 3.412000] orig_a0: 0x00000684
[11-02-14:10:31][ 3.416000] PSR: 0x80140340
[11-02-14:10:31][ 3.416000] a0: 0x00000684 a1: 0x9fb95df8 a2: 0x000007fb a3: 0x9fb91000
[11-02-14:10:31][ 3.420000] r4: 0x000007fb r5: 0x9c863c00 r6: 0x9fb95df8 r7: 0x9c863c00
[11-02-14:10:31][ 3.424000] r8: 0x9c8b9d3c r9: 0x00000003 r10: 0x812f9c78 r11: 0x00000002
[11-02-14:10:31][ 3.428000] r12: 0x0000006e r13: 0x0000006e r15: 0x80ebe5ba
[11-02-14:10:31][ 3.432000] r16: 0xfffff000 r17: 0x9f0c8850 r18: 0x00000000 r19: 0x00000004
[11-02-14:10:31][ 3.436000] r20: 0x000006e0 r21: 0xffffffff r22: 0xfffffff3 r23: 0x0010436f
[11-02-14:10:31][ 3.440000] r24: 0x7f827904 r25: 0x00000020 r26: 0x2ab456c0 r27: 0x00000000
[11-02-14:10:31][ 3.444000] r28: 0x000eb000 r29: 0x00000000 r30: 0x00000000 tls: 0x00000004
[11-02-14:10:31][ 3.448000] hi: 0x00000000 lo: 0x00000000
[11-02-14:10:31][ 3.452000]
[11-02-14:10:31]CODE:
[11-02-14:10:31]80ebd714: ddee6e3b 6d872001 96006d43 e9206d0b
[11-02-14:10:31]80ebd724: 04190006 e900901f 287b0017 0014e900
[11-02-14:10:31]80ebd734: 650e906a 90670bf8 0bf5654e e4639079
[11-02-14:10:31]80ebd744: e9032030 e3ff0010 c400ff01 96004820
[11-02-14:10:31][ 3.468000]
[11-02-14:10:31]KERNEL STACK:
[11-02-14:10:31]9c8b9c64: 80df97cc 00000000 9c8b9c7c 80dfbeee
[11-02-14:10:31]9c8b9c74: 00000000 9c84dda8 9c8b9d3c 80df8ad8
[11-02-14:10:31]9c8b9c84: 000007fb 9c863c00 9fb95df8 9c863c00
[11-02-14:10:31]9c8b9c94: 00000003 812f9c78 00000002 fffff000
[11-02-14:10:31]9c8b9ca4: 00000004 80ebe5ba 80ebd734 80140340
[11-02-14:10:31]9c8b9cb4: 9c8b9d3c 00000684 00000684 9fb95df8
[11-02-14:10:31]9c8b9cc4: 000007fb 9fb91000 000007fb 9c863c00
[11-02-14:10:31]9c8b9cd4: 9fb95df8 9c863c00 9c8b9d3c 00000003
[11-02-14:10:31]9c8b9ce4: 812f9c78 00000002 0000006e 0000006e
[11-02-14:10:31]9c8b9cf4: fffff000 9f0c8850 00000000 00000004
[11-02-14:10:31]9c8b9d04: 000006e0 ffffffff fffffff3 0010436f
[11-02-14:10:31]9c8b9d14: 7f827904 00000020 2ab456c0 00000000
[11-02-14:10:31][ 3.524000] Call Trace:
[11-02-14:10:31][<80dfa8a8>] walk_stackframe+0x0/0xc4
[11-02-14:10:31][ 3.532000] [<80dfaa0a>] show_stack+0x26/0x50
[11-02-14:10:31][ 3.536000] [<80dfa762>] show_regs+0x1e6/0x32c
[11-02-14:10:31][ 3.540000] [<80dfaf6e>] die_if_kernel.part.0+0x2e/0x68
[11-02-14:10:31][ 3.544000] [<80df97cc>] die_if_kernel+0x24/0x34
[11-02-14:10:31][ 3.548000] [<80dfbeee>] do_page_fault+0x1fe/0x364
[11-02-14:10:31][ 3.552000] [<80df8ad8>] tlbinvalidl+0x82/0xaa
[11-02-14:10:31][ 3.556000] [<80ebe5ba>] iget_locked+0x62/0x16c
[11-02-14:10:31][ 3.560000] [<80f09b72>] kernfs_get_inode+0x16/0x104
[11-02-14:10:31][ 3.564000] [<80f0a98c>] kernfs_iop_lookup+0x5c/0xb8
[11-02-14:10:31][ 3.568000] [<80eadc86>] lookup_slow+0x9e/0x174
[11-02-14:10:31][ 3.572000] [<80eb07e2>] walk_component+0x1d2/0x2b0
[11-02-14:10:31][ 3.576000] [<80eb0e66>] path_lookupat+0x66/0x134
[11-02-14:10:31][ 3.580000] [<80eb300a>] filename_lookup+0x82/0x11c
[11-02-14:10:31][ 3.584000] [<80eb3196>] user_path_at_empty+0x3e/0x60
[11-02-14:10:31][ 3.588000] [<80ea8c18>] vfs_fstatat+0x60/0xdc
[11-02-14:10:31][ 3.592000] [<80ea92d6>] SyS_fstatat64+0x1a/0x48
[11-02-14:10:31][ 3.596000] [<80df8e02>] csky_systemcall+0xa2/0xaa
[11-02-14:10:31][ 3.600000] Disabling lock debugging due to kernel taint
[11-02-14:10:31]Segmentation fault
[11-02-14:11:20]Starting network: [ 53.004000] random: crng init done
从上面的Log
中可以看出来,Kernel
启动完毕之后,start mdev
的之后出现了问题,说明整个Kerne
l 已经启动完毕,挂载rootfs
的时候出现了问题。根据以上的信息说明了什么问题?
说明发生了内存覆盖,而且只是部分覆盖,不是全部覆盖,所以才会出现上面的现象。
那哪里初问题了呢?
对Polaris.h
配置文件经过多次检查,发现PHYS_SDRAM_1_SIZE
的大小配置错误导致的,这个宏定义了uBoot
能操作的最大DDR
,之前配置的是:0x40000000,1GB
大小的空间,这种配置已经不适合当前的需求,当前的环境是CK860
在DDR
的活动区间是:0x20000000 512M
,所以如果这个值配置的太大的话就会出现部分内存覆盖的情况,但是代码中体现在什么地方需要进一步的研究。
6:写在最后
百果必有因,任何事情的发生总有原因,而要找到原因必须了解整个事情的经过和来龙去脉,光靠试是试不出来的。