yaffs中的在编译mtdemul2k.o时遇到的错误~
最近在想把Yaffs文件系统编入内核,现已支持。但是要测试比较麻烦,还好Yaffs下可以支持基于file和ram的模拟。<br />但是都是基于MTD层的接口,我在编译mtdemul2k.o文件就遇到了如下错误,前大半部分错误都是内核文件错误,不大可能吧,希望得到指教。谢谢。<br /><br />我的makefile文件:<br />Makefile for NANDemul MTD<br />#<br /># NB this is not yet suitable for putting into the kernel tree.<br /># YAFFS: Yet another Flash File System. A NAND-flash specific file system. <br />#<br /># Copyright (C) 2002 Aleph One Ltd.<br /># for Toby Churchill Ltd and Brightstar Engineering<br />#<br /># Created by Charles Manning <charles@aleph1.co.uk><br />#<br /># This program is free software; you can redistribute it and/or modify<br /># it under the terms of the GNU General Public License version 2 as<br /># published by the Free Software Foundation.<br /><br />## Change or override KERNELDIR to your kernel<br />## comment out USE_xxxx if you don't want these features.<br /><br />KERNELDIR = /lib/modules/$(shell uname -r)/build<br /><br /><br />#CFLAGS = -D__KERNEL__ -DMODULE -I$(KERNELDIR)/include -O2 -Wall -g<br />CFLAGS = -D__KERNEL__ -DMODULE -I$(KERNELDIR)/include -O2 -Wall -g<br /><br /><br /><br />TARGET = nandemul2k.o<br /><br />default: $(TARGET)<br /><br />clean:<br />rm -f $(TARGET)<br /><br />$(TARGET): %.o: %.c<br />gcc -c $(CFLAGS) $< -o $@<br /><br /><br /><br /><br />报错的内容:<br />In file included from /lib/modules/2.6.18-pae/build/include/asm/thread_info.h:16,<br />from /lib/modules/2.6.18-pae/build/include/linux/thread_info.h:21,<br />from /lib/modules/2.6.18-pae/build/include/linux/preempt.h:9,<br />from /lib/modules/2.6.18-pae/build/include/linux/spinlock.h:49,<br />from /lib/modules/2.6.18-pae/build/include/linux/capability.h:45,<br />from /lib/modules/2.6.18-pae/build/include/linux/sched.h:44,<br />from /lib/modules/2.6.18-pae/build/include/linux/module.h:9,<br />from nandemul2k.c:20:<br />/lib/modules/2.6.18-pae/build/include/asm/processor.h:80: error: ‘CONFIG_X86_L1_CACHE_SHIFT’ undeclared here (not in a function)<br />/lib/modules/2.6.18-pae/build/include/asm/processor.h:80: error: requested alignment is not a constant<br />In file included from /lib/modules/2.6.18-pae/build/include/linux/rwsem.h:24,<br />from /lib/modules/2.6.18-pae/build/include/asm/semaphore.h:42,<br />from /lib/modules/2.6.18-pae/build/include/linux/sched.h:57,<br />from /lib/modules/2.6.18-pae/build/include/linux/module.h:9,<br />from nandemul2k.c:20:<br />/lib/modules/2.6.18-pae/build/include/asm/rwsem.h: In function ‘__down_read’:<br />/lib/modules/2.6.18-pae/build/include/asm/rwsem.h:97: error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’<br />/lib/modules/2.6.18-pae/build/include/asm/rwsem.h: In function ‘__down_write_nested’:<br />/lib/modules/2.6.18-pae/build/include/asm/rwsem.h:149: error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’<br />/lib/modules/2.6.18-pae/build/include/asm/rwsem.h: In function ‘__up_read’:<br />/lib/modules/2.6.18-pae/build/include/asm/rwsem.h:192: error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’<br />/lib/modules/2.6.18-pae/build/include/asm/rwsem.h:192: warning: unused variable ‘tmp’<br />/lib/modules/2.6.18-pae/build/include/asm/rwsem.h: In function ‘__up_write’:<br />/lib/modules/2.6.18-pae/build/include/asm/rwsem.h:216: error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’<br />/lib/modules/2.6.18-pae/build/include/asm/rwsem.h: In function ‘__downgrade_write’:<br />/lib/modules/2.6.18-pae/build/include/asm/rwsem.h:242: error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’<br />In file included from /lib/modules/2.6.18-pae/build/include/linux/sched.h:57,<br />from /lib/modules/2.6.18-pae/build/include/linux/module.h:9,<br />from nandemul2k.c:20:<br />/lib/modules/2.6.18-pae/build/include/asm/semaphore.h: In function ‘down’:<br />/lib/modules/2.6.18-pae/build/include/asm/semaphore.h:99: error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’<br />/lib/modules/2.6.18-pae/build/include/asm/semaphore.h: In function ‘down_interruptible’:<br />/lib/modules/2.6.18-pae/build/include/asm/semaphore.h:123: error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’<br />/lib/modules/2.6.18-pae/build/include/asm/semaphore.h: In function ‘down_trylock’:<br />/lib/modules/2.6.18-pae/build/include/asm/semaphore.h:145: error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’<br />/lib/modules/2.6.18-pae/build/include/asm/semaphore.h: In function ‘up’:<br />/lib/modules/2.6.18-pae/build/include/asm/semaphore.h:172: error: expected ‘:’ or ‘)’ before ‘KBUILD_BASENAME’<br />In file included from /lib/modules/2.6.18-pae/build/include/asm/smp.h:17,<br />from /lib/modules/2.6.18-pae/build/include/linux/smp.h:18,<br />from /lib/modules/2.6.18-pae/build/include/linux/sched.h:63,<br />from /lib/modules/2.6.18-pae/build/include/linux/module.h:9,<br />from nandemul2k.c:20:<br />/lib/modules/2.6.18-pae/build/include/asm/mpspec.h:6:25: error: mach_mpspec.h: No such file or directory<br />In file included from /lib/modules/2.6.18-pae/build/include/asm/smp.h:17,<br />from /lib/modules/2.6.18-pae/build/include/linux/smp.h:18,<br />from /lib/modules/2.6.18-pae/build/include/linux/sched.h:63,<br />from /lib/modules/2.6.18-pae/build/include/linux/module.h:9,<br />from nandemul2k.c:20:<br />/lib/modules/2.6.18-pae/build/include/asm/mpspec.h: At top level:<br />/lib/modules/2.6.18-pae/build/include/asm/mpspec.h:8: error: ‘MAX_MP_BUSSES’ undeclared here (not in a function)<br />/lib/modules/2.6.18-pae/build/include/asm/mpspec.h:22: error: ‘MAX_IRQ_SOURCES’ undeclared here (not in a function)<br />In file included from /lib/modules/2.6.18-pae/build/include/linux/smp.h:18,<br />from /lib/modules/2.6.18-pae/build/include/linux/sched.h:63,<br />from /lib/modules/2.6.18-pae/build/include/linux/module.h:9,<br />from nandemul2k.c:20:<br />/lib/modules/2.6.18-pae/build/include/asm/smp.h:76:26: error: mach_apicdef.h: No such file or directory<br />In file included from /lib/modules/2.6.18-pae/build/include/linux/smp.h:18,<br />from /lib/modules/2.6.18-pae/build/include/linux/sched.h:63,<br />from /lib/modules/2.6.18-pae/build/include/linux/module.h:9,<br />from nandemul2k.c:20:<br />/lib/modules/2.6.18-pae/build/include/asm/smp.h: In function ‘hard_smp_processor_id’:<br />/lib/modules/2.6.18-pae/build/include/asm/smp.h:80: warning: implicit declaration of function ‘GET_APIC_ID’<br />In file included from /lib/modules/2.6.18-pae/build/include/linux/module.h:9,<br />from nandemul2k.c:20:<br />/lib/modules/2.6.18-pae/build/include/linux/sched.h: In function ‘dequeue_signal_lock’:<br />/lib/modules/2.6.18-pae/build/include/linux/sched.h:1209: warning: implicit declaration of function ‘local_irq_save’<br />/lib/modules/2.6.18-pae/build/include/linux/sched.h:1211: warning: implicit declaration of function ‘local_irq_restore’<br />In file included from /lib/modules/2.6.18-pae/build/include/asm/pgtable.h:244,<br />from /lib/modules/2.6.18-pae/build/include/linux/mm.h:38,<br />from /lib/modules/2.6.18-pae/build/include/linux/pagemap.h:7,<br />from nandemul2k.c:27:<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h: In function ‘set_pte’:<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:55: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:55: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h: In function ‘pte_clear’:<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:97: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h: At top level:<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:100: error: expected ‘)’ before ‘*’ token<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h: In function ‘ptep_get_and_clear’:<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:114: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:114: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:115: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h: In function ‘pte_same’:<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:122: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:122: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h: In function ‘pte_none’:<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:129: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h: In function ‘pte_pfn’:<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:135: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h: In function ‘pfn_pte’:<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:144: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:144: warning: right shift count >= width of type<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:146: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h: At top level:<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable-3level.h:152: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘pfn_pmd’<br />In file included from /lib/modules/2.6.18-pae/build/include/linux/mm.h:38,<br />from /lib/modules/2.6.18-pae/build/include/linux/pagemap.h:7,<br />from nandemul2k.c:27:<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable.h: In function ‘pte_modify’:<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable.h:318: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable.h:319: error: ‘pte_t’ has no member named ‘pte_high’<br />/lib/modules/2.6.18-pae/build/include/asm/pgtable.h:319: warning: right shift count >= width of type<br />In file included from /lib/modules/2.6.18-pae/build/include/asm/pgtable.h:450,<br />from /lib/modules/2.6.18-pae/build/include/linux/mm.h:38,<br />from /lib/modules/2.6.18-pae/build/include/linux/pagemap.h:7,<br />from nandemul2k.c:27:<br />/lib/modules/2.6.18-pae/build/include/asm-generic/pgtable.h: At top level:<br />/lib/modules/2.6.18-pae/build/include/asm-generic/pgtable.h:199: error: expected ‘)’ before ‘*’ token<br />/lib/modules/2.6.18-pae/build/include/asm-generic/pgtable.h:223: error: expected ‘)’ before ‘*’ token<br />In file included from /lib/modules/2.6.18-pae/build/include/linux/pagemap.h:7,<br />from nandemul2k.c:27:<br />/lib/modules/2.6.18-pae/build/include/linux/mm.h: In function ‘lowmem_page_address’:<br />/lib/modules/2.6.18-pae/build/include/linux/mm.h:531: warning: implicit declaration of function ‘__page_to_pfn’<br />/lib/modules/2.6.18-pae/build/include/linux/mm.h: At top level:<br />/lib/modules/2.6.18-pae/build/include/linux/mm.h:809: error: expected declaration specifiers or ‘...’ before ‘pmd_t’<br />/lib/modules/2.6.18-pae/build/include/linux/mm.h:810: error: expected ‘)’ before ‘*’ token<br />/lib/modules/2.6.18-pae/build/include/linux/mm.h:823: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token<br />In file included from /lib/modules/2.6.18-pae/build/include/linux/irq.h:22,<br />from /lib/modules/2.6.18-pae/build/include/asm/hardirq.h:5,<br />from /lib/modules/2.6.18-pae/build/include/linux/hardirq.h:7,<br />from /lib/modules/2.6.18-pae/build/include/linux/interrupt.h:11,<br />from /lib/modules/2.6.18-pae/build/include/asm/highmem.h:23,<br />from /lib/modules/2.6.18-pae/build/include/linux/highmem.h:23,<br />from /lib/modules/2.6.18-pae/build/include/linux/pagemap.h:10,<br />from nandemul2k.c:27:<br />/lib/modules/2.6.18-pae/build/include/asm/irq.h:15:25: error: irq_vectors.h: No such file or directory<br />In file included from /lib/modules/2.6.18-pae/build/include/asm/hardirq.h:5,<br />from /lib/modules/2.6.18-pae/build/include/linux/hardirq.h:7,<br />from /lib/modules/2.6.18-pae/build/include/linux/interrupt.h:11,<br />from /lib/modules/2.6.18-pae/build/include/asm/highmem.h:23,<br />from /lib/modules/2.6.18-pae/build/include/linux/highmem.h:23,<br />from /lib/modules/2.6.18-pae/build/include/linux/pagemap.h:10,<br />from nandemul2k.c:27:<br />/lib/modules/2.6.18-pae/build/include/linux/irq.h:169: error: ‘NR_IRQS’ undeclared here (not in a function)<br />In file included from /lib/modules/2.6.18-pae/build/include/linux/irq.h:182,<br />from /lib/modules/2.6.18-pae/build/include/asm/hardirq.h:5,<br />from /lib/modules/2.6.18-pae/build/include/linux/hardirq.h:7,<br />from /lib/modules/2.6.18-pae/build/include/linux/interrupt.h:11,<br />from /lib/modules/2.6.18-pae/build/include/asm/highmem.h:23,<br />from /lib/modules/2.6.18-pae/build/include/linux/highmem.h:23,<br />from /lib/modules/2.6.18-pae/build/include/linux/pagemap.h:10,<br />from nandemul2k.c:27:<br />/lib/modules/2.6.18-pae/build/include/asm/hw_irq.h:31: error: ‘NR_IRQ_VECTORS’ undeclared here (not in a function)<br />nandemul2k.c: In function ‘nand_read’:<br />nandemul2k.c:307: warning: implicit declaration of function ‘nand_read_ecc’<br />nandemul2k.c: At top level:<br />nandemul2k.c:314: error: static declaration of ‘nand_read_ecc’ follows non-static declaration<br />nandemul2k.c:307: error: previous implicit declaration of ‘nand_read_ecc’ was here<br />nandemul2k.c: In function ‘nand_read_oob’:<br />nandemul2k.c:387: error: invalid operands to binary * (have ‘int’ and ‘size_t *’)<br />nandemul2k.c: In function ‘nand_write’:<br />nandemul2k.c:410: warning: implicit declaration of function ‘nand_write_ecc’<br />nandemul2k.c: At top level:<br />nandemul2k.c:416: error: static declaration of ‘nand_write_ecc’ follows non-static declaration<br />nandemul2k.c:410: error: previous implicit declaration of ‘nand_write_ecc’ was here<br />nandemul2k.c: In function ‘nandemul2k_scan’:<br />nandemul2k.c:602: error: ‘struct mtd_info’ has no member named ‘oobavail’<br />nandemul2k.c:617: warning: assignment from incompatible pointer type<br />nandemul2k.c:618: warning: assignment from incompatible pointer type<br />nandemul2k.c:619: warning: assignment from incompatible pointer type<br />nandemul2k.c:620: warning: assignment from incompatible pointer type<br />nandemul2k.c:623: error: ‘struct mtd_info’ has no member named ‘readv’<br />make: *** Error 1<br />.
make |grep nandemul2k<br /><br />再看出错信息,找那几行还是这几行代码。。。
我make |grep nandemul2k之后,出错代码没有减少。makefile 写的不对,2.6内核kbuild和2.4不同
<br />ifneq ($(KERNELRELEASE),)<br />obj-m := nandemul2k.o <br />else<br />KERNELDIR ?= /lib/modules/$(shell uname -r)/build<br />PWD := $(shell pwd) <br />modules:<br /> $(MAKE) -C $(KERNELDIR) M=$(PWD) modules<br />endif <br />谢谢,果然是Makefile写错了,但是还有错误。。。
修改过后的错误:<br /><br />make -C /lib/modules/2.6.18-pae/build M=/usr/src/linux-2.6.18/fs/yaffs2/mtdemul modules<br />make: Entering directory `/usr/src/linux-2.6.18'<br /> CC /usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.o<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c: In function ‘nand_read’:<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c:307: warning: implicit declaration of function ‘nand_read_ecc’<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c: At top level:<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c:314: error: static declaration of ‘nand_read_ecc’ follows non-static declaration<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c:307: error: previous implicit declaration of ‘nand_read_ecc’ was here<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c: In function ‘nand_read_oob’:<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c:387: error: invalid operands to binary * (have ‘int’ and ‘size_t *’)<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c: In function ‘nand_write’:<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c:410: warning: implicit declaration of function ‘nand_write_ecc’<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c: At top level:<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c:416: error: static declaration of ‘nand_write_ecc’ follows non-static declaration<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c:410: error: previous implicit declaration of ‘nand_write_ecc’ was here<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c: In function ‘nandemul2k_scan’:<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c:602: error: ‘struct mtd_info’ has no member named ‘oobavail’<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c:617: warning: assignment from incompatible pointer type<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c:618: warning: assignment from incompatible pointer type<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c:619: warning: assignment from incompatible pointer type<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c:620: warning: assignment from incompatible pointer type<br />/usr/src/linux-2.6.18/fs/yaffs2/mtdemul/nandemul2k.c:623: error: ‘struct mtd_info’ has no member named ‘readv’<br />make: *** Error 1<br />make: *** Error 2<br />make: Leaving directory `/usr/src/linux-2.6.18'<br />make: *** Error 2<br />
页:
[1]