换平台项目移植

本文记录了一次从基于Renesas平台的应用移植到Freescale i.MX 6平台的过程。主要涉及图形库、OpenGL、内核、框架和应用程序的裁剪与调整。移植中遇到的挑战包括错误处理、库的替换、编译问题以及内核驱动的适配。通过对代码的逐个模块分析和修复,最终成功解决了编译错误和运行时问题,实现了平台间的平滑迁移。
摘要由CSDN通过智能技术生成

任务分析

       先大致看了一下代码,发现应用和BSP最大的相关部分在图形库及OpenGL层。这部分每个厂商有自己的实现,一般是不公开源码的,现在的平台是由Renesas提供的一些头文件及库。Freescale则有自己的实现。

 

       基于上面的情况,决定从现有的项目作为基础进行裁剪,把不需要的模块删除,只留下最基本的部分。

 

       看了一下代码,Kernel和Uboot部分肯定只能用新的(Freescalei.MX 6),framwork部分由于是应用的框架,所以可以用老的(Renesas )。system部分也基本上可以用老的。Packages是应用程序,用老的。Externals下由于是系统相关性比较强的框架,所以考虑用新的。

 

移植系统框架

       把没用的目录development,packages,framework删除,system部分也大部册子,只保留core/下的部分。Framwork和packages从老平台拷贝过来。

 

       Device下应该建立一个新的型号,简单起见,先用老的型号进行编译,等可以运行后再考虑建立一个新的型号。下载也沿用老的下载工具,包括分区信息也保持不变,这样至少可以排除掉这方面干扰,加快移植过程。

 

下面是裁剪过程中出现问题的记录。

make: *** Norule to make target `device/cxxd/common/kernel-mod/lib/modules/3.0.35/kernel/fs/fuse/fuse.ko',needed by `out/target/product/avx/obj/EXECUTABLES/fuse_intermediates/LINKED/fuse.ko'.  Stop.

device/cxxd/common/kernel-mod/kernel-mod.mk

       修改device/cxxd/avx/init.rc

删除remove fuse.ko

       http://172.26.13.23/gitweb/?p=dm001.git;a=commit;h=96c54e31865ec3c98352dcee25934db1df54a65b

 

system/core/init/bootani.c:81:2: error: #error "please definethese macro in makefile"

system/core/init/bootani.c:82:2: error: #error"BOOTANI_BLOCK_SYS_DIR"

system/core/init/bootani.c:83:2: error: #error"BOOTANI_DEV_BLOCK_HEAD_START"

system/core/init/bootani.c:84:2: error: #error "BOOTANI_DEV_BLOCK_HEAD_SIZE"

system/core/init/bootani.c:85:2: error: #error"BOOTANI_DEV_BLOCK_DATA_START"

system/core/init/bootani.c:86:2: error: #error"BOOTANI_DEV_BLOCK_DATA_SIZE_MAX"

system/core/init/bootani.c:87:2: error: #error"BOOTANI_ANI_FB_SYS_DIR"

system/core/init/bootani.c:88:2: error: #error"BOOTANI_ANI_PIXEL_FORMAT"

system/core/init/bootani.c: In function 'bootani_main':

system/core/init/bootani.c:1373:28:error: 'BOOTANI_ANI_FB_SYS_DIR' undeclared (first use in this function)

system/core/init/bootani.c:1373:28:note: each undeclared identifier is reported only once for each function itappears in

system/core/init/bootani.c:1373:28: error: expected ')' beforestring constant

system/core/init/bootani.c:1373:28: error: too few arguments tofunction 'stat'

prebuilt/toolchains/arm-fsl-linux-gnueabi/4.6.2/bin/../arm-fsl-linux-gnueabi/multi-libs/usr/include/sys/stat.h:211:12:note: declared here

system/core/init/bootani.c:1373:71: error: expected ')' beforestring constant

system/core/init/bootani.c:1373:71: error: too few arguments tofunction 'stat'

prebuilt/toolchains/arm-fsl-linux-gnueabi/4.6.2/bin/../arm-fsl-linux-gnueabi/multi-libs/usr/include/sys/stat.h:211:12:note: declared here

system/core/init/bootani.c:1385:9: error:expected ')' before 'BOOTANI_ANI_FB_SYS_DIR'

system/core/init/bootani.c:1441:9: error:expected ')' before 'BOOTANI_ANI_FB_SYS_DIR'

make: ***[out/target/product/avx/obj/EXECUTABLES/init_intermediates/bootani.o] Error 1

 

修改device/cxxd/avx/BoardInitConfig.mk

把BOOT ANIMATION禁止

BOARD_USES_BOOT_ANIMATION               := false

#BOARD_BOOTANI_PIC_PATH:= device/cxxd/avx/bootani

http://172.26.13.23/gitweb/?p=dm001.git;a=commit;h=d5ed9414f49044e7c6a2944a18aa739dfcd48ee2

 

make: *** Norule to make target `out/target/product/avx/obj/lib/libncore.so', needed by`out/target/product/avx/obj/SHARED_LIBRARIES/libbt_pskey_intermediates/LINKED/libbt_pskey.so'.  Stop.

       暂时把需要用到此库的模块删除

rm -frexternals/synergy/

http://172.26.13.23/gitweb/?p=dm001.git;a=commit;h=26134bd053eac4f762b947c56c9bd51f8ec0cf8b

 

make: *** Norule to make target `out/target/product/avx/obj/lib/libncore.so', needed by`out/target/product/avx/obj/EXECUTABLES/dhcpd-client_intermediates/LINKED/dhcpd-client'.  Stop.

       暂时把需要用到此库的模块删除

rm -frexternals/dhcp/

http://172.26.13.23/gitweb/?p=dm001.git;a=commit;h=bc4505c0ec5bf1b829da6d6d7a647fc4e722daeb

 

framework/NGFramework3D/demos/eglkms.cpp:356:36:error: expected primary-expression before '.' token

framework/NGFramework3D/demos/eglkms.cpp:356:49:error: expected primary-expression before '.' token

framework/NGFramework3D/demos/eglkms.cpp:In function 'int eglkmstest()':

framework/NGFramework3D/demos/eglkms.cpp:402:47:warning: format '%x' expects argument of type 'unsigned int', but argument 2has type 'gbm_device*' [-Wformat]

framework/NGFramework3D/demos/eglkms.cpp:410:44:warning: format '%d' expects argument of type 'int', but argument 2 has type'EGLDisplay {aka void*}' [-Wformat]

framework/NGFramework3D/demos/eglkms.cpp:443:49:warning: format '%x' expects argument of type 'unsigned int', but argument 2has type 'EGLContext {aka void*}' [-Wformat]

framework/NGFramework3D/demos/eglkms.cpp:448:50:warning: format '%x' expects argument of type 'unsigned int', but argument 2has type 'gbm_surface*' [-Wformat]

framework/NGFramework3D/demos/eglkms.cpp:451:59:warning: format '%x' expects argument of type 'unsigned int', but argument 2has type 'EGLSurface {aka void*}' [-Wformat]

framework/NGFramework3D/demos/eglkms.cpp:482:100:warning: format '%d' expects argument of type 'int', but argument 3 has type'drmModeCrtcPtr {aka _drmModeCrtc*}' [-Wformat]

make: ***[out/target/product/avx/obj/SHARED_LIBRARIES/libeglkmstest_intermediates/eglkms.o]Error 1

       这是Framework的测试程序,目前用不着,暂时屏蔽

mv nutshell.mknutshell.old

http://172.26.13.23/gitweb/?p=dm001.git;a=commit;h=6437505edb21b0d43b0385289ca63305d394bacd

 

make: *** Norule to make target `device/cxxd/common/kernel-mod/lib/modules/3.0.35/kernel/drivers/input/touchscreen/ak4187_ts.ko',needed by`out/target/product/avx/obj/EXECUTABLES/ak4187_ts_intermediates/LINKED/ak4187_ts.ko'.  Stop.

       触摸屏的驱动,屏不一样了,所以没用了。删除

device/cxxd/avx/BoardInitConfig.mk

device/cxxd/common/kernel-mod/kernel-mod.mk

device/cxxd/avx/init.rc

device/cxxd/common/init.rc

http://172.26.13.23/gitweb/?p=dm001.git;a=commit;h=e0fd46e9b446f838180be28ed0e718aee08652cb

 

acp: unable toremove '/usr/lib/libbinder.so': No such file or directory

make: *** [/usr/lib/libbinder.so] Error 1

       这个错误是由于系统中此库放在ramdisk中,而不是system.img中,所以修改Makefile

device/cxxd/common/nutshell.mk

system/core/binder/nutshell.mk

usr/lib -->$(TARGET_ROOT_OUT)/lib

http://172.26.13.23/gitweb/?p=dm001.git;a=commit;h=9814e00f67c2cc3e2183b7db2ef983df7ebe0d04

 

make: *** Norule to make target `out/target/product/avx/obj/lib/libglib-2.0.so', needed by`out/target/product/avx/obj/SHARED_LIBRARIES/libsoup-2.4_intermediates/LINKED/libsoup-2.4.so'.  Stop.

       暂时把需要用到此库的模块删除

rm -frexternals/gupnp

http://172.26.13.23/gitweb/?p=dm001.git;a=commit;h=72a9733f30a2ee95d62f67ff2d024fea53b1ccfe

 

ls: cannotaccess sbin/hotplug_event: No such file or directory

`sbin/hotplug_event'does not exist!

make: ***[out/target/product/avx/ramdisk.img] Error 1

make: ***Deleting file `out/target/product/avx/ramdisk.img'

       缺少USB设备检测加载的程序,从老版本中移过来,编译

device/cxxd/common/DeviceCommon.mk

Addhotplut_event.

http://172.26.13.23/gitweb/?p=dm001.git;a=commit;h=88045c27ac17f8eec241fb53b0d92e4d5df598ee

 

ls: cannotaccess sbin/update: No such file or directory

`sbin/update'does not exist!

make: ***[out/target/product/avx/ramdisk.img] Error 1

make: ***Deleting file `out/target/product/avx/ramdisk.img'

       升级用的模块,暂时删除

device/cxxd/common/DeviceCommon.mk

Remove update

http://172.26.13.23/gitweb/?p=dm001.git;a=commit;h=bbd7606c7d7348ae4078c920df917c8d63daf5eb

 

make: Circular out/target/product/avx/obj/lib/libffi.so.6 <-out/target/product/avx/obj/lib/libffi.so dependency dropped.

make: stat: out/target/product/avx/system/usr/lib/libffi.so: Toomany levels of symbolic links

make: stat: out/target/product/avx/system/usr/lib/libffi.so.6: Toomany levels of symbolic links

make: Circular out/target/product/avx/system/usr/lib/libffi.so.6<- out/target/product/avx/system/usr/lib/libffi.so dependency dropped.

Install: out/target/product/avx/system/usr/lib/libffi.so.6

target thumb C: init <= system/core/init/init.c

acp: unable to stat destination'out/target/product/avx/system/usr/lib/libffi.so.6'

make: *** [out/target/product/avx/system/usr/lib/libffi.so.6] Error1

 

       缺少libffi库,这属于prebuilt的glib的库,在externals目录下,打开相应的编译。

 

       到此,编译可以通过了,通过mfg工具下载到设备中,Kernel启动有LOG输出,报错。

14:42:13.779:[   12.646931] (EE) init: command(retry10) 'check /lib/modules/mbcache.ko /lib/modules/jbd2.ko /lib/modules/ext4.ko 'timeout r=-1

14:42:13.791:[   12.646973] (EE) init: command 'insmod/lib/modules/mbcache.ko', r=-1

14:42:13.797:[   12.647001] (EE) init: command 'insmod/lib/modules/jbd2.ko', r=-1

14:42:13.803:[   12.647028] (EE) init: command 'insmod/lib/modules/ext4.ko', r=-1

 

       从错误上看,是找不到mbcache.ko库,这属于文件系统的库,为了简化处理,把文件系统的支持直接编译进内核中。

Kernel config,FS_EXT4=y ....

http://172.26.13.23/gitweb/?p=dm001.git;a=commit;h=977169891d24ff148fadfd51cea53907c3782ad5

 

       重新编译下载内核,发现还是不停的报错。

15:28:09.715: [    8.657300] (\!\!) init: executing'/sbin/linux_crash_dump'

15:28:09.720: [    8.657397] (\!\!) init:   \+ process(async ldramfs2-extract) started

15:28:09.726: [    8.657638](II) init:   \+ process(asyncldramfs2-extract) command 'setprio' r=0

15:28:09.734: [    8.657693] (EE) init: cannot find'/sbin/ldramfs2'

15:28:09.738: [    8.657712] (EE) init:   \

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值