amxx 发表于 2019-1-28 17:46:20

新唐NUC972 norflash运行uboot nandflash运行linux 启动后固件丢失

想向大家请教以下几个问题:
1、kernal启动起来之后,会对nandflash进行重新初始化,重新进行分区?
2、为何在uboot在内核启动时,对内核进行参数传递会无效?具体的内容请看后面的详细内容。
3、在linux内核驱动里面如何对nandflash进行分区,因为我感觉我传入的nandflash分区信息,内核并没有识别到,内核不知道怎么采用的默认的分区,这个默认设置地方我也没有找到(boot信息分区部分,可以看到原版固件里面的分区信息,和我自己编译后的分区信息并不一样)


以下是相关问题的具体描述

购买了NUC972 ARM9开发板,买来的时候忘记记录它自身的boot时所输出的信息了。目前根据文档里面的内容,烧写了文档里面的固件,将uboot和环境变量烧写到spi norflash里面,将uimage和rootfs烧写到nandflash里面。但kernal无法运行起来,输出的boot信息如下。

U-Boot 2013.04-rc2 (Dec 19 2016 - 15:52:43)

CPU: NUC972
DRAM:64 MiB
NAND:128 MiB
MMC:   mmc: 0
SF: Detected W25Q32 with page size 4 KiB, total 4 MiB
In:    serial
Out:   serial
Err:   serial
Net:   emac
Hit any key to stop autoboot:0

Loading from nand0, offset 0x0
   Image Name:   Linux-3.10.101
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2431088 Bytes = 2.3 MiB
   Load Address: 00008000
   Entry Point:00008000
## Booting kernel from Legacy Image at 00007fc0 ...
   Image Name:   Linux-3.10.101
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2431088 Bytes = 2.3 MiB
   Load Address: 00008000
   Entry Point:00008000
   Verifying Checksum ... OK
SF: Detected W25Q32 with page size 4 KiB, total 4 MiB
SF: Device software reset
   XIP Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Li done, booting t
                              Booting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Linux version 3.10.101 (gcp@gcp-virtual-machine) (gcc version 4.8.4 (GCC) ) #16 PREEMPT Fri Nov 24 09:45:11 CST 2017
CPU: ARM926EJ-S revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: NUC970
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on.Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock1 console=ttyS0,115200n8 rdinit=/sbin/init rootfstype=yaffs2 rootflags=inband-tags mem=64M mtdparts=nand0:0x700000@0x0(kernel),-(rootfs)
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 59480k/59480k available, 6056k reserved, 0K highmem
Virtual kernel memory layout:
    vector: 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap: 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xc4800000 - 0xff000000   ( 936 MB)
    lowmem: 0xc0000000 - 0xc4000000   (64 MB)
    modules : 0xbf000000 - 0xc0000000   (16 MB)
      .text : 0xc0008000 - 0xc0455f44   (4408 kB)
      .init : 0xc0456000 - 0xc04d7c84   ( 520 kB)
      .data : 0xc04d8000 - 0xc0514e00   ( 244 kB)
       .bss : 0xc0514e00 - 0xc054e330   ( 230 kB)
SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
NR_IRQS:625
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
Console: colour dummy device 80x30
console enabled
Calibrating delay loop... 148.88 BogoMIPS (lpj=744448)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Initializing cgroup subsys devices
Initializing cgroup subsys freezer
Initializing cgroup subsys perf_event
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0xc036a6c8 - 0xc036a704
devtmpfs: initialized
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource nuc970-timer1
cfg80211: Calling CRDA to update world regulatory domain
NET: Registered protocol family 2
TCP established hash table entries: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
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.
NetWinder Floating Point Emulator V0.97 (double precision)
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 116
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 100x30
fb0: nuc970fb frame buffer device
nuc970-uart.0: ttyS0 at I/O 0x0 (irq = 36) is a NUC970
nuc970-uart.1: ttyS1 at I/O 0x0 (irq = 37) is a NUC970
nuc970-uart.2: ttyS2 at I/O 0x0 (irq = 38) is a NUC970
nuc970-uart.4: ttyS4 at I/O 0x0 (irq = 39) is a NUC970
nuc970-uart.7: ttyS7 at I/O 0x0 (irq = 45) is a NUC970
nuc970-uart.8: ttyS8 at I/O 0x0 (irq = 41) is a NUC970
nuc970-uart.9: ttyS9 at I/O 0x0 (irq = 46) is a NUC970
nuc970_dma_proxy module initialized
(NULL device *): DMA channel request error
brd: module loaded
nuc970 mtd nand driver version: 20160331
ONFI param page 0 valid
ONFI flash detected
NAND device: Manufacturer ID: 0x01, Chip ID: 0xf1 (AMD/Spansion S34ML01G2), 128MiB, page size: 2048, OOB size: 64
SYSTEM: USE   BCH_T4 HWECC algorithm(SMRA   size: 64, Parity number:32 bytes)
EXECUTE: USE BCH_T4   HWECC algorithm(SMRA size: 64, Parity number:32 bytes)
USE   BCH_T4 HWECC algorithm(Parity number:32 bytes)
Bad block table found at page 65472, version 0x01
Bad block table found at page 65408, version 0x01
2 cmdlinepart partitions found on MTD device nand0

Creating 2 MTD partitions on "nand0":
0x000000000000-0x000000700000 : "kernel"
0x000000700000-0x000008000000 : "rootfs"

fmi-sm: registered successfully! mtdid=nand0
nuc970-spi1 nuc970-spi1: master is unqueued, this is deprecated
CAN device driver interface
nuc970-can0 nuc970-can0: nuc970_can0_platform device registered (regs=f800b000, irq=58)
nuc970-can1 nuc970-can1: nuc970_can1_platform device registered (regs=f800b400, irq=59)
libphy: nuc970_rmii0: probed
PPP generic driver version 2.4.2
PPP BSD Compression module registered
usbcore: registered new interface driver asix
usbcore: registered new interface driver ax88179_178a
usbcore: registered new interface driver cdc_ether
usbcore: registered new interface driver net1080
usbcore: registered new interface driver cdc_subset
usbcore: registered new interface driver zaurus
usbcore: registered new interface driver cdc_ncm
usbcore: registered new interface driver qmi_wwan
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
nuc970-ehci nuc970-ehci: Nuvoton NUC970 EHCI Host Controller
nuc970-ehci nuc970-ehci: new USB bus registered, assigned bus number 1
nuc970-ehci nuc970-ehci: irq 23, io mem 0xb0005000
nuc970-ehci nuc970-ehci: USB 2.0 started, EHCI 0.95
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
nuc970-ohci nuc970-ohci: Nuvoton NUC970 OHCI Host Controller
nuc970-ohci nuc970-ohci: new USB bus registered, assigned bus number 2
nuc970-ohci nuc970-ohci: irq 24, io mem 0xb0007000
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
usbcore: registered new interface driver cdc_wdm
usbcore: registered new interface driver usb-storage
usbcore: registered new interface driver usbserial
usbcore: registered new interface driver option
usbserial: USB Serial support registered for GSM modem (1-port)
input: NUC970 TouchScreen(ADC) as /devices/platform/nuc970-adc/input/input0
nuc970-rtc nuc970-rtc: rtc core: registered nuc970-rtc as rtc0
genirq: Flags mismatch irq 18. 00000000 (nuc970-nadc) vs. 00004000 (nuc970adc)
nuc970-nadc nuc970-nadc: failed requesting irq, irq = 18
nuc970-nadc: probe of nuc970-nadc failed with error -16
TCP: cubic registered
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
lib80211: common routines for IEEE802.11 drivers
nuc970-rtc nuc970-rtc: hctosys: unable to read the hardware clock
yaffs: dev is 32505857 name is "mtdblock1" rw
yaffs: passed flags "inband-tags"
usb 1-2: new high-speed USB device number 2 using nuc970-ehci
hub 1-2:1.0: USB hub found
hub 1-2:1.0: 2 ports detected




根据自己的理解,重新编译了uboot、uImage、和rootfs,重新对其进行烧录,可以进入到linux,但每次只能运行一次,再次上电后,uboot无法找到可以执行的image
Menuconfig和nandflash的配置如下
General setup--->
    [] Initial RAM filesystem and RAM disk (initramfs/initrd) support
//这里由于要使用yaffs2文件系统,所以按照文档里的要求取消了ram filesystem

-*-Memory Technology Device(MTD) support--->
-*-NAND Device Suport --->
      -*-Nuvoton NUC970 MTD NAND
            NUC970 NAND Flash pin selection (Port C) --->

File System--->
[*] Miscellaneous filesystems--->
    <*> yaffs2 file system support
    -*- 512 byte/page devices
    -*- 2048 byte(or larger)/page devices
    [*] Disable yaffs2 background processing
    [*] Enable yaffs2 xattr support

Boot Options--->
(noinitrd root=/dev/mtdblock1 console=ttys0,115200n8 rdinit=/sbin/init rootfstype=yaffs2 rootflags=inband-tags mem=64M)
Kernal command line type (Use bootloader kernel arguments if available) --->


烧写后第一次上电可以有正常的boot信息,也能进入kernel并运行相应的文件系统
NUC970 IBR 20151008.1735
No Key
Boot from SPI


U-Boot 2013.04-rc2 (Jan 26 2019 - 17:49:17)

CPU: NUC972
DRAM:64 MiB
NAND:128 MiB
SF: Detected W25Q32 with page size 4 KiB, total 4 MiB
In:    serial
Out:   serial
Err:   serial
Net:   emac
Hit any key to stop autoboot:0

Loading from nand0, offset 0x0
   Image Name:   Linux-3.10.101
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1908448 Bytes = 1.8 MiB
   Load Address: 00008000
   Entry Point:00008000
## Booting kernel from Legacy Image at 00007fc0 ...
   Image Name:   Linux-3.10.101
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1908448 Bytes = 1.8 MiB
   Load Address: 00008000
   Entry Point:00008000
   Verifying Checksum ... OK
SF: Detected W25Q32 with page size 4 KiB, total 4 MiB
SF: Device software reset
   XIP Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Li done, booting tBooting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Linux version 3.10.101 (root@localhost.localdomain) (gcc version 4.8.4 (GCC) ) #7 PREEMPT Sun Jan 27 00:19:17 PST 2019
CPU: ARM926EJ-S revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: NUC970
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on.Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock1 console=ttyS0,115200n8 rdinit=/sbin/init rootfstype=yaffs2 rootflags=inband-tags mem=64M mtdparts=nand0:0x700000@0x0(kernel),-(rootfs)
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 60896k/60896k available, 4640k reserved, 0K highmem
Virtual kernel memory layout:
    vector: 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap: 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xc4800000 - 0xff000000   ( 936 MB)
    lowmem: 0xc0000000 - 0xc4000000   (64 MB)
    modules : 0xbf000000 - 0xc0000000   (16 MB)
      .text : 0xc0008000 - 0xc0365f04   (3448 kB)
      .init : 0xc0366000 - 0xc03830e4   ( 117 kB)
      .data : 0xc0384000 - 0xc03bb520   ( 222 kB)
       .bss : 0xc03bb520 - 0xc03ed5e0   ( 201 kB)
SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
NR_IRQS:625
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
Console: colour dummy device 80x30
console enabled
Calibrating delay loop... 148.88 BogoMIPS (lpj=744448)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Initializing cgroup subsys devices
Initializing cgroup subsys freezer
Initializing cgroup subsys perf_event
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0xc02b4878 - 0xc02b48b4
devtmpfs: initialized
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
cfg80211: Calling CRDA to update world regulatory domain
Switching to clocksource nuc970-timer1
NET: Registered protocol family 2
TCP established hash table entries: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
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
NetWinder Floating Point Emulator V0.97 (double precision)
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 118
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
nuc970-uart.0: ttyS0 at I/O 0x0 (irq = 36) is a NUC970
brd: module loaded
nuc970 mtd nand driver version: 20160331
ONFI param page 0 valid
ONFI flash detected
NAND device: Manufacturer ID: 0x01, Chip ID: 0xf1 (AMD/Spansion S34ML01G2), 128MiB, page size: 2048, OOB size: 64
SYSTEM: USE   BCH_T4 HWECC algorithm(SMRA   size: 64, Parity number:32 bytes)
EXECUTE: USE BCH_T4   HWECC algorithm(SMRA size: 64, Parity number:32 bytes)
USE   BCH_T4 HWECC algorithm(Parity number:32 bytes)
Bad block table not found for chip 0
Bad block table not found for chip 0
Scanning device for bad blocks
Bad block table written to 0x000007fe0000, version 0x01
Bad block table written to 0x000007fc0000, version 0x01

Creating 3 MTD partitions on "nand0":
0x000000000000-0x000000200000 : "u-boot"
0x000000200000-0x000001600000 : "Kernel"
0x000001600000-0x000008000000 : "user"

fmi-sm: registered successfully! mtdid=nand0
libphy: nuc970_rmii0: probed
libphy: nuc970_rmii1: probed
nuc970-emac1 nuc970-emac1: phy_find_first() failed
nuc970-emac1 nuc970-emac1: nuc970_mii_setup err
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
nuc970-ehci nuc970-ehci: Nuvoton NUC970 EHCI Host Controller
nuc970-ehci nuc970-ehci: new USB bus registered, assigned bus number 1
nuc970-ehci nuc970-ehci: irq 23, io mem 0xb0005000
nuc970-ehci nuc970-ehci: USB 2.0 started, EHCI 0.95
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
0x204 = 0x8
nuc970-ohci nuc970-ohci: Nuvoton NUC970 OHCI Host Controller
nuc970-ohci nuc970-ohci: new USB bus registered, assigned bus number 2
nuc970-ohci nuc970-ohci: irq 24, io mem 0xb0007000
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
usbcore: registered new interface driver usb-storage
TCP: cubic registered
NET: Registered protocol family 17
yaffs: dev is 32505857 name is "mtdblock1" rw
yaffs: passed flags "inband-tags"
usb 1-2: new high-speed USB device number 2 using nuc970-ehci
hub 1-2:1.0: USB hub found
hub 1-2:1.0: 2 ports detected
VFS: Mounted root (yaffs2 filesystem) on device 31:1.
devtmpfs: mounted
Freeing unused kernel memory: 116K (c0366000 - c0383000)
yaffs: dev is 32505856 name is "mtdblock0" rwck0 failed: No such device

yaffs: passed flags "inband-tags"
: /dev/mtdblock0 --> /mnt/mtdblock0
mount: mounting /dev/mtdblock1 on /mnt/mtdblock1 failed: No such device
: /dev/mtdblock1 --> /mnt/mtdblock1
yaffs: dev is 32505858 name is "mtdblock2" rwck2 failed: No such device

yaffs: passed flags "inband-tags"
: /dev/mtdblock2 --> /mnt/mtdblock2


BusyBox v1.22.1 (2016-02-03 14:11:04 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ # ls
bin         etc         lib         lost+foundproc      sys         usr
dev         home      linuxrc   mnt         sbin      tmp         var
~ # cd home
/home # ls
/home # cd ..
~ # uname -a
-/bin/sh: uname: not found
~ # uname
-/bin/sh: uname: not found
~ #
~ #


重新启动后打印出的boot信息
reboot
~ # umount: devtmpfs busy - remounted read-only
can't run '/sbin/swapoff': No such file or directory
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system reboot
Stopping WDT is probably not a good idea
Restarting system.

NUC970 IBR 20151008.1735
No Key
Boot from SPI


U-Boot 2013.04-rc2 (Jan 26 2019 - 17:49:17)

CPU: NUC972
DRAM:64 MiB
NAND:128 MiB
SF: Detected W25Q32 with page size 4 KiB, total 4 MiB
In:    serial
Out:   serial
Err:   serial
Net:   emac
Hit any key to stop autoboot:0

Loading from nand0, offset 0x0
** Unknown image type
Wrong Image Format for bootm command
ERROR: can't get kernel image!
U-Boot>

此时将nandflash里面的前20个block里面的数据读出来,(因为1个block的大小为128K,20个的大小为2.5M,此空间大小大于uImage的大小了)发现数据全部都变成了0xFF。

该问题困扰了我2周了,也看了nuc972的相关论坛,那个论坛也是好久都没有人更新了,QQ也加了nuc972的群,也没有人通过,估计回家过年了,请有相关经验的大虾提携一下。




redworlf007 发表于 2019-1-29 12:10:01

你先烧录新塘自带的制作好的系统试试看。

redworlf007 发表于 2019-1-29 12:12:03

还有要通过跳线来选择烧录模式,你选择usb烧录后,按BSP手册上,把所有的东西都烧录到nandflash里面,然后从nand启动。

amxx 发表于 2019-2-1 16:46:52

redworlf007 发表于 2019-1-29 12:12
还有要通过跳线来选择烧录模式,你选择usb烧录后,按BSP手册上,把所有的东西都烧录到nandflash里面,然后 ...

烧录新塘自己的固件,通过SPI flash里面烧录uboot和环境变量,nandflash里面烧录kernel和rootfs文件系统,启动到了
usb 1-2: new high-speed USB device number 2 using nuc970-ehci
hub 1-2:1.0: USB hub found
hub 1-2:1.0: 2 ports detected
这个地方就没有反应了。

这两天再次核对了make menuconfig,发现MTD选项里面 Command line partition table parsing给漏选了,重新选择后,然后再启动boot信息如下

U-Boot 2013.04-rc2 (Jan 31 2019 - 16:37:07)

CPU: NUC972
DRAM:64 MiB
NAND:128 MiB
SF: Detected W25Q32 with page size 4 KiB, total 4 MiB
In:    serial
Out:   serial
Err:   serial
Net:   emac
Hit any key to stop autoboot:0

Loading from nand0, offset 0x0
   Image Name:   Linux-3.10.101
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1909560 Bytes = 1.8 MiB
   Load Address: 00008000
   Entry Point:00008000
## Booting kernel from Legacy Image at 00007fc0 ...
   Image Name:   Linux-3.10.101
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1909560 Bytes = 1.8 MiB
   Load Address: 00008000
   Entry Point:00008000
   Verifying Checksum ... OK
SF: Detected W25Q32 with page size 4 KiB, total 4 MiB
SF: Device software reset
   XIP Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Li done, booting tBooting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Linux version 3.10.101 (root@localhost.localdomain) (gcc version 4.8.4 (GCC) ) #10 PREEMPT Thu Jan 31 23:39:39 PST 2019
CPU: ARM926EJ-S revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: NUC970
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on.Total pages: 16256
Kernel command line: noinitrd root=/dev/mtdblock1 console=ttyS0,115200n8 rdinit=/sbin/init rootfstype=yaffs2 rootflags=inband-tags mem=64M mtdparts=nand0:0x700000@0x0(kernel),-(rootfs)
PID hash table entries: 256 (order: -2, 1024 bytes)
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 60896k/60896k available, 4640k reserved, 0K highmem
Virtual kernel memory layout:
    vector: 0xffff0000 - 0xffff1000   (   4 kB)
    fixmap: 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0xc4800000 - 0xff000000   ( 936 MB)
    lowmem: 0xc0000000 - 0xc4000000   (64 MB)
    modules : 0xbf000000 - 0xc0000000   (16 MB)
      .text : 0xc0008000 - 0xc0365f04   (3448 kB)
      .init : 0xc0366000 - 0xc0383174   ( 117 kB)
      .data : 0xc0384000 - 0xc03bb4c0   ( 222 kB)
       .bss : 0xc03bb4c0 - 0xc03ed5a0   ( 201 kB)
SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Preemptible hierarchical RCU implementation.
NR_IRQS:625
sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 4294967286ms
Console: colour dummy device 80x30
console enabled
Calibrating delay loop... 148.88 BogoMIPS (lpj=744448)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
Initializing cgroup subsys devices
Initializing cgroup subsys freezer
Initializing cgroup subsys perf_event
CPU: Testing write buffer coherency: ok
Setting up static identity map for 0xc02b4e28 - 0xc02b4e64
devtmpfs: initialized
pinctrl core: initialized pinctrl subsystem
NET: Registered protocol family 16
DMA: preallocated 256 KiB pool for atomic coherent allocations
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Switching to clocksource nuc970-timer1
cfg80211: Calling CRDA to update world regulatory domain
NET: Registered protocol family 2
TCP established hash table entries: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
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
NetWinder Floating Point Emulator V0.97 (double precision)
ROMFS MTD (C) 2007 Red Hat, Inc.
msgmni has been set to 118
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
io scheduler noop registered
io scheduler deadline registered
io scheduler cfq registered (default)
nuc970-uart.0: ttyS0 at I/O 0x0 (irq = 36) is a NUC970
brd: module loaded
nuc970 mtd nand driver version: 20160331
ONFI param page 0 valid
ONFI flash detected
NAND device: Manufacturer ID: 0x01, Chip ID: 0xf1 (AMD/Spansion S34ML01G2), 128MiB, page size: 2048, OOB size: 64
SYSTEM: USE   BCH_T4 HWECC algorithm(SMRA   size: 64, Parity number:32 bytes)
EXECUTE: USE BCH_T4   HWECC algorithm(SMRA size: 64, Parity number:32 bytes)
USE   BCH_T4 HWECC algorithm(Parity number:32 bytes)
Bad block table not found for chip 0
Bad block table not found for chip 0
Scanning device for bad blocks
Bad block table written to 0x000007fe0000, version 0x01
Bad block table written to 0x000007fc0000, version 0x01
2 cmdlinepart partitions found on MTD device nand0

Creating 2 MTD partitions on "nand0":
0x000000000000-0x000000700000 : "kernel"
0x000000700000-0x000008000000 : "rootfs"

fmi-sm: registered successfully! mtdid=nand0
libphy: nuc970_rmii0: probed
libphy: nuc970_rmii1: probed
nuc970-emac1 nuc970-emac1: phy_find_first() failed
nuc970-emac1 nuc970-emac1: nuc970_mii_setup err
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
nuc970-ehci nuc970-ehci: Nuvoton NUC970 EHCI Host Controller
nuc970-ehci nuc970-ehci: new USB bus registered, assigned bus number 1
nuc970-ehci nuc970-ehci: irq 23, io mem 0xb0005000
nuc970-ehci nuc970-ehci: USB 2.0 started, EHCI 0.95
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
0x204 = 0x8
nuc970-ohci nuc970-ohci: Nuvoton NUC970 OHCI Host Controller
nuc970-ohci nuc970-ohci: new USB bus registered, assigned bus number 2
nuc970-ohci nuc970-ohci: irq 24, io mem 0xb0007000
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 2 ports detected
usbcore: registered new interface driver usb-storage
TCP: cubic registered
NET: Registered protocol family 17
yaffs: dev is 32505857 name is "mtdblock1" rw
yaffs: passed flags "inband-tags"
usb 1-2: new high-speed USB device number 2 using nuc970-ehci
hub 1-2:1.0: USB hub found
hub 1-2:1.0: 2 ports detected
VFS: Mounted root (yaffs2 filesystem) on device 31:1.
devtmpfs: mounted
Freeing unused kernel memory: 116K (c0366000 - c0383000)
yaffs: dev is 32505856 name is "mtdblock0" rwck0 failed: No such device

yaffs: passed flags "inband-tags"
: /dev/mtdblock0 --> /mnt/mtdblock0
mount: mounting /dev/mtdblock1 on /mnt/mtdblock1 failed: No such device
: /dev/mtdblock1 --> /mnt/mtdblock1


BusyBox v1.22.1 (2016-02-03 14:11:04 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.


~ # cd /
~ # ls
bin         etc         lib         lost+foundproc      sys         usr
dev         home      linuxrc   mnt         sbin      tmp         var
~ # cd mnt
/mnt # ls
mtdblock0mtdblock1
/mnt # cd mtdblock0
/mnt/mtdblock0 # ls
lost+found
/mnt/mtdblock0 # cd ..
/mnt # ls
mtdblock0mtdblock1
/mnt # cd mtdblock1
/mnt/mtdblock1 # ls
bin         etc         lib         lost+foundproc      sys         usr
dev         home      linuxrc   mnt         sbin      tmp         var
/mnt/mtdblock1 # cd ..
/mnt # cd ..
~ # ls
bin         etc         lib         lost+foundproc      sys         usr
dev         home      linuxrc   mnt         sbin      tmp         var
~ #
~ # fdisk -l
-/bin/sh: fdisk: not found
~ # cd /proc
/proc # ls
1             222         atags         filesystems   misc          sysvipc
10            3             buddyinfo   fs            modules       timer_list
107         361         bus         interrupts    mounts      tty
11            364         cgroups       iomem         mtd         uptime
110         387         cmdline       ioports       net         version
111         4             consoles      irq         pagetypeinfovmallocinfo
113         402         cpu         kallsyms      partitions    vmstat
12            409         cpuinfo       kmsg          self          yaffs
124         5             crypto      kpagecount    slabinfo      zoneinfo
13            6             devices       kpageflags    softirqs
133         7             diskstats   loadavg       stat
134         8             driver      locks         swaps
2             9             execdomains   meminfo       sys
/proc # cat filesystems
nodev   sysfs
nodev   rootfs
nodev   bdev
nodev   proc
nodev   cgroup
nodev   cpuset
nodev   tmpfs
nodev   devtmpfs
nodev   debugfs
nodev   sockfs
nodev   pipefs
nodev   anon_inodefs
nodev   devpts
nodev   ramfs
      vfat
      msdos
      romfs
      yaffs
      yaffs2
nodev   mtd_inodefs
/proc # cat partitions
major minor#blocksname

31      0       7168 mtdblock0
31      1   123904 mtdblock1
/proc # cat version
Linux version 3.10.101 (root@localhost.localdomain) (gcc version 4.8.4 (GCC) ) #10 PREEMPT Thu Jan 31 23:39:39 PST 2019
/proc # cat yaffs
cat: read error
/proc # cat iomem
00000000-03ffffff : System RAM
00008000-00365f03 : Kernel code
00384000-003ed59f : Kernel data
b0002000-b0002fff : nuc970-emac0
b0003000-b0003fff : nuc970-emac1
b0005000-b0005fff : nuc970-ehci
b0005000-b0005fff : ehci_hcd
b0007000-b0007fff : nuc970-ohci
b0007000-b0007fff : ohci_hcd
b000d000-b000dfff : nuc970-fmi
b8001800-b80018ff : nuc970-wdt
b8001800-b80018ff : nuc970-wdt
b8001900-b80019ff : nuc970-wwdt
b8001900-b80019ff : nuc970-wwdt
b8003000-b8003fff : nuc970-gpio
/proc # cat diskstats
   1       0 ram0 0 0 0 0 0 0 0 0 0 0 0
   1       1 ram1 0 0 0 0 0 0 0 0 0 0 0
   1       2 ram2 0 0 0 0 0 0 0 0 0 0 0
   1       3 ram3 0 0 0 0 0 0 0 0 0 0 0
   1       4 ram4 0 0 0 0 0 0 0 0 0 0 0
   1       5 ram5 0 0 0 0 0 0 0 0 0 0 0
   1       6 ram6 0 0 0 0 0 0 0 0 0 0 0
   1       7 ram7 0 0 0 0 0 0 0 0 0 0 0
   1       8 ram8 0 0 0 0 0 0 0 0 0 0 0
   1       9 ram9 0 0 0 0 0 0 0 0 0 0 0
   1      10 ram10 0 0 0 0 0 0 0 0 0 0 0
   1      11 ram11 0 0 0 0 0 0 0 0 0 0 0
   1      12 ram12 0 0 0 0 0 0 0 0 0 0 0
   1      13 ram13 0 0 0 0 0 0 0 0 0 0 0
   1      14 ram14 0 0 0 0 0 0 0 0 0 0 0
   1      15 ram15 0 0 0 0 0 0 0 0 0 0 0
31       0 mtdblock0 0 0 0 0 0 0 0 0 0 0 0
31       1 mtdblock1 0 0 0 0 0 0 0 0 0 0 0
/proc # ls
1             222         atags         filesystems   misc          sysvipc
10            3             buddyinfo   fs            modules       timer_list
107         361         bus         interrupts    mounts      tty
11            364         cgroups       iomem         mtd         uptime
110         387         cmdline       ioports       net         version
111         4             consoles      irq         pagetypeinfovmallocinfo
113         402         cpu         kallsyms      partitions    vmstat
12            416         cpuinfo       kmsg          self          yaffs
124         5             crypto      kpagecount    slabinfo      zoneinfo
13            6             devices       kpageflags    softirqs
133         7             diskstats   loadavg       stat
134         8             driver      locks         swaps
2             9             execdomains   meminfo       sys
/proc # cat devices
Character devices:
1 mem
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
7 vcs
10 misc
13 input
90 mtd
128 ptm
136 pts
180 usb
189 usb_device
253 bsg
254 watchdog

Block devices:
1 ramdisk
259 blkext
8 sd
31 mtdblock
65 sd
66 sd
67 sd
68 sd
69 sd
70 sd
71 sd
128 sd
129 sd
130 sd
131 sd
132 sd
133 sd
134 sd
135 sd
/proc # ls
1             222         atags         filesystems   misc          sysvipc
10            3             buddyinfo   fs            modules       timer_list
107         361         bus         interrupts    mounts      tty
11            364         cgroups       iomem         mtd         uptime
110         387         cmdline       ioports       net         version
111         4             consoles      irq         pagetypeinfovmallocinfo
113         402         cpu         kallsyms      partitions    vmstat
12            418         cpuinfo       kmsg          self          yaffs
124         5             crypto      kpagecount    slabinfo      zoneinfo
13            6             devices       kpageflags    softirqs
133         7             diskstats   loadavg       stat
134         8             driver      locks         swaps
2             9             execdomains   meminfo       sys
/proc # cat modules
/proc # ls
1             222         atags         filesystems   misc          sysvipc
10            3             buddyinfo   fs            modules       timer_list
107         361         bus         interrupts    mounts      tty
11            364         cgroups       iomem         mtd         uptime
110         387         cmdline       ioports       net         version
111         4             consoles      irq         pagetypeinfovmallocinfo
113         402         cpu         kallsyms      partitions    vmstat
12            420         cpuinfo       kmsg          self          yaffs
124         5             crypto      kpagecount    slabinfo      zoneinfo
13            6             devices       kpageflags    softirqs
133         7             diskstats   loadavg       stat
134         8             driver      locks         swaps
2             9             execdomains   meminfo       sys
/proc # cat meminfo
MemTotal:          61012 kB
MemFree:         57108 kB
Buffers:               0 kB
Cached:            584 kB
SwapCached:            0 kB
Active:            404 kB
Inactive:            260 kB
Active(anon):         80 kB
Inactive(anon):      4 kB
Active(file):      324 kB
Inactive(file):      256 kB
Unevictable:         0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:            0 kB
Dirty:               0 kB
Writeback:             0 kB
AnonPages:            96 kB
Mapped:            248 kB
Shmem:               4 kB
Slab:               2448 kB
SReclaimable:       1156 kB
SUnreclaim:         1292 kB
KernelStack:         208 kB
PageTables:         28 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:       30504 kB
Committed_AS:      504 kB
VmallocTotal:   958464 kB
VmallocUsed:         400 kB
VmallocChunk:   712264 kB
/proc # ls
1             222         atags         filesystems   misc          sysvipc
10            3             buddyinfo   fs            modules       timer_list
107         361         bus         interrupts    mounts      tty
11            364         cgroups       iomem         mtd         uptime
110         387         cmdline       ioports       net         version
111         4             consoles      irq         pagetypeinfovmallocinfo
113         402         cpu         kallsyms      partitions    vmstat
12            422         cpuinfo       kmsg          self          yaffs
124         5             crypto      kpagecount    slabinfo      zoneinfo
13            6             devices       kpageflags    softirqs
133         7             diskstats   loadavg       stat
134         8             driver      locks         swaps
2             9             execdomains   meminfo       sys
/proc # cat stat
cpu24 0 334 146889 0 0 0 0 0 0
cpu0 24 0 334 146889 0 0 0 0 0 0
intr 176035 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 174389 0 0 0 0 0 0 25 0 0 0 0 0 0 0 0 0 0 0 0 1621 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
ctxt 15766
btime 0
processes 423
procs_running 1
procs_blocked 0
softirq 147938 0 147247 0 0 0 0 1 0 0 690
/proc # ls
1             222         atags         filesystems   misc          sysvipc
10            3             buddyinfo   fs            modules       timer_list
107         361         bus         interrupts    mounts      tty
11            364         cgroups       iomem         mtd         uptime
110         387         cmdline       ioports       net         version
111         4             consoles      irq         pagetypeinfovmallocinfo
113         402         cpu         kallsyms      partitions    vmstat
12            424         cpuinfo       kmsg          self          yaffs
124         5             crypto      kpagecount    slabinfo      zoneinfo
13            6             devices       kpageflags    softirqs
133         7             diskstats   loadavg       stat
134         8             driver      locks         swaps
2             9             execdomains   meminfo       sys
/proc # cat mtd
dev:    size   erasesizename
mtd0: 00700000 00020000 "kernel"
mtd1: 07900000 00020000 "rootfs"
/proc #


此时 MTD partitions是按照uboot环境变量传入的内容,进行的分区;但内核启动后,重新断电仍然无法重新运行,感觉nandflash里面0--0x700000里面的内容全部被格式化了,目前还不知道是什么原因导致的

amxx 发表于 2019-2-1 19:04:58

mount: mounting /dev/mtdblock0 on /mnt/mtdblock0 failed: No such device
mount: mounting /dev/mtdblock1 on /mnt/mtdblock1 failed: No such device
这个地方的failed,不明白是什么原因导致的

redworlf007 发表于 2019-2-8 09:25:07

不对呀,你烧录新塘得固件,啥都不用自己改烧进去就好了,新塘的固件不是从nand驱动的,硬件选择从spi启动。

amxx 发表于 2019-2-13 13:51:24

最近经过试验,找到了解决方法,现在还不知道这个方法是否正确,写出来,给大家做个参考。
在环境变量文件里面对mtdblock分区时取消了kernel的地址空间,原因我猜想是内核启动后由于一开始指定了对kernel地址空间部分进行分区,所以对其进行了挂载,在挂载后无法找到对应的文件系统,所以将其格式化了。

redworlf007 发表于 2019-7-21 19:43:08

amxx 发表于 2019-2-13 13:51
最近经过试验,找到了解决方法,现在还不知道这个方法是否正确,写出来,给大家做个参考。
在环境变量文件 ...

那个错误最后咋解决的?
页: [1]
查看完整版本: 新唐NUC972 norflash运行uboot nandflash运行linux 启动后固件丢失