20071024 kvm uclinux
http://www.yippeesoft.com

错误一大堆~~~~~~

[root@mobile build]# make
mkdir -p obj
mkdir -p fp_obj
… obj/cache.o
arm-elf-gcc: unrecognized option `-Xa\’
arm-elf-gcc: language O2 not recognized
arm-elf-gcc: ../../../kvm/VmCommon/src/cache.c: linker input file unused since linking not done
… obj/class.o

用ARM-UCLINUX-GCC

../../../kvm/VmUnix/src/runtime_md.c: In function `InitializeFloatingPoint\’:
../../../kvm/VmUnix/src/runtime_md.c:171: error: `_FPU_EXTENDED\’ undeclared (first use in this function)
../../../kvm/VmUnix/src/runtime_md.c:171: error: (Each undeclared identifier is reported only once
../../../kvm/VmUnix/src/runtime_md.c:171: error: for each function it appears in.)
../../../kvm/VmUnix/src/runtime_md.c:171: error: `_FPU_DOUBLE\’ undeclared (first use in this function)

用ARM-ELF-GCC
/tmp/ccmzsd5d.s: Assembler messages:
/tmp/ccmzsd5d.s:301: Error: bad instruction `fldcw [fp,#-14]\’

#error Attempted to include iconv.h when uClibc built without locale support.
In file included from ../../src/convert_md.c:22:
/usr/local/arm-uclinux-tools/lib/gcc/arm-uclinux/3.4.0/../../../../arm-uclinux/include/iconv.h:27:2: #error Attempted to include iconv.h when uClibc built without locale support.
../../src/convert_md.c: In function `native2utf8\’:
../../src/convert_md.c:86: warning: passing arg 2 of `iconv\’ from incompatible pointer type
../../src/convert_md.c: In function `utf2native\’:
../../src/convert_md.c:117: warning: passing arg 2 of `iconv\’ from incompatible pointer type

Version 1.0 of the CLDC Specification did not require floating-point arithmetic in compliant implementations. However, the CLDC Specification Version 1.1 does require floating-point, and this chapter describes the implications for porting the floating-point implementation for KVM in CLDC 1.1.

[root@mobile linux]# make
/usr/local/arm-uclinux-tools/bin/arm-uclinux-gcc /home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o /home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crtl.o /home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crtn.o  -o preverify check_class.o main.o utf.o check_code.o convert_md.o util.o jar.o jar_support.o classloader.o file.o classresolver.o stubs.o inlinejsr.o sys_support.o
arm-uclinux-gcc: /home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crtl.o: No such file or directory

loader.o file.o classresolver.o stubs.o inlinejsr.o sys_support.o
/home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o: In function `_start\’:
/home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o(.text+0×0): multiple definition of `_start\’
/usr/local/arm-elf/lib/crt0.o(.text+0×0): first defined here
/home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o: In function `_start\’:
/home/sf/duoyewu/uClinux-IST/lib/uClibc/lib/crt0.o(.text+0×0): multiple definition of `_start\’
/usr/local/arm-elf/lib/crt0.o(.text+0×0): first defined here

main.o(.text+0×32c): the \’setlocale\’ function supports only C&line;POSIX locales
appptt.elf2flt: In function `open_iconv\’:
appptt.elf2flt(.text+0xa2e0): undefined reference to `iconv_open\’
appptt.elf2flt: In function `native2utf8\’:
appptt.elf2flt(.text+0xa478): undefined reference to `iconv\’
appptt.elf2flt(.text+0xa4a4): undefined reference to `iconv_close\’
appptt.elf2flt: In function `utf2native\’:
appptt.elf2flt(.text+0xa55c): undefined reference to `iconv\’
appptt.elf2flt(.text+0xa588): undefined reference to `iconv_close\’

~~~~~~~~~~
·htonl():把32位值从主机字节序转换成网络字节序
·htons():把16位值从主机字节序转换成网络字节序
·ntohl():把32位值从网络字节序转换成主机字节序
·ntohs():把16位值从网络字节序转换成主机字节序

修改了MAKEFILE文件后没有了

[alert7@redhat]# nasm -f elf tiny.asm
[alert7@redhat]# gcc -Wall -s tiny.o
tiny.o: In function `_start\’:
tiny.o(.text+0×0): multiple definition of `_start\’
/usr/lib/crt1.o(.text+0×0): first defined here
/usr/lib/crt1.o: In function `_start\’:
/usr/lib/crt1.o(.text+0×18): undefined reference to `main\’
collect2: ld returned 1 exit status

如何做才可以编译过去呢?
GCC有一个编译选项–nostartfiles

-nostartfiles
当linking时,不使用标准的启动文件。但是通常是使用的。

修改文件

这里,我们要修改的只有两处,那就是j2me_cldc/kvm/VmUnix/build/Makefile文件。因为我们的KVM是要运行在arm-linux(这里cpu为arm体系结构,操作系统为linux的开发板简称为arm-linux)系统上。所以,KVM必须用arm-linux-gcc编译器编译。我们打开Makefile文件,把

ifeq ($(GCC), true)

   CC = gcc

   …………

else

处的gcc改成arm-linux-gcc:

ifeq ($(GCC), true)

   CC = arm-linux-gcc

   …………

Else

 

第二处就是j2me_cldc/kvm/VmUnix/src/runtime_md.c文件,把这个文件中void InitializeFloatingPoint()函数中的两句注释掉,如:

#if defined(LINUX) && PROCESSOR_ARCHITECTURE_X86
/* Set the precision FPU to double precision */
// fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) &line; _FPU_DOUBLE;
// _FPU_SETCW(cw);
#endif

 

这样,就不会出现错误了,但也不支持浮点数了。这里我还不知道如何才能让它支持浮点数,并不出现错误。

这个是移植cldc1.1的:步骤基本相同,我们主要说以下不同的地方:修改完makefile后,make,会出现错误提示:
make: *** [obj/runtime_md.o] Error 1我们向上察看:kvm/VmUnix/src/runtime_md.c: In function `InitializeFloatingPoint’:是在函数InitializeFloatingPoint中出现错误:我们可以采取简单的方法将其注释掉,
void InitializeFloatingPoint() &leftsign;
#if defined(LINUX) && PROCESSOR_ARCHITECTURE_X86
/* Set the precision FPU to double precision */
// fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) &line; _FPU_DOUBLE;
// _FPU_SETCW(cw);
#endif
&rightsign;当然也也可以修改一下支持flaot,ok保存以下,接着make,就ok了!goodluck!
前两年刚刚参与Linux手机平台的开发时,尝试做了一个KJava的虚拟机,这是其中一个较早的版本,当时只实现了一些核心的功能,使用zlib和sun参考实现中的java api才能工作,可以运行基本的hello world等程序,只限于命令行,不支持UI.
 
http://blog.chinaunix.net/upfile/070823021750.zip

历史博文

标签:, , , , , ,
七月 25, 2008 at 11:43 上午 by yippee 1,066 次
Category: Dev
Tags: , , , , , ,