OpenNuvoton / NUC970_U-Boot_v2016.11

U-Boot v2016.11 for NUC970, N9H30, and NUC980
28 stars 45 forks source link

nand boot with yaffs2 compile issue #25

Open junwushi opened 4 years ago

junwushi commented 4 years ago

CC cmd/nand.o CC common/flash.o cmd/nand.c: 在函数‘do_nand’中: cmd/nand.c:642:4: 错误:‘nand’未声明(在此函数内第一次使用) nand->rw_oob = 1; ^ cmd/nand.c:642:4: 附注:每个未声明的标识符在其出现的函数内只报告一次 cmd/nand.c:646:7: 错误:‘WITH_YAFFS_OOB’未声明(在此函数内第一次使用) WITH_YAFFS_OOB); ^ cmd/nand.c:645:7: 警告:传递‘nand_write_skip_bad’的第 4 个参数时在不兼容的指针类型间转换 (u_char )addr, ^ In file included from cmd/nand.c:30:0: include/nand.h:107:5: 附注:需要类型‘size_t ’,但实参的类型为‘u_char ’ int nand_write_skip_bad(struct mtd_info mtd, loff_t offset, size_t length, ^ cmd/nand.c:644:10: 错误:提供给函数‘nand_write_skip_bad’的实参太少 ret = nand_write_skip_bad(nand, off, &rwsize, ^ In file included from cmd/nand.c:30:0: include/nand.h:107:5: 附注:在此声明 int nand_write_skip_bad(struct mtd_info mtd, loff_t offset, size_t *length, ^ make[3]: [scripts/Makefile.build:280:cmd/nand.o] 错误 1 make[2]: [Makefile:1233:cmd] 错误 2

//include/configs/nuc970-evb.h /*

define EXT_CLK 12000000 / 12 MHz crystal /

define CONFIG_SYS_TEXT_BASE 0xE00000

define CONFIG_SYS_LOAD_ADDR 0x8000

define CONFIG_SYS_MEMTEST_START 0xA00000

define CONFIG_SYS_MEMTEST_END 0xB00000

define CONFIG_ARCH_CPU_INIT

undef CONFIG_USE_IRQ

define CONFIG_CMDLINE_TAG 1 / enable passing of ATAGs /

define CONFIG_SETUP_MEMORY_TAGS 1

define CONFIG_INITRD_TAG 1

/#define CONFIG_NUC970_HW_CHECKSUM /

/#define CONFIG_SYS_USE_SPIFLASH /

define CONFIG_SYS_USE_NANDFLASH

define CONFIG_ENV_IS_IN_NAND

//add by jwshi

if defined(CONFIG_SYS_USE_NANDFLASH)

define CONFIG_BOOTCOMMAND "nboot 0x7fc0 0 0x200000;bootm 0x7c0"

endif

//end by jwshi

/#define CONFIG_ENV_IS_IN_SPI_FLASH / /#define CONFIG_ENV_IS_IN_MMC /

define CONFIG_BOARD_EARLY_INIT_F

define CONFIG_BOARD_LATE_INIT

define CONFIG_HW_WATCHDOG

define CONFIG_SYS_BOOTM_LEN 0x1000000 / 16MB max kernel size /

/#define CONFIG_BOOTDELAY 3/

define CONFIG_SYS_SDRAM_BASE 0

define CONFIG_NR_DRAM_BANKS 2 / there are 2 sdram banks for nuc970 /

define CONFIG_SYS_INIT_SP_ADDR 0xBC008000

define CONFIG_BAUDRATE 115200

define CONFIG_SYS_BAUDRATE_TABLE {115200, 57600, 38400}

/#define CONFIG_NUC970_EMAC1/ /#define CONFIG_CMD_NET /

define CONFIG_ETHADDR 00:00:00:11:66:88

define CONFIG_SYS_RX_ETH_BUFFER 16 // default is 4, set to 16 here.

/#define CONFIG_KPI_NUC970/

/#undef CONFIG_SYS_ICACHE_OFF / /#undef CONFIG_SYS_DCACHE_OFF / /#define CONFIG_SYS_ICACHE_OFF/

define CONFIG_SYS_DCACHE_OFF

/*

/*

undef CONFIG_CMD_LOADS

undef CONFIG_CMD_SOURCE

endif

ifdef CONFIG_SYS_USE_SPIFLASH

undef CONFIG_CMD_IMLS /====================> SPI only /

undef CONFIG_CMD_JFFS2

endif

ifdef CONFIG_KPI_NUC970

/#define CONFIG_KPI_PA_PORT 1 / / KPI select PA port /

define CONFIG_KPI_PH_PORT 1 / KPI select PH port /

define CONFIG_KPI_ROW_NUM 3 / row number is 1~4 /

define CONFIG_KPI_COL_NUM 3 / col number is 1~8 /

define CONFIG_KPI_DEBOUNCE 8 / debounce length setting: 0~13 /

endif

ifdef CONFIG_SYS_USE_NANDFLASH

define CONFIG_CMD_NAND 1

define CONFIG_CMD_UBI 1

define CONFIG_CMD_UBIFS 1

define CONFIG_MTD_UBI_WL_THRESHOLD 4096 / CWWeng 2017.2.13 /

define CONFIG_MTD_UBI_BEB_LIMIT 20 / CWWeng 2017.2.13 /

define CONFIG_CMD_MTDPARTS 1

define CONFIG_MTD_DEVICE 1

define CONFIG_MTD_PARTITIONS 1

define CONFIG_RBTREE 1

define CONFIG_LZO 1

define CONFIG_SYS_NAND_ONFI_DETECTION 1

define MTDIDS_DEFAULT "nand0=nand0"

define MTDPARTS_DEFAULT "mtdparts=nand0:0x200000@0x0(u-boot),0x1400000@0x200000(kernel),-(user)"

define MTD_ACTIVE_PART "nand0,2"

define CONFIG_CMD_NAND_YAFFS2 1

define CONFIG_YAFFS2 1

define CONFIG_SYS_MAX_NAND_DEVICE 1

define CONFIG_SYS_NAND_BASE 0xB000D000

define CONFIG_SYS_NAND_ECCBYTES 12

ifdef CONFIG_ENV_IS_IN_NAND

define CONFIG_ENV_OFFSET 0x80000

define CONFIG_ENV_SIZE 0x10000

define CONFIG_ENV_SECT_SIZE 0x20000

define CONFIG_ENV_RANGE (4 CONFIG_ENV_SECT_SIZE) / Env range : 0x80000 ~ 0x100000 */

define CONFIG_ENV_OVERWRITE

endif

endif

define CONFIG_SYS_NAND_U_BOOT_OFFS 0x100000 / Offset to RAM U-Boot image /

define CONFIG_SPL_TEXT_BASE 0x200

define CONFIG_SPL_STACK 0xBC008000

define CONFIG_SPL_NAND_SIMPLE

define CONFIG_SPL_NAND_LOAD

define CONFIG_SPL_NAND_BASE

define CONFIG_SPL_NAND_DRIVERS

define CONFIG_SPL_NAND_ECC

ifdef CONFIG_SPL_BUILD / CONFIG_NAND_SPL /

/ base address for uboot /

define CONFIG_SYS_PHY_UBOOT_BASE (CONFIG_SYS_SDRAM_BASE + 0xE00000)

define CONFIG_SYS_NAND_U_BOOT_DST CONFIG_SYS_PHY_UBOOT_BASE / NUB load-addr /

define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_NAND_U_BOOT_DST / NUB start-addr /

define CONFIG_SYS_NAND_U_BOOT_SIZE (500 1024) / Size of RAM U-Boot image */

endif

/ SPI flash /

ifdef CONFIG_SYS_USE_SPIFLASH

define CONFIG_SPI 1

ifdef CONFIG_ENV_IS_IN_SPI_FLASH

define CONFIG_ENV_OFFSET 0x80000

define CONFIG_ENV_SIZE 0x10000

define CONFIG_ENV_SECT_SIZE 0x10000

define CONFIG_ENV_OVERWRITE

endif

endif

/#define CONFIG_SYS_PROMPT "U-Boot> " /

define CONFIG_SYS_CBSIZE 256

define CONFIG_SYS_MAXARGS 16

define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)

define CONFIG_SYS_LONGHELP 1

define CONFIG_CMDLINE_EDITING 1

define CONFIG_AUTO_COMPLETE

define CONFIG_SYS_PROMPT_HUSH_PS2 "> "

/ Following block is for LCD support /

ifdef CONFIG_LCD

/#define CONFIG_NUC977_LCD/

define LCD_BPP LCD_COLOR16

define CONFIG_LCD_LOGO

define CONFIG_LCD_INFO

define CONFIG_LCD_INFO_BELOW_LOGO

/#define CONFIG_SYS_CONSOLE_IS_IN_ENV/ /#define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE/

define CONFIG_CONSOLE_SCROLL_LINES 1

endif

/ Following block is for MMC support /

ifdef CONFIG_NUC970_MMC

define CONFIG_CMD_MMC

define CONFIG_CMD_FAT

/#define CONFIG_MMC / /#define CONFIG_GENERIC_MMC /

define CONFIG_DOS_PARTITION

/#define CONFIG_MMC_TRACE / /#define CONFIG_NUC970_SD_PORT0 / /#define CONFIG_NUC970_SD_PORT1 / /#define CONFIG_NUC970_EMMC / / Don't enable eMMC(CONFIG_NUC970_EMMC) and NAND(CONFIG_NAND_NUC970) at the same time! /

ifdef CONFIG_ENV_IS_IN_MMC

define CONFIG_SYS_MMC_ENV_DEV 1

define CONFIG_ENV_OFFSET 0x80000

define CONFIG_ENV_SIZE /2048/0x10000

define CONFIG_ENV_SECT_SIZE 512

define CONFIG_ENV_OVERWRITE

endif

endif

/ Following block is for EHCI support/

if 1

/#define CONFIG_CMD_USB/ /#define CONFIG_CMD_FAT/ /#define CONFIG_USB_STORAGE/ /#define CONFIG_USB_EHCI/ /#define CONFIG_USB_EHCI_NUC970/

define CONFIG_EHCI_HCD_INIT_AFTER_RESET

define CONFIG_DOS_PARTITION

endif

/#define CONFIG_OF_LIBFDT / /#define CONFIG_FIT /

/*

define CONFIG_STACKSIZE (321024) / regular stack */

endif

junwushi commented 4 years ago

i think "nand" should be change to "mtd", but what's is the value of WITH_YAFFS_OOB?

yachen commented 4 years ago

I'm not seeing any error using following steps:

  1. make nuc970_defconfig
  2. eable yaffs2 support in menuconfig->file systems->yaffs2 filesystem support
  3. make
junwushi commented 4 years ago

I opened two define in uboot nuc970_evb.h

define CONFIG_CMD_NAND_YAFFS2 1

define CONFIG_YAFFS2 1

if don't need open it ,forget this

junwushi commented 4 years ago

when i finished do that { make nuc970_defconfig eable yaffs2 support in menuconfig->file systems->yaffs2 filesystem support mak}

when load rootfs, it show "devtmpfs: error mounting -2" that means uboot has issue for nand read or wirte function?

U-Boot 2016.11 (Jul 04 2020 - 14:06:41 +0800)

CPU: NUC972 Board: NUC972 DRAM: 64 MiB NAND: 128 MiB *** Warning - bad CRC, using default environment In: serial Out: serial Err: serial Net: emac Error: emac address not set. Hit any key to stop autoboot: 0 Loading from nand0, offset 0x200000 Image Name: Linux-3.10.108 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2838248 Bytes = 2.7 MiB Load Address: 00008000 Entry Point: 00008000 ## Booting kernel from Legacy Image at 00007fc0 ... Image Name: Linux-3.10.108 Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 2838248 Bytes = 2.7 MiB Load Address: 00008000 Entry Point: 00008000 Verifying Checksum ... OK XIP Kernel Image ... OK StartiBooting Linux on physical CPU 0x0 Initializing cgroup subsys cpuset Initializing cgroup subsys cpu Initializing cgroup subsys cpuacct Linux version 3.10.108 (leoshi@leoshi-VirtualBox) (gcc version 4.9.4 (Buildroot 2016.11.1-gb1c8df6-dirty) ) #3 PREEMPT Sat Jul 4 14:34:57 CST 2020 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/mtdblock2 rootfstype=yaffs2 rw rootflags=inband-tags console=ttyS0,115200n8 mem=64M 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: 58976k/58976k available, 6560k 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 - 0xc052aeec (5260 kB) .init : 0xc052b000 - 0xc054cdfc ( 136 kB) .data : 0xc054e000 - 0xc058c120 ( 249 kB) .bss : 0xc058c120 - 0xc05cb9b0 ( 255 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 Initializing cgroup subsys net_prio CPU: Testing write buffer coherency: ok Setting up static identity map for 0xc04284c0 - 0xc04284fc devtmpfs: initialized pinctrl core: initialized pinctrl subsystem NET: Registered protocol family 16 DMA: preallocated 256 KiB pool for atomic coherent allocations bio: create slab at 0 usbcore: registered new interface driver usbfs usbcore: registered new interface driver hub usbcore: registered new device driver usb NET: Registered protocol family 23 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) DLM installed exFAT: Version 1.2.9 NTFS driver 2.1.30 [Flags: R/W]. fuse init (API version 7.22) msgmni has been set to 115 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) nuc970-pwm nuc970-pwm.1: unable to reserve output pin nuc970-dma nuc970-dma-m2m: NUC970/N9H30 M2M DMA ready 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.3: ttyS3 at I/O 0x0 (irq = 43) is a NUC970 nuc970-uart.5: ttyS5 at I/O 0x0 (irq = 44) is a NUC970 nuc970-uart.8: ttyS8 at I/O 0x0 (irq = 41) is a NUC970 nuc970-uart.10: ttyS10 at I/O 0x0 (irq = 42) is a NUC970 nuc970_dma_proxy module initialized loop: module loaded nuc970 mtd nand driver version: 20160331 NAND device: Manufacturer ID: 0xef, Chip ID: 0xf1 (Winbond NAND 128MiB 3,3V 8-bit), 128MiB, page size: 2048, OOB size: 64 nand: SMRA size 64, 32 Bad block table not found for chip 0 Bad block table not found for chip 0 Scanning device for bad blocks Bad eraseblock 205 at 0x0000019a0000 Bad eraseblock 317 at 0x0000027a0000 Bad eraseblock 322 at 0x000002840000 Bad eraseblock 979 at 0x000007a60000 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 tun: Universal TUN/TAP device driver, 1.6 tun: (C) 1999-2004 Max Krasnyansky libphy: nuc970_rmii0: probed PPP generic driver version 2.4.2 SLIP: version 0.8.4-NET3.019-NEWTTY (dynamic channels, max=256). 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 ehci-platform: EHCI generic platform driver 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 nuc970adc_probe - pdev = nuc970-adc nuc970-rtc nuc970-rtc: rtc core: registered nuc970-rtc as rtc0 ipip: IPv4 over IPv4 tunneling driver gre: GRE over IPv4 demultiplexor driver ip_gre: GRE over IPv4 tunneling driver TCP: cubic registered NET: Registered protocol family 10 mip6: Mobile IPv6 sit: IPv6 over IPv4 tunneling driver ip6_gre: GRE over IPv6 tunneling driver NET: Registered protocol family 17 l2tp_core: L2TP core driver, V2.0 DCCP: Activated CCID 2 (TCP-like) DCCP: Activated CCID 3 (TCP-Friendly Rate Control) sctp: Hash tables configured (established 2048 bind 4096) NET: Registered protocol family 21 Registered RDS/tcp transport tipc: Activated (version 2.0.0) NET: Registered protocol family 30 tipc: Started in single node mode NET: Registered protocol family 36 nuc970-rtc nuc970-rtc: setting system clock to 2005-01-01 02:58:19 UTC (1104548299) yaffs: dev is 32505858 name is "mtdblock2" rw yaffs: passed flags "inband-tags" VFS: Mounted root (yaffs2 filesystem) on device 31:2. devtmpfs: error mounting -2 Freeing unused kernel memory: 132K Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance. CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.108 #3 Backtrace: [] (dump_backtrace+0x0/0x108) from [] (show_stack+0x18/0x1c) r6:00000000 r5:c0558788 r4:c0558788 r3:00000000 [] (show_stack+0x0/0x1c) from [] (dump_stack+0x20/0x28) [] (dump_stack+0x0/0x28) from [] (panic+0xa0/0x1f4) [] (panic+0x0/0x1f4) from [] (kernel_init+0x130/0x158) r3:00000000 r2:60000013 r1:000003b0 r0:c04ca81c r7:00000000 [] (kernel_init+0x0/0x158) from [] (ret_from_fork+0x14/0x3c) r5:c0424110 r4:00000000
junwushi commented 4 years ago

ipip: IPv4 over IPv4 tunneling driver gre: GRE over IPv4 demultiplexor driver ip_gre: GRE over IPv4 tunneling driver TCP: cubic registered NET: Registered protocol family 10 mip6: Mobile IPv6 sit: IPv6 over IPv4 tunneling driver ip6_gre: GRE over IPv6 tunneling driver NET: Registered protocol family 17 l2tp_core: L2TP core driver, V2.0 DCCP: Activated CCID 2 (TCP-like) DCCP: Activated CCID 3 (TCP-Friendly Rate Control) sctp: Hash tables configured (established 2048 bind 4096) NET: Registered protocol family 21 Registered RDS/tcp transport tipc: Activated (version 2.0.0) NET: Registered protocol family 30 tipc: Started in single node mode NET: Registered protocol family 36 nuc970-rtc nuc970-rtc: setting system clock to 2005-01-01 02:58:19 UTC (1104548299) yaffs: dev is 32505858 name is "mtdblock2" rw yaffs: passed flags "inband-tags" VFS: Mounted root (yaffs2 filesystem) on device 31:2. devtmpfs: error mounting -2 Freeing unused kernel memory: 132K Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance. CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.108 #3 Backtrace: [] (dump_backtrace+0x0/0x108) from [] (show_stack+0x18/0x1c) r6:00000000 r5:c0558788 r4:c0558788 r3:00000000 [] (show_stack+0x0/0x1c) from [] (dump_stack+0x20/0x28) [] (dump_stack+0x0/0x28) from [] (panic+0xa0/0x1f4) [] (panic+0x0/0x1f4) from [] (kernel_init+0x130/0x158) r3:00000000 r2:60000013 r1:000003b0 r0:c04ca81c r7:00000000 [] (kernel_init+0x0/0x158) from [] (ret_from_fork+0x14/0x3c) r5:c0424110 r4:00000000

yachen commented 4 years ago

Did you program the rootfs into NAND flash?

junwushi commented 4 years ago

i used opennvoton/buildroot for compile all parts, I found issue: in uboot configure:

define MTDPARTS_DEFAULT "mtdparts=nand0:0x200000@0x0(u-boot),0x800000@0x200000(kernel),-(user)"

but still got message in kernel when start, the rootfs is not start at 0x8000000: Creating 3 MTD partitions on "nand0": 0x000000000000-0x000000200000 : "u-boot" 0x000000200000-0x000001600000 : "Kernel" 0x000001600000-0x000008000000 : "user"

yachen commented 4 years ago

Please make sure the partition setting in Uboot is passed to kernel and command line partition table parsing is enabled in kernel config.

junwushi commented 4 years ago

i open the command line partition table parsing option, it doesn't work with uboot bootarg mtdparts paramter. i modified the nuc970_nand.c, it is work,

zhixiongBear commented 2 years ago

I have the same problem.

define CONFIG_CMD_NAND_YAFFS2 1

define CONFIG_YAFFS2 1

cmd/nand.c: In function ‘do_nand’: cmd/nand.c:642:4: error: ‘nand’ undeclared (first use in this function) nand->rw_oob = 1; ^ cmd/nand.c:642:4: note: each undeclared identifier is reported only once for each function it appears in cmd/nand.c:646:7: error: ‘WITH_YAFFS_OOB’ undeclared (first use in this function) WITH_YAFFS_OOB); ^ cmd/nand.c:646:7: warning: passing argument 4 of ‘nand_write_skip_bad’ from incompatible pointer type [enabled by default] In file included from cmd/nand.c:30:0: include/nand.h:107:5: note: expected ‘size_t ’ but argument is of type ‘u_char ’ int nand_write_skip_bad(struct mtd_info mtd, loff_t offset, size_t length, ^ cmd/nand.c:646:7: error: too few arguments to function ‘nand_write_skip_bad’ WITH_YAFFS_OOB); ^ In file included from cmd/nand.c:30:0: include/nand.h:107:5: note: declared here int nand_write_skip_bad(struct mtd_info mtd, loff_t offset, size_t length, ^ make[1]: [scripts/Makefile.build:281: cmd/nand.o] Error 1 make: [Makefile:1271: cmd] Error 2

yachen commented 2 years ago

Hi @zhixiongBear , Please provide your config file.

zhixiongBear commented 2 years ago

/*

ifndef __NUC980_NKIOT_CONFIG_H

define __NUC980_NKIOT_CONFIG_H

define CONFIG_USB_OHCI

/ #define CONFIG_USB_STORAGE / / #define CONFIG_CMD_USB / / #define CONFIG_CMD_FAT /

define CONFIG_DOS_PARTITION

define CONFIG_SUPPORT_VFAT

define EXT_CLK 12000000 / 12 MHz crystal /

define CONFIG_SYS_TEXT_BASE 0xE00000

define CONFIG_SYS_LOAD_ADDR 0xE00000

define CONFIG_SYS_MEMTEST_START 0xA00000

define CONFIG_SYS_MEMTEST_END 0xB00000

define CONFIG_ARCH_CPU_INIT

undef CONFIG_USE_IRQ

define CONFIG_CMDLINE_TAG 1 / enable passing of ATAGs /

define CONFIG_SETUP_MEMORY_TAGS 1

define CONFIG_INITRD_TAG 1

/#define CONFIG_NUC980_HW_CHECKSUM /

define CONFIG_SYS_USE_SPIFLASH

define CONFIG_SYS_USE_NANDFLASH

define CONFIG_ENV_IS_IN_NAND

/ #define CONFIG_ENV_IS_IN_SPI_FLASH /

define CONFIG_BOARD_EARLY_INIT_F

define CONFIG_BOARD_LATE_INIT

/#define CONFIG_HW_WATCHDOG/

define CONFIG_SYS_BOOTM_LEN 0x1000000 / 16MB max kernel size /

/#define CONFIG_BOOTDELAY 3/

define CONFIG_SYS_SDRAM_BASE 0

define CONFIG_NR_DRAM_BANKS 2 / there are 2 sdram banks for nuc980 /

define CONFIG_SYS_INIT_SP_ADDR 0xBC004000

define CONFIG_BAUDRATE 115200

define CONFIG_SYS_BAUDRATE_TABLE {115200, 57600, 38400}

/#define CONFIG_NUC980_EMAC1/ /#define CONFIG_CMD_NET /

define CONFIG_ETHADDR 00:00:00:11:66:88

define CONFIG_SYS_RX_ETH_BUFFER 16 // default is 4, set to 16 here.

undef CONFIG_SYS_ICACHE_OFF

define CONFIG_SYS_DCACHE_OFF

/*

/*

ifdef CONFIG_SYS_USE_SPIFLASH

undef CONFIG_CMD_IMLS /====================> SPI only /

undef CONFIG_CMD_JFFS2

endif

ifdef CONFIG_SYS_USE_NANDFLASH

define CONFIG_CMD_NAND 1

define CONFIG_CMD_UBI 1

define CONFIG_CMD_UBIFS 1

define CONFIG_MTD_UBI_WL_THRESHOLD 4096 / CWWeng 2017.2.13 /

define CONFIG_MTD_UBI_BEB_LIMIT 20 / CWWeng 2017.2.13 /

define CONFIG_CMD_MTDPARTS 1

define CONFIG_MTD_DEVICE 1

define CONFIG_MTD_PARTITIONS 1

define CONFIG_RBTREE 1

define CONFIG_LZO 1

define CONFIG_SYS_NAND_ONFI_DETECTION 1

define MTDIDS_DEFAULT "nand0=nand0"

define MTDPARTS_DEFAULT "mtdparts=nand0:0x200000@0x0(u-boot),0x1400000@0x200000(kernel),-(user)"

define MTD_ACTIVE_PART "nand0,2"

define CONFIG_CMD_NAND_YAFFS2 1

define CONFIG_YAFFS2 1

/ #define YAFFS2_DEBUG /

define CONFIG_SYS_MAX_NAND_DEVICE 1

define CONFIG_SYS_NAND_BASE 0xB000D000

define CONFIG_SYS_NAND_ECCBYTES 12

ifdef CONFIG_ENV_IS_IN_NAND

define CONFIG_ENV_OFFSET 0x80000

define CONFIG_ENV_SIZE 0x20000

define CONFIG_ENV_SECT_SIZE 0x20000

define CONFIG_ENV_RANGE (4 CONFIG_ENV_SECT_SIZE) / Env range : 0x80000 ~ 0x100000 */

define CONFIG_ENV_OVERWRITE

endif

endif

define CONFIG_SYS_NAND_U_BOOT_OFFS 0x100000 / Offset to RAM U-Boot image /

define CONFIG_SPL_TEXT_BASE 0x200

define CONFIG_SPL_STACK 0xBC004000

define CONFIG_SPL_NAND_SIMPLE

define CONFIG_SPL_NAND_LOAD

define CONFIG_SPL_NAND_BASE

define CONFIG_SPL_NAND_DRIVERS

define CONFIG_SPL_NAND_ECC

ifdef CONFIG_SPL_BUILD / CONFIG_NAND_SPL /

/ base address for uboot /

define CONFIG_SYS_PHY_UBOOT_BASE (CONFIG_SYS_SDRAM_BASE + 0xE00000)

define CONFIG_SYS_NAND_U_BOOT_DST CONFIG_SYS_PHY_UBOOT_BASE / NUB load-addr /

define CONFIG_SYS_NAND_U_BOOT_START CONFIG_SYS_NAND_U_BOOT_DST / NUB start-addr /

define CONFIG_SYS_NAND_U_BOOT_SIZE (800 1024) / (500 1024) Size of RAM U-Boot image /

endif

/ SPI flash /

ifdef CONFIG_SYS_USE_SPIFLASH

define CONFIG_SPI 1

ifdef CONFIG_ENV_IS_IN_SPI_FLASH

define CONFIG_ENV_OFFSET 0x80000

define CONFIG_ENV_SIZE 0x20000

define CONFIG_ENV_SECT_SIZE 0x20000

define CONFIG_ENV_OVERWRITE

endif

endif

/#define CONFIG_SYS_PROMPT "U-Boot> " /

define CONFIG_SYS_CBSIZE 256

define CONFIG_SYS_MAXARGS 16

define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + sizeof(CONFIG_SYS_PROMPT) + 16)

define CONFIG_SYS_LONGHELP 1

define CONFIG_CMDLINE_EDITING 1

define CONFIG_AUTO_COMPLETE

define CONFIG_SYS_PROMPT_HUSH_PS2 "> "

/*

define CONFIG_STACKSIZE (321024) / regular stack */

/ Extra Environments /

define CONFIG_EXTRA_ENV_SETTINGS \

    "baudrate=115200\0" \
    "bootdelay=3\0" \
    "stderr=serial\0" \
    "stdin=serial\0" \
    "stdout=serial\0" \
    "ethact=emac\0" \
    "setspi=sf probe 0 30000000\0" \
    "loadkernel=sf read 0x7fc0 0x200000 0x800000\0" \
    "bootcmd=run netnfs\0" \
    "ethaddr=00:00:00:11:66:88\0"\
    "serverip=192.168.31.198\0"\
    "ipaddr=192.168.31.200\0"\
    "kernel_addr_r=7fc0\0"                                \
    "bootfile=980uimage\0"                                \
    "Ubootfile=u-boot.bin\0"                                \
    "Uboot_addr_r=100000\0"                                \
    "Uimage_addr_r=200000\0"                                \
    "bootargs_ramfs=root=/dev/ram0 console=ttyS0,115200n8 rdinit=/sbin/init mem=64M\0" \
    "bootargs_nfs=mem=64M console=ttyS0,115200n8 noinitrd rw ip=192.168.0.28:192.168.0.23:192.168.0.1:255.255.255.0 " \
                  "root=/dev/nfs " \
                  "nfsroot=192.168.0.23:/usr/nuc980/buildroot-2019.02.9/output/target,nolock " \
                  "rdinit=/sbin/init\0" \
    "netnfs=tftp ${kernel_addr_r} ${bootfile}; "        \
             "setenv bootargs ${bootargs_ramfs}; " \
            "bootm ${kernel_addr_r}\0"        \
    "nfs_dl_burn_uboot_cmd=nfs ${kernel_addr_r} ${serverip}:/home/bear/nfs/u-boot.bin; " \
                         "nand erase ${Uboot_addr_r} 100000; " \
                         "nand write.e ${kernel_addr_r} ${Uboot_addr_r} 100000\0" \
    "nfs_dl_burn_uimage_cmd=nfs ${kernel_addr_r} ${serverip}:/home/bear/nfs/${bootfile}.bin; " \
                         "nand erase ${Uimage_addr_r} 1400000; " \
                         "nand write.e ${kernel_addr_r} ${Uimage_addr_r} 1400000\0" \ 
    "tftp_dl_burn_uboot_cmd=tftp ${kernel_addr_r} ${Ubootfile}; "        \
                         "nand erase ${Uboot_addr_r} 100000; " \
                         "nand write ${kernel_addr_r} ${Uboot_addr_r} 100000\0"        \

endif

yachen commented 2 years ago

Hi, I think you can comment out following two lines from the header. If you need to access ysffs2 file system, enable menuconfig->File systems->YAFFS2 filesystem support

#define CONFIG_CMD_NAND_YAFFS2 1
#define CONFIG_YAFFS2 1
zhixiongBear commented 2 years ago

Compilation is successful, but it will be blocked in "ymkdir" command.

=> mtd

device nand0 , # parts = 3

: name size offset mask_flags

0: u-boot 0x00200000 0x00000000 0 1: kernel 0x01400000 0x00200000 0 2: user 0x06a00000 0x01600000 0

active partition: nand0,0 - (u-boot) 0x00200000 @ 0x00000000

defaults: mtdids : nand0=nand0 mtdparts: mtdparts=nand0:0x200000@0x0(u-boot),0x1400000@0x200000(kernel),-(user) => ydevconfig nand 0 0x176 0x400 Configures yaffs mount nand: dev 0 start block 374, end block 1024 => ymount nand Mounting yaffs2 mount point nand => yls -l nand lost+found 2048 2 directory => ymkdir nand/test

yachen commented 2 years ago

We're not seeing this issue. But do noticed the ydevconfig command didn't report using in band tags flag. Did you programmed a yaffs2 file system before doing the test or you're just testing with an empty flash? capture

zhixiongBear commented 2 years ago

Can you provide your config file ?

yachen commented 2 years ago

Attached please find the config file and header. config.zip