使用的工程为snappear
1.
Q:
arch/arm/mach-ixp4xx/ixdp425-setup.c:226: error: `IRQT_RISING' undeclared (first use in this function)
A:
IRQT_RISING is defined include/asm/irq.h中,so #include
and
2.
Q:
ixp400: Unknown symbol system_utsname
A:
新的内核已经没有这个结构变量。由于老的驱动还要用到这个结构变量,所以在新的内核源代码的init/version.c文件添加如下代码:
struct new_utsname system_utsname = {
.sysname = UTS_SYSNAME,
.nodename = UTS_NODENAME,
.release = UTS_RELEASE,
.version = UTS_VERSION,
.machine = UTS_MACHINE,
.domainname = UTS_DOMAINNAME,
};
EXPORT_SYMBOL(system_utsname);
注:以上代码取自linux-2.6.16.RT.x
3.
Q:
/mnt/dvp/adv950_modules/adv950_v3_26/2.6/8250.c:1616: error: `UART_IIR_RDITO' undeclared (first use in this function)
A:
在include/linux/serial_reg.h添加如下宏定义:
#define UART_IER_RDITO 0x20 /* Enable character interrupt */
#define UART_IIR_RDITO 0x0C
4.
Q:
kobject_add failed for ttyAP2 with -EEXIST, don't try to register things with the same name in the same directory.
A:
2.6.16和2.6.20的内核不会出现如此警告;但2.6.29则会出现如此警告。
5.
Q:
ixp400: module license 'unspecified' taints kernel.
ixp400: Unknown symbol add_preempt_count
ixp400: Unknown symbol debug_smp_processor_id
ixp400: Unknown symbol sub_preempt_count
A:
delete ixp_osal/lib/ixp43X/linux/linuxbe and ixp400_xscale_sw/ixp43X/lib/linuxbe,then
recompile it ,you may get right!
6.
Q:
ucfront-gcc前缀的作用是什么?
A:
ucfront-gcc其实就是为编译器添加如下选项:(以armeb-unknown-linux-gnu-的编译器来进行说明)
armeb-unknown-linux-gnu-gcc -nostdinc -idirafter /mnt/winF/dvp/include -isystem /mnt/winF/dvp/glibc-2.9/build/include -isystem /mnt/winF/dvp/include/gcc -mbig-endian -mcpu=xscale -mtune=xscale
7.
Q:
在linux-2.6.29.RT.x下调试串口驱动的时候,当执行tty_register_device的时候打印出oops错误,错误内容如下:
sysfs: duplicate filename 'ttyAP0' can not be created in tty
而在linux-2.6.20.RT.x和linux-2.6.16.RT.x上则没有这个问题
A:
去掉内核配置中File system --->Pseudo filesystems --->sysfs file system support选项
就没有上述问题了。
暂时怀疑是2.6.29.RT.x对sysfs file system的支持不太好
8.
Q:
串口驱动里边的membase和mapbase有什么区别?
我的驱动里,各个端口的这两个值如下;
(1)membase=0xc898c000 mapbase=0x48000000
(2)membase=0xc898c020 mapbase=0x48000020
(3)membase=0xc898c040 mapbase=0x48000040
(4)membase=0xc898c060 mapbase=0x48000060
但我发现,寄存器的读写是以membase为基准的。
A:
mapbase是物理地址,硬件定义好的。
membase是针对内核的地址,是经过mmu映射的虚拟地址,mapbase只有通过ioremap映射为membase以后,才能被内核识别
9.
Q:
在串口驱动(2.6.29)的移植中,碰到一个这样的问题:
有时候执行insmod adv950.ko时(有时候是ok的),初始化到一半时,系统重启。调试时发现程序执行到serial_core.c文件中
“drv->state = kmalloc(sizeof(struct uart_state) * drv->nr, GFP_KERNEL);”这句代码的时候,系统重启。
A:
刚开始以为是kernel内存管理的问题,但是别的驱动都是好好的,而且我尝试在button.ko文件中申请同样大小的内存是ok的,没有
出现重启的问题。后来发现系统启动后,第一次insmod adv950.ko总是成功的,之后rmmod adv950.ko,然后insmod adv950.ko的时候才会
重启。后来发现执行rmmod adv950.ko的时候,驱动会作一些清理操作,其中有一句free(info),但可惜的是此处的info并不是通过kmalloc
获取到的。所以猜测是此处的bug导致内存管理的混乱。将此处的错误修改以后,问题解决。
10.
Q.
在执行rmmod ixp4xx-ehci-hcd.ko命令的时候,出现如下oops错误:
WARNING: at drivers/base/core.c:122 device_release+0x68/0x74()
Device 'ixp4xx-ehci.0' does not have a release() function, it is broken and must be fixed.
Modules linked in: [last unloaded: ixp4xx_ehci_hcd]
[] (dump_stack+0x0/0x14) from [] (warn_slowpath+0x68/0x9c)
[] (warn_slowpath+0x0/0x9c) from [] (device_release+0x68/0x74)
r3:bf130668 r2:c039c685
r7:c7a0bf38 r6:c7a84bc0 r5:c03d7d9c r4:bf130644
[] (device_release+0x0/0x74) from [] (kobject_release+0x48/0x5c)
[] (kobject_release+0x0/0x5c) from [] (kref_put+0x78/0x88)
r6:c03cac34 r5:c017ba4c r4:bf130660
[] (kref_put+0x0/0x88) from [] (kobject_put+0x48/0x58)
r5:bf1307b0 r4:bf130644
[] (kobject_put+0x0/0x58) from [] (put_device+0x1c/0x20)
r4:bf1305e0
[] (put_device+0x0/0x20) from [] (platform_device_put+0x1c/0x20)
[] (platform_device_put+0x0/0x20) from [] (platform_device_unregister+0x1c/0x20)
[] (platform_device_unregister+0x0/0x20) from [] (ixp4xx_ehci_cleanup+0x38/0x4c [ixp4xx_ehci_hcd])
r4:00000000
[] (ixp4xx_ehci_cleanup+0x0/0x4c [ixp4xx_ehci_hcd]) from [] (sys_delete_module+0x20c/0x280)
[] (sys_delete_module+0x0/0x280) from [] (ret_fast_syscall+0x0/0x2c)
r8:c0025024 r7:00000081 r6:6863695f r5:78785f65 r4:69787034
A.
这个错误发生在删除usb驱动时对设备进行unregister的时候:
platform_device_unregister(device);//device = &ixdp4xx_ehci_controller[0];
其中ixdp4xx_ehci_controller的定义如下:
static struct platform_device ixdp4xx_ehci_controller[] = {
/* Host controller 0 */
{
.name = IXP4XX_EHCI_NAME,
.id = 0,
.dev = {
.dma_mask = &ehci_dma_mask,
.coherent_dma_mask = 0xffffffff,
},
.resource = ixp4xx_ehci_host0_res,
.num_resources = 2,
},
}
WARNING警告出自内核的如下代码:driver/base/core.c
static void device_release(struct kobject *kobj)
{
struct device *dev = to_dev(kobj);
if (dev->release)
dev->release(dev);
else if (dev->type && dev->type->release)
dev->type->release(dev);
else if (dev->class && dev->class->dev_release)
dev->class->dev_release(dev);
else
WARN(1, KERN_ERR "Device '%s' does not have a release() "
"function, it is broken and must be fixed.\n",
dev_name(dev));
}
根据警告信息提示,我在ixdp4xx_ehci_controller[0]的.dev域下实现了一个空的release函数,解决办法如下:
static void ixdp4xx_ehci_controller_release(struct device *dev)
{
printk(KERN_INFO "\nixdp4xx_ehci_controller_release...");
}
static struct platform_device ixdp4xx_ehci_controller[] = {
/* Host controller 0 */
{
.name = IXP4XX_EHCI_NAME,
.id = 0,
.dev = {
.dma_mask = &ehci_dma_mask,
.coherent_dma_mask = 0xffffffff,
.release = &ixdp4xx_ehci_controller_release
},
.resource = ixp4xx_ehci_host0_res,
.num_resources = 2,
},
}
然后ok
11
Q.
执行insmod /lib/modules/`uname -r`/kernel/drivers/net/ixp400_eth.ko no_phy_scan=1 phy_reset=1,然后rmod ixp400_eth.ko.
之后再次insmod ixp400_eth.ko的时候,失败,提示如下:
ixp400_eth: Initializing IXP400 NPE Ethernet driver software v. 1.7SG
ixp400_eth: CPU clock speed (approx) = 398 MHz
ixQMgrInit: IxQMgr already initialised
ixp400_eth: Error initialising queue manager!
insmod: cannot insert `/lib/modules/2.6.29.6-rt24/kernel/drivers/net/ixp400_eth.ko': Operation not permittedd
A.
insmod的时候执行如下操作:
insmod /lib/modules/ixp400.ko
cat /etc/IxNpeMicrocode.dat > /dev/ixNpe
insmod /lib/modules/`uname -r`/kernel/drivers/net/ixp400_eth.ko no_phy_scan=1 phy_reset=1 npe_learning=0
rmmod的时候执行如下操作:
rmmod ixp400_eth.ko
rmmod ixp400.ko
就不会出现上面的问题了
12
Q.
在/mnt/winF/com进行编译时,弹出如下错误:
/mnt/winF/com/glibc-2.9/build/include/limits.h:125:26: error: limits.h: No such file or directory
A.
/mnt/winF/com/glibc-2.9/build/include/limits.h文件的第125行附近:
125# include_next
126#endif
127
128/* The files in some gcc versions don't define LLONG_MIN,
129 LLONG_MAX, and ULLONG_MAX. Instead only the values gcc defined for
130 ages are available. */
我的解决办法:
在/mnt/winF/com/include文件夹下建立一个文件limits.h
内容如下:
/*
this file was added by jinxin
*/
#ifndef _LINUX_LIMITS_H
#define _LINUX_LIMITS_H
#define NR_OPEN 1024
#define NGROUPS_MAX 65536 /* supplemental group IDs are available */
#define ARG_MAX 131072 /* # bytes of args + environ for exec() */
#define LINK_MAX 127 /* # links a file may have */
#define MAX_CANON 255 /* size of the canonical input queue */
#define MAX_INPUT 255 /* size of the type-ahead buffer */
#define NAME_MAX 255 /* # chars in a file name */
#define PATH_MAX 4096 /* # chars in a path name including nul */
#define PIPE_BUF 4096 /* # bytes in atomic write to a pipe */
#define XATTR_NAME_MAX 255 /* # chars in an extended attribute name */
#define XATTR_SIZE_MAX 65536 /* size of an extended attribute value (64k) */
#define XATTR_LIST_MAX 65536 /* size of extended attribute namelist (64k) */
#define INT_MIN (-INT_MAX - 1)
#define INT_MAX 2147483647
#define RTSIG_MAX 32
#define UINT_MAX 4294967295U
#define LONG_MAX 2147483647L
#define LONG_MIN (-LONG_MAX - 1L)
#define ULONG_MAX 4294967295UL
#define UCHAR_MAX 255
#endif
然后重新编译,问题解决
13
Q.
(*(unsigned long *)&jiffies)++;
有人对这个语句的解释是:
更新系统时间,这种写法保证对jiffies操作的原子性,请问为什么 ?
A.
14
Q.
现insmod adv950.ko,然后st -svoa -m 232 /dev/ttyAP0 -b 115200 -c n81 -f none,然后rmmod adv950.ko
结果出现如下oops信息:
[] (check_tty_count+0x0/0xb8) from [] (do_tty_hangup+0x60/0x32c)
r6 = C0283148 r5 = C7B900A0 r4 = BF1143E0
[] (do_tty_hangup+0x0/0x32c) from [] (tty_vhangup+0x10/0x14)
[] (tty_vhangup+0x0/0x14) from [] (adv_uart_resume_port+0x27c/0x2c8 [adv950])
[] (adv_uart_resume_port+0x250/0x2c8 [adv950]) from [] (adv_uart_remove_one_port+0x78/0x94 [adv950])
r6 = BF113608 r5 = BF1143E0 r4 = C7F39000
[] (adv_uart_remove_one_port+0x0/0x94 [adv950]) from [] (adv_serial8250_exit+0x28/0xedc [adv950])
r7 = C7B9BF48 r6 = C7B9A000 r5 = BF1144A8 r4 = BF117518
[] (adv_serial8250_exit+0x0/0xedc [adv950]) from [] (cleanup_module+0x24/0x30 [adv950])
r5 = 00000000 r4 = BF1142A0
[] (cleanup_module+0x0/0x30 [adv950]) from [] (sys_delete_module+0x1b8/0x1e0)
[] (sys_delete_module+0x0/0x1e0) from [] (ret_fast_syscall+0x0/0x2c)
A.
这个问题是由于在uart_unconfigure_port函数中,没有将state->info置为NULL,加入下面的语句就好了
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
state->info = NULL;
#endif
15
Q.
# ifconfig ixp1 172.21.73.87
ixp400_eth: ixp1: ixEthDBPortAgingEnable failed for port 1, res = 3
SIOCSIFFLAGS: Operation not permitted
A.
在2.6.16.RT.x下使用insmod /lib/modules/`uname -r`/kernel/drivers/net/ixp400_eth.ko no_phy_scan=1 phy_reset=1命令插入模块会出现如上问题,
解决办法是,插入模块的时候,指定npe_learning参数为0
insmod /lib/modules/`uname -r`/kernel/drivers/net/ixp400_eth.ko no_phy_scan=1 phy_reset=1 npe_learning=0
16
Q.
struct uart_state *state;//有一个struct uart_info *类型的成员
struct uart_info *info = state->info;//state->info=0xc7b7e620
state->info = NULL;
info = ??
A.
info = 0xc7b7e620而不是NULL
上次我犯的这个初级的错误,让我对一个串口驱动调试了一天
17
Q.file,file_operations,dentry和inode_operations结构的区别和联系
A.
struct file {
/*
* fu_list becomes invalid after file_free is called and queued via
* fu_rcuhead for RCU freeing
*/
union {
struct list_head fu_list;
struct rcu_head fu_rcuhead;
} f_u;
struct dentry *f_dentry;//文件对应的目录项结构,一般使用filp->f_dentry->d_inode的方式来访问文件或目录的索引节点的结构
struct vfsmount *f_vfsmnt;
struct file_operations *f_op;
atomic_t f_count;
unsigned int f_flags;
mode_t f_mode;
loff_t f_pos;
struct fown_struct f_owner;
unsigned int f_uid, f_gid;
struct file_ra_state f_ra;
unsigned long f_version;
void *f_security;
/* needed for tty driver, and maybe others */
void *private_data; //用来在跨系统调用时保存状态信息
#ifdef CONFIG_EPOLL
/* Used by fs/eventpoll.c to link all the hooks to this file */
struct list_head f_ep_links;
spinlock_t f_ep_lock;
#endif /* #ifdef CONFIG_EPOLL */
struct address_space *f_mapping;
};
file是一个内核结构,它不会出现在用户程序中。
每个文件除了有一个索引节点inode数据结构外,还有一个目录项dentry(directory enrty)数据结构。dentry 结构中有个d_inode指针指向相应的inode结构。读者也许会问,既然inode结构和dentry结构都是对文件各方面属性的描述,那为什么不把这两个结构“合而为一”呢?这是因为二者所描述的目标不同,dentry结构代表的是逻辑意义上的文件,所描述的是文件逻辑上的属性,因此,目录项对象在磁盘上并没有对应的映像;而inode结构代表的是物理意义上的文件,记录的是物理上的属性,对于一个具体的文件系统(如Ext2),Ext2_ inode结构在磁盘上就有对应的映像。所以说,一个索引节点对象可能对应多个目录项对象。一个有效的dentry结构必定有一个inode结构,这是因为一个目录项要么代表着一个文件,要么代表着一个目录,而目录实际上也是文件。所以,只要dentry结构是有效的,则其指针d_inode必定指向一个inode结构。可是,反过来则不然,一个inode却可能对应着不止一个dentry结构;也就是说,一个文件可以有不止一个文件名或路径名。这是因为一个已经建立的文件可以被连接(link)到其他文件名。所以在inode结构中有一个队列i_dentry,凡是代表着同一个文件的所有目录项都通过其dentry结构中的d_alias域挂入相应inode结构中的i_dentry队列。
file_operations用来建立驱动程序和设备编号的连接。
具体文件系统的索引节点是存储在磁盘上的,是一种静态结构,要使用它,必须调入内存,填写VFS的索引节点,因此,也称VFS索引节点是动态节点。
struct inode有两个操作成员
struct inode_operations *i_op; /*索引节点的操作*/
struct file_operations *i_fop; /*指向文件操作的指针 */
18
Q.
2007-10-14 12:09:51:DIO error, setting DO as 0, but get DI:F0, DO:F0
2007-10-14 12:09:52:DIO error, setting DO as 1, but get DI:F0, DO:F1
2007-10-14 12:09:52:DIO error, setting DO as 2, but get DI:F0, DO:F2
2007-10-14 12:09:53:DIO error, setting DO as 3, but get DI:F0, DO:F3
2007-10-14 12:09:53:DIO error, setting DO as 4, but get DI:F0, DO:F4
2007-10-14 12:09:54:DIO error, setting DO as 5, but get DI:F0, DO:F5
2007-10-14 12:09:54:DIO error, setting DO as 6, but get DI:F0, DO:F6
2007-10-14 12:09:55:DIO error, setting DO as 7, but get DI:F0, DO:F7
2007-10-14 12:09:55:DIO error, setting DO as 8, but get DI:F0, DO:F8
2007-10-14 12:09:56:DIO error, setting DO as 9, but get DI:F0, DO:F9
2007-10-14 12:09:56:DIO error, setting DO as A, but get DI:F0, DO:FA
2007-10-14 12:09:57:DIO error, setting DO as B, but get DI:F0, DO:FB
2007-10-14 12:09:58:DIO error, setting DO as C, but get DI:F0, DO:FC
2007-10-14 12:09:58:DIO error, setting DO as D, but get DI:F0, DO:FD
2007-10-14 12:09:59:DIO error, setting DO as E, but get DI:F0, DO:FE
2007-10-14 12:09:59:DIO error, setting DO as F, but get DI:F0, DO:FF
A.
对于EKI-1128上的dio,di和do寄存器的高四位总是1。do和di接在了一起,di的值应该等于do的值.
按照如下顺序接线:
DI 1 <-> DO 1, DI 2 <-> DO 2, DI 3 <-> DO 3, DI 4 <-> DO4, V+ <-> 24V, V- <-> GND
do的bit 0~3控制第1~4个灯
19
Q.编译uClibc时(摘自lib/Makefile的如下片段):
.PHONY: $(DIRS_y)
$(DIRS_y):
if [ $(findstring glibc,$@) == "glibc" ];then \
[ ! -d "$@" ] || touch $@/.sgbuilt_lib && $(MAKE) -j$(HOST_NCPU) -C $(ROOTDIR)/$@/$(GLIBC_BUILD) && make -C $(ROOTDIR)/$@/$(GLIBC_BUILD) install; \
else \
[ ! -d "$@" ] || ( touch $@/.sgbuilt_lib && $(MAKE) -j$(HOST_NCPU) -C $@ ) || exit $$?; \
fi
编译出错,而
.PHONY: $(DIRS_y)
$(DIRS_y):
if [ $(findstring glibc,$@) == "glibc" ];then \
[ ! -d "$@" ] || touch $@/.sgbuilt_lib && $(MAKE) -j$(HOST_NCPU) -C $(ROOTDIR)/$@/$(GLIBC_BUILD) && make -C $(ROOTDIR)/$@/$(GLIBC_BUILD) install; \
else \
[ ! -d "$@" ] || ( touch $@/.sgbuilt_lib && $(MAKE) -j1 -C $@ ) || exit $$?; \
fi
则成功。编译时,我的机器i686,core 2.
A.觉得可能是此处的多线程编译导致了依赖的混乱,看来在Makefile中不能随心所欲的使用make的 '-j'参数
20
Q.
static wait_queue_head_t wq;
wake_up_interruptible(&wq)
假如wq没有等待队列,会咋样?会立即返回,然后执行下一个语句么?
假如wq有等待队列,那会不会引发进程调度?
21
Q.poll_wait()函数的作用?
A.
首先,poll_wait函数并不阻塞,真正的阻塞动作是上层的select函数中完成的。
select会在一个循环中对每个需要监听的设备调用它们自己的poll支持函数以使得当前进程被加入各个设备的等待列表。若当前没有任何被监听的设备就绪,则select/poll阻塞一定的时间(时间由select函数的最后一个参数确定),假如在此期限内,有被监听的设备就绪,则返回select的下一条语句继续执行,否则,超时,select返回。
22.
Q.wai_event及其变种是无法执行独占等待的,那么如何执行独占等待呢?
A.
23.
Q.如果调用wake_up的进程在原子上下文中(拥有自旋锁或在一个中断处理例程中),则重新调度就不会发生;而wake_up_interruptible_sync保证无论是否在原子操作,在唤醒返回后,本进程的调度不会被新唤醒的进程抢占,本进程依然运行。
这两者有什么区别?
24.
Q.linux-2.6.25.RT.x/include/linux/inetdevice.h:215: error: parse error before "mask"
A.发现可能是不识别__be32这个类型.进一步检查,发现假如#ifdef __KERNEL__,那么使用这个类型是没有问题的,但是,我现在是在用户空间调用,所以就不能识别了。
修正办法,将不被__KERNEL__包括的__de32改为__u32,OK
25.
Q.
CC arch/arm/kernel/process.o
In file included from /mnt/winF/sbmt/linux-2.6.29.RT.x/arch/arm/include/asm/system.h:63,
from include/linux/list.h:7,
from include/linux/module.h:9,
from arch/arm/kernel/process.c:13:
/mnt/winF/sbmt/linux-2.6.29.RT.x/arch/arm/include/asm/memory.h:117:1: warning: "__virt_to_phys" redefined
arch/arm/mach-w90n740/include/mach/memory.h:18:1: warning: this is the location of the previous definition
出现如上警告信息的含义,我们该怎么作?
A.
process.c的第13行是#include
linux/module.h的第9行是#include
linux/list.h的第7行是#include
asm/system.h的第63行是#include
asm/memrory的第117行出现了重复定义
之前的定义在mach/memory.h文件的第18行
出现上面的警告信息,表明发生了重复定义,那么我们应该仔细推敲,一定要搞清楚我们应该使用哪一个定义,而不是能因为它是个警告而轻易放过它。
26.
Q.编译内核的时候,出现了如下error:
/mnt/winF/sbmt/linux-2.6.29.RT.x/arch/arm/include/asm/elf.h: Assembler messages:
/mnt/winF/sbmt/linux-2.6.29.RT.x/arch/arm/include/asm/elf.h:85: Error: bad instruction `extern char elf_platform[]'
/mnt/winF/sbmt/linux-2.6.29.RT.x/arch/arm/include/asm/elf.h:87: Error: bad instruction `struct elf32_hdr'
/mnt/winF/sbmt/linux-2.6.29.RT.x/arch/arm/include/asm/elf.h:92: Error: bad instruction `extern int elf_check_arch(const struct elf32_hdr*)'
/mnt/winF/sbmt/linux-2.6.29.RT.x/arch/arm/include/asm/elf.h:95: Error: bad instruction `extern int arm_elf_read_implies_exec(const struct elf32_hdr*,int)'
/mnt/winF/sbmt/linux-2.6.29.RT.x/arch/arm/include/asm/elf.h:113: Error: bad instruction `extern void elf_set_personality(const struct elf32_hdr*)'
make[2]: *** [arch/arm/mach-w90n740/head.o] Error 1
A.
此处的代码如下:(处在asm/elf.h)
85 extern char elf_platform[];
86 struct elf32_hdr;
87 extern int elf_check_arch(const struct elf32_hdr *);
88 extern int arm_elf_read_implies_exec(const struct elf32_hdr *, int);
89 extern void elf_set_personality(const struct elf32_hdr *);
这是一段很正常的C语言,怎么会出现:“bad instruction”这样的错误呢?
再仔细看,发现还有一句话:“Assembler messages”,原来是head.S这个汇编文件里包含了asm/elf.h这个文件,而elf.h文件里边有一些汇编程序不能识别的语句。解决的办法是:
#ifndef __ASSEMBLY__
extern char elf_platform[];
struct elf32_hdr;
extern int elf_check_arch(const struct elf32_hdr *);
extern int arm_elf_read_implies_exec(const struct elf32_hdr *, int);
extern void elf_set_personality(const struct elf32_hdr *);
#endif
__ASSEMBLY__在哪里定义呢?
head.o := arm-elf-gcc -Wp,-MD,arch/arm/mach-w90n740/.head.o.d -nostdinc -isystem /usr/local/arm-uclinux-tool-20080121/lib/gcc/arm-uclinux/3.4.3/include -Iinclude -I/mnt/winF/sbmt/linux-2.6.29.RT.x/arch/arm/include -include include/linux/autoconf.h -D__KERNEL__ -mlittle-endian -Iarch/arm/mach-w90n740/include -D__ASSEMBLY__ -mapcs-32 -mno-thumb-interwork -D__LINUX_ARM_ARCH__=4 -march=armv4t -mtune=arm7tdmi -msoft-float -c -o arch/arm/mach-w90n740/head.o arch/arm/mach-w90n740/head.S
可见,在编译汇编文件的时候,会在编译选项中添加宏定义“-D__ASSEMBLY__”,这样,汇编文件就知道应该去包含头文件中的那些语句了
27.
Q.
kernel/built-in.o(.text+0x24910): In function `cmpxchg_futex_value_locked':
: undefined reference to `pagefault_disable'
kernel/built-in.o(.text+0x24914): In function `cmpxchg_futex_value_locked':
: undefined reference to `pagefault_disable'
kernel/built-in.o(.text+0x2492c): In function `cmpxchg_futex_value_locked':
: undefined reference to `pagefault_enable'
kernel/built-in.o(.text+0x24930): In function `cmpxchg_futex_value_locked':
: undefined reference to `pagefault_enable'
A.
在include/asm-generic/cmpxchg-local.h中,其实cmpxchg_futex_value_locked没有任何地方定义它,所以,我的
办法很简单,直接注释掉
28.
Q.
arch/arm/mm/built-in.o(__ksymtab+0x88): undefined reference to `cpu_arm7tdmi_set_pte_ext'
A.
在arch/arm/mm/proc-arm7tdmi.S文件中直接添加一句:
ENTRY(cpu_arm7tdmi_set_pte_ext)
29.
Q.
在EKI-1122L向2.6.29.RT.x的移植中,文件系统启动了两个shell
A.
Makefile中有一句:
case "$(LINUXDIR)" in \
*2.4.*) ;; \
*) echo "ttyS0:linux:/bin/sh" >> $(ROMFSDIR)/etc/inittab ;; \
将其删除即可
30.
Q.
EKI-1122L在2.6.29.RT.x的串口驱动用st测试有如下问题:
当将串口的波特率设为921600时,接收错误(overrun:389996);而设为115200,则通讯正常;why?
A.
妥善设置串口的TTL和RTL的值
31.
Q.
linux串口控制台无法输入?
A.
这个帖子很完美的解决了这个问题:
32.
Q.
tty_insert_flip_string以及read BUG?
A.
这个帖子会让你眼界大开的
33.
Q.
想在uclinux+busybox下匿名访问ftp服务器
/etc/inetd.conf文件内容如下:
ftp stream tcp nowait root /bin/ftpd -A
在ftpd.c中有一句暗示:
“-A, --anonymous-only Server configure for anonymous service only\n\”
也就是说"-A"参数表示只允许匿名访问!
在pc上输入ftp 172.21.73.113
信息如下:
Connected to 172.21.73.113 (172.21.73.113).
220 AdvantechNew FTP server (GNU inetutils 1.4.1) ready.
Name (172.21.73.113:root): anonymous
331 Guest login ok, type your name as password.
Password:
550 Can't set guest privileges.
Login failed.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
“331 Guest login ok”但是又"550 Can't set guest privileges."
为什么?
A.
首先,执行 "adduser ftp"
然后,在/home下建立一个名为ftp的目录
之后执行:,chmod 777 ftp
然后就ok了
Note: 此时,只有两个用户可以访问ftp服务器:anonymous和ftp
34.
Q.
在uclinux+busybox上使用boa服务器时,同样的boa.conf配置文件,有时候可以正常访问,有时候则不可以,并出现如下错误信息:
404 Not Found
The requested URL / was not found on this server.
请问这是为什么?
A.
这是由于boa.conf配置文件的问题。假如你在pc中使用gedit访问过boa.conf,然后再放到uclinux+busybox环境中。那么在uclinux+busybox环境下boa.conf可能就不能识别。
所以碰到这种情况,我的解决办法是:在我的pc中,将boa.conf的内容先进行复制,然后粘贴到一个用vi打开的文件中,并将此文件保存为boa.conf,然后将其
通过ftp或tftp传到uclinux+busybox系统中。然后boa服务器就可以正常工作了。
35.
Q.
开发版系统上运行uclinux+busybox,在测试开发板上的telnetd时出现如下错误:
[root@localhost tftpboot]# telnet 172.21.73.113
Trying 172.21.73.113...
Connected to 172.21.73.113.
Escape character is '^]'.
telnetd: All network ports in use.
Connection closed by foreign host.
在uclinux系统的/dev目录下存在相应的ttyp*和ptyp*文件,请问是怎么回事?
A.
在一个帖子中看到:The issue is with the Unix98 Pty fs.受到启示,赶紧查看内核配置文件,没有选择CONFIG_UNIX98_PTYS,于是选择
CONFIG_UNIX98_PTYS=y
CONFIG_LEGACY_PTYS=y(这个也必须得选择)
CONFIG_LEGACY_PTY_COUNT=50
然后重新编译内核,烧写进flash,再次执行,ok
注意:此处CONFIG_LEGACY_PTY_COUNT=50是因为:本来默认是256,但是,我选择256以后,系统不停的重启,于是选择50,正好ok,于是设置CONFIG_LEGACY_PTY_COUNT=50
36.
Q.
configure参数host, target, build三者的含义是什么?
A.
build -- 在build系统中建立package
host -- 建立好package后,package能够在host运行
target -- 经由package所产生的可执行文件能够在target上运行。
例如:
在GNU/Linux系统上建立一个交叉编译工具,此交叉编译工具可以在AIX上运行,由此交叉编译出来的文件可以在ARM上运行,那么:
build = i*86-pc-linux-gnu
host = rs6000-ibm-aix3.2
target = arm-linux
37.
Q.
BUG: sleeping function called from invalid context at kernel/rtmutex.c:685
in_atomic(): 0, irqs_disabled(): 128, pid: 1, name: swapper
[<000223bc>] (dump_stack+0x0/0x14) from [<0002fd68>] (__might_sleep+0xe0/0x104)
[<0002fc88>] (__might_sleep+0x0/0x104) from [<00239cf4>] (rt_spin_lock+0x34/0x64)
r5:00000006 r4:002d0fb8
[<00239cc0>] (rt_spin_lock+0x0/0x64) from [<00077558>] (_slab_irq_disable+0x18/0x28)
r4:0035bd50
[<00077540>] (_slab_irq_disable+0x0/0x28) from [<000783cc>] (kmem_cache_alloc+0x44/0x148)
r4:0035bd50
[<00078388>] (kmem_cache_alloc+0x0/0x148) from [<00060500>] (request_irq+0x8c/0xdc)
r7:002d0098 r6:04000000 r5:00000006 r4:00e0a200
[<00060474>] (request_irq+0x0/0xdc) from [<0014a348>] (startup+0xfc/0x2ec)
[<0014a24c>] (startup+0x0/0x2ec) from [<0014b88c>] (rs_open+0x1e0/0x408)
r8:00500001 r7:00000000 r6:00000000 r5:002dbbb4 r4:00315444
[<0014b6ac>] (rs_open+0x0/0x408) from [<00142b48>] (tty_open+0x2b4/0x3ec)
[<00142894>] (tty_open+0x0/0x3ec) from [<0007ed7c>] (chrdev_open+0x1a4/0x1cc)
[<0007ebd8>] (chrdev_open+0x0/0x1cc) from [<0007af60>] (__dentry_open+0x194/0x2a4)
[<0007adcc>] (__dentry_open+0x0/0x2a4) from [<0007b194>] (nameidata_to_filp+0x4c/0x64)
[<0007b148>] (nameidata_to_filp+0x0/0x64) from [<0008544c>] (do_filp_open+0x358/0x6ec)
r5:0035bf14 r4:00000000
[<000850f4>] (do_filp_open+0x0/0x6ec) from [<0007b38c>] (do_sys_open+0x60/0xa4)
[<0007b32c>] (do_sys_open+0x0/0xa4) from [<0007b3f4>] (sys_open+0x24/0x28)
r8:00000000 r7:00000000 r6:0001b904 r5:0001b904 r4:002e4894
[<0007b3d0>] (sys_open+0x0/0x28) from [<0001e440>] (init_post+0x34/0x120)
[<0001e40c>] (init_post+0x0/0x120) from [<00008a14>] (kernel_init+0x114/0x164)
r4:002e4894
[<00008900>] (kernel_init+0x0/0x164) from [<0003ae40>] (do_exit+0x0/0x610)
r6:00000000 r5:00000000 r4:00000000
A.
查看内核代码,在kernel/rtmutex.c:685处的代码为:might_sleep();
在include/linux/kernel.h中,有对might_sleep的描述:
* might_sleep - annotation for functions that can sleep
*
* this macro will print a stack trace if it is executed in an atomic
* context (spinlock, irq-handler, ...).
只有在编译内核的时候选择了CONFIG_DEBUG_SPINLOCK_SLEEP或者CONFIG_DEBUG_PREEMPT,might_sleep才会起作用!
所以,一般的使用方法是:
在mm/slab.c中有一句:
might_sleep_if(flags & __GFP_WAIT);
#define might_sleep_if(cond) do { if (cond) might_sleep(); } while (0)
假如flags标记包含__GFP_WAIT,那么就表示要在原子上下文中用__GFP_WAIT标记来分配内存,这明显是不允许的,所以,打印出oops
目前还没有想到比较好的解决办法,这可能是内核的bug,我只能先把这个选项关闭!
38.
Q.在开发板上的linux+busybox的系统中执行:
/> snmpd -f -U -c /etc/snmp/snmpd.conf &
[294]
/>
Unhandled fault: vector exception (0x000) at 0x00000000
/>
开发板环境:
kernel版本:2.6.29.6-rt24
net-snmp版本:5.2.1
uClib版本:0.9.26
平台:arm7tdmi NOMMU
A.
尝试使用最新的net-snmpd,或许最新的net-snmpd已经解掉了这个bug!
下载net-snmp-5.4.1.tar.gz,解压为net-snmp-5.4.1.
#cd net-snmp-5.4.1
#mkdir build
#cd build
#CCFLAGS="-msoft-float" LDFLAGS="-elf2flt -staic" \
../configure --host=arm-linux --target=arm-elf --with-cc='arm-elf-gcc' --with-ar=arm-elf-ar \
--prefix=/tftpboot/Test --disable-shared --with-endianness=little --enable-mini-agent
#make
然后在build/agent下生成了新的snmpd,执行:
[root@localhost agent]# file snmpd
snmpd: BFLT executable - version 4 ram
说明生成的可执行文件是正确的,将snmpd通过ftp/tftp复制到板子上并运行如下命令:
snmpd -f -U -c /var/other1/snmpd.conf &
在pc上运行“snmpwalk -v 1 172.21.73.113 -c public system”,“172.21.73.113是开发板的ip地址”,出现如下输出,则表示ok了。
[root@localhost agent]# snmpwalk -v 1 172.21.73.113 -c public system
Timeout: No Response from 172.21.73.113
[root@localhost agent]# snmpwalk -v 1 172.21.73.113 -c public system
SNMPv2-MIB::sysDescr.0 = STRING: Linux AdvantechNew 2.6.29.6-rt24 #57 PREEMPT RT Fri Jun 11 13:14:55 CST 2010 armv4tl
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.255
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (150) 0:00:01.50
SNMPv2-MIB::sysContact.0 = STRING: root@acn.advantech.corp
SNMPv2-MIB::sysName.0 = STRING: AdvantechNew
SNMPv2-MIB::sysLocation.0 = STRING: Unknown
SNMPv2-MIB::sysORLastChange.0 = Timeticks: (7) 0:00:00.07
SNMPv2-MIB::sysORID.1 = OID: SNMPv2-MIB::snmpMIB
SNMPv2-MIB::sysORID.2 = OID: SNMP-VIEW-BASED-ACM-MIB::vacmBasicGroup
SNMPv2-MIB::sysORID.3 = OID: SNMP-FRAMEWORK-MIB::snmpFrameworkMIBCompliance
SNMPv2-MIB::sysORID.4 = OID: SNMP-MPD-MIB::snmpMPDCompliance
SNMPv2-MIB::sysORID.5 = OID: SNMP-USER-BASED-SM-MIB::usmMIBCompliance
SNMPv2-MIB::sysORDescr.1 = STRING: The MIB module for SNMPv2 entities
SNMPv2-MIB::sysORDescr.2 = STRING: View-based Access Control Model for SNMP.
SNMPv2-MIB::sysORDescr.3 = STRING: The SNMP Management Architecture MIB.
SNMPv2-MIB::sysORDescr.4 = STRING: The MIB for Message Processing and Dispatching.
SNMPv2-MIB::sysORDescr.5 = STRING: The management information definitions for the SNMP User-based Security Model.
SNMPv2-MIB::sysORUpTime.1 = Timeticks: (6) 0:00:00.06
SNMPv2-MIB::sysORUpTime.2 = Timeticks: (6) 0:00:00.06
SNMPv2-MIB::sysORUpTime.3 = Timeticks: (6) 0:00:00.06
SNMPv2-MIB::sysORUpTime.4 = Timeticks: (7) 0:00:00.07
SNMPv2-MIB::sysORUpTime.5 = Timeticks: (7) 0:00:00.07
阅读(4071) | 评论(0) | 转发(0) |