qnx内核coreos_pub编译

来源:互联网 发布:时间序列预测最新算法 编辑:程序博客网 时间:2024/05/17 22:56

 qnx内核coreos_pub编译


1、环境:
windows xp sp3
qnx6.4.0安装在E:/QNX640
qnx coreos_pub svn version :199012  last modify time 1:53:32, 2008年9月5日

 

2、源码目录结构:
pwd显示:
E:/Delores/QNX_SRC/coreos_pub
dir显示:
trunk
hide-gnu.sh
其中hide-gnu.sh是从http://community.qnx.com/sf/wiki/do/viewAttachment/projects.core_os/wiki/BuildTheOSSource/hide-gnu.sh下载的。
以后的路径都是使用E:/Delores/QNX_SRC/coreos_pub,注意使用"/"而不是"/"

 

3、按官方文档的说明,在非qnx宿主开发环境下需要进行配置文件的转换。ignore the content of the GNU configure style source modules。
执行下面的语句,要等待10来分钟。
ksh hide-gnu.sh E:/Delores/QNX_SRC/coreos_pub

 

4、创建:stage目录,这里回存放编译过程中需要的头文件及编译后的结果。
cd E:/Delores/QNX_SRC/coreos_pub
mkdir stage

 

5、创建文本文件qconf-override.mk,这个文件主要设置qnx编译需要的几个环境变量,内容如下:
USE_INSTALL_ROOT=1
INSTALL_ROOT_nto=E:/Delores/QNX_SRC/coreos_pub/stage
VERSION_REL=6.4.0

 

6、设置环境变量 Set the override environment variable to point at the makefile stub
set QCONF_OVERRIDE=E:/Delores/QNX_SRC/coreos_pub/qconf-override.mk

 

7、Install all of the Header Files in the local stage
cd E:/Delores/QNX_SRC/coreos_pub/trunk
make OSLIST=nto hinstall

这个时间可是相当的漫长啊,从上午10点多到15:38,中间由于开着防病毒及木马的程序,造成机子当机了两次,可能是大量文件复制的问题吧。如果有人要编译qnx内核,建议把杀毒软件及防火墙关掉,免得自讨苦吃。

 

8、编译内核:
可以使用make OSLIST=nto install 编译全部内核,为了节省时间,这里我只编译x86的看看,编译时间很长的,大概搞了一天。
make OSLIST=nto CPULIST=x86 install

 

编译中共遇到如下几个问题:

问题1
e:/QNX640/host/win32/x86/usr/bin/qnx_cp -vfpc  libc.a E:/Delores/QNX_SRC/coreos_pub/stage/x86/lib/libc.a
'bash.exe' 不是内部或外部命令,也不是可运行的程序或批处理文件。
make[5]: *** [qinstall] Error 1
make[5]: Leaving directory `E:/Delores/QNX_SRC/coreos_pub/trunk/lib/c/lib/x86/a'
make[4]: *** [install] Error 2
make[4]: Leaving directory `E:/Delores/QNX_SRC/coreos_pub/trunk/lib/c/lib/x86'
make[3]: *** [install] Error 2
make[3]: Leaving directory `E:/Delores/QNX_SRC/coreos_pub/trunk/lib/c/lib'
make[2]: *** [install] Error 2
make[2]: Leaving directory `E:/Delores/QNX_SRC/coreos_pub/trunk/lib/c'
make[1]: *** [install] Error 2
make[1]: Leaving directory `E:/Delores/QNX_SRC/coreos_pub/trunk/lib'
make: *** [install] Error 2
E:/Delores/QNX_SRC/coreos_pub/trunk>time /t
E:/Delores/QNX_SRC/coreos_pub/trunk>

看了一下,发现是E:/QNX640/host/win32/x86/usr/bin/qnx_cp.bat里用的是bash,改成ksh
set bash.exe=ksh.exe

 

问题2
编译kdebug时出错,如下信息:
E:/Delores/QNX_SRC/coreos_pub/trunk/services/kdebug>set QCONF_OVERRIDE=E:/Delores/QNX_SRC/coreos_pub/qconf-override.mk
E:/Delores/QNX_SRC/coreos_pub/trunk/services/kdebug>make OSLIST=nto CPULIST=x86
make -j 1 -Cgdb -fMakefile
make[1]: Entering directory `E:/Delores/QNX_SRC/coreos_pub/trunk/services/kdebug/gdb'
make -j 1 -Cx86 -fMakefile
make[2]: Entering directory `E:/Delores/QNX_SRC/coreos_pub/trunk/services/kdebug
/gdb/x86'
make -j 1 -Co -fMakefile
make[3]: Entering directory `E:/Delores/QNX_SRC/coreos_pub/trunk/services/kdebug
/gdb/x86/o'
e:/QNX640/host/win32/x86/usr/bin/rm -f  E:/Delores/QNX_SRC/coreos_pub/trunk/serv
ices/kdebug/gdb/x86/o/gdb_kdebug
e:/QNX640/host/win32/x86/usr/bin/ldbootstrap -Bstatic -u_start   -oE:/Delores/QN
X_SRC/coreos_pub/trunk/services/kdebug/gdb/x86/o/gdb_kdebug    cache_ctrl.o    c
pu_init.o    cstart.o    debugpath.o    do_traps.o    gdb.o    kdbgcpu.o    kpri
ntf.o    main.o    mapping.o    outside.o    traps.o    vaddrinfo.o    x86_init.
o   -L . -L E:/Delores/QNX_SRC/coreos_pub/stage/x86/lib -L E:/Delores/QNX_SRC/co
reos_pub/stage/x86/usr/lib -L e:/QNX640/target/qnx6/x86/lib -L e:/QNX640/target/
qnx6/x86/usr/lib   -lkdutil       -Le:/QNX640/target/qnx6/x86/lib -lc e:/qnx640/
host/win32/x86/usr/bin/../lib/gcc/i386-pc-nto-qnx6.4.0/4.2.4/libgcc.a
process_begin: CreateProcess((null), e:/QNX640/host/win32/x86/usr/bin/ldbootstra
p -Bstatic -u_start -oE:/Delores/QNX_SRC/coreos_pub/trunk/services/kdebug/gdb/x8
6/o/gdb_kdebug cache_ctrl.o cpu_init.o cstart.o debugpath.o do_traps.o gdb.o kdb
gcpu.o kprintf.o main.o mapping.o outside.o traps.o vaddrinfo.o x86_init.o -L .
-L E:/Delores/QNX_SRC/coreos_pub/stage/x86/lib -L E:/Delores/QNX_SRC/coreos_pub/
stage/x86/usr/lib -L e:/QNX640/target/qnx6/x86/lib -L e:/QNX640/target/qnx6/x86/
usr/lib -lkdutil -Le:/QNX640/target/qnx6/x86/lib -lc e:/qnx640/host/win32/x86/us
r/bin/../lib/gcc/i386-pc-nto-qnx6.4.0/4.2.4/libgcc.a, ...) failed.
make (e=2): 系统找不到指定的文件。
make[3]: *** [E:/Delores/QNX_SRC/coreos_pub/trunk/services/kdebug/gdb/x86/o/gdb_
kdebug] Error 2
make[3]: Leaving directory `E:/Delores/QNX_SRC/coreos_pub/trunk/services/kdebug/
gdb/x86/o'
make[2]: *** [all] Error 2
make[2]: Leaving directory `E:/Delores/QNX_SRC/coreos_pub/trunk/services/kdebug/
gdb/x86'
make[1]: *** [all] Error 2
make[1]: Leaving directory `E:/Delores/QNX_SRC/coreos_pub/trunk/services/kdebug/
gdb'
make: *** [all] Error 2
分析了一下错误输出:process_begin: CreateProcess((null),好像是找不到什么命令,发现这个编译不使用的qcc,而是e:/QNX640/host/win32/x86/usr/bin/ldbootstrap,呵呵,这个目录下根本就没有ldbootstrap,去相应的qnx632下看了一下,果真有,复制到e:/QNX640/host/win32/x86/usr/bin/,重新编译这个库,哈哈,通过。
cd E:/Delores/QNX_SRC/coreos_pub/trunk/services/kdebug
make OSLIST=nto CPULIST=x86
其实有类似问题还有kdumper等。回到E:/Delores/QNX_SRC/coreos_pub/truwe录继续编译:

 

问题3 E:/Delores/QNX_SRC/coreos_pub/trunk/utils/r/rtc编译出错
无法找到头文件:
#include <hw/i2c.h>
看了一下common.mk,发现有下面的路径,联想fondry27上说的,hardware里面都是硬件相关的头文件,公开的源码里没有这个目录。看来是没办法编译rtc了,不过也没啥用。把rtc目录剪切掉继续编译。
EXTRA_INCVPATH = $(PROJECT_ROOT)/../../../lib/util/public
EXTRA_INCVPATH += $(PROJECT_ROOT)/../../../hardware/startup/lib/public

 

问题4、编译textmode出错
找不到头文件。发现qnx640下根本没有这些东东。只有从632里复制了。
#include <graphics/display.h>
#include <graphics/disputil.h>
#include <graphics/vbios.h>
从E:/QNX632/target/qnx6/usr/include复制graphics目录到E:/QNX640/target/qnx6/usr/include下。
编译textmode通过。

全部编译通过。还真是麻烦。

参考资料:
http://community.qnx.com/sf/wiki/do/viewPage/projects.core_os/wiki/Os_source_guide
http://community.qnx.com/sf/wiki/do/viewPage/projects.core_os/wiki/BuildTheOSSource
http://community.qnx.com/sf/wiki/do/viewPage/projects.core_os/wiki/Kernel_source_guide
http://community.qnx.com/sf/wiki/do/viewPage/projects.core_os/wiki/CoreOSSourceDescription