📄 [已解决]嵌入式板子控制台丢失!(页 1) - 嵌入式系统 - linux论坛 - powered by discuz! archiver.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- saved from url=(0181)http://cache.baidu.com/c?word=busybox%2C%D6%B4%D0%D0%3B%BD%C5%B1%BE&url=http%3A//linux%2Echinaunix%2Enet/bbs/archiver/tid%2D900854%2Ehtml&p=873e8b0584934eab5ab5c7710d1395&user=baidu -->
<!--STATUS OK--><HTML><HEAD><TITLE>[已解决]嵌入式板子控制台丢失!(页 1) - 嵌入式系统 - Linux论坛 - powered by Discuz! Archiver</TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<FORM action=http://www.baidu.com/s>
<META content="MSHTML 6.00.2900.3132" name=GENERATOR></HEAD>
<BODY topMargin=10>
<TABLE cellPadding=0 width="100%" bgColor=#ffffff border=0>
<TBODY>
<TR>
<TD width=254><A href="http://www.baidu.com/"><IMG alt=到百度首页
src="[已解决]嵌入式板子控制台丢失!(页 1) - 嵌入式系统 - Linux论坛 - powered by Discuz! Archiver.files/logo-kz.gif"
border=0></A></TD>
<TD><FONT color=black size=-1><INPUT
style="FONT-SIZE: 16px; FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif"
size=30 name=wd> <INPUT type=submit value=百度一下></FONT> </TD></TR>
<TR>
<TD colSpan=2><FONT color=black size=-1>您的查询字词都已标明如下:<B
style="COLOR: black; BACKGROUND-COLOR: #ffff66"><A
href="http://cache.baidu.com/c?word=busybox%2C%D6%B4%D0%D0%3B%BD%C5%B1%BE&url=http%3A//linux%2Echinaunix%2Enet/bbs/archiver/tid%2D900854%2Ehtml&p=873e8b0584934eab5ab5c7710d1395&user=baidu#baidusnap0">busybox</A> </B><B
style="COLOR: black; BACKGROUND-COLOR: #a0ffff"><A
href="http://cache.baidu.com/c?word=busybox%2C%D6%B4%D0%D0%3B%BD%C5%B1%BE&url=http%3A//linux%2Echinaunix%2Enet/bbs/archiver/tid%2D900854%2Ehtml&p=873e8b0584934eab5ab5c7710d1395&user=baidu#baidusnap1">执行</A> </B><B
style="COLOR: black; BACKGROUND-COLOR: #99ff99"><A
href="http://cache.baidu.com/c?word=busybox%2C%D6%B4%D0%D0%3B%BD%C5%B1%BE&url=http%3A//linux%2Echinaunix%2Enet/bbs/archiver/tid%2D900854%2Ehtml&p=873e8b0584934eab5ab5c7710d1395&user=baidu#baidusnap2">脚本</A> </B>
(点击查询词,可以跳到它在文中首次出现的位置) <BR>如果您想保存该页面,可以<A
onclick="window.open('http://cang.baidu.com/do/add?it='+encodeURIComponent(document.title)+'&iu='+encodeURIComponent(location.href)+'&fr=ps#nw=1','_s','scrollbars=no,width=600,height=450,right=75,top=20,status=no,resizable=yes'); return false;"
href="http://cang.baidu.com/do/add" target=_blank><FONT
style="TEXT-DECORATION: underline" color=blue>添加到搜藏</FONT></A><BR><FONT
color=gray>(百度和网页<A
href="http://linux.chinaunix.net/bbs/archiver/tid-900854.html"><FONT
color=blue>http://linux.chinaunix.net/bbs/archiver/tid-900854.html</FONT></A>的作者无关,不对其内容负责。百度快照谨为网络故障时之索引,不代表被搜索网站的即时页面。)</FONT></FONT>
</TD></TR></TBODY></TABLE></FORM>
<HR>
<META
content="Discuz!,Board,Comsenz,forums,bulletin board,Linux,开源,Linux新闻,Linux图片新闻,Linux发行版,Linux技术文档,入门,桌面,程序,嵌入式,安全,网络,数据库,内核"
name=keywords>
<META
content="板子有个串口,做控制台,大家都知道我弄的系统在内核启动后开始运行到init进程了.运行到最后一段 : [table=95%][tr][td]free_initmem(); unlock_kernel(); system_state = SYSTEM_RUNNING; ... Linux论坛 ChinaUnix Linux时代论坛为网友提供最新的Linux资讯、技术文档,同时为广大Linux爱好者提供一个方便的交流社区。 - Discuz! Archiver"
name=description>
<META content="Discuz! Archiver 5.0.0" name=generator><LINK
href="[已解决]嵌入式板子控制台丢失!(页 1) - 嵌入式系统 - Linux论坛 - powered by Discuz! Archiver.files/style_1.css"
type=text/css rel=stylesheet>
<CENTER>
<DIV class=tableborder style="BACKGROUND-COLOR: #ffffff">
<DIV class="subtable bold altbg1"><A
href="http://linux.chinaunix.net/bbs/archiver/">Linux论坛</A> <B>»</B> <A
href="http://linux.chinaunix.net/bbs/archiver/fid-42.html">嵌入式系统</A> <B>»</B>
[已解决]嵌入式板子控制台丢失!</DIV><BR><BR>
<DIV class="simpletable smalltxt" style="WIDTH: 98%">
<DIV class="subtable altbg1"><SPAN class=right>2007-6-13 16:02</SPAN>
<B>smalloc</B></DIV>
<DIV class="subtable altbg2 t_msg"
style="WIDTH: auto; HEIGHT: auto"><B>[已解决]嵌入式板子控制台丢失!</B><BR><BR>板子有个串口,做控制台,大家都知道<BR>我弄的系统在内核启动后开始运行到init进程了.<BR>运行到最后一段 :<BR>
[table=95%][tr][td]free_initmem();<BR>
unlock_kernel();<BR>
system_state = SYSTEM_RUNNING;<BR>
numa_default_policy();<BR><BR>
if (sys_open((const char __user *) "/dev/console", O_RDWR, 0)
&lt; 0)<BR>
printk(KERN_ERR "Warning: unable to open an initial console.\n");<BR>
(void) sys_dup(0);<BR>
(void) sys_dup(0);<BR>
/*<BR> * We try each of
these until one succeeds.<BR> *<BR>
* The Bourne shell can be used instead of init
if we are <BR> * trying to recover a
really broken machine.<BR>
*/<BR>printk(KERN_ERR"execute command\n");<BR>
if (execute_command)<BR>
run_init_process(execute_command);<BR>//if
(sys_open((const char __user
*)"/sbin/init",O_RDWR,0)&lt;0){printk(KERN_ERR"connot open
/sbin/init\n");}else {printk(KERN_E<BR>RR"/sbin/init
opened\n");}<BR>printk(KERN_ERR"run_init_process ok\n");<BR>
run_init_process("/sbin/init");<BR>printk(KERN_ERR"sbin,init\n");<BR>
run_init_process("/etc/init");<BR>
run_init_process("/bin/init");<BR>
run_init_process("/bin/sh");<BR><BR>
panic("No init found. Try passing
init= option to
kernel.");<BR>}[/td][/tr][/table]<BR><BR>run_init_process("/sbin/init");能启动/sbin/init指向buzybox也运行了,但是这个时候控制台丢失了,但是可以printk出来信息,就是不能输入了<BR>
(void) sys_dup(0);<BR>
(void)
sys_dup(0);<BR>这2个dup应该是复制文件描述符难道只有标准出错可请指教以用了,标准输入标准输出没了?<BR><BR>[[i] 本帖最后由
smalloc 于 2007-6-18 11:05 编辑 [/i]]</DIV></DIV><BR>
<DIV class="simpletable smalltxt" style="WIDTH: 98%">
<DIV class="subtable altbg1"><SPAN class=right>2007-6-14 12:14</SPAN>
<B>smalloc</B></DIV>
<DIV class="subtable altbg2 t_msg" style="WIDTH: auto; HEIGHT: auto">初步断定是<A
name=baidusnap0></A><B
style="COLOR: black; BACKGROUND-COLOR: #ffff66">busybox</B>的问题,请问大家有没有在busyboy配置不对的情况下出现过这情况?</DIV></DIV><BR>
<DIV class="simpletable smalltxt" style="WIDTH: 98%">
<DIV class="subtable altbg1"><SPAN class=right>2007-6-14 13:56</SPAN>
<B>kf701</B></DIV>
<DIV class="subtable altbg2 t_msg" style="WIDTH: auto; HEIGHT: auto">直接
init=/bin/sh 就可以。</DIV></DIV><BR>
<DIV class="simpletable smalltxt" style="WIDTH: 98%">
<DIV class="subtable altbg1"><SPAN class=right>2007-6-14 14:22</SPAN>
<B>smalloc</B></DIV>
<DIV class="subtable altbg2 t_msg" style="WIDTH: auto; HEIGHT: auto">[quote]原帖由
[i]kf701[/i] 于 2007-6-14 13:56 发表于 3楼 <BR>直接 init=/bin/sh 就可以。
[/quote]<BR>谢谢回复,你的意思是直接/bin/sh,当0进程,但是还有个问题,就是在嵌入板子上这些命令其实都是指向<B
style="COLOR: black; BACKGROUND-COLOR: #ffff66">busybox</B>的连接,即使<A
name=baidusnap1></A><B
style="COLOR: black; BACKGROUND-COLOR: #a0ffff">执行</B>/bin/sh也还是运行<B
style="COLOR: black; BACKGROUND-COLOR: #ffff66">busybox</B>,不同的是当init运行的时候会以inittab为参数文件运行里面的初始化<A
name=baidusnap2></A><B
style="COLOR: black; BACKGROUND-COLOR: #99ff99">脚本</B>和getty.</DIV></DIV><BR>
<DIV class="simpletable smalltxt" style="WIDTH: 98%">
<DIV class="subtable altbg1"><SPAN class=right>2007-6-14 16:10</SPAN>
<B>augustusqing</B></DIV>
<DIV class="subtable altbg2 t_msg"
style="WIDTH: auto; HEIGHT: auto">建议你找个能确定肯定没问题的<B
style="COLOR: black; BACKGROUND-COLOR: #ffff66">busybox</B>盘验证一下<BR><BR>还有,请把你的启动信息给出来,给个内核函数啥用,大家都知道这个函数<BR>你可以在<B
style="COLOR: black; BACKGROUND-COLOR: #ffff66">busybox</B>的init_main()函数开始使用一下printf()函数,你能用printk()说明不了你的问题,你的问题中printk()早就能用了,看能不能在用户空间使用printf()函数</DIV></DIV><BR>
<DIV class="simpletable smalltxt" style="WIDTH: 98%">
<DIV class="subtable altbg1"><SPAN class=right>2007-6-14 16:44</SPAN>
<B>smalloc</B></DIV>
<DIV class="subtable altbg2 t_msg" style="WIDTH: auto; HEIGHT: auto">[quote]原帖由
[i]augustusqing[/i] 于 2007-6-14 16:10 发表于 5楼 <BR>建议你找个能确定肯定没问题的<B
style="COLOR: black; BACKGROUND-COLOR: #ffff66">busybox</B>盘验证一下<BR><BR>还有,请把你的启动信息给出来,给个内核函数啥用,大家都知道这个函数<BR>你可以在<B
style="COLOR: black; BACKGROUND-COLOR: #ffff66">busybox</B>的init_main()函数开始使用一下printf()函数,你能用printk()说明不
... [/quote]<BR><BR>嵌入式系统(开发板)的<B
style="COLOR: black; BACKGROUND-COLOR: #ffff66">busybox</B>盘?不明白.我这边的<B
style="COLOR: black; BACKGROUND-COLOR: #ffff66">busybox</B>是编译好就在文件系统里面然后写在flash上,然后内核启动mount
的,<B
style="COLOR: black; BACKGROUND-COLOR: #ffff66">busybox</B>作为init进程肯定是运行了.不知道init_main能不能显示printf的内容,应该是不行吧.<BR><BR><B
style="COLOR: black; BACKGROUND-COLOR: #ffff66">busybox</B>初始话<B
style="COLOR: black; BACKGROUND-COLOR: #99ff99">脚本</B>设为/etc/inittab<BR>其内容是<BR>::sysinit:/etc/rc.d/rcS<BR>::respawn:/sbin/getty
ttyS1 115200 #
这行试过ttyS0和ttyS1都不行,而且这2设备是可以被打开的.<BR>::shutdown:/bin/umount
-a<BR><BR><BR><BR><BR><BR>/etc/rc.d/rcS的内容是动态加载一些模块和设置设备参数<BR>头一部分是<BR>#!/bin/sh<BR><BR>#
This script runs when init it run during the boot process.<BR># Mounts
everything in the fstab<BR>echo "rdS start"<BR>mount -a<BR><BR>#turn on user
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -