2015年11月30日 星期一

在arm平台交叉編譯perl

1. 下載perl和cross-perl
$ tar -zxvf perl-5.12.3.tar.gz
$ tar -zxvf perl-5.12.3-cross-0.5.tar.gz
2. 修改以下檔案
$ vi configure
$ vi cnf/configure
$ vi cnf/configure__f.sh
$ vi Makefile.config.SH

Modify #!/bin/sh to #!/bin/bash
3. 產生Makefile
$ CC=aarch64-linux-gnu-gcc LD=aarch64-linux-gnu-ld AR=aarch64-linux-gnu-ar RANLIB=aarch64-linux-gnu-ranlib OBJDUMP=aarch64-linux-gnu-objdump ./configure --prefix=/home/allen/Work/perl-5.12.3/output --target=arm-linux
4. 編譯
$ make
$ make install
5. 參考來源
http://arsv.github.io/perl-cross/
http://wenku.baidu.com/view/59dc7c33f111f18583d05a6c.html
http://stackoverflow.com/questions/5464538/cross-compile-perl-for-arm
http://www.aliog.com/34757.html
http://arsv.github.io/perl-cross/usage.html

ssh遠端檔案傳輸 - scp

1. scp help
usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
           [-l limit] [-o ssh_option] [-P port] [-S program]
           [[user@]host1:]file1 ... [[user@]host2:]file2
2. 本地主機傳輸至遠端主機
$ scp [本地檔案] [帳號]@[遠端主機]:[遠端目錄]

ex. 
$ scp test.c allen@8.8.8.8:/home/allen
3. 遠端主機傳輸至本地主機
$ scp [帳號]@[遠端主機]:[遠端檔案] [本地目錄]

ex.
$ scp allen@8.8.8.8:/home/allen/test.c .
4. 參考來源 鳥哥的 Linux 私房菜-第十一章、遠端連線伺服器SSH / XDMCP / VNC / RDP

2015年10月28日 星期三

在x86平台交叉編譯perl

1. 下載perl和cross-perl
$ tar -zxvf perl-5.12.3.tar.gz
$ tar -zxvf perl-5.12.3-cross-0.5.tar.gz
2. 修改以下檔案
$ vi configure
$ vi cnf/configure
$ vi cnf/configure__f.sh
$ vi Makefile.config.SH

Modify #!/bin/sh to #!/bin/bash
3. 產生Makefile
$ ./configure --prefix=/home/allen/Work/perl-5.12.3/output
4. 編譯
$ make
$ make install
5. 參考來源
http://arsv.github.io/perl-cross/
http://wenku.baidu.com/view/59dc7c33f111f18583d05a6c.html
http://stackoverflow.com/questions/5464538/cross-compile-perl-for-arm
http://www.aliog.com/34757.html
http://arsv.github.io/perl-cross/usage.html

Memory效能測試工具: Lmbench

1. What is LMbench?
Suite of simple, portable benchmarks
Compares different UNIX systems performance
Free software, covered by the GNU General Public License
2. benchmark
- Bandwidth benchmarks
    Cached file read
    Memory copy (bcopy)
    Memory read
    Memory write
    Pipe
    TCP
- Latency benchmarks
    Context switching.
    Networking: connection establishment, pipe, TCP, UDP, and RPC hot potato
    File system creates and deletes.
    Process creation.
    Signal handling
    System call overhead
    Memory read latency
- Miscellanious
    Processor clock rate calculation
3. Untar the LMbench-3.0-a9.tgz
http://www.bitmover.com/lmbench
$ tar -xvf lmbench-3.0-a9.tgz

$ tree -d
.
│── doc      # document
│── results     # test results
│── scripts     # script for running benchmark
│── src      # source code
4. 編譯lmbench
4.1. Build the benchmark, the executables will appear in a subdirectory of bin
$ make build
4.2. Build and run the benchmark
$ cd lmbench-3.0-a9
$ make results


=====================================================================

                L M B E N C H   C ON F I G U R A T I O N
                ----------------------------------------

You need to configure some parameters to lmbench.  Once you have configured
these parameters, you may do multiple runs by saying

        "make rerun"

in the src subdirectory.

NOTICE: please do not have any other activity on the system if you can
help it.  Things like the second hand on your xclock or X perfmeters
are not so good when benchmarking.  In fact, X is not so good when
benchmarking.

=====================================================================

If you are running on an MP machine and you want to try running
multiple copies of lmbench in parallel, you can specify how many here.

Using this option will make the benchmark run 100x slower (sorry).

NOTE:  WARNING! This feature is experimental and many results are
        known to be incorrect or random!

MULTIPLE COPIES [default 1]:
=====================================================================

Options to control job placement
1) Allow scheduler to place jobs
2) Assign each benchmark process with any attendent child processes
   to its own processor
3) Assign each benchmark process with any attendent child processes
   to its own processor, except that it will be as far as possible
   from other processes
4) Assign each benchmark and attendent processes to their own
   processors
5) Assign each benchmark and attendent processes to their own
   processors, except that they will be as far as possible from
   each other and other processes
6) Custom placement: you assign each benchmark process with attendent
   child processes to processors
7) Custom placement: you assign each benchmark and attendent
   processes to processors

Note: some benchmarks, such as bw_pipe, create attendent child
processes for each benchmark process.  For example, bw_pipe
needs a second process to send data down the pipe to be read
by the benchmark process.  If you have three copies of the
benchmark process running, then you actually have six processes;
three attendent child processes sending data down the pipes and
three benchmark processes reading data and doing the measurements.

Job placement selection [default 1]:
=====================================================================

Hang on, we are calculating your timing granularity.
OK, it looks like you can time stuff down to 5000 usec resolution.

Hang on, we are calculating your timing overhead.
OK, it looks like your gettimeofday() costs 0 usecs.

Hang on, we are calculating your loop overhead.
OK, it looks like your benchmark loop costs 0.00000000 usecs.

=====================================================================

Several benchmarks operate on a range of memory.  This memory should be
sized such that it is at least 4 times as big as the external cache[s]
on your system.   It should be no more than 80% of your physical memory.

The bigger the range, the more accurate the results, but larger sizes
take somewhat longer to run the benchmark.

MB [default 5523]: 1024
Checking to see if you have 1024 MB; please wait for a moment...
1024MB OK
1024MB OK
1024MB OK
Hang on, we are calculating your cache line size.
OK, it looks like your cache line is  bytes.

=====================================================================

lmbench measures a wide variety of system performance, and the full suite
of benchmarks can take a long time on some platforms.  Consequently, we
offer the capability to run only predefined subsets of benchmarks, one
for operating system specific benchmarks and one for hardware specific
benchmarks.  We also offer the option of running only selected benchmarks
which is useful during operating system development.

Please remember that if you intend to publish the results you either need
to do a full run or one of the predefined OS or hardware subsets.

SUBSET (ALL|HARWARE|OS|DEVELOPMENT) [default all]:
=====================================================================

This benchmark measures, by default, memory latency for a number of
different strides.  That can take a long time and is most useful if you
are trying to figure out your cache line size or if your cache line size
is greater than 128 bytes.

If you are planning on sending in these results, please don't do a fast
run.

Answering yes means that we measure memory latency with a 128 byte stride.

FASTMEM [default no]:
=====================================================================

This benchmark measures, by default, file system latency.  That can
take a long time on systems with old style file systems (i.e., UFS,
FFS, etc.).  Linux' ext2fs and Sun's tmpfs are fast enough that this
test is not painful.

If you are planning on sending in these results, please don't do a fast
run.

If you want to skip the file system latency tests, answer "yes" below.

SLOWFS [default no]:
=====================================================================

This benchmark can measure disk zone bandwidths and seek times.  These can
be turned into whizzy graphs that pretty much tell you everything you might
need to know about the performance of your disk.

This takes a while and requires read access to a disk drive.
Write is not measured, see disk.c to see how if you want to do so.

If you want to skip the disk tests, hit return below.

If you want to include disk tests, then specify the path to the disk
device, such as /dev/sda.  For each disk that is readable, you'll be
prompted for a one line description of the drive, i.e.,

        Iomega IDE ZIP
or
        HP C3725S 2GB on 10MB/sec NCR SCSI bus

DISKS [default none]:
=====================================================================

If you are running on an idle network and there are other, identically
configured systems, on the same wire (no gateway between you and them),
and you have rsh access to them, then you should run the network part
of the benchmarks to them.  Please specify any such systems as a space
separated list such as: ether-host fddi-host hippi-host.

REMOTE [default none]:
=====================================================================

Calculating mhz, please wait for a moment...
I think your CPU mhz is

        3990 MHz, 0.2506 nanosec clock

but I am frequently wrong.  If that is the wrong Mhz, type in your
best guess as to your processor speed.  It doesn't have to be exact,
but if you know it is around 800, say 800.

Please note that some processors, such as the P4, have a core which
is double-clocked, so on those processors the reported clock speed
will be roughly double the advertised clock rate.  For example, a
1.8GHz P4 may be reported as a 3592MHz processor.

Processor mhz [default 3990 MHz, 0.2506 nanosec clock]:
=====================================================================

We need a place to store a 1024 Mbyte file as well as create and delete a
large number of small files.  We default to /usr/tmp.  If /usr/tmp is a
memory resident file system (i.e., tmpfs), pick a different place.
Please specify a directory that has enough space and is a local file
system.

FSDIR [default /var/tmp]:
=====================================================================

lmbench outputs status information as it runs various benchmarks.
By default this output is sent to /dev/tty, but you may redirect
it to any file you wish (such as /dev/null...).

Status output file [default /dev/tty]:
=====================================================================

There is a database of benchmark results that is shipped with new
releases of lmbench.  Your results can be included in the database
if you wish.  The more results the better, especially if they include
remote networking.  If your results are interesting, i.e., for a new
fast box, they may be made available on the lmbench web page, which is

        http://www.bitmover.com/lmbench

Mail results [default yes]: no
OK, no results mailed.
=====================================================================

Confguration done, thanks.

There is a mailing list for discussing lmbench hosted at BitMover.
Send mail to majordomo@bitmover.com to join the list.


$ tree -d
.
│── bin      # Binary file
│   │── x86_64-linux-gnu
│── doc
│── results
│   │── HTML
│   │── PS
│   │── tmp
│   │── x86_64-linux-gnu
│── scripts
│── src
    │── webpage-lm
        │── gifs
        │── pictures
4.3. Run the benchmark again
$ make rerun
4.4. Generate PostScript file
The PostScript file will appear in a subdirectory of lmbench-3.0-a9/results/PS, and you can generate the test results.
$ cd results && make ps
5. Cross cmpiler
$ make OS=arm-linux-gnu CC=arm-none-linux-gnueabi-gcc result
6. 參考來源
http://www.bitmover.com/lmbench/why_lmbench.html
http://blog.hushlight.com/2014/04/lmbench-linux-benchmark-test/
http://blog.csdn.net/dianhuiren/article/details/7331777
http://processors.wiki.ti.com/index.php/Lmbench

repo教學

https://source.android.com/source/using-repo.html

2015年10月26日 星期一

Ubuntu安裝ia32-libs

1. 有時候會遇到Ubuntu上需要32位元的Library,可以透過apt-get來安裝ia32-libs
$ sudo -i
$ cd /etc/apt/sources.list.d
$ echo "deb http://old-releases.ubuntu.com/ubuntu/ raring main restricted universe multiverse" >ia32-libs-raring.list
$ apt-get update
$ apt-get install ia32-libs
2. 參考來源
http://stackoverflow.com/questions/23182765/how-to-install-ia32-libs-in-ubuntu-14-04-lts-trusty-tahr