WhyCan Forum

本站无需注册,无需积分,无需回复可下载所有资料,如果真的喜欢小站,请您注册之后请至少回复一个帖子激活Id,谢谢支持! 站长QQ: 516333132 (挖坑网/填坑网) admin@whycan.cn

您尚未登录。

#1 2019-03-04 12:46:26

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

nuc977的jffs2文件系统移植问题

最近在做nuc977文件系统的移植问题,在jffs2文件系统启动上出现了问题 。启动日志如下,不能正确挂载jffs2文件系统。

SF: Detected W25Q128 with page size 4 KiB, total 16 MiB
## Booting kernel from Legacy Image at 00007fc0 ...
   Image Name:   
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    4080640 Bytes = 3.9 MiB
   Load Address: 00007fc0
   Entry Point:  00008000
   Verifying Checksum ... OK
SF: Detected W25Q128 with page size 4 KiB, total 16 MiB
SF: DeviceBooting Linux on physical CPU 0x0
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Linux version 3.10.108 (cookie@NtrGoldWind) (gcc version 4.9.4 (Buildroot 2018.02.8) ) #2 PREEMPT Fri Mar 1 12:45:16 CST 2019
CPU: ARM926EJ-S [41069265] 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 rootfstype=jffs2 rootflags=inband-tags console=ttyS0 rdinit=/sbin/init 
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: 60680k/60680k available, 4856k 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 - 0xc0395eec   (3640 kB)
      .init : 0xc0396000 - 0xc03b5740   ( 126 kB)
      .data : 0xc03b6000 - 0xc03ec400   ( 217 kB)
       .bss : 0xc03ec400 - 0xc0421ac4   ( 214 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 [ttyS0] 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 0xc02d99f0 - 0xc02d9a2c
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
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)
jffs2: version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 118
Block layer SCSI generic (bsg) driver version 0.4 loaded (major 254)
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-spi0 nuc970-spi0: master is unqueued, this is deprecated
m25p80: Enable Dual Read Mode
m25p80 spi0.0: w25q128 (16384 Kbytes)
Creating 2 MTD partitions on "m25p80":
0x000000000000-0x000000800000 : "kernel"
0x000000800000-0x000001000000 : "rootfs"
CAN device driver interface
nuc970-can0 nuc970-can0: nuc970_can0_platform device registered (regs=f800b000, irq=58)
libphy: nuc970_rmii0: probed
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci_nuc970_probe() - name: nuc970-ehci
nuc970-ehci nuc970-ehci: Nuvoton NUC970/N9H30 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/N9H30 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
cpuidle: using governor ladder
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
List of all partitions:
No filesystem could mount root, tried:  jffs2
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.108 #2
Backtrace: 
[<c001213c>] (dump_backtrace+0x0/0x108) from [<c001234c>] (show_stack+0x18/0x1c)
 r6:00008000 r5:c03b0ef0 r4:c38a5000 r3:00000000
[<c0012334>] (show_stack+0x0/0x1c) from [<c02d6af4>] (dump_stack+0x20/0x28)
[<c02d6ad4>] (dump_stack+0x0/0x28) from [<c02d4aa0>] (panic+0xa0/0x1f4)
[<c02d4a00>] (panic+0x0/0x1f4) from [<c03970c0>] (mount_block_root+0x234/0x27c)
 r3:c3843ea8 r2:00000020 r1:c3843ea8 r0:c034d0d0
 r7:c034d138
[<c0396e8c>] (mount_block_root+0x0/0x27c) from [<c03972f0>] (mount_root+0xec/0x114)
[<c0397204>] (mount_root+0x0/0x114) from [<c0397478>] (prepare_namespace+0x160/0x1c0)
 r8:c03ec400 r7:0000005b r6:c03b0ef0 r5:c03b0ef0 r4:c03ec460
[<c0397318>] (prepare_namespace+0x0/0x1c0) from [<c0396c3c>] (kernel_init_freeable+0x1d8/0x224)
 r6:c03ec400 r5:00000008 r4:c03b5738
[<c0396a64>] (kernel_init_freeable+0x0/0x224) from [<c02d4420>] (kernel_init+0x10/0x158)
[<c02d4410>] (kernel_init+0x0/0x158) from [<c000ee98>] (ret_from_fork+0x14/0x3c)
 r5:c02d4410 r4:00000000

我的uboot启动参数设置如下:

baudrate=115200
bootargs=noinitrd root=/dev/mtdblock1 rootfstype=jffs2 rootflags=inband-tags console=ttyS0 rdinit=/sbin/init 
bootcmd=sf probe 0 240000000; sf read 0x7fc0 0x200000 0x8a0000;bootm 0x7fc0
bootdelay=3
ethact=emac
ethaddr=00:00:00:11:66:88
stderr=serial
stdin=serial
stdout=serial

制作jffs2的命令如下:

mkfs.jffs2 -r target -o images/k2rootfs.jffs2 -n -l

使用的是W25Q128  SPI-FLASH芯片16M大小。
这个问题是不是出在jffs2文件系统的制作方面了

最近编辑记录 thy442156388 (2019-03-04 12:46:46)

离线

#2 2019-03-04 13:34:31

山无棱
会员
注册时间: 2017-10-23
累计积分: 116

Re: nuc977的jffs2文件系统移植问题

你的是不是 winbond spi flash?

离线

#3 2019-03-04 16:52:17

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

Re: nuc977的jffs2文件系统移植问题

winbond 这个我不太懂。啥意思啊 但是是一个SPI—FLASH没错。

离线

#4 2019-03-04 17:13:23

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 6,756

Re: nuc977的jffs2文件系统移植问题

thy442156388 说:

winbond 这个我不太懂。啥意思啊 但是是一个SPI—FLASH没错。

你的flash上面丝印是什么型号?

离线

#5 2019-03-05 11:10:25

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

Re: nuc977的jffs2文件系统移植问题

对丝印上写的是winbond

离线

#6 2019-03-05 11:13:37

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 6,756

Re: nuc977的jffs2文件系统移植问题

winbond flash的linux驱动适配 jffs2 文件系统要修改一点点,我找找

离线

#7 2019-03-05 11:28:23

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

Re: nuc977的jffs2文件系统移植问题

我之前一直怀疑是烧录地址,和我的MTD分区表没对上的结果。

离线

#8 2019-03-05 12:46:35

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

Re: nuc977的jffs2文件系统移植问题

这里是不是还要修改新唐内核代码关于SPI-FLASH的驱动部分。

离线

#9 2019-03-05 13:38:07

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 6,756

Re: nuc977的jffs2文件系统移植问题

http://zero.lichee.pro/系统开发/SPI_falsh_doc3.html

  • mkfs.jffs2 使用的最小擦除尺寸是8KB,而spi flash的扇区大小是4KB,所以按照扇区擦除的话,会无法使用,所以必须使用块擦除。
    编译内核前先确认下drivers/mtd/spi-nor/spi-nor.c里,自己使用的flash的相关信息

  • #define SECT_4K BIT(0) /* SPINOR_OP_BE_4K works uniformly */

  • 如果发现信息里有SECT_4K,则会导致jffs2不能正常擦除(64KB),需要去掉该flag。




操作方法, 打开 https://github.com/torvalds/linux/blob/master/drivers/mtd/spi-nor/spi-nor.c

找到你的 flash:

{ "w25q256", INFO(0xef4019, 0, 64 * 1024, 512, SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },

删除 SECT_4K:

{ "w25q256", INFO(0xef4019, 0, 64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },

离线

#10 2019-03-05 16:01:18

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

Re: nuc977的jffs2文件系统移植问题

我是用的新唐的内核 没有用这个设备树,那我需要下载最新的Linux内核去编译么 ?

离线

#11 2019-03-05 16:02:55

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

Re: nuc977的jffs2文件系统移植问题

jffs2: Perhaps the file system was created with the wrong erase size?
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0013f000: 0xae23 instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0013f004: 0x213a instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0013f008: 0x03f7 instead
jffs2: jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0013f00c: 0xab7f instead

现在给我提示这个错误
如果出现这个错误是不是我在制作jffs2文件系统镜像的时候,擦除数据大小设置的有问题

最近编辑记录 thy442156388 (2019-03-05 16:04:06)

离线

#12 2019-03-05 16:12:58

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 6,756

Re: nuc977的jffs2文件系统移植问题

thy442156388 说:

我是用的新唐的内核 没有用这个设备树,那我需要下载最新的Linux内核去编译么 ?

不用,找 w25 那行代码,目录差不多,具体文件可能不同。

离线

#13 2019-03-05 16:14:54

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 6,756

Re: nuc977的jffs2文件系统移植问题

理论上你可以修改 mkfs.jffs2 的源码实现,不过目前建议你用九楼的方法。

离线

#14 2019-03-05 16:23:42

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

Re: nuc977的jffs2文件系统移植问题

我找到了 修改过来了 现在jffs2 是挂载上去了,但是给我提示这个

can: raw protocol (rev 20120528)
can: broadcast manager protocol (rev 20120528 t)
can: netlink gateway (rev 20130117) max_hops=1
jffs2: Empty flash at 0x00347ffc ends at 0x00348000
jffs2: Empty flash at 0x00357ffc ends at 0x00358000
jffs2: Empty flash at 0x00367ffc ends at 0x00368000
jffs2: Empty flash at 0x00377ffc ends at 0x00378000
jffs2: Empty flash at 0x00387ffc ends at 0x00388000
jffs2: Empty flash at 0x00397ffc ends at 0x00398000
jffs2: Empty flash at 0x003a7ffc ends at 0x003a8000
jffs2: Empty flash at 0x003b7ffc ends at 0x003b8000
jffs2: Empty flash at 0x003c7ffc ends at 0x003c8000
jffs2: Empty flash at 0x003d7f54 ends at 0x003d8000
VFS: Mounted root (jffs2 filesystem) on device 31:1.
devtmpfs: mounted
Freeing unused kernel memory: 124K
mount: you must be root
mkdir: can't create directory '/dev/pts': Permission denied
mkdir: can't create directory '/dev/shm': Permission denied
mount: you must be root
hostname: sethostname: Operation not permitted
Starting logging: OK
Initializing random number generator... done.
Starting network: RTNETLINK answers: Operation not permitted
RTNETLINK answers: Operation not permitted
FAIL
can't open /dev/console: Permission denied
can't open /dev/console: Permission denied
can't open /dev/console: Permission denied
can't open /dev/console: Permission denied
can't open /dev/console: Permission denied

最近编辑记录 thy442156388 (2019-03-05 17:49:09)

离线

#15 2019-03-05 16:31:39

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 6,756

Re: nuc977的jffs2文件系统移植问题

jffs2那个应该只是一个警告或者提示,后面的问题是没有创建目录,可以手动创建

离线

#16 2019-03-05 17:38:20

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

Re: nuc977的jffs2文件系统移植问题

ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci_nuc970_probe() - name: nuc970-ehci
nuc970-ehci nuc970-ehci: Nuvoton NUC970/N9H30 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/N9H30 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
cpuidle: using governor ladder
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
jffs2: Empty flash at 0x003d7f54 ends at 0x003d8000
VFS: Mounted root (jffs2 filesystem) on device 31:1.
devtmpfs: mounted
Freeing unused kernel memory: 124K
devpts: called with bogus options
Starting logging: OK
Initializing random number generator... done.
Starting network: OK

现在卡在这里了 ,这个问题出在那里啊。串口能输入数据,是不是应该写开机脚本了?

最近编辑记录 thy442156388 (2019-03-05 17:39:08)

离线

#17 2019-03-05 17:43:20

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 6,756

Re: nuc977的jffs2文件系统移植问题

应该是有一个开机脚本塞住了控制台, 试一试 CTRL + C 能不能中断.

离线

#18 2019-03-05 17:44:00

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

Re: nuc977的jffs2文件系统移植问题

断不开啊

离线

#19 2019-03-05 17:44:46

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 6,756

Re: nuc977的jffs2文件系统移植问题

你用什么串口终端软件?

离线

#20 2019-03-05 17:46:05

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

Re: nuc977的jffs2文件系统移植问题

Security CRT

离线

#21 2019-03-05 17:47:17

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 6,756

Re: nuc977的jffs2文件系统移植问题

那再试一试 CTRL + Z

离线

#22 2019-03-05 17:47:41

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

Re: nuc977的jffs2文件系统移植问题

我用buildroot做的文件系统,init.d文件夹下的启动脚本和我之前的有点不一样啊
是这样四个名字的脚本
S01logging  S20urandom  S40network  rcK  rcS

离线

#23 2019-03-05 17:48:38

晕哥
Administrator
注册时间: 2017-09-06
累计积分: 6,756

Re: nuc977的jffs2文件系统移植问题

那你检查根文件系统里面 /etc/init.d/  /etc/profile.d 这些文件里面是不是启动了什么命令.

离线

#24 2019-03-05 17:48:44

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

Re: nuc977的jffs2文件系统移植问题

Crtl+ D Q C W 都试过了 没用

离线

#25 2019-03-05 18:01:50

thy442156388
会员
所在地: 新疆乌鲁木齐
注册时间: 2018-10-21
累计积分: 54

Re: nuc977的jffs2文件系统移植问题

我检查了和之前编译的出来的文件系统在/etc/init.d和/etc/profile.d路径下的文件一样,这个文件系统是可以被NFS正确引导启动的。

离线

#26 2019-04-12 17:24:16

NBIOT001
会员
注册时间: 2017-11-15
累计积分: 11

Re: nuc977的jffs2文件系统移植问题

厉害了。

离线

页脚