2023年12月2日发(作者:)

移植android驱动遇到的一些问题和解决

郑重声明:

(可能有些不是能解决,还请见谅)

1、Q:apt-get: command not found

A:先搞清楚自己用的是啥系统吧,如果是ubuntu或者debian,去相应的版块问问题,否则,改用yum,Fedora里面找不到apt-get不是什么太奇怪的事情。

在Fedora里正确的安装procinfo的方法就是(首先确保你是超级用户),yum

install procinfo。你使用的su -c 'yum install procinfo'是正确的,如果装不上,

就把错误信息贴出来。

2、Q:nandflash如何正确分区:

A:(1)MISC分区

其中misc分区信息第一篇文章有解释: 保存设备配置信息:CID (Carrier

or Region ID),USB和其它硬件设备配置信息,大约20K的样子。

(2)recovery分区

recovery 分区即恢复分区,在正常分区被破坏后,仍可以进入这一分区进行备份和恢复.我的理解是这个分区保存一个简单的OS或底层软件,

在Android的内核被破坏后可以用bootloader从这个分区引导进行操作。

(3)boot 分区

一般的嵌入式Linux的设备中.bootloader,内核,根文件系统被分为三个不同分区。在Android做得比较复杂,从这个 分区和来看,

这里boot分区是把内核和ramdisk file的根文件系统打包在一起了,是编译生成来烧录的。它有如下格式。

(4)rootfs-combin分区:文件系统分区

(5)cache分区:缓存

(6)一个分区例子

[ 2.329249] 0x0000000c0000-0x : "misc"

[ 2.337472] 0x-0x : "recovery"

[ 2.343285] 0x-0x000000c00000 : "kernel"

[ 2.347297] 0x000000c00000-0x00000cc00000 : "rootfs-combin"

[ 2.384980] 0x00000cc00000-0x : "cache"

3、Q:想把自己写的一个flash的驱动程式加载到工程中,而且能够通过menuconfig配置内核时选择该驱动该怎么办呢?

A:第一:将您写的nandflash_tast.c 文档添加到/driver/mtd/maps/ 目录下。

第二:修改/driver/mtd/maps目录下的kconfig文档:

config MTD_nandflash_tast

tristate “my flash"

这样当make menuconfig时 ,将会出现 my flash选项。

第三:修改该目录下makefile文档。

4、Q:修改的地方?

A:archarmmach-s5pc100,原来没有mach-s5pc100,修改者把led、按键驱动、nandflash分区放置在这个文件夹中

5、Q:/root/android/common/drivers/mtd/maps/Makefile:10: *** 未终止的变量引用。 停止。make[2]: *** [drivers/mtd/maps] 错误 2

A:obj-$(CONFIG_MTD_flashtest += flashtest.o ,这句少了右边括号

6、Q:drivers/mtd/maps/nandflash_tast.c:66: fatal error: plat/regs-nand.h:

No such file or directory

A:取消电源管理选项

7、Q:

drivers/usb/gadget/r8a66597-udc.c: In function 'r8a66597_probe':

drivers/usb/gadget/r8a66597-udc.c:1585: error: implicit declaration of

function 'IS_ERR'

drivers/usb/gadget/r8a66597-udc.c:1588: error: implicit declaration of

function 'PTR_ERR'

make[2]: *** [drivers/usb/gadget/r8a66597-udc.o] 错误 1

make[1]: *** [drivers/usb/gadget] 错误 2

make: *** [drivers] 错误 2

A:取消USB Gadget Support 下的usb Peripheral Controller

8、Q:

drivers/video/console/vgacon.c: In function 'vgacon_startup':

drivers/video/console/vgacon.c:508: error: 'PCIMEM_BASE' undeclared (first

use in this function)

drivers/video/console/vgacon.c:508: error: (Each undeclared identifier is

reported only once

drivers/video/console/vgacon.c:508: error: for each function it appears in.)

drivers/video/console/vgacon.c: In function 'vgacon_do_font_op':

drivers/video/console/vgacon.c:1068: error: 'PCIMEM_BASE' undeclared

(first use in this function)

make[3]: *** [drivers/video/console/vgacon.o] 错误 1

make[2]: *** [drivers/video/console] 错误 2

make[1]: *** [drivers/video] 错误 2

A:去除部分:Device Drivers --->

Graphics support --->

Console display driver

support --->

[ ] VGA

text console

9、Q:cc1:

错误:unrecognized command line option ‘-mlittle-endian’

cc1: 错误:unrecognized command line option ‘-mno-thumb-interwork’

scripts/mod/empty.c:1:0: 错误:ABI (aapcs-linux)未知,-mabi= switch

scripts/mod/empty.c:1:0: 错误:-march= switch所带参数(armv5t)不正确

A: 是没有找到编译器的执行文件,export

CROSS_COMPILE=arm-none-linux-gnueabi-

11、Q:

arch/arm/common/vic.c:284: error: conflicting types for 'vic_init'

/root/android/common/arch/arm/include/asm/hardware/vic.h:44: note:

previous declaration of 'vic_init' was here

make[1]: *** [arch/arm/common/vic.o] 错误 1

12、Q:有的宏定义搜索不出来

A:sourceinsight配置keyconfig和makefile

14、

Q:drivers/input/touchscreen/s3c-ts.c:68: warning: "CONFIG_CPU_FREQ" is

not defined

net/ethernet/eth.c:402: warning: 'print_mac' is deprecated (declared at

net/ethernet/eth.c:397)

lib/decompress_bunzip2.c:511: warning: the frame size of 1880 bytes is

larger than 1024 bytes

15、Q:nandflash分区位置

16、Q:nandflash读写问题1

A:作者的内核是通过U-BOOT写到Nand Flash的, U-BOOT 通过的软件ECC算法产生ECC校验码, 这与内核校验的ECC码不一样, 内核中的ECC码是由S3C2410中

Nand Flash控制器产生的。所以,我在这里选择禁止内核ECC校验。 //此段引用别人的 我只是照此修改了 搜索关键字NAND_ECC_SOFT,在

s3c2410_nand_init_chip函数里,修改NAND_ECC_SOFT为NAND_ECC_NONE

17、Q:

drivers/video/s3c-fb.c:26: fatal error: mach/regs-fb.h: No such file or

directory compilation terminated.

A:不能直接用,改成

18、

Q:NAND read: device 0 offset 0x900000, size 0x300000

3145728 bytes read: OK

Boot with zImage do not support this address : 20008000

Starting kernel ......................................................................................

自后就不动了,

A:启动Location:

│ -> Kernel hacking

│ -> Kernel debugging (DEBUG_KERNEL [=y])

│ -> Debug object operations (DEBUG_OBJECTS [=n])

选择调试开关:

Kernel low-level debugging functions │ │

│ │ [ ] Kernel low-level debugging via EmbeddedICE DCC channel

19、Q:烧写进文件系统过后,不能重新烧写zImage

A:需要在进入时按下enter键进入SMDK100#命令控制,然后输入dnw

20008000

20、

Q: arch/arm/boot/compressed/../../../../lib/inflate.c:1286: error:

section attribute cannot be specified for local variables

arch/arm/boot/compressed/../../../../lib/inflate.c:1287: error: section

attribute cannot be specified for local variables

arch/arm/boot/compressed/../../../../lib/inflate.c:1288: error: section

attribute cannot be specified for local variables

arch/arm/boot/compressed/../../../../lib/inflate.c:1291: error: section

attribute cannot be specified for local variables

arch/arm/boot/compressed/../../../../lib/inflate.c:1295: error: section

attribute cannot be specified for local variables

已经找到原因:

KFT的profile all if conditionals的原因,去掉就行。

21、

Q: <1>Unable to handle kernel NULL pointer dereference at virtual

address 0000007c

<1>pgd = c0004000

<1>[0000007c] *pgd=00000000

<0>Internal error: Oops: 5 [#1]

<0>last sysfs file:

Modules linked in:

CPU: 0 Not tainted (2.6.32.9-00862-g750bc63-dirty #26)

PC is at device_for_each_child+0x10/0x70

LR is at i2c_check_addr+0x28/0x34 A: i2c_check_addr函数对相应的地址访问或修改非法,???????

includelinuxi2c.h,137行添加:int id;

Symbol: S5PC1XX_SETUP_I2C0 [=y]

│ Symbol: S5PC1XX_SETUP_I2C1 [=y]

取消--Kconfig (archarmplat-s5pc1xx):47

config S5PC1XX_SETUP_I2C0

bool

default y(改成:default n)

config S5PC1XX_SETUP_I2C1

bool

default y(改成:default n)

取消--archarmmach-s5pc100Kconfig,注释掉:#select S3C_DEV_I2C1

22、Q:VFS: Cannot open root device "mtdblock2" or unknown-block(2,0)

A:文件系统没有选择正确

23、

报错:<3>init: untracked pid 3479 exited

<3>init: untracked pid 3494 exited

处理:取消选中:< > NFS client support

24,

有个选项没发现处理:Boot options-->() Default kernel command string

CONFIG_CMDLINE="root=/dev/mtdblock2 rootfstype=cramfs init=/linuxrc

console=ttySAC2,115200 mem=128M"

mem=32M console=ttyS0,115200 initrd=0x20210000,3145728

root=/dev/arm rw

fs/proc/task_mmu.c: In function 'pagemap_read':

fs/proc/task_mmu.c:755: warning: ignoring return value of 'copy_to_user',

declared with attribute warn_unused_result

fs/yaffs2/yaffs_guts.c:1571: warning: 'yaffs_DeleteWorker' defined but not

used

fs/yaffs2/yaffs_guts.c:600: warning: 'yaffs_VerifyTnodeWorker' defined but

not used

<4>yaffs tragedy: attempting to use non-directory as a directory in scan. Put

in lost+found. 已取消----fsyaffs2yaffs_fs.c,123行改成:unsigned int

yaffs_auto_checkpoint = 2;

有建议:从yaffs2文件系统所挂载的分区的开始,到nand flash 的最后,这段空间,都要完全擦除

方法(1)先取消yaffs的编译 < > YAFFS2 file system support

方法(2)修改config MTD_NAND_S3C2410

config MTD_NAND_S3C2410_DEBUG

config MTD_NAND_S3C2410_HWECC

config MTD_NAND_S3C2410_CLKSTOP

原因:这几个选项会覆盖s5pcxx的

处理后还是报错,可能是没有重新编译到想应改动的地方。

driversvideoKconfig,去掉config FB_S3C,config

FB_S3C_DEBUG_REGWRITE

button未编译,

static int wait_for_one_process(int block)函数中

static int wait_for_one_process(int block)

{

pid_t pid;

int status;

struct service *svc;

struct socketinfo *si;

time_t now;

struct listnode *node;

struct command *cmd;

while ( (pid = waitpid(-1, &status, block ? 0 : WNOHANG)) == -1 &&

errno == EINTR );

if (pid <= 0) return -1;

INFO("waitpid returned pid %d, status = %08xn", pid, status);

svc = service_find_by_pid(pid);

if (!svc) {

ERROR("untracked pid %d exitedn", pid); //这里报的错吧,什么原因呢

return 0;

}

如过是通过generic生成的android,启动时会有如下错误提示:

init: untracked pid 1870 exited

init: untracked pid 1918 exited

init: untracked pid 1870 exited

init: untracked pid 1918 exited init: untracked pid 1870 exited

init: untracked pid 1918 exited

等 问题,

主要是原因是权限问题。

文件系统在启动时,被挂载成只读的了。需要在中将其改变成可读写的。

如果我们使用NFS文件系统,则配置文件应如下:

/source/ *(rw,sync,no_root_squash)

只能用这个。用别的都会报错误哦~

希望大家喜欢,如果您有任何问题,请访问清源教育论坛提问讨论或者交流,谢谢阅读!

来源:清源教育