⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uclinux

📁 本书讲叙了移植uclinux的三步骤,很容易理解
💻
📖 第 1 页 / 共 3 页
字号:
            name=2965></A><B>minian_007</B></SPAN><BR><SPAN 
            class=postdetails><BR><BR><BR>注册时间: 2004-03-16<BR>帖子: 
            43<BR></SPAN><BR></TD>
          <TD class=row1 vAlign=top width="100%" height=28>
            <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>
              <TR>
                <TD width="100%"><A 
                  href="http://www.gzlinux.org/forum/viewtopic.php?p=2965#2965"><IMG 
                  title=帖子 height=9 alt=帖子 
                  src="Guangzhou Linux Consortium  阅读主题 - uclinux的移植三步曲(第三步).files/icon_minipost.gif" 
                  width=12 border=0></A><SPAN class=postdetails>发表于: Wed Mar 24, 
                  2004 9:13 pm<SPAN class=gen>&nbsp;</SPAN>&nbsp; &nbsp;发表主题: 
                  uclinux的移植三步曲(第三步)</SPAN></TD>
                <TD vAlign=top noWrap><A 
                  href="http://www.gzlinux.org/forum/posting.php?mode=quote&amp;p=2965"><IMG 
                  title=引用并回复 alt=引用并回复 
                  src="Guangzhou Linux Consortium  阅读主题 - uclinux的移植三步曲(第三步).files/icon_quote.gif" 
                  border=0></A> </TD></TR>
              <TR>
                <TD colSpan=2>
                  <HR>
                </TD></TR>
              <TR>
                <TD colSpan=2><SPAN class=postbody>第三步:这第三步吗! 
                  当然就是开发你的驱动程序和应用程序啦. 
                  <BR>先值得说明的一点是在你嵌到linux里面的驱动程序,编译的时候不要在文件头部定义MODULE这个符号,因为在嵌入式linux中一般不会把模块编成可安装模式.而是直接放到嵌到内核中.在linux初始化的时候就执行自己初始程序,以向内核注册. 
                  <BR>好下面是两篇网友写的文章,我把它帖出来. <BR><BR>添加驱动程序 <BR>uclinux添加设备驱动的完整过程 
                  <BR>下面以添加一个字符设备为例,说明添加设备驱动的过程.块设备与网络设备可以比照处理. <BR>0.原文件放在 
                  linux-2.4.x/driver/char/ ;本例中,名为xyz.c 
                  <BR>1.设备驱动原文件必须包括这样的一个函数: <BR>void 
                  xyz_init(void){register(254, 'xyz', &amp;xyz_fops)} 
                  这个函数完成注册.在linux-2.4.x/driver/mem.c 将会调用它. <BR>这个函数也可以写成: 
                  <BR>void __init xyz_init(void){register(254, 'xyz', 
                  &amp;xyz_fops)} 这样不必须在 linux-2.4.x/driver/mem.c 调用它 <BR>2.修改 
                  linux-2.4.x/driver/char/Makefile 在适当位置添加一行: 
                  <BR>obj_$(CONFIG_XYZ) += xyz.o 
                  <BR>3.修改linux-2.4.x/driver/char/Config.in, 添加一行: <BR>bool 'xyz 
                  hahahaha' CONFIG_XYZ <BR>便于在 make menuconfig 时选择 
                  <BR>4.修改linux-2.4.x/driver/char/mem.c 
                  <BR>在适当位置(你去找就会发现,在文件头部)添加: <BR>#ifdef CONFIG_XYZ <BR>extern 
                  void xyz_init(void); <BR>#endif <BR>在chr_dev_init()函数添加: 
                  <BR>#ifdef CONFIG_XYZ <BR>xyz_init(); <BR>#endif <BR>5. 
                  修改vendor/Samsung/4510b/Makefile ,建立设备节点; <BR>在12---35行间,DEVICE 
                  部分添加 如下内容 <BR>xzy,c,254,0 <BR><BR>6.make menuconfig 选中 xyz 
                  hahahaha, <BR>编译,下载;启动后你会看到 /proc/devices 中字符设备多了一项 xyz 254 
                  <BR><BR><BR><BR><BR><BR><BR>应用程序的添加: 
                  <BR><BR>这个是在uclinux下如何添加应用程序的过程: 
                  <BR><BR>为4510B添加自己程序,并编译/下载它们的过程 <BR>step 1: 
                  <BR>创建一个自己的Application: 请首先认真阅读uClinux 2.4.x 
                  Kernel的目录内的Document,directry: 
                  <BR>../Documentation/Adding-User-Apps-HOWTO.txt <BR>通过阅读this 
                  document可以帮助您自己动手创建一个application. <BR>step 2: 
                  <BR>创建一个自己的application工程后,您可以利用Linux(Redhat等)在PC上编译,在PC上通过执行(./youappexe)来验证您的程序是否有bug 
                  or 
                  error等.但是这个在PC上看起来可以run的"可执行程序/文件"不是您的基于ARM/DragonBall/ColdFire/PowerPC等单片机环境的"可执行程序/文件",因为PC(x86)平台使用的文件系统和您的目标板子(单片机板子)的uClinux使用的文件系统不相同,uClinux的ROMFS格式的可执行程序/文件是不能被PC上的Linux(Redhat等)所认识的.假设您创建的new 
                  application: <BR>../user/MyApp/demo.c 
                  <BR>假设您已经完全按照下面的要求(*在../Documentation/Adding-User-Apps-HOWTO.txt中也是这样要求的 
                  *): <BR>../user/MyApp/demo.c的内容 ----- <BR>#include 
                  &lt;stdlib.h&gt; <BR>#include &lt;stdio.h&gt; <BR>void 
                  main(void) <BR>{ <BR>printf("Hello world! This is my first 
                  app. from WangZF,2002/11/04\n"); <BR>} 
                  <BR>../user/MyApp/Makefile的内容和格式 ----- <BR><BR>EXEC = demo 
                  <BR>OBJS = demo.o <BR><BR>all: $(EXEC) <BR><BR>$(EXEC): 
                  $(OBJS) <BR>$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS) 
                  <BR><BR>romfs: <BR>$(ROMFSINST) /bin/$(EXEC) <BR>clean: <BR>rm 
                  -f $(EXEC) *.elf *.gdb *.o 
                  <BR>然后编译它,仅在当前的应用程序目录执行:make,结果自己看吧,正如您的预料。 <BR>step 3: 
                  <BR>增加下面的内容到../user/Makefile中: 
                  <BR>dir_$(CONFIG_USER_MYAPP_DEMO) += myapp 
                  <BR>它的作用是让编译器可以访问到您创建的MyApp目录的Makefile. 
                  它被加到那一行并不重要,这个文件中的各路径排列是按照英文字母顺序,您也不比独具匠心,按照这个顺序把您的MyApp目录的路径加进去吧! 
                  <BR><BR>step 4: <BR>下一步是修改uClinux 2.4.x系统中对编译器来讲最重要的2个文件: 
                  <BR>../Config/config.in (1) <BR>../Config/Configure.help (2) 
                  <BR>../Config/autoconf.h (3) {[&lt;(这个文件不能手工修改,系统会自动修改它)&gt;]} 
                  <BR><BR>step 5: <BR>open 'config.in' file,首先把下面的内容拷贝: 
                  <BR><BR>############################################################################# 
                  <BR><BR>mainmenu_option next_comment <BR>comment 'My New 
                  Application' <BR><BR>bool 'demo' CONFIG_USER_MYAPP_DEMO 
                  <BR>bool 'app1' CONFIG_USER_MYAPP_APP1 <BR>bool 'app2' 
                  CONFIG_USER_MYAPP_APP2 <BR>bool 'app3' CONFIG_USER_MYAPP_APP3 
                  <BR>comment "My New Application" <BR><BR>endmenu 
                  <BR><BR>############################################################################# 
                  <BR><BR>step 6: <BR>make xconfig, 看到下面的画面!您的工作非常成功! 
                  <BR><BR>(sorry! i don't send .jpg files to website) 
                  <BR><BR>step 7: <BR>相信下面的几步大家都很熟悉: <BR>make dep <BR>make clean 
                  <BR>make lib_only(可以仅1次,不必要每次都来) <BR>make 
                  user_only(每次修改过您的应用程序之后,这一步后面的都必须重来) <BR>make romfs <BR>make 
                  image <BR>make <BR>step 8: <BR>download image.rom to your 
                  board! run it! 
                  <BR><BR>哈哈哈,到此为止,linux移植要做的工作大概就这么多了,大家肯定看到了.从上面的内容来看,uclinux的移值还是比较简单的.但大家不要庆幸,因要如果你要继续深入的话,那就是一句话"路漫漫其修远兮". 
                  比如怎么加一个新的平台(就是一个新的uclinux不支持的芯片)到uclinux中(之前我们做的只是选择别人己经做好的平台),makefile的撰写,内核程序的分析.总之还有很多很多,如果大家要想成为linux高手的话,这些都是必经之路.那我还是一句话结束这个话题"革命尚未成功,同志任需努力".</SPAN><SPAN 
                  class=postbody><BR>_________________<BR>linux有你才美丽</SPAN><SPAN 
                  class=gensmall></SPAN></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD class=row1 vAlign=center align=left width=150><SPAN class=nav><A 
            class=nav 
            href="http://www.gzlinux.org/forum/viewtopic.php?t=850&amp;highlight=uclinux%B5%C4%D2%C6%D6%B2%C8%FD%B2%BD%C7%FA#top">返回页首</A></SPAN></TD>
          <TD class=row1 vAlign=bottom noWrap width="100%" height=28>
            <TABLE height=18 cellSpacing=0 cellPadding=0 width=18 border=0>
              <TBODY>
              <TR>
                <TD vAlign=center noWrap><A 
                  href="http://www.gzlinux.org/forum/profile.php?mode=viewprofile&amp;u=268"><IMG 
                  title=阅览会员资料 alt=阅览会员资料 
                  src="Guangzhou Linux Consortium  阅读主题 - uclinux的移植三步曲(第三步).files/icon_profile.gif" 
                  border=0></A> <A 
                  href="http://www.gzlinux.org/forum/privmsg.php?mode=post&amp;u=268"><IMG 
                  title=发送站内信件 alt=发送站内信件 
                  src="Guangzhou Linux Consortium  阅读主题 - uclinux的移植三步曲(第三步).files/icon_pm.gif" 
                  border=0></A>
                  <SCRIPT language=JavaScript type=text/javascript><!--	if ( navigator.userAgent.toLowerCase().indexOf('mozilla') != -1 && navigator.userAgent.indexOf('5.') == -1 && navigator.userAgent.indexOf('6.') == -1 )		document.write(' ');	else		document.write('</td><td>&nbsp;</td><td valign="top" nowrap="nowrap"><div style="position:relative"><div style="position:absolute"></div><div style="position:absolute;left:3px;top:-1px"></div></div>');				//--></SCRIPT>
                   <NOSCRIPT></NOSCRIPT></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD class=spaceRow colSpan=2 height=1><IMG height=1 alt="" 
            src="Guangzhou Linux Consortium  阅读主题 - uclinux的移植三步曲(第三步).files/spacer.gif" 
            width=1></TD></TR>
        <TR align=middle>
          <TD class=catBottom colSpan=2 height=28>
            <TABLE cellSpacing=0 cellPadding=0 border=0>
              <TBODY>
              <TR>
                <FORM action=viewtopic.php?t=850&amp;start=0 method=post>
                <TD align=middle><SPAN class=gensmall>从以前的帖子开始显示: <SELECT 
                  name=postdays><OPTION value=0 selected>所有帖子</OPTION><OPTION 
                    value=1>1 天内</OPTION><OPTION value=7>7 天内</OPTION><OPTION 
                    value=14>2 星期内</OPTION><OPTION value=30>1 月内</OPTION><OPTION 
                    value=90>3 月内</OPTION><OPTION value=180>6 月内</OPTION><OPTION 
                    value=364>1 年内</OPTION></SELECT>&nbsp;<SELECT 
                    name=postorder><OPTION value=asc 
                    selected>最旧的帖子</OPTION><OPTION 
                  value=desc>最新的帖子</OPTION></SELECT>&nbsp;<INPUT class=liteoption type=submit value=Go name=submit></SPAN></TD></FORM></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=2 cellPadding=2 width="100%" align=center border=0>
        <TBODY>
        <TR>
          <TD vAlign=center noWrap align=left><SPAN class=nav><A 
            href="http://www.gzlinux.org/forum/posting.php?mode=newtopic&amp;f=44"><IMG 
            alt=发表新帖 
            src="Guangzhou Linux Consortium  阅读主题 - uclinux的移植三步曲(第三步).files/post.gif" 
            align=middle border=0></A>&nbsp;&nbsp;&nbsp;<A 
            href="http://www.gzlinux.org/forum/posting.php?mode=reply&amp;t=850"><IMG 
            alt=回复帖子 
            src="Guangzhou Linux Consortium  阅读主题 - uclinux的移植三步曲(第三步).files/reply.gif" 
            align=middle border=0></A></SPAN></TD>
          <TD vAlign=center align=left width="100%"><SPAN 
            class=nav>&nbsp;&nbsp;&nbsp;<A class=nav 
            href="http://www.gzlinux.org/forum/index.php">Guangzhou Linux 
            Consortium 首页</A> -&gt; <A class=nav 
            href="http://www.gzlinux.org/forum/viewforum.php?f=44">嵌入式Linux</A></SPAN></TD>
          <TD vAlign=top noWrap align=right><SPAN class=gensmall>论坛时间为 
            北京时间</SPAN><BR><SPAN class=nav></SPAN></TD></TR>
        <TR>
          <TD align=left colSpan=3><SPAN 
          class=nav>第<B>1</B>页/共<B>1</B>页</SPAN></TD></TR></TBODY></TABLE>
      <TABLE cellSpacing=2 width="100%" align=center border=0>
        <TBODY>
        <TR>
          <TD vAlign=top noWrap align=left width="40%"><SPAN 
            class=gensmall><BR><A 
            href="http://www.gzlinux.org/forum/favorites.php?t=850&amp;mode=add">加入收藏夹</A></SPAN><BR>&nbsp;<BR></TD>
          <TD vAlign=top noWrap align=right>
            <FORM name=jumpbox 
            onsubmit="if(document.jumpbox.f.value == -1){return false;}" 
            action=viewforum.php method=get>
            <TABLE cellSpacing=0 cellPadding=0 border=0>
              <TBODY>
              <TR>
                <TD noWrap><SPAN class=gensmall>转跳到:&nbsp;<SELECT 
                  onchange="if(this.options[this.selectedIndex].value != -1){ forms['jumpbox'].submit() }" 
                  name=f><OPTION value=-1>选择一个版面</OPTION><OPTION 
                    value=-1>&nbsp;</OPTION><OPTION 
                    value=-1>消息与事务处理区</OPTION><OPTION 
                    value=-1>----------------</OPTION><OPTION 
                    value=1>公共消息</OPTION><OPTION value=3>建议与错误报告</OPTION><OPTION 
                    value=-1>&nbsp;</OPTION><OPTION 
                    value=-1>开源项目研讨</OPTION><OPTION 
                    value=-1>----------------</OPTION><OPTION 
                    value=45>Vocal与软交换</OPTION><OPTION value=46>Jetspeed 
                    Portal研讨</OPTION><OPTION value=47>IM Server 
                    Jabberd研讨</OPTION><OPTION value=-1>&nbsp;</OPTION><OPTION 
                    value=-1>Linux软件开发</OPTION><OPTION 
                    value=-1>----------------</OPTION><OPTION 
                    value=27>Java开发与Web服务</OPTION><OPTION 
                    value=28>C&amp;C++开发</OPTION><OPTION 
                    value=29>脚本语言</OPTION><OPTION value=44 
                    selected>嵌入式Linux</OPTION><OPTION 
                    value=-1>&nbsp;</OPTION><OPTION 
                    value=-1>Linux基础与应用区</OPTION><OPTION 
                    value=-1>----------------</OPTION><OPTION 
                    value=34>Linux基础与桌面应用</OPTION><OPTION 
                    value=37>Linux服务器端应用</OPTION><OPTION 
                    value=39>存储系统与数据库</OPTION><OPTION 
                    value=38>案例研究</OPTION><OPTION 
                    value=-1>&nbsp;</OPTION><OPTION 
                    value=-1>轻松一下</OPTION><OPTION 
                    value=-1>----------------</OPTION><OPTION 
                    value=41>IT新闻与评论</OPTION><OPTION 
                  value=22>灌水</OPTION></SELECT><INPUT type=hidden 
                  value=959a4a9f4ac6cb5806c324f4eabd3a59 name=sid>&nbsp;<INPUT class=liteoption type=submit value=Go></SPAN></TD></TR></TBODY></TABLE></FORM><SPAN 
            class=gensmall>您<B>不能</B>发布新主题<BR>您<B>可以</B>在这个论坛回复主题<BR>您<B>不能</B>在这个论坛编辑自己的帖子<BR>您<B>不能</B>在这个论坛删除自己的帖子<BR>您<B>不能</B>在这个论坛发表投票<BR>You 
            <B>cannot</B> attach files in this forum<BR>You <B>cannot</B> 
            download files in this forum<BR></SPAN></TD></TR></TBODY></TABLE>
      <DIV align=center><SPAN class=copyright><BR><BR><!--	We request you retain the full copyright notice below including the link to www.phpbb.com.	This not only gives respect to the large amount of time given freely by the developers	but also helps build interest, traffic and use of phpBB 2.0. If you cannot (for good	reason) retain the full copyright we request you at least leave in place the	Powered by phpBB 2.0.10 line, with phpBB linked to www.phpbb.com. If you refuse	to include even this then support on our forums may be affected.	The phpBB Group : 2002// -->Powered 
      by <A class=copyright href="http://www.phpbb.com/" target=_phpbb>phpBB</A> 
      2.0.10 Patched on 2004-12-27 &copy; 2001, 2002 phpBB 
  Group<BR></SPAN></DIV></TD></TR></TBODY></TABLE></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -