Digital Frame project with ARM9 YC2440

Digital Frame project with ARM9 YC2440

    YC2440
    =YC2440 connection=
    ==Install minicom==
    #.apt-get install minicom[root@utu-linux bin]# ./hello1
    ./hello1: error while loading shared libraries: libqpe.so.1: cannot open sharedy

    ==Connect to YC2440 BY minicon==
    # minicon -s
    1) Setup
    Serial Device : /dev/ttyS0
    Bps/Par/Bits : 115200 8N1
    Hardware Flow Control : No
    ==Login to Root account ==
    # sudo -s

    =Install Cross-compiling Toolchain=

    Add a line in /etc/profile like below:

    PATH=/usr/local/Trolltech/QtEmbedded-4.4.1/bin:$PATH
    export PATH

    The toolchain packages are in arm-linux-gcc-3.4.1.tar.bz2. You can use this toolchain to
    compile kernel and applications, however you need arm-linux-gcc-3.3.2.tar.bz2 to
    compile the provided qtopia version.

    #mkdir –p /usr/local/arm

    #tar -xjvf arm-linux-gcc-3.4.1.tar.bz2 –C /

    == Set path==
    Add a line in /etc/profile like below:

    PATH=/usr/local/arm/3.4.1/bin:$PATH
    export PATH

    ==test arm-linux-gcc==
    #arm-linux-gcc –version
    Message similar to the following are displayed:
    arm-linux-gcc (GCC) 3.4.1

    ==my first gcc code, source ==
    main()
    {
    printf(“hello\n”);
    }

    ==my first gcc code, hello world ==
    looptek@looptek-desktop:~/Desktop/looptek/dev/hello$ gcc -o hello hello.c
    hello.c: In function ‘main’:
    hello.c:5: warning: incompatible implicit declaration of built-in function ‘printf’
    looptek@looptek-desktop:~/Desktop/looptek/dev/hello$ ./hello
    hello

    ==my first arm-linux-gcc code, hello world ==
    looptek@looptek-desktop:~/Desktop/looptek/dev/hello$ arm-linux-gcc -o helloarm hello.c
    looptek@looptek-desktop:~/Desktop/looptek/dev/hello$ ls
    hello helloarm hello.c hello.c~

    [root@utu-linux dev]# ./helloarm
    hello
    ==mount SD card ==

    #mount /dev/mmcblk0p1 /mnt

    ==Mount a USB drive==
    #mount /dev/sda1 /mnt

    ==find, dir -s ==

    find ./ -iname “*.php” -or -iname “*.tpl” -or -iname “*.html”

    ==auto mount ==
    in terminal type as root: gedit /etc/fstab and NOW YOU CAN ADD THIS LINE TO FSTAB to auto mount it:
    Code:
    /dev/sda1 /mnt/usbflash vfat noauto,users,rw,umask=0 0 0
    Adding “rw” allows to read and write in the usb flash drive.
    Please note that under FC3 it automounts in your desktop. It is plug and play.

    =List all process =
    $ ps ux
    =kill process =
    $ kill -9 3216

    =execution shell lanaguage =
    #write below to 1.sh

    mkdir /azuo/myqtopia
    cd /azuo/myqtopia

    # Change Property to can execution
    # ./1.sh

    =Setup TFTP server=

    PATH=/usr/local/Trolltech/QtEmbedded-4.4.1/bin:$PATH
    export PATH

    1. Install tftpd and related packages.

    $ sudo apt-get install xinetd tftpd tftp

    2. Create /etc/xinetd.d/tftp and put this entry:

    service tftp
    {
    protocol = udp
    port = 69
    socket_type = dgram
    wait = yes
    user = nobody
    server = /usr/sbin/in.tftpd
    server_args = /tftpboot
    disable = no
    }

    3. Make /tftpboot directory

    $ sudo mkdir /tftpboot
    $ sudo chmod -R 777 /tftpboot
    $ sudo chown -R nobody /tftpboot

    4. Start tftpd through xinetd

    $ sudo /etc/init.d/xinetd start

    5. Testing. Tranfering file hda.txt from 192.168.1.100 (Client using tftp) to 192.168.1.100 (Server 192.168.1.100). Get an example file to transfer (eg. hda.txt)

    $ touch /tftpboot/hda.txt
    $ chmod 777 /tftpboot/hda.txt
    $ ls -l /tftpboot/
    total 0
    -rwxrwxrwx 1 davids davids 0 2006-03-27 23:04 hda.txt
    $ tftp 192.168.1.100
    tftp> put hda.txt
    Sent 722 bytes in 0.0 seconds
    tftp> quit
    $ ls -l /tftpboot/
    total 4

    -rwxrwxrwx 1 davids davids 707 2006-03-27 23:07 hda.txt

    Copy bootloader image (u-boot.bin), kernel image (uImage), or file system image
    (filesystem.yaffs) to /tftpboot of host PC
    $ cp filesystem.yaffs-2440-qtopia-touchscreen \tftpboot\filesystem.yaffs

    == Update file system ==
    ===Set bootloader IP ===
    utu-bootloader=>>>setenv ipaddr 192.168.1.168
    utu-bootloader=>>>setenv serverip 192.168.1.138
    #run install-filesystem

    export QPEDIR=/opt/Qtopia
    export QTDIR=/opt/Qtopia
    export PATH=$QTDIR/bin:$PATH
    export TMAKEPATH=/opt/Qtopia/tmake/lib/qws/linux-generic-g++
    export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

    ===install gcc lib ===
    apt-get install libc6-dev
    apt-get install ncurses-dev
    make menuconfig

    =Build kernel =

    ftp 192.168.1.168

    #sudo tar –xjvf utu-linux_for_s3c2440_V1.5-2007-8-18.tar.bz2 –C /opt
    cd utu-linux_for_s3c2440_dm9000_V1.5.8
    cp mkimage to /usr/bin

    =FTP =
    Po: Don’t used Filezilla, or FTP though Win PC, the file doesn’t working in ARM9,only shell ftp can working.
    Server: Filezilla 192.168.1.168 anonymous
    Target: Share file at pub目錄在arm上的位置為/var/ftp/pub

    喔,我看arm系統啟動時vsftpd就自己啟動囉,應該是設在/etc/init.d/rcS這檔案裡
    我看arm系統啟動時vsftpd就自己啟動囉,應該是設在/etc/init.d/rcS這檔案裡
    倒數第5,6行

    ftp 192.168.1.168 anonymous

    =TELNET =

    剛發現你可以用telnet 192.168.1.168 login 進arm

    =install tftp on ubutun =
    apt-get install tftp-hpa
    /etc/init.d/openbsd-inetd start

    Config file: vi /etc/inetd.conf
    內容改成 pd /tftpboot

    anonymous
    // httpss://hi.baidu.com/wangy0919/blog/item/3808eaa1388bd389471064c2.html
    ubuntu中配置tftp服务 2007-08-02 18:08
    sudo apt-get install tftpd-hpa tftp-hpa
    打开/etc/default/tftpd-hpa
    #Defaults for tftpd-hpa
    RUN_DAEMON=”no”
    OPTIONS=”-l -s /var/lib/tftpboot”
    修改设置如下:
    #Defaults for tftpd-hpa
    RUN_DAEMON=”yes”
    OPTIONS=”-l -s /home/zdreamx/tftpboot”
    其中/home/zdreamx/tftpboot是自己设定的目录,可以根据情况修改。

    =My First Qtopia application =
    reference: httpss://www.kevinboone.com/myfirstqtopiaapp2.html

    ==install g++ ==
    $ sudo apt-get install gcc
    $ sudo apt-get install g++

    1) Check the environment is correct:

    $ cp qt-embedded-2.3.7 \opt\qt-embedded-2.3.7

    export QPEDIR=/opt/qt-embedded-2.3.7
    export QTDIR=/opt/qt-embedded-2.3.7
    export PATH=$QTDIR/bin:$PATH
    export TMAKEPATH=/opt/qt-embedded-2.3.7/tmake/lib/qws/linux-generic-g++c
    export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

    arm-linux-g++ -L $QTDIR/lib/ -o main.o hello.o -luuid -ljpeg -lqpe -lqte

    2) Make a copy of the example:

    cd somewhere
    cp -r $QPEDIR/examples/application .
    cd application

    3) Generate a Makefile:

    sudo apt-get install tmake
    4) source code hello1.cpp

    #include
    #include

    int main(int argc, char** argv)
    {
    QPEApplication app(argc, argv);
    QMainWindow* mainWindow = new QMainWindow();
    mainWindow->setCaption(“Hello, World!”);
    app.showMainWidget(mainWindow);
    return app.exec();
    }

    5) complier

    arm-linux-g++ -o hello1 hello1.cpp -DQWS -fno-rtti -L/opt/qtopia-1.7-tp/qt-embedded-2.3.7/lib/ -L/opt/qtopia-1.7-tp/3rdparty/lib/ -L/opt/qtopia-1.7-tp/qtopia-free-1.7.0/lib/ -I/opt/qtopia-1.7-tp/qt-embedded-2.3.7/include/ -I/opt/qtopia-1.7-tp/3rdparty/include/ -I/opt/qtopia-1.7-tp/qtopia-free-1.7.0/include/ -luuid -lpng -lqpe -lqte

    // export QPEDIR=/opt/qtopia-1.7-tp
    // arm-linux-g++ -I $QTDIR/include/ -DQWS -fno-rtti -o hello.o -c hello.cpp
    // arm-linux-g++ -I $QTDIR/include/ -DQWS -fno-rtti -o main.o -c main.cpp
    // arm-linux-g++ -L $QTDIR/lib/ -o main.o hello.o -luuid -ljpeg -lqpe -lqte

    arm-linux-g++ -o hello1 imagefip.cpp imagetexteditor.cpp main.cpp showimg.cpp -DQWS -fno-rtti -L/opt/qtopia-1.7-tp/qt-embedded-2.3.7/lib/ -L/opt/qtopia-1.7-tp/3rdparty/lib/ -L/opt/qtopia-1.7-tp/qtopia-free-1.7.0/lib/ -I/opt/qtopia-1.7-tp/qt-embedded-2.3.7/include/ -I/opt/qtopia-1.7-tp/3rdparty/include/ -I/opt/qtopia-1.7-tp/qtopia-free-1.7.0/include/ -luuid -lpng -lqpe -lqte

    5) Makefile
    hello1: hello1 hello1.o
    arm-linux-g++ -o hello1 hello1.o -L/opt/qtopia-1.7-tp/qt-embedded-2.3.7/lib/ -L/opt/qtopia-1.7-tp/3rdparty/lib/ -L/opt/qtopia-1.7-tp/qtopia-free-1.7.0/lib/ -luuid -lpng -lqpe -lqte

    hello1.o:
    arm-linux-g++ -c hello1.o hello1.cpp -DQWS -fno-rtti -I/opt/qtopia-1.7-tp/qt-embedded-2.3.7/include/ -I/opt/qtopia-1.7-tp/3rdparty/include/ -I/opt/qtopia-1.7-tp/qtopia-free-1.7.0/include/

    6) UPload the filr via FTP

    7) change exection property
    chmod -x hello

    ==imageviewer QT Application ==
    我解開了;放在/home/looptek/qtopia-1.7-mouse/qtopia-free-1.7.0/src/applications/imageviewer
    /opt/qtopia-1.7
    -tp/qtopia-free-1.7.0/src/applications/imageviewer

    ==download and install qt- x11 4.4.1 ==

    cd /tmp
    gunzip qt-embedded-linux-opensource-src-4.4.1.tar.gz # uncompress the archive
    tar xvf qt-embedded-linux-opensource-src-4.4.1.tar # unpack it

    cd qt-embedded-linux-opensource-src-4.4.1
    echo “yes”|./configure -embedded arm -no-stl -no-qt3support -no-nis -no-cups -no-iconv -no-qdbus -no-freetype -depths 4,8,16,32 -qt-mouse-linuxtp

    // ./configure -embedded arm // QT document recommend.
    // ./configure -embedded [architecture] //architectures are x86, arm and mips.

    #make
    #make install

    ==1.3 Copy to a root file system==
    httpss://blog.chinaunix.net/u/28781/showart_384828.html

    Assume that you have a root file system /opt/rootfs on your host PC that is NFS exported.
    #cd /opt
    #rm -r rootfs/opt/* (delete old Qtopia if any)
    #rm rootfs/bin/qtopia (delete old Qtopia if any)
    #mkdir -p rootfs/usr/local/Trolltech/QtopiaCore-4.3.2-arm/lib
    #cp -a /usr/local/Trolltech/QtopiaCore-4.3.2-arm/lib/*
    rootfs/usr/local/Trolltech/QtopiaCore-4.3.2-arm/lib
    #cp -a /usr/local/Trolltech/QtopiaCore-4.3.2-arm/examples
    rootfs/usr/local/Trolltech/QtopiaCore-4.3.2-arm/
    #cp -a /usr/local/Trolltech/QtopiaCore-4.3.2-arm/demos
    rootfs/usr/local/Trolltech/QtopiaCore-4.3.2-arm/
    To copy the root file system to the nand flash of the target, please refer to 5.3.

    ==11.4 Configure touchscreen==
    Edit /opt/rootfs/etc/profile, add the following 2 lines:
    QWS_MOUSE_PROTO=”LinuxTP:/dev/h3600_tsraw”
    export QWS_MOUSE_PROTO

    =Setup NFS Server=

    #tar –xjvf utu-linux_for_s3c2440_V1.5-2007-8-18.tar.bz2 –C /opt

    sudo mkdir /rootfs
    apt-get install nfs-kernel-server nfs-common portmap
    #vi /etc/exports
    add /rootfs
    /etc/init.d/nfs-kernel-server restart

    =Setup NFS Client/Target=

    1. .(Server) /etc/init.d/nfs-kernel-server restart
    2. . (Target) mount -t nfs -o nolock 192.168.1.138:/rootfs /mnt

    =test application =

    Boot your target so that it NFS-mounts a previously-prepared root file system on host PC
    – /opt/rootfs. Go to the examples and demos directories to run those applications.
    For example, at the minicom terminal:
    #./analogclock –qws

    =Install VNC Server =

    HOWTO: Set up VNC server with resumable sessions
    So here’s the complete list of steps that are required to set the VNC server that any user can login into and start a session. It is also persistent, meanning that even if you disconnect the VNC client your X session will not end (unless you explicitly log out) and you can reconnect to the same session again. The VNC server uses a separate display (:1) than your regular X server, which works with your physical display (:0). So two sessions can be active at the same time (one person sitting at the physical display and another remotely connecting using VNC).

    1. Enable XDMCP
    System->Administration->Login Screen Setup
    Tab Security->Enable XDMCP
    Tab XDMCP–> You can disable “Honor Indirect Requests”

    Note: Before doing the next step, you need to make sure the extra repositories (e.g. universe) are enabled:
    httpss://easylinux.info/wiki/Ubuntu#Ho…a_repositories

    2. Install required packages (vncserver and xinetd)

    Code:

    sudo apt-get install vnc4server xinetd

    Note to AMD64 users: The current version of vnc4server in the repositories has a bug, so you need to download and install the fixed vnc4 packages as shown below:

    Code:

    wget httpss://qt1.iq.usp.br/download/vnc4server_4.0-7.3_amd64.deb
    wget httpss://qt1.iq.usp.br/download/xvnc4viewer_4.0-7.3_amd64.deb
    sudo dpkg -i vnc4server_4.0-7.3_amd64.deb
    sudo dpkg -i xvnc4viewer_4.0-7.3_amd64.deb

    3. Set the VNC passwd
    Code:

    sudo vncpasswd /root/.vncpasswd

    4. Add vnc service to xinetd:
    Code:

    sudo gedit /etc/xinetd.d/Xvnc

    Enter this into the new file:

    Code:

    service Xvnc
    {
    type = UNLISTED
    disable = no
    socket_type = stream
    protocol = tcp
    wait = yes
    user = root
    server = /usr/bin/Xvnc
    server_args = -inetd :1 -query localhost -geometry 1024×768 -depth 16 -once -fp /usr/share/X11/fonts/misc -DisconnectClients=0 -NeverShared passwordFile=/root/.vncpasswd
    port = 5901
    }

    5. Restart xinetd (usually there is no need to reboot, but occasionally it might be required)

    Code:

    sudo /etc/init.d/xinetd stop
    sudo killall Xvnc
    sudo /etc/init.d/xinetd start

    6. That’s it! To test that this is working first try to connect from the same machine (the machine we just set up the VNC server on):

    Code:

    vncviewer localhost:1

    You should be prompted for the VNC password, and then see the GDM login screen where you can login and start a new X session. If that works, you can now go ahead and try to connect from remote machine using your favorite VNC client (remember to first close the local vncviewer we started above). Remember to use the VNC server machine’s domain name or IP address, followed by :1 (e.g. 192.168.0.100:1). If connecting locally as shown above works, but connecting remotely fails, then this means you have a problem with a firewall which is blocking some ports. See the notes below about how to deal with that.

    Note about ports: The VNC server set up as shown uses TCP port 5901. If you are using firewall software (e.g. firestarter) on that machine, you need to allow incoming connections on this port. If you are using a router which assigns your machine a private address (e.g. 192.168.0.100) which is not accessible from the internet, then you need to forward TCP port 5901 from the router to this machine.

    Note about security: This setup allows any user to start an X-session remotely by logging in using his regular password (after starting the VNC connection using the VNC password), so if the user disconnects without logging out, any other user which knows the VNC password can connect afterwards and resume the same session that the first user started. So if you do not want to log out before disconnecting, it’s advisable to at least lock your VNC X-session screen. Also note that while a remote user is connected thru VNC, no other connection will be accepted. An idle VNC client will be disconnected after one hour, but this can be changed by using the “-IdleTimeout” option in the server_args line in /etc/xinetd.d/Xvnc. For example, you can add “-IdleTimeout 300″ to change it to 5 minutes.

    =Update Qtopia Core Opensource =
    DOTO

    =Big problem fixed =
    ==setup tftp ==
    ==complier and link lib ==
    ==Upload file ==
    == FromFile() in Windows SmartPhone ==
    pictureBox1.Image = Image.FromFile(t_path);
    Does Compact Framework has a FromFile()?????
    whenever i tried to use that method, i will get a error complaining that :
    ‘System.Drawing.Image’ does not contain a definition for ‘FromFile’ .

    Answer:
    Image img = new Bitmap(@”\path\to\some\image.png”);
    Image img = new Bitmap(t_path);
    System.Drawing.Image image = img;