免费注册 查看新帖 |

Chinaunix

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

[NetBSD] mini2440上运行netbsd 6 beta2 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-07-16 11:17 |只看该作者 |倒序浏览
本帖最后由 Prife 于 2012-07-16 11:36 编辑

host: ubuntu 12.04 32bit
netbsd版本: ftp://ftp.netbsd.org/pub/NetBSD/NetBSD-6.0_BETA2/evbarm/
板子:mini2440

最近netbsd增加了对mini2440的支持,参见这里http://xpg.dk/projects/netbsd-support-for-the-mini2440/

上面的网页点击后,内部有一个HOWTO的链接即,http://xpg.dk/projects/netbsd-su ... 440/nb-mini2440-ht/,点击进入之后,就有详细的步骤。

尽管笔者照着他给的howto操作,但依然遇到了困难
1. 问题1, bootmini2440无法通过nfs/tftp加载netsd
beta2中自带的bootmini2440好像有些问题,无法正常初始化DM9000,也就无法使用NFS来加载netbsd,但是u-boot却可以使用nfs和tftp。为了顺利启动内核,我不得不利用uboot将netbsd(bin格式,非elf格式)加载到指定RAM(0x30200000) 然后修改bootmini2440代码,使其设置完MMU后,直接跳转到 0x30200000处运行。

终于成功启动内核。

2.  制作ramfs后启动失败
参考 http://bbs.chinaunix.net/thread-801055-1-1.html 中的步骤,制作了一个3M的 ramdisk,并启动,但却提示如下信息:

下面是uboot中的操作:

MINI2440 # tftp 30a00000 bootmini2440
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:08:11:18:12:27
TFTP from server 10.0.0.107; our IP address is 10.0.0.105
Filename 'bootmini2440'.
Load address: 0x30a00000
Loading: ########
done
Bytes transferred = 110208 (1ae80 hex)
MINI2440 # tftp 30200000 ramdisk     
dm9000 i/o: 0x20000300, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:08:11:18:12:27
TFTP from server 10.0.0.107; our IP address is 10.0.0.105
Filename 'ramdisk'.
Load address: 0x30200000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ###############################
done
Bytes transferred = 5224448 (4fb800 hex)
MINI2440 # go 30a00000
## Starting application at 0x30A00000 ...
S3C: CLK=405 HCLK=101 PCLK=50 UCLK=48
S3C: CLK=405 HCLK=101 PCLK=50 UCLK=48

接下里就可以看到netbsd的启动信息了,如下所示

>> NetBSD/evbarm boot2440, revision 1.0 (Sun Jul 15 11:13:29 CST 2012)
Argument count: 1
Boot string: 30a00000
val = 29282b2a, DM9000 Chip not found
suppose it runs in qemu, run all the same
begin open tftp file, add by prife 2012/07/14 17:42:51
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 6.0_BETA2 (MY_2440) #0: Mon Jul  9 22:47:41 CST 2012
        prife@smart:/usr/src/sys/arch/evbarm/compile/MY_2440
total memory = 65536 KB
avail memory = 58468 KB
mainbus0 (root)
cpu0 at mainbus0: ARM920T rev 0 (ARM9TDMI core)
cpu0: DC enabled IC enabled WB enabled EABT
cpu0: 16KB/32B 64-way Instruction cache
cpu0: 16KB/32B 64-way write-back-locking-A Data cache
ssio0 at mainbus0: fclk 405 MHz hclk 101 MHz pclk 50 MHz
ohci0 at ssio0 intr 26
ohci0: OHCI version 0.0
ohci0: unsupported OHCI revision
ohci0: init failed, error=4
sscom0 at ssio0 unit 0
sscom0: console (major=104)
ssextio0 at ssio0
dme0 at ssextio0 addr 0x20000300 intr 7
dme0: Unable to get mac-address property
lcd0 at ssio0
s3c_lcd_write: attempt to enable LPC3600
wsdisplay0 at lcd0
lcd0: Allocating LCD frame buffer of size 153600
sssdi0 at ssio0
sdmmc0 at sssdi0
ssiis0 at ssio0
udassio0 at ssiis0
audio0 at udassio0: half duplex, playback, capture
sstouch0 at ssio0
wsmouse0 at sstouch0 mux 0
ssrtc0 at ssio0: RTC
clock: hz=100 stathz = 64 PCLK=50625000 prescaler=2 tc=24719
boot device: <unknown>
root on md0a dumps on md0b
root file system type: ffs
warning: no /dev/console
exec /sbin/init: error 2
init: trying /sbin/oinit
exec /sbin/oinit: error 2
init: trying /sbin/init.bak
exec /sbin/init.bak: error 2
init path (default /sbin/init):


但实际上在/sbin/init文件是存在的。不知道为什么无法加载。
笔者google了很久也没有找到解决方案。。。如果有人知道,请多多指点。

PS:  笔者在 mini2440-qemu上和开发板上都作了尝试,同样的错误。关于如何使用qemu来模拟2440可以参考笔者的qemu配置笔记,在这里:
https://github.com/prife/documen ... 40_qemu_install.txt

3. SD卡安装netbsd失败
然后尝试参考HOWTO的第一节,尝试将netbsd安装到SD卡上,同样遇到问题,笔者使用的是2G的SD卡,在安装时选择分区后,始终提示遇到错误,无法安装,然后就会返回第一页继续安装,整个过程如下所示。













到下一步就出错了,然后就会回到第一个页面继续。

评分

参与人数 1可用积分 +6 收起 理由
send_linux + 6

查看全部评分

论坛徽章:
13
15-16赛季CBA联赛之同曦
日期:2016-01-28 19:52:032015亚冠之北京国安
日期:2015-10-07 14:28:19NBA常规赛纪念章
日期:2015-05-04 22:32:03处女座
日期:2015-01-15 19:45:44卯兔
日期:2014-10-28 16:17:14白羊座
日期:2014-05-24 15:10:46寅虎
日期:2014-05-10 09:50:35白羊座
日期:2014-03-12 20:52:17午马
日期:2014-03-01 08:37:27射手座
日期:2014-02-19 19:26:54子鼠
日期:2013-11-30 09:03:56狮子座
日期:2013-09-08 08:37:52
2 [报告]
发表于 2012-07-16 11:20 |只看该作者
感谢分享宝贵的经验 ^_^

论坛徽章:
0
3 [报告]
发表于 2012-07-16 11:25 |只看该作者
回复 2# ulovko


   晕啊,我是想求一下解决方案啊。有没有同学在玩2440上跑netbsd的?

论坛徽章:
49
15-16赛季CBA联赛之福建
日期:2016-06-22 16:22:002015年亚洲杯之中国
日期:2015-01-23 16:25:12丑牛
日期:2015-01-20 09:39:23未羊
日期:2015-01-14 23:55:57巳蛇
日期:2015-01-06 18:21:36双鱼座
日期:2015-01-02 22:04:33午马
日期:2014-11-25 09:58:35辰龙
日期:2014-11-18 10:40:07寅虎
日期:2014-11-13 22:47:15申猴
日期:2014-10-22 15:29:50摩羯座
日期:2014-08-27 10:49:43辰龙
日期:2014-08-21 10:47:58
4 [报告]
发表于 2012-07-17 09:38 |只看该作者
Prife 发表于 2012-07-16 11:25
回复 2# ulovko


这个可能嵌入式开发板块的人多点,玩嵌入式板子的嘛,呵呵

论坛徽章:
0
5 [报告]
发表于 2012-07-18 16:04 |只看该作者
mark

帮顶!

论坛徽章:
2
亥猪
日期:2014-03-19 16:36:35午马
日期:2014-11-23 23:48:46
6 [报告]
发表于 2012-07-18 16:48 |只看该作者
回复 1# Prife


手上没系统,只能根据印象看看了.
第一个问题前面都起来了,内核和ramdisk看起来都合法,剩下应该是文件系统里的东西没做好,包括/dev/console等等.
第二个问题分区没弄对.没记错的话,应该有地方指定swap和/分区,你给的图上没看见.

论坛徽章:
0
7 [报告]
发表于 2012-07-18 17:51 |只看该作者
回复 7# gvim


ramdisk的大小是严格要求的,在conf/INSTALL文件(该文件由SMDK2410_INSTALL包含进去)中有一句MEMORY_DISK_ROOT_SIZE=6150,它是以512字节的快形式给出,具体的换算是6150*512/1024 = 6150/2 =3075k 稍微大于3m(所以我们在第4步的nbmakefs 的时候 -s参数给的是3m),这里内核本身预留的空间至少要大于后等于nbmakefs产生的ramdisk大小。

这个ramdisk只有3m,如果要制作更大的ramdisk,放更多的东西进去,需要修改2行内核代码,有兴趣咱们再另外说


请问修改哪里的代码?

我现在的程序有了些新的进展。

原来的ramdisk里我忘记添加 /lib下加入动态链接库,导致内核无法启动init。现在我加入库之后,ramdisk超过3M,因此我修改INSTALL文件,将ramdisk修改为5M后,制作ramdisk,并启动运行,这次我得到的信息是:

>> NetBSD/evbarm boot2440, revision 1.0 (Sun Jul 15 11:13:29 CST 2012)
Argument count: 1
Boot string: 30a00000
val = 29282b2a, DM9000 Chip not found
suppose it runs in qemu, run all the same
begin open tftp file, add by prife 2012/07/14 17:42:51
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 6.0_BETA2 (MY_2440) #1: Wed Jul 18 15:31:44 CST 2012
        prife@smart:/usr/src/sys/arch/evbarm/compile/MY_2440
total memory = 65536 KB
avail memory = 56456 KB
mainbus0 (root)
cpu0 at mainbus0: ARM920T rev 0 (ARM9TDMI core)
cpu0: DC enabled IC enabled WB enabled EABT
cpu0: 16KB/32B 64-way Instruction cache
cpu0: 16KB/32B 64-way write-back-locking-A Data cache
ssio0 at mainbus0: fclk 405 MHz hclk 101 MHz pclk 50 MHz
ohci0 at ssio0 intr 26
ohci0: OHCI version 0.0
ohci0: unsupported OHCI revision
ohci0: init failed, error=4
sscom0 at ssio0 unit 0
sscom0: console (major=104)
ssextio0 at ssio0
dme0 at ssextio0 addr 0x20000300 intr 7
dme0: Unable to get mac-address property
lcd0 at ssio0
s3c_lcd_write: attempt to enable LPC3600
wsdisplay0 at lcd0
lcd0: Allocating LCD frame buffer of size 153600
sssdi0 at ssio0
sdmmc0 at sssdi0
ssiis0 at ssio0
udassio0 at ssiis0
audio0 at udassio0: half duplex, playback, capture
sstouch0 at ssio0
wsmouse0 at sstouch0 mux 0
ssrtc0 at ssio0: RTC
clock: hz=100 stathz = 64 PCLK=50625000 prescaler=2 tc=24719
boot device: <unknown>
root on md0a dumps on md0b
root file system type: ffs
warning: no /dev/console
panic: init died (signal 0, exit 11)
Stopped in pid 1.1 (init) at    c0218d3c:       mov     r15, r14
db>


另外,查看 嵌入程序的动态链接库可以使用这个方法:

arm--netbsdelf-readelf -d  init

prife@smart:~/work/ramdisk$ arm--netbsdelf-readelf -d  sbin/init

Dynamic section at offset 0x442c contains 20 entries:
  Tag        Type                         Name/Value
0x00000001 (NEEDED)                     Shared library: [libutil.so.7]
0x00000001 (NEEDED)                     Shared library: [libcrypt.so.1]
0x00000001 (NEEDED)                     Shared library: [libc.so.12]

0x0000000f (RPATH)                      Library rpath: [/lib]
0x0000000c (INIT)                       0x8f78
0x0000000d (FINI)                       0xbb44
0x00000004 (HASH)                       0x8134
0x00000005 (STRTAB)                     0x89a0
0x00000006 (SYMTAB)                     0x83c0
0x0000000a (STRSZ)                      815 (bytes)
0x0000000b (SYMENT)                     16 (bytes)
0x00000015 (DEBUG)                      0x0
0x00000003 (PLTGOT)                     0x144f4
0x00000002 (PLTRELSZ)                   576 (bytes)
0x00000014 (PLTREL)                     REL
0x00000017 (JMPREL)                     0x8d38
0x00000011 (REL)                        0x8cd0
0x00000012 (RELSZ)                      104 (bytes)
0x00000013 (RELENT)                     8 (bytes)
0x00000000 (NULL)                       0x0
prife@smart:~/work/ramdisk$

这样就可以在主机上查看了,并且可以编写一个脚本,自动对ramdisk文件夹下所有可执行文件调用上面的命令,将输出保存成一个文件 libraw.txt,然后再使用
grep  "Shared library"   libraw.txt
取出所有共享库的行,然后再用 sort -u 删除重复的行,

0x00000001 (NEEDED)                     Shared library: [libbz2.so.1] >
0x00000001 (NEEDED)                     Shared library: [libcrypt.so.1]
0x00000001 (NEEDED)                     Shared library: [libc.so.12]
0x00000001 (NEEDED)                     Shared library: [libc.so.6]
0x00000001 (NEEDED)                     Shared library: [libcurses.so.7] >>
0x00000001 (NEEDED)                     Shared library: [libedit.so.3]
0x00000001 (NEEDED)                     Shared library: [libipsec.so.3]
0x00000001 (NEEDED)                     Shared library: [libkvm.so.6]
0x00000001 (NEEDED)                     Shared library: [liblzma.so.1]
0x00000001 (NEEDED)                     Shared library: [libm.so.0]
0x00000001 (NEEDED)                     Shared library: [libprop.so.1]
0x00000001 (NEEDED)                     Shared library: [librt.so.1]    >>
0x00000001 (NEEDED)                     Shared library: [librumpclient.so.0]
0x00000001 (NEEDED)                     Shared library: [libterminfo.so.1]
0x00000001 (NEEDED)                     Shared library: [libutil.so.7]
0x00000001 (NEEDED)                     Shared library: [libz.so.1]

论坛徽章:
2
亥猪
日期:2014-03-19 16:36:35午马
日期:2014-11-23 23:48:46
8 [报告]
发表于 2012-07-18 18:00 |只看该作者
VERBOSE_INIT_ARM

你把这个宏打开.

论坛徽章:
0
9 [报告]
发表于 2012-07-18 18:13 |只看该作者
回复 9# gvim

好像没什么新变化,我修改的是 MINI2440

MINI2440_INSTALL 依赖 MINI2440这个宏。

options     VERBOSE_INIT_ARM # verbose bootstraping messages

然后启动这个新的netbsd。信息如下

    >> NetBSD/evbarm boot2440, revision 1.0 (Sun Jul 15 11:13:29 CST 2012)
Argument count: 1
Boot string: 30a00000
val = 29282b2a, DM9000 Chip not found
suppose it runs in qemu, run all the same
begin open tftp file, add by prife 2012/07/14 17:42:51
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011, 2012
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 6.0_BETA2 (MY_2440) #2: Wed Jul 18 18:06:36 CST 2012
        prife@smart:/usr/src/sys/arch/evbarm/compile/MY_2440
total memory = 65536 KB
avail memory = 56456 KB
mainbus0 (root)
cpu0 at mainbus0: ARM920T rev 0 (ARM9TDMI core)
cpu0: DC enabled IC enabled WB enabled EABT
cpu0: 16KB/32B 64-way Instruction cache
cpu0: 16KB/32B 64-way write-back-locking-A Data cache
ssio0 at mainbus0: fclk 405 MHz hclk 101 MHz pclk 50 MHz
ohci0 at ssio0 intr 26
ohci0: OHCI version 0.0
ohci0: unsupported OHCI revision
ohci0: init failed, error=4
sscom0 at ssio0 unit 0
sscom0: console (major=104)
ssextio0 at ssio0
dme0 at ssextio0 addr 0x20000300 intr 7
dme0: Unable to get mac-address property
lcd0 at ssio0
s3c_lcd_write: attempt to enable LPC3600
wsdisplay0 at lcd0
lcd0: Allocating LCD frame buffer of size 153600
sssdi0 at ssio0
sdmmc0 at sssdi0
ssiis0 at ssio0
udassio0 at ssiis0
audio0 at udassio0: half duplex, playback, capture
sstouch0 at ssio0
wsmouse0 at sstouch0 mux 0
ssrtc0 at ssio0: RTC
clock: hz=100 stathz = 64 PCLK=50625000 prescaler=2 tc=24719
boot device: <unknown>
root on md0a dumps on md0b
root file system type: ffs
warning: no /dev/console
panic: init died (signal 0, exit 11)
Stopped in pid 1.1 (init) at    c0218d3c:       mov     r15, r14
db>

论坛徽章:
2
亥猪
日期:2014-03-19 16:36:35午马
日期:2014-11-23 23:48:46
10 [报告]
发表于 2012-07-18 18:17 |只看该作者
回复 10# Prife


    你用的/sbin/init和/netbsd编译器用的一样吗?看下他们的abi是不是一样的,编译指令的版本是不是一样的.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP