2014年5月26日 星期一

kernel bsp 下 make menuconfig時,發生錯誤


 make menuconfig時,發生錯誤
前提已經修改
ARCH                    ?= arm
CROSS_COMPILE   ?= arm-linux-
________________________________________________________
cadtc@cadtc:~/20140520/linux-2.6.35.7-TQ210$ make menuconfig

make[1]: *** [scripts/kconfig/mconf] Error 1
make: *** [menuconfig] Error 2

………………………………………………………………………………
menubox.c:(.text+0x55): undefined reference to `wrefresh'
scripts/kconfig/lxdialog/menubox.o: In function `print_arrows':
menubox.c:(.text+0x1a5): undefined reference to `wrefresh'
scripts/kconfig/lxdialog/menubox.o: In function `do_print_item':
menubox.c:(.text+0x3b2): undefined reference to `wrefresh'
scripts/kconfig/lxdialog/menubox.o: In function `print_buttons':
menubox.c:(.text+0x4d4): undefined reference to `wrefresh'
collect2: ld returned 1 exit status
make[1]: *** [scripts/kconfig/mconf] Error 1
make: *** [menuconfig] Error 2

***************************************

解决方法如下:
sudo apt-get install build-essential
sudo apt-get install libncurses5
sudo apt-get install libncurses5-dev

2014年5月19日 星期一

u-boot下 /lib_arm/board.c 修改


#define GPD0DAT                           0xE02000A4 <==不能這樣寫,他讀到的是值,非位址

出現以下錯誤
board.c: In function 'buzzer_on':
board.c:225: error: lvalue required as left operand of assignment
board.c: In function 'buzzer_off':
board.c:234: error: lvalue required as left operand of assignment
board.c: At top level:
board.c:242: warning: function declaration isn't a prototype
make[1]: *** [board.o] Error 1
make[1]: Leaving directory `/home/cadtc/20140513/uboot_TQ210_1.3.4/lib_arm'
make: *** [lib_arm/libarm.a] Error 2
make: *** Waiting for unfinished jobs....
make[1]: Entering directory `/home/cadtc/20140513/uboot_TQ210_1.3.4/drivers/mtd/nand_legacy'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/cadtc/20140513/uboot_TQ210_1.3.4/drivers/mtd/nand_legacy'
make[1]: Entering directory `/home/cadtc/20140513/uboot_TQ210_1.3.4/drivers/mtd/onenand'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/cadtc/20140513/uboot_TQ210_1.3.4/drivers/mtd/onenand'
make: *** wait: 沒有子程序存在.  Stop.


#define GPD0DAT                            __REG(0xE02000A4)<==改成這樣變成指標指向位址

2014年5月15日 星期四

使用execl()改寫執行cat指令


#include<stdio.h>
#include<sys/wait.h>
#include<unistd.h>
int main(void)
{
pid_t pid=fork();
if(pid==0){
execl("/bin/cat", "cat", "/proc/cpuinfo", NULL);
perror("execl() error");
}
if(pid>0){
wait(NULL);
}
return 0;
}