编译uCliunx内核时报错如下:
make[2]: Entering directory `/home/Layne/uClinux-dist/linux-2.4.x/arch/armnommu/mach-c5471'
make all_targets
make[3]: Entering directory `/home/Layne/uClinux-dist/linux-2.4.x/arch/armnommu/mach-c5471'
arm-elf-gcc -D__KERNEL__ -I/home/Layne/uClinux-dist/linux-2.4.x/include -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -fno-common -pipe -fno-builtin -D__linux__ -g -DNO_MM -mapcs-32 -march=armv4 -mtune=arm7tdmi -mshort-load-bytes -msoft-float -nostdinc -iwithprefix include -DKBUILD_BASENAME=arch -c -o arch.o arch.c
arch.c:23: `MACH_TYPE_C5471' undeclared here (not in a function)
arch.c:23: initializer element is not constant
arch.c:23: (near initialization for `__mach_desc_C5471.nr')
找到arch\armnommu下的arch.c文件,发现压根没有什么MACH_TYPE_C5471,再找到其中包含的头文件arch.h ,包含以下代码:
/*
* Set of macros to define architecture features. This is built into
* a table by the linker.
*/
#define MACHINE_START(_type,_name) \
const struct machine_desc __mach_desc_##_type \
__attribute__((__section__(".arch.info"))) = { \
.nr = MACH_TYPE_##_type, \
.name = _name,
#define MAINTAINER(n)
#define BOOT_MEM(_pram,_pio,_vio) \
.phys_ram = _pram, \
.phys_io = _pio, \
.io_pg_offst = ((_vio)>>18)&0xfffc,
#define BOOT_PARAMS(_params) \
.param_offset = _params,
#define VIDEO(_start,_end) \
.video_start = _start, \
.video_end = _end,
#define DISABLE_PARPORT(_n) \
.reserve_lp##_n = 1,
#define BROKEN_HLT /* unused */
#define SOFT_REBOOT \
.soft_reboot = 1,
#define FIXUP(_func) \
.fixup = _func,
#define MAPIO(_func) \
.map_io = _func,
#define INITIRQ(_func) \
.init_irq = _func,
#define MACHINE_END \
};
看不懂其中的:
const struct machine_desc __mach_desc_##_type \
__attribute__((__section__(".arch.info"))) = { \
.nr = MACH_TYPE_##_type, \
.name = _name,
这是一个结构体么?怎么怪怪的?在结构体中再定义宏?哪位高人帮忙指点一下这段代码到底是什么意思?
[align=right][color=#000066][此贴子已经被作者于2005-9-1 10:46:41编辑过][/color][/align]