主题 : 在mini2440 SD卡 emdebian 发行版嵌入式系统中安装图形界面GUI(qtopia2+icewm)问题总汇 复制链接 | 浏览器收藏 | 打印
星星之火,可以燎原
级别: 骑士
UID: 42844
精华: 2
发帖: 140
金钱: 805 两
威望: 161 点
贡献值: 2 点
综合积分: 320 分
注册时间: 2011-04-11
最后登录: 2016-05-23
楼主  发表于: 2011-10-26 16:35

 在mini2440 SD卡 emdebian 发行版嵌入式系统中安装图形界面GUI(qtopia2+icewm)问题总汇

管理提醒: 本帖被 kasim 执行加亮操作(2011-10-26)
我按照http://www.aiothome.net/read.php?tid-4914.html上面的方法在mini2440上安装了emdebian,不过我使用的文件系统
http://code.google.com/p/mini2440/wiki/Emdebian上面的emdebian-grip-090306-armel-lenny-installed.tar.bz2


可以启动,我也对遇到的问题进行了些改进,比如:

一 、编译环节,完全可以不使用上面提到的

arm-2008q3-72-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2

来编译u-boot和kernel,为了与友善之臂提供的程序兼容,可以直接使用友善现在的交叉编译器arm-linux-gcc-4.4.3.tgz 来编译它们,其中,编译内核的时候,就可以依次使用下列命令(如果大家想要一次性的编译成功的话,那就先把后面的看完再修改内核代码,最后进行编译):

 #进入内核源码目录 
 cd mini2440
#建立最终二进制文件存放目录,
mkdir -p ../kernel-bin 

#生成mini2440的.config文件, 其中O是大写字母O ,最好带上这个参数,有利于后续的查看与修改
CROSS_COMPILE=arm-linux- ARCH=arm make O=../kernel-bin/ mini2440_defconfig


#编译内核及模块,生成后放在当前用户主目录的kernel/kernel-bin目录;
CROSS_COMPILE=arm-linux- ARCH=arm make O=../kernel-bin/

#蓝色部份在原英文文档中没有,会导致以后启动时出现无法找到modules.dep的错误提示

CROSS_COMPILE=arm-linux- ARCH=arm make O=../kernel-bin/ INSTALL_MOD_PATH=../kernel-bin/ modules_install


#生成uImage文件放在当前用户主目录的kernel/kernel-bin目录,必须使用前面编译u-boot.bin 时生成的mkimage 工具而不能使用系统原先含有的mkimage, 否则后面就会出现segment fault这类的段错误了。


 ../../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


这样后面移植图形环境,就可以直接拷贝
rootfs_qtopia_qt4-20100816.tar.gz 之中的qtopia部分来使用了,而不用重新编译这样麻烦了, 其中的文件系统我使用的是
http://code.google.com/p/mini2440/downloads/detail?name=emdebian-grip-090306-armel-lenny-installed.tar.bz2&can=2&q=
 之中的emdebian-grip-090306-armel-lenny-installed.tar.bz2
或者是 http://code.google.com/p/sim1/downloads/list 之中的

Debian "armel" squeeze root file system for linux 2.6.36 ,个人感觉这个比较好,版本新,而且前一个网络设置有些问题。

这样的方法下载文件系统(最好是先执行 sudo -s , 再运行上述命令,因为文件系统中有些文件需要完整的root用户权限来生成), 但是我使用上述方法下载的文件系统,etc文件夹中没有inittab这个文件,这样我就不好使用变换 runlevel 的方法,来进行更换图形界面的操作。


大家在u-boot命令行中,执行saveenv 后可能会遇到以下错误:

Erasing Nand...nand_erase: attempt to erase a bad block at page 0x00000260

那么就可以看这个网址
http://wiki.linuxmce.org/index.php/Mini2440中说的方法去解决,但是我感觉只要使用完 nand scrub 再执行 saveenv  就OK了,因为执行  nand createbbt 需要等待很长时间,像是mini2440死机了的样子,串口终端那里是没有反应的,有时候强制重启后反而破坏了 nand 分区的内容,造成u-boot无法启动的情况。 


(格式化SD卡的方法,大家请看http://code.google.com/p/mini2440/wiki/Emdebian这个网址)

二、u-boot 和 kernel 都移植好后,rootfs 也写进SD卡了,然而在开发板系统启动过程中遇到以下错误,


    mmc0: error -110 whilst initialising SD card 
    s3c-sdi s3c2440-sdi: powered down. 
    usb 1-1.1: new low speed USB device using s3c2410-ohci and address 3 
    usb 1-1.1: configuration #1 chosen from 1 choice 
    input: USB Optical Mouse as /devices/platform/s3c2410-ohci/usb1/1-1/1-1.1/1-1.1:
    1.0/input/input2 
    generic-usb 0003:192F:0416.0001: input,hidraw0: USB HID v1.11 Mouse [USB Optical
     Mouse] on usb-s3c24xx-1.1/input0 
    usb 1-1.2: new full speed USB device using s3c2410-ohci and address 4 
    usb 1-1.2: configuration #1 chosen from 1 choice 
    Root-NFS: No NFS server available, giving up. 
    VFS: Unable to mount root fs via NFS, trying floppy. 
    VFS: Cannot open root device "mmcblk0p1" or unknown-block(2,0) 
    Please append a correct "root=" boot option; here are the available partitions: 
    1f00 256 mtdblock0 (driver?) 
    1f01 128 mtdblock1 (driver?) 
    1f02 5120 mtdblock2 (driver?) 
    1f03 256640 mtdblock3 (driver?) 
    Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0) 
    [<c002e954>] (unwind_backtrace+0x0/0xd8) from [<c02d56fc>] (panic+0x40/0x118) 
    [<c02d56fc>] (panic+0x40/0x118) from [<c0008e74>] (mount_block_root+0x1c8/0x208)
    [<c0008e74>] (mount_block_root+0x1c8/0x208) from [<c0009108>] (prepare_namespace
    +0x160/0x1b8) 
    [<c0009108>] (prepare_namespace+0x160/0x1b8) from [<c0008434>] (kernel_init+0xd8
    /0x10c) 
    [<c0008434>] (kernel_init+0xd8/0x10c) from [<c002a868>] (kernel_thread_exit+0x0/
    0x8)


不要慌张,把开发板上面的复位键按一下(不要拨动开关,那样就没有效果了),再重新启动一遍,可能就容易进系统了,
我的情况就是这样的,如果还是不行,那么就可能是SD卡没有放好,或是SD卡中的文件系统出问题了。重新做一遍文件系统吧!

(注:以上是我之前使用的方法,现在我又找到了新的方法:http://apps.hi.baidu.com/share/detail/5887602 在这个网址里面已经写的很清楚了,这是要修改内核源代码的。一次性解决以上 mmc0: error -110 whilst initialising SD card 这样的问题)
鄙视百度,上面的空间打不开了,我历经千辛万苦,总算把上面帖子的内容找回来了http://www.linuxidc.com/Linux/2010-09/28934.htm,Linux公社虽然经常不加引用的转载别人的技术成果,但是还算厚道,不会去改文章题目的,现在为了以防万一,我还是把文章内容复制在下面吧:
“ Linux上SD/MMC卡驱动移植调试记录
我的内核是Linux 2.6.28,已经带有了sd mmc卡驱动了只要在menuconfig里面把相应选项选上即可,编译出来了之后,我插上了我的一个512mb的卡,在启动信息了打印如下:
s3c2440-sdi s3c2440-sdi: powered down.
mmc0: error -110 whilst initialising SD card
s3c2440-sdi s3c2440-sdi: powered down.
注意红色部分,进入了之后/dev/devices 里面看不到没有相应的驱动。驱动工作不正常!但是插上了一个32mb的卡后,就能够正常识别。在网上查到如下信息:mmc0: error -110 whilst initialising SD card 
應該是卡在 linux/driver/mmc/core/sd.c 的 
mmc_sd_init_card() --> mmc_send_app_op_cond(host, ocr, NULL) 

ocr 是指 card 內部的 Operation Condition Register (OCR) 讀出來的值 
發送 CMD41 CMD55 讀取 OCR 的值 
問題是出在 OCR[31] 一直是 0 <--- 初始化沒有完成?? 
結果問題是出在電壓不足,要把 sd power enable

上面这位说的解决方法我也不太清楚,不过他指出的错误地方是正确的,就是在那里出错的。现在说下这个错误的解决方案:driver/mmc/core/sd.c 的mmc_sd_init_card()函數中mmc_read_switch前延時10ms

mdelay(10);

err = mmc_read_switch(card);
看到红色语句了么,就这个加上去就可以了啊,哈哈......加上红色延时语句之后启动信息如下s3c2440-sdi s3c2440-sdi: running at 196kHz (requested: 195kHz).
s3c2440-sdi s3c2440-sdi: running at 25000kHz (requested: 25000kHz).
s3c2440-sdi s3c2440-sdi: running at 25000kHz (requested: 25000kHz).
mmc0: new SD card at address 95b9
mmcblk0: mmc0:95b9 SD02G 1.83 GiB
mmcblk0: p1
驱动工作完全正常。
进入系统后
mount /dev/mmcblk0p1 /mnt


三、登录问题,我将文件系统中的/etc/inittab修改为了

    4 # The default runlevel.
    5 id:S:initdefault:

这样,登录的时候,按下回车键,就进入了系统:simone:/# 
或者,console的问题也可以通过直接修改sd卡上的文件来解决。

    # echo ttySAC0 >>etc/securetty 
    # printf "T0:123:respawn:/sbin/getty 115200 ttySAC0\n" >>etc/inittab

然后,对于自动登录,可以参照如下方法:

for auto login
edit /etc/inittab and change
    1:2345:respawn:/sbin/getty 38400 tty1
to make it look like
    #1:2345:respawn:/sbin/getty 38400 tty1
    1:2345:respawn:/bin/login -f root tty1 </dev/tty1 >/dev/tty1 2>&1


对于,minicom之类的串口终端没有自动登录的问题,则可以在将最后面的

    T0:123:respawn:/sbin/getty 115200 ttySAC0

改为:
    #T0:12345:respawn:/sbin/rungetty ttySAC0 --autologin root
    T0:12345:respawn:/bin/login -f root 115200 ttySAC0 </dev/ttySAC0 >/dev/ttySAC0 2>&1

这样,开发板LCD屏幕上与串口终端两边都可以自动登录了。


四、在插入U盘的时候,出现了
    modprobe: FATAL: Could not open 'kernel/drivers/usb/storage/usb-storage.ko'

这个问题,于是我运行了一遍
    depmod -a

就好了。


五、上网问题,由于我是在学校里面,IP是动态获取的,运行 dhclient eth0 使之自动分配IP。
如果由于想像我一样节省网费,不想直接上外网,那么可以发挥教育网的优势,先使用DevilProxy,自己去搜索网上的教育网代理吧,找到可以使用的免费代理,比如我的就是将/etc/bash.bashrc后面加上以下语句:

    http_proxy=202.112.117.202:3128
    export http_proxy
注意:上述文件修改并非必须的。可以直接上网的,就不用修改了!
而对于更新软件源,下载软件,需要修改etc/apt/sources.list , 我找到的可以连接的软件源如下:
    #中科大 
    deb ftp://debian.ustc.edu.cn/debian lenny main non-free contrib 
    deb-src ftp://debian.ustc.edu.cn/debian lenny main non-free contrib

再运行 apt-get update 后,即可上网使用命令 apt-get install xxx,安装自己需要的软件.


六、移植图形界面,直接将友善
rootfs_qtopia_qt4-20100816.tar.gz
之中的 opt 文件夹 和 usr/local/ 文件夹全部按照同样的路径拷贝到SD卡下面去,然后在root文件夹下添加一个文件 .bash_profile ,内容如下:

    if [ -f ~/.bashrc ] ; then
    . ~/.bashrc
    fi

    /bin/qtopia &
    echo " " > /dev/tty1
    echo "Starting Qtopia, please waiting..." > /dev/tty1

重新开机,即可看到qtopia2.2的画面了。但是其中还是有些问题(比如"Start Qt4.6.3"图标失去作用),需要在后续研究中解决。


七、T35统宝3.5寸LCD中,图形界面偏移问题我查看资料过程中,发现在arch/arm/mach-s3c2440/mach-mini2440.c 这个文件中有以下代码:

    static struct s3c2410fb_display mini2440_lcd_cfg[] __initdata = {
        [0] = {    /* mini2440 + 3.5" TFT + touchscreen - old model "N35" */
            _LCD_DECLARE(
                7,            /* The 3.5 is quite fast */
                240, 21, 38, 6,     /* x timing */
                320, 4, 4, 2,        /* y timing */
                60),            /* refresh rate */
            .lcdcon5    = (S3C2410_LCDCON5_FRM565 |
                     S3C2410_LCDCON5_INVVLINE |
                     S3C2410_LCDCON5_INVVFRAME |
                     S3C2410_LCDCON5_INVVDEN |
                     S3C2410_LCDCON5_PWREN),
        },
    ........    [3] = {    /* mini2440 + 3.5" TFT + TS -- New model as Nov 2009 "T35" */
            _LCD_DECLARE(
                7,            /* The 3.5 is quite fast */
                240, 21, 25, 6,     /* x timing */
                320, 2, 4, 2,        /* y timing */
                40),            /* refresh rate */
            .lcdcon5    = (S3C2410_LCDCON5_FRM565 |
                     S3C2410_LCDCON5_INVVLINE |
                     S3C2410_LCDCON5_INVVFRAME |
                     S3C2410_LCDCON5_INVVDEN |
                     S3C2410_LCDCON5_PWREN),
        },

而且在Documentation/kernel-parameters.txt  中,也有以下说明:

    mini2440=    [ARM,HW,KNL]
                Format:[0..2][c][t]
                Default: "0tb"
                MINI2440 configuration specification:
                0 - The attached screen is the 3.5" TFT
                1 - The attached screen is the 7" TFT
                2 - The VGA Shield is attached (1024x768)
                Leaving out the screen size parameter will not load
                the TFT driver, and the framebuffer will be left
                unconfigured.
                b - Enable backlight. The TFT backlight pin will be
                linked to the kernel VESA blanking code and a GPIO
                LED. This parameter is not necessary when using the
                VGA shield.
                c - Enable the s3c camera interface.
                t - Reserved for enabling touchscreen support. The
                touchscreen support is not enabled in the mainstream
                kernel as of 2.6.30, a preliminary port can be found
                in the "bleeding edge" mini2440 support kernel at
                http://repo.or.cz/w/linux-2.6/mini2440.git

这样,后来,经过测试,直接在u-boot的设置环境中,输入以下语句。

    setenv bootargs 'noinitrd rootdelay=4 mini2440=3tb root=/dev/mmcblk0p1 console=ttySAC0,115200'
    saveenv

然后输入 reset 重启 ,即可得到没有偏移的图形界面。


八、 安装xorg icewm 的过程中遇到的问题:
首先,安装 icewm 使用以下命令:

    apt-get install xorg icewm aroraapt-get install xserver-xorg-input-evtouchapt-get install xserver-xorg-input-tslibapt-get install xserver-xorg-video-fbdev

如果还不行的话,再试试下面的命令:

apt-get install xserver-xorg-input-evtouch xorg xserver-xorg-video-fbdev xfonts-base xinit xfonts-75dpi xserver-xorg-input-mouse xserver-xorg-input-kbd udev locales

在使用startx 后出现以下错误:

    (EE) FBDEV(0): FBIOPUT_VSCREENINFO: Invalid argument
    (EE) FBDEV(0): mode initialization failed

解决这个问题的过程中发现这样一段话:

    also fighting with the error and found a sulotion on a japanisch site,
    http://www.mech.tohoku-gakuin.ac.jp/rde/contents/tech/mini2440/install_s...thx 
    google translate 
    :-)you need to ad one line to the fb driver im kernel.
    edit this in your kernel ../linux/drivers/video/fbmem.c
    Rewriting point (fbmem.c, near line 1050)

    case FBIOPUT_VSCREENINFO:
    return 0; 
    #### INSERT THIS LINE ####
    if(copy_from_user(&var...))
    return -EFAULT;

    recompile your kernel(uImage) and be happy.

按照上面所说的方法修改代码并重新编译后,就可以 startx 重新启动 icewm/x11 图形界面了。



(注:此图为http://code.google.com/p/mini2440/wiki/Emdebian之中的图片,我的屏幕上方有T35的标志)


、图形界面的触摸屏校正方法,在qtopia2之中,直接使用tslib即可。不过要将 bin/qtopia 之中的
    export TSLIB_TSDEVICE=/dev/input/event0

 修改为

    export TSLIB_TSDEVICE=/dev/input/event1

可以先把/etc/pointercal 这个文件删除,然后再开机测试,这样可以更好的校正触摸屏。

而对于 icewm/x11 图形界面,它的既可以使用 tslib, 也可以使用 evtouch.
不过两者对于 /etc/X11/xorg.conf 这个文件的内容,都不一样. 这两者,我都没有测试成功。
对于tslib ,我参考的两篇文章网址如下:
http://permalink.gmane.org/gmane.linux.distributions.angstrom.user/3717
http://project4fun.com/node/37

对于 evtouch ,我参考的文章网址如下:
http://translate.google.com/translate?hl=en&ie=UTF8&prev=_t&rurl=translate.google.com&sl=th&tl=en&u=http://project4fun.com/node/5

我直接使用的是鼠标。
其中,icewm 图形界面中的字体太大了,可以将xorg.conf 之中的  

    Section "Monitor" 
    Identifier "Monitor0" 
    ModelName "Monitor Model" 
    DisplaySize 240 320 
    EndSection

240 与 320 修改为 100 与 150 ,即可正常显示。


十、使用runlevel 来更换图形界面:
首先,在etc/init.d/ 文件夹下面生成两个文件,分别为 qtopia2.sh 内容为:

    # enable bash completion in interactive shells
    if [ -f /etc/profile ]; then
        . /etc/profile
    fi

    /bin/qtopia &
    echo " " > /dev/tty1
    echo "Starting Qtopia, please waiting..." > /dev/tty1

startx.sh 内容为:

    # enable bash completion in interactive shells
    if [ -f /etc/profile ]; then
        . /etc/profile
    fi

    if [ -f /etc/pointercal ]; then 
            startx &
        else 
            /usr/local/bin/ts_calibrate 
            startx &
    fi

而 etc/profile 的内容为:
    # /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
    # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

    export TSLIB_TSDEVICE=/dev/input/event1 
    export TSLIB_ROOT=/usr/local/tslib
    export TSLIB_CONFFILE=$TSLIB_ROOT/etc/ts.conf
    export TSLIB_PLUGINDIR=$TSLIB_ROOT/lib/ts
    export TSLIB_CALIBFILE=/etc/pointercal
    export TSLIB_CONSOLEDEVICE=none
    export TSLIB_FBDEVICE=/dev/fb0 
    export LD_LIBRARY_PATH=$TSLIB_ROOT/lib:$LD_LIBRARY_PATH

    if [ "`id -u`" -eq 0 ]; then
      PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
    else
      PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
    fi

    if [ "$PS1" ]; then
      if [ "$BASH" ]; then
        PS1='\u@\h:\w\$ '
        if [ -f /etc/bash.bashrc ]; then
        . /etc/bash.bashrc
        fi
      else
        if [ "`id -u`" -eq 0 ]; then
          PS1='# '
        else
          PS1='$ '
        fi
      fi
    fi

    export PATH

    umask 022

再使用以下命令将这些图形界面与权限挂钩:

    cd etc/
    chmod a+x etc/init.d/qtopia2.sh
    chmod a+x etc/init.d/startx.sh
    ln init.d/qtopia2.sh rc2.d/S99qtopia2
    ln init.d/startx.sh rc5.d/S99startx

如此之后,只需要修改 etc/inittab之中的id后面的数字, 换成自己想要的图形界面的权限号即可。

    # The default runlevel.
    id:2:initdefault:


但如果想要在qtopia2.2 与 icewm 的图形界面之间切换,还得先在命令行中修改/etc/inittab中的ID,然后重启系统才能产生效果,所以如果能够有种方法像,新版mini2440-qtopia2.2中的“Start Qt4.6.3”图标启动qt4的方法来启动icewm,那样就更好了,但是由于友善没有提供qt4-starter的源码,所以也就没有办法做研究了!

[ 此帖被cyx8648在2013-07-04 09:04重新编辑 ]
星星之火,可以燎原!