Tuesday, November 23, 2010

SSH file transfer

[1] http://www.go2linux.org/scp-linux-command-line-copy-files-over-ssh
[2] http://en.kioskea.net/faq/794-file-transfer-via-ssh
[3] http://www.terminally-incoherent.com/blog/2006/09/23/command-line-scp-for-windows/

[1]
---------------------
Usage
scp [[user@]from-host:]source-file [[user@]to-host:][destination-file]

scp -r miguel@10.1.2.2:/home/miguel/ miguel@10.1.2.3:/home/miguel/

[q.yang@localhost user]$ scp q.yang@10.10.20.70:/home/q.yang/lpc3250/ltib-GsnComms3240/rootfs/home/user/TcpIpCommsTarget root@10.10.20.89:/home/user/
The authenticity of host '10.10.20.70 (10.10.20.70)' can't be established.
RSA key fingerprint is 1b:19:f1:da:bd:28:f7:ac:15:fc:d8:28:62:58:47:8b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.20.70' (RSA) to the list of known hosts.
q.yang@10.10.20.70's password:
Permission denied, please try again.
q.yang@10.10.20.70's password:
The authenticity of host '10.10.20.89 (10.10.20.89)' can't be established.
RSA key fingerprint is 9a:5b:48:d3:8c:aa:4f:19:6b:fe:5d:9c:bd:64:72:16.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.10.20.89' (RSA) to the list of known hosts.
root@10.10.20.89's password:
TcpIpCommsTarget 100% 11KB 11.0KB/s 00:00
Connection to 10.10.20.70 closed.



[3] PSCP SCP client under windows
------------------------------------
You can download pscp.exe from Putty download page. Works under windows command line.
See screen shot:

Microsoft Windows XP [Version 5.1.2600]

D:\MyDocXp\Downloads>pscp U:\Quentin\Zone__Release\Release-CommsModule\Current\A
pp\GsnCommsTask_20110214 root@172.16.18.2:/home/user/
root@172.16.18.2's password:
GsnCommsTask_20110214 | 318 kB | 318.8 kB/s | ETA: 00:00:00 | 100%

D:\MyDocXp\Downloads>

See screen shot:






[2]
-----------------------------------
ssh server "cat remote_file" > local_file
ssh server "gzip -c remote_file" > local_file.gz
ssh server "gzip -c remote_file " |gunzip > local_file

* Linux/Unix
o Most Unix/Linux versions are supplied as standard with an ssh client, and most with an ssh server.
* Under Windows
* Free ssh client:
o Putty
* Free graphical scp/sftp client :
o WinSCP
o FileZilla
* Free SSH server:
* For Windows 2000/XP:
o ssh Windows (can be operate as a service)
* For Windows 95/98/ME/2000/XP:
o Use Cygwin

Wednesday, November 17, 2010

LTIB -- Usage Summary

[1] http://www.ltib.org/documentation-LtibFaq
[2] http://blog.csdn.net/wangzhong1979/archive/2010/02/08/5295777.aspx
[3] http://lists.gnu.org/archive/html/ltib/2010-11/msg00139.html
[4] http://lists.gnu.org/archive/html/ltib/2010-10/msg00008.html --- cross compiler
[5] http://www.linuxselfhelp.com/HOWTO/MIPS-HOWTO-9.html ---- cross compiler
[6] http://www.codesourcery.com/sgpp/lite/arm/portal/target_arch?@action=faq&target_arch=arm --- one provider where can download arm-nonlinux-guneabi
[7] http://www.codesourcery.com/sgpp/lite/arm ---GNU Tool Chain from CodeSourcery
[8] http://lists.gnu.org/archive/html/ltib/2010-10/msg00008.html --- Ltib not installing the cross compiler.
[9] https://wiki.linaro.org/Resources/FAQ ---- Org for Linux On ARM solution
[10]http://web.archiveorange.com/archive/v/zE6LZwICaTeR5uWNSWaW ----- Stuart Reply /proc make nods.
[11]mkfs.jffs2 man

USE DIFFERENT CROSS COMPILING TOOL CHAIN UNDER LTIB
---------------------------------------------
[4] [5]
[6] Why doesn't Sourcery G++ Lite Edition contain libraries for big-endian GNU/Linux? Or for systems with VFP or NEON?
Why does CodeSourcery provide GLIBC? Can I use the version that comes with my GNU/Linux distribution?
Why is the configuration name for GNU/Linux arm-none-linux-gnueabi instead of just arm-none-linux-eabi? Is there a GNU variant of the EABI?
Answer
The Free Software Foundation prefers that configuration names for GNU/Linux contain both the string linux and the string gnu. The configuration arm-none-linux-gnu refers to the legacy ARM ABI for GNU/Linux. Some tools depend on the fact that configuration names have at most three hyphens, so gnu and eabi were combined into a single word.
The ABI used on GNU/Linux is not a special GNU variant of the EABI; it is just the EABI.




-O2 -fsigned-char -mfloat-abi=softfp -mfpu=vfp

/home/quentin/CodeSourcery/arm-2010q1

arm-none-linux-gnueabi-


BUILD FROM SCRATCH
------------------------------------------------
Note:
This will remove rootfs and all configrations.

Build all packages and kernel from scratch.
[root@localhost ltib-qs]#./ltib -m distclean
[root@localhost ltib-qs]#./ltib --config


ADD CUSTOMER BSP INTO LTIB MENU
--------------------------------
Steps to Add your new board into LTIB menu (CM-HS1)
01-MAR-2012
1. Add new machine ID for the new board:
Register a machine ID for the new board via http://www.arm.linux.org.uk/developer/machines/ website and then update mach-types.h under /linux_kernel_dir/arch/arm/tools/ to the latest version;

2. Add new board information into the LTIB menus:
a. Make a folder for the new Board Support Package (BSP) under '/ltib/config/platform/'. The folder name should be the same as that defined in main.lkc, i.e., '/ltib/config/platform/gsncomm'. Please refer to 2.c below.
b. Copy all files from an existing Board Support Package (BSP) folder to the new BSP folder. We use the one we did the evaluation, i.e., from 'phy3250';
c. Make necessary changes to main.lkc under new BSP folder '/ltib/config/platform/$NEW_BOARD/'. All contents in main.lkc that are related to CPU and board need to be modified.
d. Create a Linux kernel pre-configuration file, e.g., 'linux-2.6.34-gsncomm.config'. This file can be manually generated by running the LTIB, which has Linux Kernel configuration GUI. 'linux-2.6.34-gsncomm.config' is generated based on 'linux-2.6.34-phy3250.config' with some modifications to mach GridSense Lpc 3240 board. 'linux-2.6.34-gsncomm.config' has to be stored under path '/ltib/config/platform/$NEW_BOARD/'
e. Overwrite the Linux board configuration file 'defconfig' and 'defconfig.dev' under ''/ltib/config/platform/$NEW_BOARD/' with your own board configuration file, in which different Linux kernel pre-configuration file, and installed Linux packages can be defined. New Linux board configuration file can also be generated with the help of LTIB, which has a Linux board configuration GUI. Basically, board configuration file will decide what application will be installed in Linux Root File System (RFS).

3. Add new BSP into to Linux Kernel (here we use lpc32xx based board as example):
a. Add new board choice to Kconfig under '/linux_kernel_src_dir/arch/arm/mach_lpc32xx/'. Add sub menu items if required;
b. Add board level initialisation BSP source code under the folder. It is recommended the main source code file name follow the board name. i.e., BSP source code 'gsncomm.c' under '/linux_kernel_src_dir/arch/arm/mach_lpc32xx/'.
c. Add board level initialisation code file(s) to the Makefile within the folder.
d. Copy Linux kernel pre-configuration file 'linux-2.6.34-gsncomm.config' to folder '/linux_kernel_src_dir/arch/arm/configs/' and rename it to 'gsncomm_defconfig'.

4. Use LTIB menu-based GUI to do further configuration and then build the kernel. Fix any error raised during porting.




CHOOSE CUSTOMER BSP
-------------------------




UPDATE ALL PACKAGES AND PATCHES FROM CVS
---------------------------------------------
Just run"cvs update" in your ltib directory. It'll fetch the updates and in the ltib config you can see the 2.6.34 kernel support.



MISSING NODES UNDER /DEV/
--------------------------------------
Has to change default phytect 'busybox.config', and add support for 'mdev'.
then /rootfs/sbin/mdev will appear and symbol link to busybox.







Make /DEV/ nodes from device_table.txt
If the target architecture is different from the original one, a different cross compiler will be needed. It will be downloaded and installed in the correct location if it isn't already present.
How to add device nodes
Device nodes with static major/minor numbers can be added to the file ltib/bin/device_table.txt. The format is described in the file itself.

Since there is no dependency checking for device_table.txt, after adding a new entry, force rebuild devices to make sure the new /dev nodes are in the file system:

$ ./ltib -p dev -f


MISSING /PROC/DEVICES
-------------------------------
After changing the property of all files under 'etc/rc.d/init.d/', adding 'x' right, problem is solved.
quentin@ubuntu:~/lpc3250/ltib-qs/rootfs$ sudo chmod a+x etc/rc.d/init.d/*
quentin@ubuntu:~/lpc3250/ltib-qs/rootfs$ ll etc/rc.d/init.d/
total 88
drwxr-xr-x 2 root root 4096 2011-06-10 16:56 ./
drwxr-sr-x 3 root root 4096 2011-06-11 08:14 ../
-rw-r--r-- 1 root root 357 2011-06-10 16:56 boa
-rw-r--r-- 1 root root 176 2011-06-10 16:56 depmod
-rw-r--r-- 1 root root 219 2011-06-10 16:56 devfsd
-rw-r--r-- 1 root root 904 2011-06-10 16:56 dhcp
-rw-r--r-- 1 root root 413 2011-06-10 16:56 dhcpd
-rw-r--r-- 1 root root 651 2011-06-10 16:56 dropbear
-rw-r--r-- 1 root root 1299 2011-06-10 16:56 filesystems
-rw-r--r-- 1 root root 183 2011-06-10 16:56 hostname
-rw-r--r-- 1 root root 342 2011-06-10 16:56 inetd
-rw-r--r-- 1 root root 741 2011-06-10 16:56 mdev
-rw-r--r-- 1 root root 165 2011-06-10 16:56 modules
-rw-r--r-- 1 root root 160 2011-06-10 16:56 mount-proc-sys
-rw-r--r-- 1 root root 5229 2011-06-10 16:56 network
-rw-r--r-- 1 root root 346 2011-06-10 16:56 portmap
-rw-r--r-- 1 root root 722 2011-06-10 16:56 settime
-rw-r--r-- 1 root root 279 2011-06-10 16:56 smb
-rw-r--r-- 1 root root 735 2011-06-10 16:56 sshd
-rw-r--r-- 1 root root 502 2011-06-10 16:56 syslog
-rw-r--r-- 1 root root 797 2011-06-10 16:56 udev


[l.lu@localhost ltib]$ ll rootfs/etc/rc.d/init.d/
total 84
-rwxr-xr-x 1 root root 357 2011-06-01 19:02 boa
-rwxr-xr-x 1 root root 176 2011-06-01 19:02 depmod
-rwxr-xr-x 1 root root 219 2011-06-01 19:02 devfsd
-rwxr-xr-x 1 root root 904 2011-06-01 19:02 dhcp
-rwxr-xr-x 1 root root 413 2011-06-01 19:02 dhcpd
-rwxr-xr-x 1 root root 651 2011-06-01 19:02 dropbear
-rwxr-xr-x 1 root root 1299 2011-06-01 19:02 filesystems
-rwxr-xr-x 1 root root 183 2011-06-01 19:02 hostname
-rwxr-xr-x 1 root root 1170 2011-06-01 19:12 hotplug
-rwxr-xr-x 1 root root 342 2011-06-01 19:02 inetd
-rwxr-xr-x 1 root root 741 2011-06-01 19:02 mdev
-rwxr-xr-x 1 root root 165 2011-06-01 19:02 modules
-rwxr-xr-x 1 root root 160 2011-06-01 19:02 mount-proc-sys
-rwxr-xr-x 1 root root 5229 2011-06-01 19:02 network
-rwxr-xr-x 1 root root 346 2011-06-01 19:02 portmap
-rwxr-xr-x 1 root root 722 2011-06-01 19:02 settime
-rwxr-xr-x 1 root root 279 2011-06-01 19:02 smb
-rwxr-xr-x 1 root root 735 2011-06-01 19:02 sshd
-rwxr-xr-x 1 root root 502 2011-06-01 19:02 syslog
-rwxr-xr-x 1 root root 797 2011-06-01 19:02 udev





HOW TO UNINSTALL LTIB
-----------------------------
[2] 在ubuntu系统上,假如ltib已经安装了,我们只需编译、重新配置ltib,
以非root用户登陆,进入ltib所在文件夹,依次输入以下两条命令:
./ltib clean
./ltib -c
即可先后配置linux应用软件包、linux内核。
编译成功后,~/ltib/rootfs/boot目录下,有新编译的内核文件uImage、设备树mpc8315erdb_default.dtb,分别拷贝到/tftpboot目录下。

MULTIPLE LTIB INSTALLATION
-----------------------------------
[1]Can I have more than one root file system on my host at the same time
Yes, the system will support multiple root file systems, for the same or for different target architectures.
If you are using an iso image, install your ltib archive into an different directory by entering a new directory name for the installation when prompted by the install script..
If you are using CVS, check-out CVS into a different directory by using the -d option to cvs co. For example:


ADD FILES TO THE TARGET ROOT FILE SYSTEM
------------------------------------------
[1] Can I add files to the target root file system without creating a package

Yes, to do this, you need to create a merge directory. There are 2 options:
1 Top level merge directory, that applies to all targets 2 Platform specific merge directory
The platform specific merge directory contents override the top level merge directory, which overrides the corresponding file(s) in your rootfs
Example:
You have a CVS version of LTIB, and you have build the tqm823l default configuration, now:
1 You want to add the a platform specific file /home/fred/myfile1 2 You want all platforms you may build to use your own /etc/hosts file
Here's what you would do:

$ cd
$ mkdir -p config/platform/tqm823l/merge/home/fred
$ cp /myfile1 config/platform/tqm823l/merge/home/fred
$ mkdir -p merge/etc
$ cp /hosts merge/etc
$ ./ltib


CHECK LTIB LOCAL CVS REVISION
------------------------------------
[l.lu@localhost ltib]$ cd CVS/
[l.lu@localhost CVS]$ ll
total 16
-rw-rw-rw- 1 l.lu developer 215 2011-05-30 15:28 Entries
-rw-rw-rw- 1 l.lu developer 86 2011-05-30 15:28 Entries.Log
-rw-rw-rw- 1 l.lu developer 5 2011-05-30 15:28 Repository
-rw-rw-rw- 1 l.lu developer 57 2011-05-30 15:28 Root
-rw-rw-rw- 1 l.lu developer 0 2011-05-30 15:28 Template
[l.lu@localhost CVS]$ cat Entries
/.gitignore/1.1.1.2/Wed Mar 18 17:53:24 2009//
/.ltibrc/1.16/Tue Aug 17 18:18:00 2010//
/COPYING/1.1.1.2/Tue Nov 6 15:44:42 2007//
/README/1.1.1.3/Tue Nov 6 15:44:41 2007//
/ltib/1.75/Sat Apr 2 10:56:01 2011//
[l.lu@localhost CVS]$ cat Root
:pserver:anonymous@cvs.savannah.nongnu.org:/sources/ltib
[l.lu@localhost CVS]$ cat Repository
ltib
[l.lu@localhost CVS]$ cat Entries.Log
A D/bin////
A D/config////
A D/dist////
A D/doc////
A D/internal////
R D/internal////



BUILD RFS ROOT FILE SYSTEM
--------------------------------------

------++++check files/folders size under rootfs
[root@localhost ltib]# du -h rootfs/ | grep M
38M rootfs/boot
7.1M rootfs/usr/lib
1.4M rootfs/usr/include/openssl
3.3M rootfs/usr/include
1.1M rootfs/usr/sbin
7.0M rootfs/usr/bin
236K rootfs/usr/share/locale/uk/LC_MESSAGES
32K rootfs/usr/share/locale/ko/LC_MESSAGES
212K rootfs/usr/share/locale/da/LC_MESSAGES

----++++ trimmed unwanted files/folders in rootfs
----++++ force dev table if don't have enough in /rootfs/dev/
[l.lu@localhost ltib]$ ./ltib -p dev -f
Processing platform: Phytec 3250 board with the NXP LPC32XX SoC
=================================================================
using config/platform/phy3250/.config

Processing: dev
=================
Build path taken because: force set, build key set,

rpmbuild --dbpath /home/l.lu/lpc3250/ltib/rootfs//var/lib/rpm --target arm --define '_unpackaged_files_terminate_build 0' --define '_target_cpu arm' --define '__strip strip' --define '_topdir /home/l.lu/lpc3250/ltib/rpm' --define '_prefix /usr' --define '_tmppath /home/l.lu/lpc3250/ltib/tmp' --define '_rpmdir /home/l.lu/lpc3250/ltib/rpm/RPMS' --define '_mandir /usr/share/man' --define '_sysconfdir /etc' --define '_localstatedir /var' -bb --clean --rmsource /home/l.lu/lpc3250/ltib/dist/lfs-5.1/dev/dev.spec
Building target platforms: arm
Building for target arm
Executing(%prep): /bin/sh -e /home/l.lu/lpc3250/ltib/tmp/rpm-tmp.29641
+ umask 022
+ cd /home/l.lu/lpc3250/ltib/rpm/BUILD
+ cd /home/l.lu/lpc3250/ltib/rpm/BUILD
+ rm -rf dev-1.1
+ /bin/gzip -dc /home/l.lu/lpc3250/ltib/rpm/SOURCES/dev-1.1.tar.gz
+ tar -xvvf -
drwxr-xr-x seh/users 0 2005-03-23 22:48 dev-1.1/
-rw-r--r-- seh/users 5643 2005-03-23 06:49 dev-1.1/device_table.txt
-rwxr-xr-x seh/users 2187 2005-03-23 22:43 dev-1.1/mkrpmdev
-rw-r--r-- seh/users 766 2005-03-23 22:48 dev-1.1/dev.spec
-rw-r--r-- seh/users 34 2005-03-23 22:46 dev-1.1/Makefile
-rw-r--r-- seh/users 262 2005-03-23 22:47 dev-1.1/README
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd dev-1.1
+ exit 0
Executing(%build): /bin/sh -e /home/l.lu/lpc3250/ltib/tmp/rpm-tmp.29641
+ umask 022
+ cd /home/l.lu/lpc3250/ltib/rpm/BUILD
+ cd dev-1.1
+ exit 0
Executing(%install): /bin/sh -e /home/l.lu/lpc3250/ltib/tmp/rpm-tmp.29641
+ umask 022
+ cd /home/l.lu/lpc3250/ltib/rpm/BUILD
+ cd dev-1.1
+ rm -rf /home/l.lu/lpc3250/ltib/tmp/dev
+ '[' -f /home/l.lu/lpc3250/ltib/bin/device_table.txt ']'
+ DEV_TABLE=/home/l.lu/lpc3250/ltib/bin/device_table.txt
+ mkdir -p /home/l.lu/lpc3250/ltib/tmp/dev//opt/freescale/rootfs/arm//dev
+ ln -s /var/tmp/log /home/l.lu/lpc3250/ltib/tmp/dev//opt/freescale/rootfs/arm//dev/log
+ ln -s /proc/mounts /home/l.lu/lpc3250/ltib/tmp/dev//opt/freescale/rootfs/arm//dev/mtab
+ PREFIX=/opt/freescale/rootfs/arm/
+ perl mkrpmdev /home/l.lu/lpc3250/ltib/bin/device_table.txt
+ exit 0
Processing files: dev-1.1-1
Finding Provides: (using /opt/ltib/usr/lib/rpm/find-provides)...
Finding Requires: (using /opt/ltib/usr/lib/rpm/find-requires)...
PreReq: rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
Requires(rpmlib): rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
Wrote: /home/l.lu/lpc3250/ltib/rpm/RPMS/arm/dev-1.1-1.arm.rpm
Executing(%clean): /bin/sh -e /home/l.lu/lpc3250/ltib/tmp/rpm-tmp.98556
+ umask 022
+ cd /home/l.lu/lpc3250/ltib/rpm/BUILD
+ cd dev-1.1
+ rm -rf /home/l.lu/lpc3250/ltib/tmp/dev
+ rm -f /tmp/manifest
+ exit 0
Executing(--clean): /bin/sh -e /home/l.lu/lpc3250/ltib/tmp/rpm-tmp.98556
+ umask 022
+ cd /home/l.lu/lpc3250/ltib/rpm/BUILD
+ rm -rf dev-1.1
+ exit 0
Build time for dev: 2 seconds

sudo /opt/ltib/usr/bin/rpm --root /home/l.lu/lpc3250/ltib/rootfs --dbpath /var/lib/rpm -e --allmatches --nodeps --noscripts --define '_tmppath /tmp/ltib' dev 2>/dev/null
sudo /opt/ltib/usr/bin/rpm --root /home/l.lu/lpc3250/ltib/rootfs --dbpath /var/lib/rpm --prefix / --ignorearch -ivh --force --excludedocs --noscripts --define '_tmppath /tmp/ltib' /home/l.lu/lpc3250/ltib/rpm/RPMS/arm/dev-1.1-1.arm.rpm
error: failed to stat /home/l.lu/.gvfs: Permission denied
Preparing... ########################################### [100%]
1:dev ########################################### [100%]

Processing deployment operations
==================================
making filesystem image file
staging directory is /home/l.lu/lpc3250/ltib/rootfs.tmp
removing the boot directory and files
removing man files and directories
removing info files
removing /usr/src directory
removing /usr/include directory
removing /usr/share/locale directory
removing static libraries
removing target rpm database
stripping binaries and libraries
WARN: /home/l.lu/lpc3250/ltib/rootfs.tmp/sbin/sln statically linked
WARN: /home/l.lu/lpc3250/ltib/rootfs.tmp/sbin/ldconfig statically linked
WARN: /home/l.lu/lpc3250/ltib/rootfs.tmp/bin/busybox statically linked

Filesystem stats, including padding:

Total size = 38408k
Total number of files = 1055


running post build user command: . ../GsnComm_FlashRelease_copyUimgRfsToTftp.sh
cp: cannot stat `/home/l.lu/lpc3250/ltib/rootfs/boot/uImage': No such file or directory

Started: Thu Jun 2 10:40:31 2011
Ended: Thu Jun 2 10:40:57 2011
Elapsed: 26 seconds

Build Succeeded

--------++++Manually generate RFS


mkfs.jffs2 [ -p,--pad[=SIZE] ] [ -r,-d,--root directory ] [ -s,--pagesize=SIZE ] [ -e,--eraseblock=SIZE ] [ -c,--cleanmarker=SIZE ] [ -n,--no-cleanmarkers ] [ -o,--output image.jffs2 ] [ -l,--little-endian ] [ -b,--big-endian ] [ -D,--devtable=FILE ] [ -f,--faketime ] [ -q,--squash ] [ -U,--squash-uids ] [ -P,--squash-perms ] [ --with-xattr ] [ --with-selinux ] [ --with-posix-acl ] [ -m,--compression-mode=MODE ] [ -x,--disable-compressor=NAME ] [ -X,--enable-compressor=NAME ] [ -y,--compressor-priority=PRIORITY:NAME ] [ -L,--list-compressors ] [ -t,--test-compression ] [ -h,--help ] [ -v,--verbose ] [ -V,--version ] [ -i,--incremental image.jffs2 ]

Note: /rootfs/ has to be owned by root, so make sure
#chown -R root:root ./rootfs/ before manually generating RFS.

/opt/ltib/usr/bin/mkfs.jffs2 -n -r rootfs_working -m size -e 16 -o /tftpboot/rootfs.jffs2

[l.lu@localhost ltib]$ /opt/ltib/usr/bin/mkfs.jffs2 -n -r ./rootfs -m size -e 16 -o ./manual_rfs.jffs2

[l.lu@localhost ltib]$ /opt/ltib/usr/bin/mkfs.jffs2 -n -r ./manual_trimmed_rootfs_after-p-dev-f_bkup/rootfs/ -m size -e 16 -o ./manual_rfs.jffs2



use LTIB to build RFS auotmatically
-----------------------------------------------
[3]
$./ltib -m clean
$./ltib -m distclean

Removed whole rootfs folder after '-m distclean'

quentin@ubuntu:~/lpc3250/ltib-qs$ ./ltib -m distclean
You are about remove all the work you have been doing, are you really
sure you want to completely remove files from:

/home/quentin/lpc3250/ltib-qs/rootfs

To continue type in 'yes': yes
Removing target root filesystem
[sudo] password for quentin:

Processing: mkdistclean
=========================
Build path taken because: force set, build key set, no prebuilt rpm,

rpmbuild --dbpath ///home/quentin/lpc3250/ltib-qs/cleanupdb --target i686 --define '_unpackaged_files_terminate_build 0' --define '_target_cpu i686' --define '__strip strip' --define '_topdir /home/quentin/lpc3250/ltib-qs/rpm' --define '_prefix /usr' --define '_tmppath /home/quentin/lpc3250/ltib-qs/tmp' --define '_rpmdir /home/quentin/lpc3250/ltib-qs/rpm/RPMS' --define '_mandir /usr/share/man' --define '_sysconfdir /etc' --define '_localstatedir /var' -bb --clean --rmsource /home/quentin/lpc3250/ltib-qs/dist/lfs-5.1/mkdistclean/mkdistclean.spec
Building target platforms: i686
Building for target i686
Executing(%prep): /bin/sh -e /home/quentin/lpc3250/ltib-qs/tmp/rpm-tmp.46763
+ umask 022
+ cd /home/quentin/lpc3250/ltib-qs/rpm/BUILD
+ exit 0
Executing(%build): /bin/sh -e /home/quentin/lpc3250/ltib-qs/tmp/rpm-tmp.46763
+ umask 022
+ cd /home/quentin/lpc3250/ltib-qs/rpm/BUILD
+ exit 0
Executing(%install): /bin/sh -e /home/quentin/lpc3250/ltib-qs/tmp/rpm-tmp.46763
+ umask 022
+ cd /home/quentin/lpc3250/ltib-qs/rpm/BUILD
+ : /home/quentin/lpc3250/ltib-qs/rootfs
+ '[' '!' -d /home/quentin/lpc3250/ltib-qs/rootfs ']'
+ '[' /home/quentin/lpc3250/ltib-qs/rootfs = / ']'
+ '[' 1000 = 0 ']'
+ '[' '!' -O /home/quentin/lpc3250/ltib-qs/rootfs ']'
+ rm -rf /home/quentin/lpc3250/ltib-qs/tmp/mkdistclean
+ mkdir -p /home/quentin/lpc3250/ltib-qs/tmp/mkdistclean//opt/freescale/rootfs/i686
+ cd /home/quentin/lpc3250/ltib-qs/rootfs
+ set +e
+ find -type d -exec mkdir -p '/home/quentin/lpc3250/ltib-qs/tmp/mkdistclean//opt/freescale/rootfs/i686/{}' ';'
+ find . '!' -type d -exec touch '/home/quentin/lpc3250/ltib-qs/tmp/mkdistclean//opt/freescale/rootfs/i686/{}' ';'
+ exit 0
+ mkdir -p /home/quentin/lpc3250/ltib-qs/tmp/mkdistclean//opt/freescale/rootfs/i686/root/.ssh
+ touch /home/quentin/lpc3250/ltib-qs/tmp/mkdistclean//opt/freescale/rootfs/i686/root/.ssh/known_hosts
+ touch /home/quentin/lpc3250/ltib-qs/tmp/mkdistclean//opt/freescale/rootfs/i686/.ash_history
Processing files: mkdistclean-1.0-1
Finding Provides: (using /opt/ltib/usr/lib/rpm/find-provides)...
Finding Requires: (using /opt/ltib/usr/lib/rpm/find-requires)...
PreReq: rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
Requires(rpmlib): rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(CompressedFileNames) <= 3.0.4-1
Wrote: /home/quentin/lpc3250/ltib-qs/rpm/RPMS/i686/mkdistclean-1.0-1.i686.rpm
Executing(%clean): /bin/sh -e /home/quentin/lpc3250/ltib-qs/tmp/rpm-tmp.23031
+ umask 022
+ cd /home/quentin/lpc3250/ltib-qs/rpm/BUILD
+ rm -rf /home/quentin/lpc3250/ltib-qs/tmp/mkdistclean
+ exit 0
Executing(--clean): /bin/sh -e /home/quentin/lpc3250/ltib-qs/tmp/rpm-tmp.23031
+ umask 022
+ cd /home/quentin/lpc3250/ltib-qs/rpm/BUILD
+ exit 0
Build time for mkdistclean: 15 seconds

sudo /opt/ltib/usr/bin/rpm --root / --dbpath /home/quentin/lpc3250/ltib-qs/cleanupdb -e --allmatches --nodeps --noscripts --define '_tmppath /home/quentin/lpc3250/ltib-qs/tmp' mkdistclean 2>/dev/null
sudo /opt/ltib/usr/bin/rpm --root / --dbpath /home/quentin/lpc3250/ltib-qs/cleanupdb --prefix /home/quentin/lpc3250/ltib-qs/rootfs --ignorearch -ivh --force --excludedocs --noscripts --define '_tmppath /home/quentin/lpc3250/ltib-qs/tmp' /home/quentin/lpc3250/ltib-qs/rpm/RPMS/i686/mkdistclean-1.0-1.i686.rpm
error: failed to stat /home/quentin/.gvfs: Permission denied
Preparing... ########################################### [100%]
1:mkdistclean ########################################### [100%]
sudo /opt/ltib/usr/bin/rpm --root / --dbpath /home/quentin/lpc3250/ltib-qs/cleanupdb -e --allmatches --noscripts --define '_tmppath /home/quentin/lpc3250/ltib-qs/tmp' mkdistclean
error: failed to stat /home/quentin/.gvfs: Permission denied
quentin@ubuntu:~/lpc3250/ltib-qs$ ll rootfs_image
lrwxrwxrwx 1 quentin developer 14 2011-05-31 11:05 rootfs_image -> ./rootfs.jffs2
quentin@ubuntu:~/lpc3250/ltib-qs$ ll
total 288
drwxrwxrwx 8 quentin quentin 4096 2011-06-01 08:52 ./
drwxr-xr-x 4 quentin quentin 4096 2011-05-26 12:37 ../
-rwxr--r-- 1 quentin quentin 886 2011-05-25 11:55 2869_ltib.patch*
drwxrwxrwx 3 quentin quentin 4096 2011-06-01 08:52 bin/
drwxrwxrwx 7 quentin quentin 4096 2011-06-01 08:52 config/
-rw-rw-rw- 1 quentin quentin 17989 2007-11-07 02:44 COPYING
drwxrwxrwx 2 quentin quentin 4096 2011-05-24 14:50 CVS/
drwxrwxrwx 4 quentin quentin 4096 2011-05-24 14:50 dist/
drwxrwxrwx 3 quentin quentin 4096 2011-05-24 14:50 doc/
-rw-rw-rw- 1 quentin quentin 436 2009-03-19 04:53 .gitignore
-rwxrwxrwx 1 quentin quentin 110719 2011-05-25 11:57 ltib*
-rwxrwxrwx 1 quentin quentin 110337 2011-04-02 21:56 ltib.orig*
-rw-rw-rw- 1 quentin quentin 2579 2010-08-18 04:18 .ltibrc
-rw-rw-rw- 1 quentin quentin 952 2007-11-07 02:44 README
lrwxrwxrwx 1 quentin developer 14 2011-05-31 11:05 rootfs_image -> ./rootfs.jffs2
drwxrwsr-x 3 quentin quentin 4096 2011-06-01 08:52 rpm/
quentin@ubuntu:~/lpc3250/ltib-qs$


NOTES FROM LtibConvertPcsBsp
-----------------------------------------
-----+++ Deploying the BSP

The primary deployment mechanism in ltib is expected to be NFS. By
default ltib will build a root filesystem suitable for exporting as
a root filesystem in ~/ltib/rootfs . It is the user's responsibility
to export this directory and setup the bootloader parameters to
use this. Note that the built kernel can be located in ~/ltib/rootfs/boot


---++ Saving your work

Once you have booted your board and are happy to check in your work,
you need to do the following:

* copy the updated .config to defconfig
cp config/platform/mpc5200/.config config/platform/mpc5200/defconfig
* checking ltib changes to CVS
* copy new source files to the GPP

Machine ID Management.

[1] http://www.arm.linux.org.uk/developer/machines/list.php?id=3185

/linux-2.6.34/arch/arm/tools/mach-types will list all supported ARM machine ID.

Necessary Package List

[1] ipcrm http://en.wikipedia.org/wiki/Ipcrm



[*] util_linux include support of 'ipcrm'

Necessary Package List

[1] ipcrm http://en.wikipedia.org/wiki/Ipcrm



[*] util_linux

Tuesday, November 16, 2010

Bash_Prog while loop and Delay

[1] http://www.faqs.org/docs/bashman/bashref_68.html




#!/bin/bash

var0=0
LIMIT=10

while [ ! -a /dev/ttyUSB3 ]

#while [ -a /dev/tty6 ]
do
echo "checking /dev/ttyUSB3 " # -n suppresses newline.
sleep 3
done

#exit 1

Monday, November 15, 2010

GPIO Access from user space.

[1] http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO#Getting_access_to_a_GPIO


CREATE 'gpo06' FOR USER SPACE GPIO ACCESS
------------------------------------------------
[root@GsnCommsModule user]# echo "85" > /sys/class/gpio/export
[root@GsnCommsModule user]# ls /sys/class/gpio/
export gpiochip32 gpiochip51 gpiochip8 unexport
gpiochip0 gpiochip45 gpiochip79 gpo06
[root@GsnCommsModule user]#

Thursday, November 11, 2010

TFTP and NFS server set up

[1] http://rpm.pbone.net/index.php3/stat/4/idpl/13694850/dir/fedora_9/com/tftp-server-0.48-6.fc9.i386.rpm.html
[2] https://help.ubuntu.com/community/SettingUpNFSHowTo ---- NFS setting under UBUNTU
[3] https://help.ubuntu.com/8.04/serverguide/C/network-file-system.html --- NFS Setting
[4] Fail to put file to TFTP server answer

Ip address range should be listed in format below:

192.168.1.0/28                  192.168.1.0   - 192.168.1.15
192.168.1.16/28                 192.168.1.16  - 192.168.1.31
192.168.1.32/27                 192.168.1.32  - 192.168.1.63
192.168.1.64/26                 192.168.1.64  - 192.168.1.127
192.168.1.128/25                192.168.1.128 - 192.168.1.255


###########################
#TFTP Server Set UP.
###########################

CHECK WHETHER TFTP PACKAGE IS INSTALLED
-------------------------------------------
[q.yang@localhost ~]$ rpm -q tftp-server
tftp-server-0.48-6.fc9.i386

INSTALL TFTP FROM RPM
------------------------------
Download it from [1]
Download Tftp dependancy xinetd-2.3.14-20.fc9.i386 from [1]

[root@localhost q.yang]# rpm -ivh Download/xinetd-2.3.14-20.fc9.i386.rpm
warning: Download/xinetd-2.3.14-20.fc9.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6df2196f
Preparing... ########################################### [100%]
1:xinetd ########################################### [100%]
[root@localhost q.yang]# rpm -ivh Download/tftp-server-0.48-6.fc9.i386.rpm
warning: Download/tftp-server-0.48-6.fc9.i386.rpm: Header V3 DSA signature: NOKEY, key ID 6df2196f
Preparing... ########################################### [100%]
1:tftp-server ########################################### [100%]

[root@localhost q.yang]# rpm -q tftp-server
tftp-server-0.48-6.fc9.i386
[root@localhost q.yang]# chkconfig tftp on






[root@localhost ~]# vi /etc/sysconfig/iptables
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A INPUT -m state --state NEW -m udp -p udp --dport 69 -j ACCEPT
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
[root@localhost ~]# service iptables restart

Alternatively using GUI to manage firmwall:





[root@localhost ~]# chkconfig tftp on
[root@localhost ltib-qs]# service xinetd restart
#show whether tftp is running.
[root@localhost ltib-qs]# netstat -a | grep udp
[root@localhost ~]# chown q.yang /var/lib/tftpboot
[root@localhost ~]# chgrp users /var/lib/tftpboot
alternatively:
[root@localhost q.yang]# chown q.yang:developer /var/lib/tftpboot/
[root@localhost q.yang]# chmod g+w /var/lib/tftpboot/
drwxrwxr-x 2 q.yang developer 4096 2008-05-22 07:55 tftpboot


VARIFY TFTP SERVER IS WORKING FROM WINDOWS
--------------------------------------------
Using Tftp command under windows console





PERMISSION ERROR WHEN WRITE FILE INTO TFTP SERVER
--------------------------------------
#chmod 777 /var/lib/tftpboot


RESTART TFTP SERVER
---------------------
[root@localhost ltib-qs]# service xinetd restart


FAIL TO PUT FILE TO TFTP SERVER [4]
----------------------------------
check the /etc/xinetd.d/tftp file..

change:
server_args = -s /tftpboot

to:
server_args = -c -s /tftpboot

“-c” allows the creation of new file





##################################
# NFS Server set up under UBUNTU
###################################
[3] [2]
quentin@ubuntu:~/CodeSourcery/arm-2010q1$ sudo apt-get install nfs-kernel-server
............
............
quentin@ubuntu:~/CodeSourcery/arm-2010q1$ sudo vi /etc/exports

quentin@ubuntu:~/CodeSourcery/arm-2010q1$ sudo /etc/init.d/nfs-kernel-server start
* Exporting directories for NFS kernel daemon... [ OK ]
* Starting NFS kernel daemon [ OK ]

$ sudo service nfs-kernel-server start
 * Exporting directories for NFS kernel daemon...                                                                                                                 [ OK ]
 * Starting NFS kernel daemon                                                                                                                                     [ OK ]



#########################
# NFS Server set up
#######################
INSTALL NFS-UTILS RPCBIND RPM PACKAGE IF NOT INSTALLED
--------------------------------------------------------
#rpm -q nfs-utils To check whether nfs-utils installed.

INSTALL NFS-UTILS AND RPCBIND VIA YUM
-------------------------------------
Note:Not latest rpm is detected by yum due to yum package is old.
[root@localhost q.yang]# yum install nfs-utils rpcbind
Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package rpcbind.i386 0:0.1.4-14.fc9 set to be updated
---> Package nfs-utils.i386 1:1.1.2-2.fc9 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
nfs-utils i386 1:1.1.2-2.fc9 fedora 291 k
rpcbind i386 0.1.4-14.fc9 fedora 48 k

Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 339 k
Is this ok [y/N]: y
.....................
.....................

CREATE NFS SHARE
-----------------------
-- Option 1: --
You can edit /etc/exports file as follows:
[root@localhost ~]# vi /etc/exports
[q.yang@localhost ~]$ cat /etc/exports
/home/q.yang/Desktop 10.10.20.70(rw,insecure,sync,no_root_squash)
/home/q.yang/lpc3250/ltib-qs/rootfs 10.10.20.88(rw,no_root_squash,no_subtree_check,sync)
/home/q.yang/lpc3250/rootfs4Luke 10.10.20.90(rw,no_root_squash,no_subtree_check,sync)

-- Option 2: --
Using NFS GUI (need install yp-tools.i386 0:2.9-3 ypbind.i386 3:1.20.4-6.fc9 two packages)

START NFS, RPCBIND SERVICE
------------------------------
[root@localhost eclipse]# service rpcbind start
Starting rpcbind: [ OK ]
[root@localhost eclipse]# service nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]

CHECK WHETHER NFS IS RUNNING
-----------------------------------
You should see portmapper and nfs running as below. If not try
#service nfs restart

[root@localhost ~]# rpcinfo -p
program vers proto port service
100000 4 tcp 111 portmapper
100000 3 tcp 111 portmapper
100000 2 tcp 111 portmapper
100000 4 udp 111 portmapper
100000 3 udp 111 portmapper
100000 2 udp 111 portmapper
100000 4 0 111 portmapper
100000 3 0 111 portmapper
100000 2 0 111 portmapper
100011 1 udp 1016 rquotad
100011 2 udp 1016 rquotad
100011 1 tcp 1019 rquotad
100011 2 tcp 1019 rquotad
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100021 1 udp 56276 nlockmgr
100021 3 udp 56276 nlockmgr
100021 4 udp 56276 nlockmgr
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 tcp 39972 nlockmgr
100021 3 tcp 39972 nlockmgr
100021 4 tcp 39972 nlockmgr
100005 1 udp 54842 mountd
100005 1 tcp 59798 mountd
100005 2 udp 54842 mountd
100005 2 tcp 59798 mountd
100005 3 udp 54842 mountd
100005 3 tcp 59798 mountd


CHECK WHETHER NFS IS RUNNING FROM ANOTHER LINUX PC
--------------------------------------------------
On Linux PC B(10.10.20.70):
[root@localhost q.yang]# mount -t nfs 10.10.20.35:/home/q.yang/Desktop /mnt/nfstest/
[root@localhost q.yang]# ll /mnt/nfstest/
total 12
-rw-r--r-- 1 q.yang 500 5559 2010-06-03 17:23 gnome-terminal.desktop

On Linux PC A (10.10.20.35)
[q.yang@localhost ~]$ cat /etc/exports
/home/q.yang/Desktop 10.10.20.70(rw,insecure,sync,no_root_squash)


NFS TROUBLE SHOOTING
-------------------------------------
Fail to connect NFS due to firewall
-----------------------------------
1. Upgrade system-config-firewall/system-config-firewall-tui rpm package so that
correct /etc/sysconfig/iptables, /etc/sysconfig/iptables-config can be generated.
2. Disable firewall.

UPGRADE FIREWALL RPM PACKAGE MANUALLY
----------------------------------------
The files modified and generated as a result of system-config-firewall (system-config-firewall-1.2.16-3.fc9.noarch.rpm)
[root@localhost eclipse]# ll /etc/sysconfig/ |grep ip
-rw------- 1 root root 1753 2011-02-25 14:32 ip6tables-config
-rw------- 1 root root 1740 2011-02-25 14:32 iptables-config
-rw------- 1 root root 1776 2011-02-24 15:25 ip6tables-config.old
-rw------- 1 root root 1876 2011-02-24 15:10 ip6tables.old
-rw------- 1 root root 1763 2011-02-24 15:25 iptables-config.old
-rw------- 1 root root 1871 2011-02-24 15:10 iptables.old


YUM COULDN'T FIND LATEST FIREWALL RPM PACKAGE
[root@localhost eclipse]# yum install system-config-firewall
Loaded plugins: refresh-packagekit
updates | 2.6 kB 00:00
fedora | 2.4 kB 00:00
Setting up Install Process
Parsing package install arguments
Package system-config-firewall-1.2.7-1.fc9.noarch already installed and latest version
Nothing to do


[root@localhost eclipse]# rpm -U /home/q.yang/Download/system-config-firewall-1.2.16-3.fc9.noarch.rpm
warning: /home/q.yang/Download/system-config-firewall-1.2.16-3.fc9.noarch.rpm: Header V3 DSA signature: NOKEY, key ID df9b0ae9
error: Failed dependencies:
system-config-firewall-tui = 1.2.16-3.fc9 is needed by system-config-firewall-1.2.16-3.fc9.noarch
[root@localhost eclipse]# rpm -U /home/q.yang/Download/system-config-firewall-tui-1.2.16-3.fc9.noarch.rpm
warning: /home/q.yang/Download/system-config-firewall-tui-1.2.16-3.fc9.noarch.rpm: Header V3 DSA signature: NOKEY, key ID df9b0ae9
error: Failed dependencies:
system-config-firewall-tui = 1.2.7-1.fc9 is needed by (installed) system-config-firewall-1.2.7-1.fc9.noarch
[root@localhost eclipse]# rpm -q system-config-firewall-tui
system-config-firewall-tui-1.2.7-1.fc9.noarch

REMOVE EXISTING FIREWALL RPM PACKAGE
[root@localhost eclipse]# rpm -e system-config-firewall-tui
error: Failed dependencies:
system-config-firewall-tui = 1.2.7-1.fc9 is needed by (installed) system-config-firewall-1.2.7-1.fc9.noarch
[root@localhost eclipse]# rpm -e system-config-firewall
[root@localhost eclipse]# rpm -e system-config-firewall-tui

MANUALLY INSTALL FIREWALL RPM PACKAGE
[root@localhost eclipse]# rpm -ivh /home/q.yang/Download/system-config-firewall-1.2.16-3.fc9.noarch.rpm
warning: /home/q.yang/Download/system-config-firewall-1.2.16-3.fc9.noarch.rpm: Header V3 DSA signature: NOKEY, key ID df9b0ae9
error: Failed dependencies:
system-config-firewall-tui = 1.2.16-3.fc9 is needed by system-config-firewall-1.2.16-3.fc9.noarch
[root@localhost eclipse]# rpm -ivh /home/q.yang/Download/system-config-firewall-tui-1.2.16-3.fc9.noarch.rpm
warning: /home/q.yang/Download/system-config-firewall-tui-1.2.16-3.fc9.noarch.rpm: Header V3 DSA signature: NOKEY, key ID df9b0ae9
Preparing... ########################################### [100%]
1:system-config-firewall-########################################### [100%]
[root@localhost eclipse]# rpm -ivh /home/q.yang/Download/system-config-firewall-1.2.16-3.fc9.noarch.rpm
warning: /home/q.yang/Download/system-config-firewall-1.2.16-3.fc9.noarch.rpm: Header V3 DSA signature: NOKEY, key ID df9b0ae9
Preparing... ########################################### [100%]
1:system-config-firewall ########################################### [100%]


CHECK FIREWALL FROM COMMAND LINE
-------------------------------------
[root@localhost eclipse]# iptables -L |more
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT icmp -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:nfs
ACCEPT udp -- anywhere anywhere state NEW udp dpt:nfs
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-ns
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-dgm
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:netbios-ssn
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:microsoft-ds
...................
..................


IF NFS FAILURE IS DUE TO OLD NFS-UTILS RPCBIND RPM PACKAGE
----------------------------------------------------------

REMOVE AND INSTALL NEW PACKAGE VIA YUM
-----------------------------------------

[root@localhost eclipse]# yum erase rpcbind
Loaded plugins: refresh-packagekit
Setting up Remove Process
updates | 2.6 kB 00:00
fedora | 2.4 kB 00:00
Resolving Dependencies
--> Running transaction check
---> Package rpcbind.i386 0:0.1.7-1.fc9 set to be erased
--> Processing Dependency: rpcbind for package: nfs-utils
--> Processing Dependency: rpcbind for package: ypbind
--> Running transaction check
---> Package nfs-utils.i386 1:1.1.2-2.fc9 set to be erased
---> Package ypbind.i386 3:1.20.4-6.fc9 set to be erased
--> Processing Dependency: ypbind for package: yp-tools
--> Running transaction check
---> Package yp-tools.i386 0:2.9-3 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Removing:
rpcbind i386 0.1.7-1.fc9 installed 90 k
Removing for dependencies:
nfs-utils i386 1:1.1.2-2.fc9 installed 555 k
yp-tools i386 2.9-3 installed 151 k
ypbind i386 3:1.20.4-6.fc9 installed 64 k

Transaction Summary
=============================================================================
Install 0 Package(s)
Update 0 Package(s)
Remove 4 Package(s)

Is this ok [y/N]:
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Shutting down NFS mountd: [ OK ]
Shutting down NFS daemon: [ OK ]
Shutting down NFS quotas: [ OK ]
Shutting down NFS services: [ OK ]
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]
Stopping RPC idmapd: [ OK ]
Starting RPC idmapd: [ OK ]
Erasing : nfs-utils ######################### [1/4]
warning: /var/lib/nfs/state saved as /var/lib/nfs/state.rpmsave
warning: /var/lib/nfs/etab saved as /var/lib/nfs/etab.rpmsave
Erasing : rpcbind ######################### [2/4]
Erasing : yp-tools ######################### [3/4]
Erasing : ypbind ######################### [4/4]

Removed: rpcbind.i386 0:0.1.7-1.fc9
Dependency Removed: nfs-utils.i386 1:1.1.2-2.fc9 yp-tools.i386 0:2.9-3 ypbind.i386 3:1.20.4-6.fc9
Complete!



[root@localhost eclipse]# rpm -q rpcbind
package rpcbind is not installed
[root@localhost eclipse]# yum install nfs-utils rpcbind
Loaded plugins: refresh-packagekit
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package rpcbind.i386 0:0.1.4-14.fc9 set to be updated
---> Package nfs-utils.i386 1:1.1.2-2.fc9 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
nfs-utils i386 1:1.1.2-2.fc9 fedora 291 k
rpcbind i386 0.1.4-14.fc9 fedora 48 k

Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 339 k
Is this ok [y/N]: y

Uboot Env -- Original and Newly build

ORIGINAL U-Boot 1.3.3 (Apr 10 2009 - 09:21:30)
----------------------------------------------------
uboot> printenv
bootdelay=3
baudrate=115200
bootfile=uImage
bootargs=console=ttyS0,115200n81 root=/dev/mtdblock3 rw rootfstype=jffs2 init=/sbin/init
flash_kernel=nand erase 0x190000 0x270000; nand write.jffs2 0x80100000 0x190000 0x1a0000
flash_rootfs=nand erase 0x590000 0x3a70000; nand write.jffs2 0x80100000 0x590000 0xbc4000
boot_nand=nboot.jffs2 0x80100000 0x0 0x190000; bootm
bootcmd=nboot.jffs2 0x80100000 0x0 0x190000; bootm
stdin=serial
stdout=serial
stderr=serial
filesize=19F4D4
fileaddr=80100000
gatewayip=192.168.1.1
netmask=255.255.255.0
ipaddr=10.10.20.88
serverip=10.10.20.70
Environment size: 575/16380 bytes<0A>

Program Linux FileSystem to Flash with UBoot

tftpboot 0x80100000 rootfs.jffs2
HW MAC address: 00:01:90:00:C0:81
ENET:auto-negotiation complete
ENET:FULL DUPLEX
ENET:100MBase
TFTP from server 10.10.20.70; our IP address is 10.10.20.88
Filename 'rootfs.jffs2'.
Load address: 0x80100000
Loading: #################################################################
#################################################################
#################################################################
#################################################################
#################################################################
######################################################
done
Bytes transferred = 5554176 (54c000 hex)
uboot> nand erase 0x590000 0x3a70000
NAND erase: device 0 offset 0x590000, size 0x3a70000
Erasing at 0x590000 -- 0% complete.<0D>
Erasing at 0x624000 -- 1% complete.<0D>
Erasing at 0x6b8000 -- 2% complete.<0D>
Erasing at 0x750000 -- 3% complete.<0D>
Erasing at 0x7e4000 -- 4% complete.<0D>
Erasing at 0x878000 -- 5% complete.<0D>
....................................
Erasing at 0x2648000 -- 56% complete.
Erasing at 0x26dc000 -- 57% complete.
Skipping bad block at 0x026f4000
Erasing at 0x2774000 -- 58% complete.
Erasing at 0x2808000 -- 59% complete.
......................................
Erasing at 0x3f68000 -- 99% complete.<0D>
Erasing at 0x3ffc000 -- 100% complete.
OK
uboot> nand write.jffs2 0x80100000 0x590000 0x54C000
NAND write: device 0 offset 0x590000, size 0x54c000
5554176 bytes written: OK
uboot> setenv bootargs 'console=ttyS0,115200n81 root=/dev/mtdblock3 rw rootfstype
=jffs2 ip=10.10.20.88 init=/sbin/init'
uboot> saveenv
Saving Environment to NAND...
Erasing Nand...
Erasing at 0x1f4000 -- 25% complete.<0D>
Erasing at 0x1f8000 -- 50% complete.<0D>
Erasing at 0x1fc000 -- 75% complete.<0D>
Erasing at 0x200000 -- 100% complete.
Writing to Nand... done
uboot>

Program Linux Kernel to Flash with UBoot

uboot> tftpboot 0x80100000 uImage
HW MAC address: 00:01:90:00:C0:81
ENET:auto-negotiation complete
ENET:FULL DUPLEX
ENET:100MBase
TFTP from server 10.10.20.70; our IP address is 10.10.20.88
Filename 'uImage'.
Load address: 0x80100000
Loading: *<08>#################################################################
##########################################################
done
Bytes transferred = 1801676 (1b7dcc hex)
uboot>nand erase 0x190000 0x270000
NAND erase: device 0 offset 0x190000, size 0x270000
Erasing at 0x190000 -- 0% complete.<0D>
Erasing at 0x194000 -- 1% complete.<0D>
Erasing at 0x19c000 -- 2% complete.<0D>
Erasing at 0x1a0000 -- 3% complete.<0D>
Erasing at 0x1a8000 -- 4% complete.<0D>
Erasing at 0x1ac000 -- 5% complete.<0D>
.......................................
Erasing at 0x3f0000 -- 98% complete.<0D>
Erasing at 0x3f8000 -- 99% complete.<0D>
Erasing at 0x3fc000 -- 100% complete.<0A>

OK
uboot>nand write.jffs2 0x80100000 0x190000 0x1B8000
NAND write: device 0 offset 0x190000, size 0x1b8000
1802240 bytes written: OK
uboot>setenv bootcmd 'nboot.jffs2 0x80100000 0x0 0x190000; bootm'
uboot> saveenv
Saving Environment to NAND...
Erasing Nand...
Erasing at 0x1f4000 -- 25% complete.<0D>
Erasing at 0x1f8000 -- 50% complete.<0D>
Erasing at 0x1fc000 -- 75% complete.<0D>
Erasing at 0x200000 -- 100% complete.
Writing to Nand... done
uboot>

Tuesday, November 9, 2010

Multiple network in Linux

[1] http://www.shallowsky.com/linux/networkSchemes.html
[2] http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch03_:_Linux_Networking


Howto Set Up Multiple Network Schemes on a Linux Laptop

PPP in Linux

[1] http://www.faqs.org/docs/Linux-HOWTO/PPP-HOWTO.html#AEN582
[2] http://rsc.anu.edu.au/General/linux_ppp/ANU-PPP-HOWTO-3.html
[3] http://www.spinics.net/lists/linux-ppp/msg00799.html pppd options

Packages that are needed when compiling Linux Kernel
-------------------------------------
With support for ppp_async, pppoe.


Maintaining a permanent connection to the net with pppd.

You can see why ppp failed from this log:
[root@GsnCommsModule user]# cat /var/log/messages


You can shut down the pppd connection by:
killall -HUP pppd


AUTO PPP
---------------------------
/svn/CableTracker/CommsModuleLinuxKernel/trunk/rootfs/etc/rc.d/rc.local
can automatically run all the shells that root user want to run after restart.


PPP account and connection retry
---------------------------------
/svn/CableTracker/CommsModuleLinuxKernel/trunk/rootfs/etc/ppp/peers/gsm

$cat gsm
lcp-echo-failure 0
/dev/ttyUSB3
115200
debug
defaultroute
usepeerdns

#ipcp-no-address
#ipcp-no-addresses
ipcp-max-failure 4
ipcp-accept-local
ipcp-accept-remote

# AUTHENTICATION
# If noauth works, use that, otherwise you have to pass
# the user name and password. This is an example of a
# standard Cingular user/pw combo

noauth
#ppp account infomation
user GridSense0002@maxwan.com.au
password GTre387a

crtscts
#persist will cause connection retry after ppp off-line
persist
maxfail 100
lock
connect '/sbin/chat -v -t6 -f /etc/ppp/peers/gsm_chat'

PULL DOWN ETH CONNECTION
----------------------------
[root@GsnCommsModule user]# ifconfig eth0 down

Monday, November 8, 2010

Decimal point in java script

[1] http://www.mredkj.com/javascript/nfbasic2.html

// Example: toFixed(2) when the number has no decimal places
// It will add trailing zeros
var num = 10;
var result = num.toFixed(2); // result will equal 10.00

// Example: toFixed(3) when the number has decimal places
// It will round to the thousandths place
num = 930.9805;
result = num.toFixed(3); // result will equal 930.981


PADDING '0'
-----------------------------------

function PadDigits(n, totalDigits)
{
n = n.toString();
var pd = '';
if (totalDigits > n.length)
{
for (i=0; i < (totalDigits-n.length); i++)
{
pd += '0';
}
}
return pd + n.toString();
}