• «
  • 1
  • 2
  • »
  • Pages: 1/2     Go
主题 : mini2440上安装debian在高速SD卡 复制链接 | 浏览器收藏 | 打印
级别: 侠客
UID: 5728
精华: 1
发帖: 92
金钱: 785 两
威望: 572 点
贡献值: 1 点
综合积分: 204 分
注册时间: 2009-05-06
最后登录: 2017-09-13
楼主  发表于: 2010-02-24 14:24

 mini2440上安装debian在高速SD卡

管理提醒: 本帖被 kasim 执行加亮操作(2010-02-24)
个人一直认为装有操作系统的机器就不应再花时间编译自己想要的程序,因为很多已经别人做过的啊!一直希望能在mini2440上用debian系统, 经过近几天在网上找和看文档,终于搞好在mini2440上的SD卡安装并运行debian系统。曾经下载别人编译好的UBOOT二进制文件,不是没有SD卡支持就是不支持高速SD卡,利用春节假期参考了几篇文档,终于实现目标,参考的全是老外的文档,特记录过程,方便自己及同好,希望这方面多跟同好交流学习www@beebuu.com,感谢以下内容的老外
Thanks for these authors and their help:
http://bill.station51.net/index.php?post/2010/01/16/U-Boot-on-Mini2440
http://blog.leshak.ru/english/pages/how-to-install-debian-50-lenny-to-arm-qq2440/
http://wiki.linuxmce.org/index.php/Mini2440
http://code.google.com/p/mini2440/wiki/Emdebian
http://narnia.cs.ttu.edu/drupal/node/131


以下操作在ubuntu9.10server版操作系统中执行
1) 下载安装编译工具
    cd
    #回当前用户主目录
    wget http://www.codesourcery.com/sgpp/lite/arm/portal/package3696/public/arm-none-linux-gnueabi/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
    #下载
    cd /opt
    #进入目录
    tar jxvf ~/arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
    #解压
    export PATH=$PATH:/opt/arm-2009q1/bin/
    #将目录加入环境变量
2) 安装 git 工具
    命令 apt-get install git-core
3) 下载并编译u-boot
   cd;mkdir uboot;cd uboot
    #回当前用户主目录,建uboot目录后进入
    git clone git://repo.or.cz/u-boot-openmoko/mini2440.git
    #下载uboot源码
    export CROSS_COMPILE=arm-none-linux-gnueabi-
    #设置编译器变量
    cd mini2440
    #进入uboot源码目录
    make mini2440_config
    #设置编译目标
    make all
    #编译
    ls u-boot.bin -l
    #显示u-boot.bin文件,确定已成功编译
4) 下载并编译内核
    cd;mkdir kernel;cd kernel
    #回当前用户主目录,建kernel目录后进入
    git clone git://repo.or.cz/linux-2.6/mini2440.git
    #下载内核源码
    cd mini2440
    #进入内核源码目录
    mkdir -p ../kernel-bin
    #建立最终二进制文件存放目录
    CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ mini2440_defconfig
    #生成mini2440的.config文件
    CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ INSTALL_MOD_PATH=../kernel-bin/ modules_install
    #编译内核及模块,生成后放在当前用户主目录的kernel/kernel-bin目录;蓝色部份在原英文文档中没有,会导致以后启动时出现无法找到modules.dep的错误提示
    ../../uboot/mini2440/tools/mkimage -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d ../kernel-bin/arch/arm/boot/zImage ~/kernel/kernel-bin/uImage
    #生成uImage文件放在当前用户主目录的kernel/kernel-bin目录
5) 制作文件系统
    cd
    #回当前用户主目录,建kernel目录后进入
    wget http://blog.leshak.ru/files/debian-5.0-armel-rootfs-20090216.tar.bz2
    #下载老外已经做好的文件系统压缩文件,也可按http://blog.leshak.ru/english/pages/how-to-install-debian-50-lenny-to-arm-qq2440/上方法自行制作;
    fdisk /dev/sdb
    #本人的SD卡是SDHC的4G卡,利用读卡器连接在电脑的USB口,用fdisk分区分了第一区为2G,详细命令步骤省去。
    mkfs.ext3 /dev/sdb1
    #在SD卡上的第一个分区建立EXT3文件系统
    mount /dev/sdb1 /mnt/arm
    #挂接到/mnt/arm
    cd /mnt/arm; tar jxvf debian-5.0-armel-rootfs-20090216.tar.bz2
    #进入目录,解压
    cp ~/kernel/kernel-bin/lib/modules lib/ -R
    #把以上第4)步中生成的~/kernel/kernel-bin/lib/modules目录拷贝到解压以上文件后的
    cd;umount /mnt/arm
    #最后回当前用户主目录,卸载,把SD卡取出放进mini2440主机中

以下操作在XP操作系统中执行,XP中已按mini2440手册安装设置并可使用DNW程序及usb的驱动,且超级终端能正确连接mini2440;因本人选择使用tftp下载内核的方法,所以先从网上下载安装了tftpd32 for windows,且将以上第4)步生成的uImage文件放在tftpd32的目录后启动tftpd32 for windows,XP的网络IP设为192.168.1.110
6) 烧写uboot到nand
    按 mini2440用户手册(2010-2-4版) 中第390页的“8.3.2 把 U-Boot 烧写到开发板”内容将以上第3)步生成的u-boot.bin烧写到mini2440板上
7) 烧写内核
    关掉mini2440后,把mini2440上的“NOR/NAND选择开关”设置为NAND重新开机,这时可以超级终端看到uboot的启动信息,启动后进入待命状态显示 mini2440 #
    打入以下命令:   
    dynpart
    #划分nand
    dynenv set u-boot_env
    #建立uboot动态环境
    saveenv
    #保存
    setenv ipaddr 192.168.1.100
    #设置uboot变量,tftp下载文件时的IP
    setenv serverip 192.168.1.110
    #设置uboot变量,tftp下载文件时的服务器IP
    tftp 0x31000000 uImage
    #下载uImage内核文件到0x31000000处
    nand write 0x31000000 kernel
    #将0x31000000处内容写入kernel部份
    setenv bootargs 'noinitrd rootdelay=4 root=/dev/mmcblk0p1 console=ttySAC0,115200'
    #设置启动传递参数,mmcblk0p1指明文件要系统在SD卡的第一个分区个
    setenv bootcmd nboot.e kernel \; bootm
    #设置uboot自动启动命令
    saveenv
    #保存以上设置
    reset
    #重启
8) 一切正常的话,就可以看到LCD上的login提示,超级终端上也有login提示。本人没有尝试连接USB键盘到mini2440上直接登录,但发现在超级终端上的login尝试登录root失败,最后把SD卡放在读卡器连接ubuntu9.10的电脑,强行直接修改SD卡上的文件系统中的etc目录里的passwd,shadow,group文件,且在home目录建立用户目录,增加一用户user01密码为abc;这样mini2440启动后才能在超级终端中登录user01再操作。OK,开始在mini2440上运行debian了!设置网卡、修改主机名、修改fstab等文件、安装SSH服务器dropbear…………一切如常操作,喜欢debian系列的系统是因为它安装软件特简单,一个apt-get就搞定了,找软件只要apt-cache search就行了,这下不用再自己一步步地编译软件了,象以前自己编译的iptables,pppoe啊什么的都不用做了,一个apt-get install搞定!而且debian的软件很丰富,很多软件都有现成的了,象我这样的懒人真是高兴啊~~

PS:光是记录这过程就花了我近三个小时,如有错漏,还请指导EMAIL:www@beebuu.com
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
1楼  发表于: 2010-02-24 15:15
哈哈哈哈,恭喜恭喜。论坛有多了一篇精华贴。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
2楼  发表于: 2010-02-24 15:18
如果能用debootstrap自己制作文件系统就更有价值了。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
3楼  发表于: 2010-03-08 16:05

 回 6楼(xiaogen) 的帖子

通常这是因为没有检测到你的SD卡,或者是SD卡上没有正确的分区,mmcblk0p1 = partition1 on mmcblk0。
贴出完整的启动信息,这样才能知道你是属于哪一种情况
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
4楼  发表于: 2010-03-08 22:16
引用第8楼xiaogen于2010-03-08 16:30发表的  :
感谢kasim回复,
启动参数为 bootargs 'noinitrd rootdelay=4 root=/dev/mtcblk0p1 console=ttySAC0,115200'
启动信息如下:
Waiting 4sec before mounting root device...
s3c-sdi s3c2440-sdi: running at 398kHz (requested: 400kHz).
.......

两个问题:
1. 内核命令行的参数应该是“root=/dev/mmcblk0p1”而不是“/dev/mtcblk0p1”
2. 从你的板子打印出来的"mmc0: error -110 whilst initialising SD card"来看,SD卡无法正常读取,初始化失败。

另外,你能不能照我说的贴出*完整*的启动信息(从Uncompressing Linux......开始)?用的什么版本,哪里来的内核?你用的是普通的SD卡(<2G)的还是SDHC卡?
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
5楼  发表于: 2010-03-25 13:43

 回 15楼(higeon) 的帖子

在U-boot里执行nand bad有什么输出?
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
6楼  发表于: 2010-03-25 14:10
nand createbbt
dynpart
dynenv set u-boot_env
saveenv

然后重新下载u-boot和内核镜像到NAND Flash中试试
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
7楼  发表于: 2010-04-06 09:41
是啊,我也遇到了这个问题,换了两个SD卡都没有成功

如果你在内核启动时看到了
mmc0: error -110 whilst initialising SD card
那说明SD卡在初始化时出错了,这可能是由于硬件引起(SD卡槽的电源,时钟,SD卡的类型...),也有可能是内核中的SD驱动的问题。
我是1g的板子,直接把文件系统拷进去如何?这样的话,uboot的启动参数又应该是怎样的那?

你可以把Emdebian的文件系统做成yaffs2/jffs2格式的镜像,只要你用的bootloader支持这种格式的文件系统镜像烧录。假设你将文件系统镜像烧入NAND Flash的第三个分区,内核启动参数上改成root=/dev/mtdblock2, 依次类推。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
8楼  发表于: 2010-04-06 18:26

 回 25楼(underarrest) 的帖子

可以,但我建议你按照beebuu的做法用uboot + jffs2格式的文件系统镜像。论坛里有太多的人制作出的yaffs2 image都无法被内核挂载成功。相对来说,内核和uboot对jffs2的支持要好得多。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
*無鈳取玳
级别: 论坛版主
UID: 27
精华: 12
发帖: 5398
金钱: 40120 两
威望: 17929 点
贡献值: 71 点
综合积分: 11036 分
注册时间: 2008-01-16
最后登录: 2014-11-22
9楼  发表于: 2010-04-07 11:57
但是我使用了shutdown -h now之后,LCD依然显示,minicom显示系统已经关闭,比较奇怪。

没什么可奇怪的,mini2440本身无法切断板子的供电。至于LCD,软件上需要整合在关机流程中关闭LCD电源的逻辑。
"If you have an apple and I have an apple and we exchange apples, then you and I will
still each have one apple. But if you have an idea and I have an idea and we exchange
these ideas, then each of us will have two ideas."
  • «
  • 1
  • 2
  • »
  • Pages: 1/2     Go