免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 2847 | 回复: 11
打印 上一主题 下一主题

请教一个内核编译选项的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-01-17 09:51 |只看该作者 |倒序浏览
各位大侠,CONFIG_BINFMT_MISC  定义为运行Java程序的自动运行是什么概念?此选项为Y时,Java程序就可以不用虚拟机直接运行吗?请高手帮忙解疑答惑,谢谢。

论坛徽章:
0
2 [报告]
发表于 2009-01-17 10:32 |只看该作者
原帖由 wwjjtt 于 2009-1-17 09:51 发表
各位大侠,CONFIG_BINFMT_MISC  定义为运行Java程序的自动运行是什么概念?此选项为Y时,Java程序就可以不用虚拟机直接运行吗?请高手帮忙解疑答惑,谢谢。



应该是说在内核中支持某些二进制的程序格式,
CONFIG_BINFMT_MISC:                                                     │
  │                                                                         │
  │ If you say Y here, it will be possible to plug wrapper-driven binary    │
  │ formats into the kernel. You will like this especially when you use     │
  │ programs that need an interpreter to run like Java, Python, .NET or     │
  │ Emacs-Lisp. It's also useful if you often run DOS executables under     │
  │ the Linux DOS emulator DOSEMU (read the DOSEMU-HOWTO, available from    │
  │ <http://www.tldp.org/docs.html#howto>). Once you have                   │
  │ registered such a binary class with the kernel, you can start one of    │
  │ those programs simply by typing in its name at a shell prompt; Linux    │
  │ will automatically feed it to the correct interpreter.


但并不是说只选进去就可以运行JAVA这些了,仍然需要安装JDK这些的。在内核文档Documentation/java.txt中讲到:
Java(tm) Binary Kernel Support for Linux v1.03
               ----------------------------------------------
Linux beats them ALL! While all other OS's are TALKING about direct support of Java Binaries in the OS, Linux is doing it!
You can execute Java applications and Java Applets just like any other program after you have done the following:
1) You MUST FIRST install the Java Developers Kit for Linux. The Java on Linux HOWTO gives the details on getting and
   installing this. This HOWTO can be found at:
        ftp://sunsite.unc.edu/pub/Linux/docs/HOWTO/Java-HOWTO
   You should also set up a reasonable CLASSPATH environment
   variable to use Java applications that make use of any
   nonstandard classes (not included in the same directory
   as the application itself).
2) You have to compile BINFMT_MISC either as a module or into the kernel (CONFIG_BINFMT_MISC) and set it up properly.
   If you choose to compile it as a module, you will have
   to insert it manually with modprobe/insmod, as kmod
   cannot easily be supported with binfmt_misc.
   Read the file 'binfmt_misc.txt' in this directory to know
   more about the configuration process.

后面省略


另外,还可以参考一下内核文档
Documentaton/binfmt_misc.txt

论坛徽章:
0
3 [报告]
发表于 2009-01-17 10:36 |只看该作者
在《Linux内核源代码情景分析》中第四章第4节讲到了内核在执行程序时如何去查看这个程序的格式,然后再采取相应的执行方式。

论坛徽章:
0
4 [报告]
发表于 2009-01-17 10:53 |只看该作者

回复 #3 scutan 的帖子

谢谢法师提醒。我再去看看书。

论坛徽章:
0
5 [报告]
发表于 2009-01-17 10:59 |只看该作者

回复 #2 scutan 的帖子

版主法师,我自己做了一个文件系统,并且自己的内核也跑起来了,此选项并没有编译进内核,但是我在移植了一个Java虚拟机到文件系统之后,Java程序也是可以运行的,不知道这个选项是不是在进行java应用时必须那?

论坛徽章:
3
戌狗
日期:2014-09-10 17:07:162015年辞旧岁徽章
日期:2015-03-03 16:54:15wusuopu
日期:2016-06-17 17:43:45
6 [报告]
发表于 2009-01-17 18:43 |只看该作者
原帖由 wwjjtt 于 2009-1-17 10:59 发表
我自己做了一个文件系统,并且自己的内核也跑起来了,此选项并没有编译进内核,但是我在移植了一个Java虚拟机到文件系统之后,Java程序也是可以运行的,...

很牛

论坛徽章:
0
7 [报告]
发表于 2009-01-17 22:33 |只看该作者
原帖由 wwjjtt 于 2009-1-17 10:59 发表
版主法师,我自己做了一个文件系统,并且自己的内核也跑起来了,此选项并没有编译进内核,但是我在移植了一个Java虚拟机到文件系统之后,Java程序也是可以运行的,不知道这个选项是不是在进行java应用时必须那? ...


你执行java程序时是怎样执行的?
java yourclass
还是
./yourclass

论坛徽章:
0
8 [报告]
发表于 2009-01-19 10:14 |只看该作者

回复 #7 scutan 的帖子

我是用java myclass执行的,你的意思是如果这个选项被选中了,那么就可以直接用./myclass来执行了吗? 我做个试验来看看。

论坛徽章:
0
9 [报告]
发表于 2009-01-19 10:32 |只看该作者
原帖由 wwjjtt 于 2009-1-19 10:14 发表
我是用java myclass执行的,你的意思是如果这个选项被选中了,那么就可以直接用./myclass来执行了吗? 我做个试验来看看。


嗯,按照文档的说明来看,应该是的。
你看我二楼贴的:

                                                                         Once you have                   │
  │ registered such a binary class with the kernel, you can start one of    │
  │ those programs simply by typing in its name at a shell prompt; Linux    │
  │ will automatically feed it to the correct interpreter.

论坛徽章:
0
10 [报告]
发表于 2009-01-19 10:33 |只看该作者
原帖由 wwjjtt 于 2009-1-19 10:14 发表
我是用java myclass执行的,你的意思是如果这个选项被选中了,那么就可以直接用./myclass来执行了吗? 我做个试验来看看。


有了结果也分享一下啊。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP