Sunday, May 29, 2011

Network setting under Linux ---Embedded Linux Internet Access

[1] http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch03_:_Linux_Networking


[root@GsnCommsModule rc.d]# ifconfig -a
[root@GsnCommsModule rc.d]# cat rc.conf
all_services="mount-proc-sys mdev udev hostname devfsd depmod modules filesystems syslog network inetd portmap dropbear sshd boa smb dhcpd settime qtopia watchdog gtk2 pango"
all_services_r="pango gtk2 watchdog qtopia settime dhcpd smb boa sshd dropbear portmap inetd network syslog filesystems modules depmod devfsd hostname udev mdev mount-proc-sys"

cfg_services="mount-proc-sys mdev hostname depmod modules filesystems syslog network sshd settime "

cfg_services_r=" settime sshd network syslog filesystems modules depmod hostname mdev mount-proc-sys"

export HOSTNAME="GsnCommsModule [-m ] [options....]"
export NTP_SERVER="ntp.cs.strath.ac.uk"
export MODLIST=""
export RAMDIRS="/tmp /var"
export TMPFS="tmpfs"
export TMPFS_SIZE="512k"
export READONLY_FS=""
export INETD_ARGS=""
export BOA_ARGS=""
export SMBD_ARGS=""
export NMBD_ARGS=""
export DHCP_ARG=""
export DEPLOYMENT_STYLE="JFFS2"
export SYSCFG_DHCPC_CMD="udhcpc -b -i "
export DROPBEAR_ARGS=""
# net interface 1
export SYSCFG_IFACE1=y
export INTERFACE1="eth0"
export IPADDR1="10.10.20.89"
export NETMASK1="255.255.0.0"
export BROADCAST1="10.10.255.255"
export GATEWAY1="10.10.10.1"
export NAMESERVER1="10.10.10.1"

[root@GsnCommsModule rc.d]# source rc.local

--------------------------------------------
VIEW ROUTING TABLE

[root@GsnCommsModule rc.d]# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.10.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo

------------------------------
ADD DEFAULT GATEWAY

[root@GsnCommsModule rc.d]# route add default gw 10.10.10.1 eth0

Routing table with 0.0.0.0 as destination is the default gateway.
[root@GsnCommsModule rc.d]# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface.1
10.10.0.0 10.10.10.1 255.255.255.255 UGH 0 0 0 eth0
10.10.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 10.10.10.1 0.0.0.0 UG 0 0 0 eth0

------------------------
DELETE GATEWAY

[root@GsnCommsModule rc.d]# route del -net 10.10.0.0 netmask 255.255.255.255 gw 10.10.10.1 eth0
[root@GsnCommsModule rc.d]# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
10.10.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 10.10.10.1 0.0.0.0 UG 0 0 0 eth0






Wednesday, May 25, 2011

Ubuntu --- install tftp Server

[1] http://pjpramod.blogspot.com/2009/08/setting-up-tftp-server-on-ubuntu-904.html
[2] http://www.ubuntugeek.com/howto-setup-advanced-tftp-server-in-ubuntu.html


-----------------------[1]---------------------------------------
quentin@ubuntu:~/lpc3250/ltib-qs$ sudo apt-get install tftpd-hpa

Running Java on Embedded Linux

[1] Libffi Official Link
[2] http://www.linuxquestions.org/questions/linux-kernel-70/locale-support-in-linux-kernel-811248/
[3] http://java.sun.com/developer/technicalArticles/JavaTechandLinux/RedHat/ ---NPTL from RedHat
[4] http://en.wikipedia.org/wiki/NPTL#cite_note-0 ---NPTL
[5] http://en.wikipedia.org/wiki/LinuxThreads ---NPTL replace LinuxThreads
[6] http://dev.maxtrack.com.br/index.php/Td60_notes#Set_Locale --- locale issue
[7] http://sourceware.org/ml/libffi-discuss/2009/msg00004.html --- mail list for using libffi for power pc.
[8] http://www.linuxquestions.org/questions/linux-general-1/locale-cannot-set-lc_all-to-default-locale-no-such-file-or-directory-218622/ --- check locale
[9] http://www.busybox.net/ --- busy box home page
[10] http://groups.google.com/group/netusg20/tree/browse_frm/month/2010-01/2d17cfad90f32150?rnum=31&lnk=ol --- localedef crash (same as locale-gen crash)
[11] http://www.linuxquestions.org/questions/linux-newbie-8/detect-glibc-version-based-on-libpthread-so-627968/ --- check Glibc version
[12] http://ubuntuforums.org/showthread.php?t=829866 ---- java class library loading error.
[13] http://www.coderanch.com/t/110728/Linux-UNIX/find-vma-failed-warning ---VM Stack warning.
[14] http://www.velocityreviews.com/forums/t149023-cant-detect-initial-thread-stack-location.html --- JVM Stack warning.
[15] Embedded JRE Download from Oracle --- EJRE
[16] http://www.linux-mtd.infradead.org/faq/jffs2.html#L_bbhandle ---- jffs2 file system CRC error on node



RUN REST SERVER ON LINUX USING JAVA
------------------------------------
[root@10 HandMade]# java -jar Make.jar &
[1] 384
[root@10 HandMade]# Jan 3, 1970 1:52:04 AM org.restlet.engine.http.connector.HttpServerHelper start
INFO: Starting the internal HTTP server on port 8182

From Browser:
http://10.10.20.89:8182/powergridiq/datapac
[root@10 HandMade]# ps -A --sort -rss -o comm,pmem |head -n 11
COMMAND %MEM
java 57.7
sh 5.5
ps 3.0
init 0.9
head 0.8
kthreadd 0.0
ksoftirqd/0 0.0
events/0 0.0
khelper 0.0
async/mgr 0.0
[root@10 HandMade]# cat /proc/meminfo
MemTotal: 28952 kB
MemFree: 1424 kB
Buffers: 0 kB
Cached: 11684 kB
SwapCached: 0 kB
Active: 13344 kB
Inactive: 12100 kB
Active(anon): 6732 kB
Inactive(anon): 7028 kB
Active(file): 6612 kB
Inactive(file): 5072 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 13792 kB
Mapped: 4444 kB
Shmem: 0 kB
Slab: 1100 kB
SReclaimable: 256 kB
SUnreclaim: 844 kB
KernelStack: 264 kB
PageTables: 116 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 14476 kB
Committed_AS: 31352 kB
VmallocTotal: 745472 kB
VmallocUsed: 428 kB
VmallocChunk: 744912 kB





Access REST server from browser
http://10.10.20.89:8182/powergridiq/datapac



WORKAROUND FOR CLASS LIBRARY LOADING ERROR
----------------------------------------------
Here's a workaround. It's for making the package install and configure properly, not for actually running java in the chrooted environment.

1. Install sun-java6-bin. It fails to configure.
2. Find out where libjli.so is. Do "locate libjli.so". In my case it was here:

/opt/jdk1.7.0/jre/lib/i386/jli/libjli.so

3. Set the LD_LIBRARY_PATH variable so that the package can configure properly. Enter the following command (using your location of libjli.so):

LD_LIBRARY_PATH=/opt/jdk1.7.0/jre/lib/i386/jli dpkg --configure -a

Hopefully it's now installed and configured correctly.


TRY RUNNING JAVA PROGRAM AFTER LOCALE IS SET CORRECTLY
-----------------------------------------------------
[root@10 HandMade]# java -jar Make.jar
Java HotSpot(TM) Client VM warning: Can't detect initial thread stack location - find_vma failed
Jan 1, 1970 12:44:27 AM org.restlet.engine.http.connector.HttpServerHelper start
INFO: Starting the internal HTTP server on port 8182



Calling C function from Java. [1]
-----------------------------------


CHECK GLIBC VERSION [11]
-------------------
[root@GsnCommsModule lib]# cat /lib/libpthread.so.0 |grep GLIBC
GLIBC_2.4
GLIBC_PRIVATE
pthread_cond_timedwait@@GLIBC_2.4
__libc_dlopen_mode@@GLIBC_PRIVATE
tfind@@GLIBC_2.4
pthread_attr_getaffinity_np@@GLIBC_2.4
__fsetlocking@@GLIBC_2.4



SOLVE LOCALE ISSUE TO GET EMBEDDED JAVA RUN IN EMBEDDED LINUX [2]
-----------------------------------------------------------------
From [8]
[root@GsnCommsModule /]# locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=
[root@GsnCommsModule /]# locale -a
C
POSIX
[root@GsnCommsModule /]#

AFTER USING CODESOURCERY arm-2010q1 COMPILER
----------------------------------------------
arm-2010q1 is using newer version GCC (GCC4.41)
So all locale and language suit are generated in LTIB
Extra folders are removed so that only support wanted languages and font coding.

[root@LIQ-GateWay /]# locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
[root@LIQ-GateWay /]# locale -a
C
en_GB
en_GB.utf8
en_US
en_US.utf8
POSIX

[root@LIQ-GateWay /]# locale -m
UTF-8

Tuesday, May 24, 2011

Ubuntu --- install LTIB

[1] http://imxcommunity.org/group/ubuntutipsandtricks/forum/topics/building-ltib-in-ubuntu-1004
[2] http://www.imxdev.org/wiki/index.php?title=ALL_Boards_ltib_config_ubuntu


quentin@ubuntu:~/lpc3250$ wget http://www.bitshrine.org/netinstall

--2011-05-23 21:47:51-- http://www.bitshrine.org/netinstall
Resolving www.bitshrine.org... 66.96.145.106
Connecting to www.bitshrine.org|66.96.145.106|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2327 (2.3K) [text/html]
Saving to: `netinstall'

100%[======================================>] 2,327 --.-K/s in 0s

2011-05-23 21:47:53 (6.94 MB/s) - `netinstall' saved [2327/2327]

quentin@ubuntu:~/lpc3250$ ll
total 12
drwxr-xr-x 2 quentin quentin 4096 2011-05-23 21:47 ./
drwxr-xr-x 24 quentin quentin 4096 2011-05-23 21:42 ../
-rw-r--r-- 1 quentin quentin 2327 2008-10-23 01:43 netinstall
quentin@ubuntu:~/lpc3250$ perl netinstall

You are about to install the LTIB (GNU/Linux Target Image Builder)

Do you want to continue ? Y|n
y
Where do you want to install LTIB ? (/home/quentin/lpc3250/ltib)
/home/quentin/lpc3250/ltib-qs
Installing LTIB to /home/quentin/lpc3250/ltib-qs
+ cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/ltib co -d ltib-qs -P ltib
sh: cvs: not found
Died at netinstall line 69, line 2.
quentin@ubuntu:~/lpc3250$ cvs
The program 'cvs' can be found in the following packages:
* cvs
* cvsnt
Try: sudo apt-get install
quentin@ubuntu:~/lpc3250$ sudo apt-get install cvs
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
cvs
0 upgraded, 1 newly installed, 0 to remove and 326 not upgraded.
Need to get 1,685kB of archives.
After this operation, 3,703kB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu/ maverick/main cvs i386 1:1.12.13-12ubuntu1 [1,685kB]
Fetched 1,685kB in 10s (161kB/s)
Preconfiguring packages ...
Selecting previously deselected package cvs.
(Reading database ... 118286 files and directories currently installed.)
Unpacking cvs (from .../cvs_1%3a1.12.13-12ubuntu1_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for install-info ...
Processing triggers for doc-base ...
Processing 31 changed 2 added doc-base file(s)...
Registering documents with scrollkeeper...
Setting up cvs (1:1.12.13-12ubuntu1) ...
Ignoring install-info called from maintainer script
The package cvs should be rebuilt with new debhelper to get trigger support
Ignoring install-info called from maintainer script
The package cvs should be rebuilt with new debhelper to get trigger support
quentin@ubuntu:~/lpc3250$ ll
total 12
drwxr-xr-x 2 quentin quentin 4096 2011-05-23 21:47 ./
drwxr-xr-x 24 quentin quentin 4096 2011-05-23 21:42 ../
-rw-r--r-- 1 quentin quentin 2327 2008-10-23 01:43 netinstall
quentin@ubuntu:~/lpc3250$ perl netinstall

You are about to install the LTIB (GNU/Linux Target Image Builder)

Do you want to continue ? Y|n
y
Where do you want to install LTIB ? (/home/quentin/lpc3250/ltib)
/home/quentin/lpc3250/ltib-qs/



===============================Ref [1] below ================================
quentin@ubuntu:~/lpc3250/ltib-qs$ sudo rm /bin/sh
[sudo] password for quentin:
quentin@ubuntu:~/lpc3250/ltib-qs$ sudo ln -s /bin/bash /bin/sh
quentin@ubuntu:~/lpc3250/ltib-qs$ sudo chmod 777 /opt
quentin@ubuntu:~/lpc3250/ltib-qs$ sudo apt-get install gcc build-essential

quentin@ubuntu:~/lpc3250/ltib-qs$ sudo apt-get install zlib1g-dev
quentin@ubuntu:~/lpc3250/ltib-qs$ sudo apt-get install libncurses-dev
quentin@ubuntu:~/lpc3250/ltib-qs$ sudo apt-get install m4
quentin@ubuntu:~/lpc3250/ltib-qs$ sudo apt-get install bison
quentin@ubuntu:~/lpc3250/ltib-qs$ sudo apt-get install rpm
quentin@ubuntu:~/lpc3250/ltib-qs$ sudo apt-get install ccache
quentin@ubuntu:~/lpc3250/ltib-qs$ sudo apt-get install flex

------------------------------------------------
In order to apply patch file, set up Samba server for file exchange between Windows
and Ubuntu box.

quentin@ubuntu:~/lpc3250/ltib-qs$ sudo apt-get install samba-common-bin (has to be done to get samba work)
quentin@ubuntu:~/lpc3250/ltib-qs$ sudo apt-get install system-config-samba

-------------------------------
quentin@ubuntu:~/lpc3250/ltib-qs$ cp -p /home/quentin/Downloads/2869_ltib.patch ./
quentin@ubuntu:~/lpc3250/ltib-qs$ patch -i 2869_ltib.patch
patching file ltib
Hunk #1 succeeded at 964 (offset 38 lines).

quentin@ubuntu:~/lpc3250/ltib-qs$ sudo /usr/sbin/visudo

# User privilege specification
root ALL=(ALL) ALL
quentin ALL = NOPASSWD: /usr/bin/rpm, /opt/ltib/usr/bin/rpm, /opt/freescale/lti$

---------------------------------------------------------
uentin@ubuntu:~/lpc3250/ltib-qs$ ./ltib -m config

Installing host support packages.

This only needs to be done once per host, but may take up to
an hour to complete ...

If an error occurs, a log file with the full output may be found in:
/home/quentin/lpc3250/ltib-qs/host_config.log

If you would like to see the log messages as the host packages are built and
installed:

* Open another terminal in the same directory
* Run the command: tail -f host_config.log
* When you're done with the tail, use CTRL+C to exit

------------------------------------------------
$ sudo rm -rf ~/.ccache

Wednesday, May 4, 2011

How does iPad WiFi model have locatiion service --- Skyhook Wireless

[1] http://bbs.weiphone.com/read-htm-tid-1020301-page-2.html

Skyhook Wireless

Website Skyhook Wireless
Skyhook Wireless (formerly known as Quarterscope) is a Boston-based company that has developed a technology for determining geographical location using Wi-Fi as the underlying reference system. Using the MAC addresses of nearby wireless access points and proprietary algorithms, WPS can determine the position of a mobile device within 20–30 meters. It provides service similar to GPS without GPS hardware and can also integrate with GPS-enabled devices to provide hybrid positioning. Skyhook Wireless claims that with sub-second time-to-first-fix, supposed 20–30 meter accuracy and near 100% availability indoors and in dense urban areas.
Skyhook's database is gathered through wardriving,[1] and includes more than 100 million wi-fi access points and covers 70 percent of population centers in the United States and Canada.[2]
Skyhook Wireless offers Loki[3], a free 'virtual GPS' toolbar that automatically integrates a user's location with web content such as Google Maps, Fandango, Weather.com, etc. It has been now replaced by a "Find Me" page on the website, as well as tools and SDK's used for adding location-based data to sites such as WeatherBug.com.
Skyhook announced a partnership to help users in geotagging their pictures.[4]
At the Macworld Conference & Expo in January 2008, Apple CEO Steve Jobs announced that both the iPhone and iPod Touch will use Skyhook's WPS as the primary location engine for Google Maps and other applications.[5] However, Apple revealed that starting with iPhone/iPad software 3.2 in April 2010, its devices no longer uses Skyhook, but relies on its own location technologies.[6]

Monday, May 2, 2011

Unzip window zip file under Linux

[1] http://www.cyberciti.biz/tips/how-can-i-zipping-and-unzipping-files-under-linux.html