龙芯3A2000上移植NASA WorldWind指南
http://www.loongson.cn/news/company/467.html
一、初识NASA WORLDWIND
NASA World Wind是NASA(美国)国家航空和宇宙航行局联合出品,类似Earthview 3D的鸟瞰工具,更加权威而且完全免费。通过这套程序的3D引擎,可以让你从外太空看见地球上的任何一个角落。
worldwind主界面
有“天眼”之称的一款软件是否可以在龙芯平台上运行呢?经过修改、调试、编译,笔者终于成功的在龙芯3A2000上运行了worldwind。下面来看看移植过程。
二、下载worldwind以及相关的软件包
首先介绍下和worliwind相关的两外两个软件包gluegen和jogl。
gluegen是自动生成的java和JNI代码,调用C库的工具,可以绑定底层API,如java本地接口(JNI)和 AWT本地接口(jawt)。
jogl是Java对OpenGL绑定的开源项目并设计为采用Java开发的应用程序,还提供了众多3D图形库,如:AWT、Swing和SWT widget,以及自定义窗口工具nativewindow。
为了不让大家走弯路,笔者先简单的介绍下载包的版本。笔者下载的worldwind是2.0.0版本,REDME.txt文档上介绍支持Java SDK1.5.0以上版本。需下载1.5版本的gluegen和jogl包。
● worldwind下载路径:http://ftp.loongnix.org/others/NasaWorldWind/
● gluegen和jogl下载路径:http://jogamp.org/deployment/archive/rc/v2.1.5/archive/Sources/
点击gluegen-v2.1.5.tar.7z和jogl-v2.1.5.tar.7z即可下载。
三、编译环境
笔者使用的电脑是龙芯3A2000,系统是Loongnix-Fedora21。
系统下载地址: http://www.loongnix.org
四、编译源代码
笔者详细的述说这三个软件包里需要修改的地方。
第一步:首先编译gluegen软件包
1.进入gluegen软件包,查找build.xml文件。(记得将解压后的文件名修改为gluegen)
[loongson@localhost gluegen]$find . -name build.xml ./test/TestOneJar_InJar/jogamp01/build.xml ./test/junit/com/jogamp/gluegen/build.xml ./make/build.xml |
修改 ./make/build.xml文件,搜索mips,添加如下代码:
在328行添加如下代码:
+ <target name="declare.linux.mips64el" if="isLinuxMips64el"> + <echo message="Linux.mips64el" /> + <property name="compiler.cfg.id" value="compiler.cfg.linux" /> + <property name="linker.cfg.id" value="linker.cfg.linux.mips64el" /> + </target> |
在360行后面加上代码:
+ declare.linux.mips64el, |
2.进入gluegen软件包,查找PlatformPropsImpl.java文件。
[loongson@localhost gluegen]$ find . -name PlatformPropsImpl.java ./src/java/jogamp/common/os/PlatformPropsImpl.java |
修改PlatformPropsImpl.java文件,查找mips,在301行添加如下代码:
+ else if( archLower.equals("mips64") ) { // android gaoquan + return CPUType.MIPS_64; + } else if( archLower.equals("mips64el") ) { // android gaoquan + return CPUType.MIPS_64el; + } |
3.修改PlatformPropsImpl.java文件。
在./src/java/jogamp/common/os/PlatformPropsImpl.java文件的getOSAndArch()方法下,添加分支,代码如下:
case IA64: _os_and_arch = "ia64"; break; + case MIPS_64el: + os_and_arch = "mips64el"; + break; case SPARCV9_64: _os_and_arch = "sparcv9"; break; |
4.修改MachineDescriptionRuntime.java文件。
在./src/java/jogamp/common/os/MachineDescriptionRuntime.java文件的isCPUArch32Bit()方法下,添加分支,代码如下:
private static boolean isCPUArch32Bit(final Platform.CPUType cpuType) throws RuntimeException { switch( cpuType ) { case X86_32: ........... + case MIPS_64el: return false; |
5.进入gluegen软件包,查找./make/gluegen-cpptasks-base.xml文件,此文件修改的代码有些多。在gluegen-cpptasks-base.xml中搜索mipsel,在380行添加代码:
在gluegen-cpptasks-base.xml中搜索mipsel,在380行添加代码:
<condition property="isLinuxMipsel"> <and> <istrue value="${isLinux}" /> <os arch="mipsel" /> </and> </condition> + <condition property="mipsel"> + <os arch="mipsel" /> + </condition> + <condition property="isLinuxMips64el"> + <and> + <istrue value="${isLinux}" /> + <os arch="mips64el" /> + </and> + </condition> + <condition property="mips64el"> + <os arch="mips64el" /> + </condition> <condition property="isLinuxPpc"> |
580行添加代码:
<echo message="LinuxMipsel=${isLinuxMipsel}" /> + <echo message="LinuxMips64el=${isLinuxMips64el}" /> <echo message="LinuxPpc=${isLinuxPpc}" /> |
650行添加代码:
<target name="gluegen.cpptasks.detect.os.linux.mipsel" unless="gluegen.cpptasks.detected.os.2" if="isLinuxMipsel"> <property name="os.and.arch" value="linux-mipsel" /> </target> + <target name="gluegen.cpptasks.detect.os.linux.mips64el" unless="gluegen.cpptasks.detected.os.2" if="isLinuxMips64el"> + <property name="os.and.arch" value="linux-mips64el" /> + </target> <target name="gluegen.cpptasks.detect.os.linux.ppc" unless="gluegen.cpptasks.detected.os.2" if="isLinuxPpc"> <property name="os.and.arch" value="linux-ppc" /> </target> |
682行添加代码
+ gluegen.cpptasks.detect.os.linux.mips64el, |
1192行添加代码:
<linker id="linker.cfg.linux.mipsel" name="${gcc.compat.compiler}"> </linker> + <linker id="linker.cfg.linux.mips64el" name="${gcc.compat.compiler}"> + </linker> <linker id="linker.cfg.linux.ppc" name="${gcc.compat.compiler}"> </linker> |
1413行添加代码:
<target name="gluegen.cpptasks.declare.compiler.linux.mipsel" if="isLinuxMipsel"> <echo message="Linux.Mipsel" /> <property name="compiler.cfg.id.base" value="compiler.cfg.linux" /> <property name="linker.cfg.id.base" value="linker.cfg.linux" /> <property name="java.lib.dir.platform" value="${java.home.dir}/jre/lib/mipsel" /> </target> + <target name="gluegen.cpptasks.declare.compiler.linux.mips64el" if="isLinuxMips64el"> + <echo message="Linux.Mips64el" /> + <property name="compiler.cfg.id.base" value="compiler.cfg.linux" /> + <property name="linker.cfg.id.base" value="linker.cfg.linux" /> + <property name="java.lib.dir.platform" value="${java.home.dir}/jre/lib/mips64el" /> + </target> <target name="gluegen.cpptasks.declare.compiler.linux.ppc" if="isLinuxPpc"> <echo message="Linux.Ppc" /> <property name="compiler.cfg.id.base" value="compiler.cfg.linux" /> <property name="linker.cfg.id.base" value="linker.cfg.linux" /> <property name="java.lib.dir.platform" value="${java.home.dir}/jre/lib/ppc" /> </target> |
1449行添加代码:
+ gluegen.cpptasks.declare.compiler.linux.mipsel, |
6.在build-test.xml文件中搜索java.build,在164行添加如下代码:
+ <!-- + <target name="android.package" depends="java.generate,java.build,native.build" if="isAndroid"> + --> + <target name="android.package" depends="java.generate,native.build" if="isAndroid"> + <aapt.signed assetsdir="resources/assets-test" |
7.最后在make目录下,使用ant来编译:
gluegen.build.check.aapt: android.package: developer-src-zip: [zip] Building zip: /home/loongson/jogl/gluegen/build/gluegen-java-src.zip developer-zip-archive: all: BUILD SUCCESSFUL |
gluegen软件包终于编译成功了!
* 最后记得将build目录下的 .jar 文件拷贝到worldwind下
第二步:编译jogl软件包
1.下载swt.jar文件(http://ftp.loongnix.org/others/NasaWorldWind/),拷贝到swt目录下(jogl-v2.1.5/make/lib/swt/)
2.进入jogl-v2.15软件包,在./make/build-nativewindow.xml文件中进行修改。
<target name="c.configure.linux.mipsel" if="isLinuxMipsel"> <echo message="Linux.MIPSEL" /> <property name="compiler.cfg.id" value="compiler.cfg.linux" /> <property name="linker.cfg.id.oswin" value="linker.cfg.linux.nativewindow.x11" /> </target> + <target name="c.configure.linux.mips64el" if="isLinuxMips64el"> + <echo message="Linux.MIPS64EL" /> + <property name="compiler.cfg.id" value="compiler.cfg.linux" /> + <property name="linker.cfg.id.oswin" value="linker.cfg.linux.nativewindow.x11" /> + </target> <target name="c.configure.linux.ppc" if="isLinuxPpc"> .......... + c.configure.linux.mipsel,c.configure.linux.mips64el,c.configure.linux.ppc |
3.修改build-common.xml文件,添加如下代码:
<condition property="swt.jar" value="${project.root}/make/lib/swt/gtk-linux-x86/swt-debug.jar"> <istrue value="${isAndroid}" /> <!-- FIXME JAU .. hack --> </condition> + <condition property="swt.jar" value="${project.root}/make/lib/swt/gtk-linux-mips64el/swt.jar"> + <istrue value="${isLinuxMips64el}" /> <!-- FIXME JAU .. hack --> + </condition> <property name="swt-cocoa-macosx-x86_64.jar" value="${project.root}/make/lib/swt/cocoa-macosx-x86_64/swt-debug.jar"/> |
4.修改build-jogl.xml文件,添加如下代码:
<target name="c.configure.linux.mipsel" if="isLinuxMipsel"> <echo message="Linux.MIPSEL" /> <property name="compiler.cfg.id" value="compiler.cfg.linux" /> <property name="linker.cfg.id.os" value="linker.cfg.linux.jogl.x11" /> </target> + <target name="c.configure.linux.mips64el" if="isLinuxMipsel"> + <echo message="Linux.MIPSEL" /> + <property name="compiler.cfg.id" value="compiler.cfg.linux" /> + <property name="linker.cfg.id.os" value="linker.cfg.linux.jogl.x11" /> + </target> + c.configure.linux.mipsel,c.configure.linux.mips64el,c.configure.linux.ppc |
5.修改build-newt.xml文件,添加如下代码:
+ <target name="c.configure.linux.mips64el" if="isLinuxMips64el"> + <echo message="Linux.mips64el" /> + <property name="compiler.cfg.id" value="compiler.cfg.linux" /> + <condition property="linker.cfg.id.oswin" value="linker.cfg.linux.newt.x11" + else="linker.cfg.linux"> + <isset property="isX11" /> + </condition> + <echo message="linker.cfg.id.oswin ${linker.cfg.id.oswin}" /> + </target> + c.configure.linux.mipsel,c.configure.linux.mips64el,c.configure.linux.ppc |
6.在make目录下,使用ant来编译:
all: BUILD SUCCESSFUL Total time: 3 minutes 1 second |
终于编译成功了!
* 记得将jogl下的jogl-all.jar、nativewindow-natives-linux-mips64el.jar、jogl-all-natives-linux-mips64el.jar,拷贝到worldwind下
第三步:在worldwind下,运行提供的用例。
[loongson@localhost worldwind-2.0.0]$ chmod +x run-demo.bash [loongson@localhost worldwind-2.0.0]$ ./run-demo.bash gov.nasa.worldwindx.examples.ApplicationTemplate |
最终worldwind终于运行起来了!3A2000下拖动页面基本流畅。
为了能够更流畅的查看地图,可以屏蔽终端的输入:
[loongson@localhost worldwind-2.0.0]$ ./run-demo.bash gov.nasa.worldwindx.examples.ApplicationTemplate &>/dev/null |
1000km高空下的地球
北京城市地图
龙芯公司
华盛顿城市路线图
worldwind官方网站上提供更多精美实例,大家一起欣赏下。
五、如果您觉得要修改的代码太多,不方便。笔者为你提供了更简单的方法。
1. 下载http://ftp.loongnix.org/others/NasaWorldWind/ 里面有patch文件,还有使用说明。根据说明来修改三个软件包,最后在worldwind目录里输入
./run-demo.bash gov.nasa.worldwindx.examples.ApplicationTemplate
龙芯3A2000上移植NASA WorldWind指南相关推荐
- Linux 内核将要支持最新龙芯 3A2000/3B2000
龙芯3A2000/3B2000是龙芯3号系列处理器的最新升级产品.处理器核升级为新一代GS464E架构.最近据龙芯开源社区loongnix.org报道,3A2000/3B2000的支持代码已经加入了L ...
- 龙芯完成.NET移植稳步推进生态建设
不久前,龙芯团队完成了.Net Core 3.1在龙芯上的移植.早在1年前,一位网友就告知,希望.Net能够移植到龙芯平台,因为一些政务应用场景有这方面的需求.只不过了一年,这就问题就被龙芯团队解决了 ...
- 经验分享|在龙芯2K上运行RT-Thread系统并开源
大家好,今天分享下群友老李在大四上学期做的一个项目.希望对大家有启发. 项目信息 项目名称:龙芯2K上的RT-Thread系统 学生姓名:李志锐 学校:聊城大学 大四在读 方案描述:该项目要求首先实现 ...
- 龙芯linux内核,最新龙芯3A2000/3B2000爆发!Linux内核官方支持
据龙芯开源社区消息,龙芯3A2000/3B2000处理器的支持代码已经加入了Linux官方内核,会在最新的版本发布时正式采用. linux-mips官方Git代码库 据介绍,龙芯3A2000/3B20 ...
- 龙芯平台python答案_在龙芯平台上自己编写原创应用——“动态壁纸”
原标题:在龙芯平台上自己编写原创应用--"动态壁纸" 一.为何要在龙芯平台上编写"动态壁纸"? 龙芯3A3000桌面电脑的用户越来越多了,人们都想在龙芯电脑上有 ...
- 龙芯linux内核移植开发板,基于国产龙芯GS32I的开发板的设计与嵌入式Linux的移植...
摘要: 目前,嵌入式系统已经渗透到各个领域:工业控制,军事国防,消费类电子产品,网络通信等,但大部分领域的应用都是基于国外各大厂商的嵌入式处理器.在嵌入式领域使用国产芯片,走国产化道路已经成为一个迫切 ...
- 龙芯平台上的容器和CI/CD实现方案
http://www.loongson.cn/news/company/505.html 一:简介 Windocker是云宏公司基于龙芯平台开发的容器管理web平台.主要功能包括:系统 ...
- 包教包会:龙芯3A5000上尝试运行任意Windows软件
几个月之前,龙芯中科刚放出可用的二进程翻译模块时,我写了一篇<在龙芯3A5000上运行Windows程序>.在龙芯3A5000上运行Windows程序https://zhuanlan.zh ...
- 干货应用迁移|搜狗输入法在龙芯平台上的适配与应用
技术引领创新,用"芯"构建生态,第一期龙芯生态论坛于2021年3月12日(周五)盛大开讲!龙芯生态论坛作为龙芯生态建设的重要技术交流窗口,将汇聚龙芯资深技术专家及行业生态伙伴精英, ...
最新文章
- Spring Boot 应用如何提高服务吞吐量?
- 如何基于 String 实现同步锁?
- App上线需要自查的list——主要针对产品、部分运营加测试
- C++字节序反转的实现算法(附完整源码)
- strtok函数取WinMain的参数
- 女人必知:10个好习惯 让老公不想出轨
- Spark 独立部署模式
- git 查看分支_系统掌握Git之—探索.git
- linux网卡ip自动启动不了怎么办,Linux杂谈:解决配置静态ip后eth0网卡启动不了的问题...
- C++ 常见错误(02) —— 将dll(用c++写的)处理的结果展示在界面上
- Lucene全文检索(一)
- day02_20190106 基础数据类型 编码 运算符
- c++ PP第九章最后一题
- HBase权威指南,架构:存储
- matlab 图像加密解密 代码,matlab图像加密解密
- 微信个人赞赏码怎么用?微信赞赏码使用教程详解
- C/C++ 宏参数名前加#变为字符串
- facebook登陆,如何邀请玩家成为测试人员
- win2003 锁定计算机,windows2003怎么取消自动锁定
- i12蓝牙耳机怎么设置成中文_耳朵里的小精灵——乐迈车载智能蓝牙耳机