📄 uclinux
字号:
<BR>ARCH/ARMNOMMU/BOOT/MAKEFILE中 <BR>ZREALADDR
决定KERNEL解压后数据输出的地址,同1,0xc000000 <BR>ZTEXTADDR
带BOOTLOADER的压缩内核文件烧入FLASH的起始地址,即从哪个位置开始执行,0xc300000. <BR>==修改
<BR>include/asm-armnommu//proc-armv/system.h中 <BR>#ifdef
CONFIG_ARCH_S3C44B0 <BR>#undef vectors_base() <BR>#define
vectors_base() (0x0c7fff00) <BR>#endif <BR>13.串口的波特率调整
<BR>串口问题:经常碰到的是串口显示乱码或是没有显示。对于串口无显示,极可以是没有在uClinux核心中配置支持Serial
Port。而显示乱码多半是波特率不对。对于前者如已配置了串口支持还没显示,则可用JTAG跟入到Kernel中的第一个printk中去看看。对于后者,有几种情况。第一种是BootLoader中的波特率设定与uClinux中不一样,这种情况下直接让两者一致就可以了。第二种情况是波特率设的虽一样,但两边的频率设定不一样。在加入TPU的Patch之后,uClinux中默认的时钟为60MHz,如果BootLoader设定的PLL时钟不是60Mhz,就会造成uClinux与BootLoader中的设定不一致而产生乱码。还有一种情况是以上设定都对,但是uClinux在计算时会舍去小数点后的数,使较高的波特率发生偏差。这时应把算法改为四舍五入。最后还有一种情况是uClinux前面的输出很正确,但进行CONSOLE后,就变成乱码了,这也是由于是计算时的误差造成的。
<BR><BR>(data 12/0<IMG alt=Cool
src="Guangzhou Linux Consortium 阅读主题 - uclinux的移植三步曲(第二步).files/icon_cool.gif"
border=0>遇到乱码的情况,查看bootloader中的PLL时钟设置发现
<BR>设成了pin为10Mhz,pout为60Mhz.错误就在这里,pin其实是8m的.
<BR>所以修改bootloader <BR>[ PLLCLK = 60000000 <BR>M_DIV EQU 52
;Fin=8MHz Fout=60MHz <BR>P_DIV EQU 2 <BR>S_DIV EQU 1 <BR>]
<BR>重新烧写bootloader,显示正确! <BR>*^_^*
<BR><BR>14.start_kernel中,无法通过calibrate_delay函数
<BR>简单测试,初步认为与sti()函数的位置无关. <BR><BR>经历了无数次的测试发现, <BR>好像是这样的.
<BR><BR>start_kernel中在calibrate_delay周围,
<BR>如果调用了init_main.c中的__init函数就会停在此函数处. <BR>如果调用了其他.c(如
drivers/serial/s3c44b0.c)中的__init函数,表现正常.
<BR><BR>但是呢,start_kernel中的parse_options也是__init函数如果把它放在前面没错,
<BR>如果放在calibrate周围也会停住.
<BR><BR>calibrate_delay如果放在parse_options周围,没错可以通过.
<BR>calibrate_delay如果放在console_init周围,有错,无法通过. <BR><BR>查到一点信息
<BR>case: <BR>是8m sdram 0xc000000-0xc800000
<BR>把vector_base置为0xc7fff00 <BR>Image装载到0xc000000处.
<BR><BR>problem: <BR>calibrate_delay的代码段(.init段0xc000200)被覆盖了.
<BR>出现的时机好像不固定,有时在start_kernel的init_IRQ之前有时在之后. <BR><BR>每次都是
<BR>0xc000100-0xc000200之后的一段空间, <BR>被vector_IRQ ,vector_data
,vector_prefetch(arch/armnommu/kernel/entry-armv.S中) 他们的代码覆盖.
<BR>所以calibrate被调用时就会出错. <BR><BR>答: <BR><BR>15.修改12部的设计方案
<BR>bootloader 在flashrom中0x0-0x1000段 <BR>kernel
image在flashrom中0x1000-0x1fffff段 <BR>由bootloader把kernel
image从rom0x1000中拷到ram0xc008000处 <BR><BR>irq vector 从ram
0xc000000 开始 <BR>在bootloader中_ISR_STARTADDRESS 指定. <BR>在kernel
中由vectors_base指定. <BR><BR>BOOTLOADER=============== <BR>b
ResetHandler ;for debug <BR>ldr pc,=0xc000004 ;handlerUndef
0xc000004 <BR>ldr pc,=0xc000008 ;SWI interrupt handler
0xc000008 <BR>ldr pc,=0xc00000c ;handlerPAbort 0xc00000c
<BR>ldr pc,=0xc000010 ;handlerDAbort 0xc000010 <BR>ldr
pc,=0xc000014 ;handlerReserved 0xc000014 <BR>ldr pc,=0xc000018
;irq 0xc000018 <BR>ldr pc,=0xc00001c ;fiq 0xc00001c
<BR><BR>把内核image拷贝到0xc008000处,再跳到0xc008000处执行
<BR><BR>KERNEL================== <BR><BR>==修改
<BR>arch/armnommu/Makefile中 <BR>TEXTADDR
决定KERNEL起始运行地址,即IMAGE应DOWN到的位置0xc008000 <BR>==修改
<BR>ARCH/ARMNOMMU/BOOT/MAKEFILE中 <BR>ZREALADDR
决定KERNEL解压后数据输出的地址,同1,0xc008000 <BR>ZTEXTADDR
带BOOTLOADER的压缩内核文件烧入FLASH的起始地址,即从哪个位置开始执行,0xc300000. <BR>==修改
<BR>include/asm-armnommu//proc-armv/system.h中 <BR>#ifdef
CONFIG_ARCH_S3C44B0 <BR>#undef vectors_base() <BR>#define
vectors_base() (0x0c000000)
<BR><BR>&&&&&&&&&&&&&&&&
<BR>&problem 14解决&
<BR>&&&&&&&&&&&&&&&&
<BR><BR>16 <BR>但是,为什么为发生代码段的拷贝, 0x8000的空间分配是怎样的? <BR>答:
<BR>先看arch/armnommu/kernel/entry_armv.S中的__trap_init
<BR>在vectors_base处(0xc000000) @set up the vectors
<BR>把stubs拷贝到vectors_base+0x200处(0xc000200) .
<BR>stubs即每种异常(irq,fiq,data,undefined等)的分类处理路线.
<BR>这样从0xc000000-0xc000200-到0xc000***,就建立起了完整的中断处理表.
<BR><BR>而在这中间0xc000100处有其他信息请参见17.
<BR><BR>17.启动时setup_arch中出现Warning: bad configuration page,
trying to continue <BR>原因是,parse_params()要获取相关参数信息,
<BR>在arch/armnommu/mach-s3c44b0/arch.c中
<BR>把arch的params定位在0xc000100处,
<BR>这个params是bootloader应该做的工作.!! <BR><BR>18.无法 在blkmem和vfs处停住
<BR>现象: <BR>(make menuconfig时选定romfs 和rom disk support)
<BR>(修改blkmem_init()加入此二句. <BR>arena[0].length = (unsigned
long)(-1); <BR>arena[0].address = (unsigned long)0x0C700000;
<BR>在装载内核的时候,要把romfs.img装载到0xc70000处. <BR>) <BR>生成romfs
<BR>/*referring to the Makefile of uclinux-disk-20030909*/
<BR>genromfs -v -V "ROMdisk" -f $(ROMFSIMG) -d $(ROMFSDIR)
<BR>cat $(IMAGEDIR)/linux.text $(IMAGEDIR)/linux.data
$(ROMFSIMG) > $(IMAGE) <BR><BR>Blkmem 0 disk images:
<BR>device is 0, arenas is 0 <BR>arena open of 0 failed!
<BR>VFS: Cannot open root device "rom0" or 1f:00 <BR>Please
append a correct "root=" boot option <BR>Kernel panic: VFS:
Unable to mount root fs on 1f:00 <BR>问题:
<BR>是不是如果我选择把romfs放在ram中就应该support ram disk
<BR>如果把romfs放在rom中就应该support rom disk啊.
<BR><BR>我把blkmem_init()中加了两句. <BR>arena[0].length = (unsigned
long)(-1); <BR>arena[0].address = (unsigned long)0x0C700000;
<BR><BR>但是不管选support ram disk还是rom disk都不行, <BR>请问这可能是什么原因?
<BR><BR>解决: <BR>发现arenas始终为0. 也就是说config时,选定的flash芯片不符,
<BR>所以初始化时arena[]数组大小为0. <BR><BR>所以修改#define arenas 1
<BR>然后编译. <BR><BR>现在显示: <BR>Blkmem 1 disk images: <BR>0:
C700000-C742BFF [VIRTUAL C700000-C742BFF] (RW) <BR>device is
0, arenas is 1 <BR>, address is c700000 <BR>VFS: Mounted root
(romfs filesystem) readonly. <BR>Freeing init memory: 32K
<BR>busybox v0.60.4 (2002.11.25-19:05+0000) multi-call binary
<BR><BR>Usage: busybox [function] [arguments]... <BR>or:
[function] [arguments]... <BR><BR>busybox is a multi-call
binary that combines many comKernel panic: Attem <BR>pted to
kill init! <BR>mon Unix <BR>utilities into a single
executable. Most people will create a <BR>link to busybox for
each function they wish to use, and busybox <BR>will act like
whatever it was invoked as. <BR><BR>Currently defined
functions: <BR>[, busybox, cat, chmod, clear, cp, date, dd,
df, dmesg, du, echo, <BR>env, false, free, hostname, insmod,
kill, killall, ln, ls, lsmod, <BR>mkdir, mknod, modprobe,
mount, msh, mv, ps, pwd, rm, rmdir, rmmod, <BR>sh, sleep,
syslogd, test, touch, true, umount, uname <BR><BR>19.
<BR>>>make menuconfig(这里选用0522dist,只用它来编译romfs)
<BR>在user application 配置选上 <BR>init ;console
shell;login;sash(如果用bash无法编译通过);busybox等 <BR>>>make dep;
<BR>>>make lib_only; <BR>>>make user_only;
<BR>>>make romfs; <BR>>>genromfs -v -V "ROMdisk"
-f [ROMFSIMAGE] -d [ROMFSDIR] <BR>现在执行完
<BR>/etc/rc就出现"Execution finished!. exiting..."
<BR><BR>修改/etc/rc, <BR>最后加一句 <BR>sh <BR>让sash跑起来 <BR>出现
<BR>____ _ _ <BR>/ __| ||_| <BR>_ _| | | | _ ____ _ _ _ _
<BR>| | | | | | || | _ \| | | |\ \/ / <BR>| |_| | |__| || | |
| | |_| |/ \ <BR>| ___\____|_||_|_| |_|\____|\_/\_/ <BR>| |
<BR>|_| <BR><BR>For further information check: <BR><A
href="http://www.uclinux.org/"
target=_blank>http://www.uclinux.org/</A> <BR><BR>Command: sh
<BR><BR>Sash command shell (version 1.1.1) <BR>name is (null).
<BR>/> Reading command line: Bad file descriptor <BR>pid
10: failed 256 <BR>Execution Finished, Exiting <BR>init:
Booting to single user mode <BR><BR>Sash command shell
(version 1.1.1) <BR>name is (null). <BR>/> <BR>还有一个问题,
<BR>我现在是这样调试的 <BR>0x0-0x1000放bootloader代码, <BR>调试的时候把kernel
load到0xc008000 <BR>把romfs load到0xc700000. <BR>然后pc设置为0,开始执行.
<BR><BR>但是现在每次中断后,重新置为pc = 0. <BR>重新执行就oops了.
<BR><BR>shell的符号终于出现了... <BR>(等续)</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=846&start=0&postdays=0&postorder=asc&highlight=#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&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&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> </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>
<TD class=row2 vAlign=top align=left width=150><SPAN class=name><A
name=4264></A><B>游客</B></SPAN><BR><SPAN
class=postdetails><BR><BR><BR><BR><BR></SPAN><BR></TD>
<TD class=row2 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=4264#4264"><IMG
title=帖子 height=9 alt=帖子
src="Guangzhou Linux Consortium 阅读主题 - uclinux的移植三步曲(第二步).files/icon_minipost.gif"
width=12 border=0></A><SPAN class=postdetails>发表于: Mon Jan 10,
2005 11:09 am<SPAN class=gen> </SPAN> 发表主题:
Re: uclinux的移植三步曲(第二步)</SPAN></TD>
<TD vAlign=top noWrap><A
href="http://www.gzlinux.org/forum/posting.php?mode=quote&p=4264"><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></SPAN>
<TABLE cellSpacing=1 cellPadding=3 width="90%" align=center
border=0>
<TBODY>
<TR>
<TD><SPAN class=genmed><B>minian_007
写到:</B></SPAN></TD></TR>
<TR>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -