2011年7月26日 星期二

QEMU

Note: It seems to me that only some combinations of versions of qemu and linux/defconfig would work. Changing any of them is tends to fail.

CodeSourcery G++ lite arm-2009q1 toolchain is used to build target image.

Installation
apt-get install qemu qemu-kvm-extras kvm-pxe

The qemu-system-arm installed by Ubuntu 10.04 (qemu_0.12.3+noroms-0ubuntu9.16_i386, qemu-kvm-extras_0.12.3+noroms-0ubuntu9.16_i386) always require memory option, e.g. "-m 128M".

*The qemu-system-arm installed by Ubuntu 10.04 (qemu_0.12.3+noroms-0ubuntu9.16_i386, qemu-kvm-extras_0.12.3+noroms-0ubuntu9.16_i386) doesn't work even on qemu ARM disk image (arm-test-0.2.tar.gz). But it works on other images(e.g. 2.6.33 versatilepb image), reason unknown.

# qemu-system-arm -kernel zImage.integrator -initrd arm_root.img -nographic
qemu: hardware error: pl011_read: Bad offset 16000018

CPU #0:
R00=00000055 R01=2d02ef8d R02=16000000 R03=ffffffff
R04=00000055 R05=00013149 R06=41069265 R07=00000113
R08=00000100 R09=00000000 R10=00127d9c R11=0013120c
R12=00131210 R13=00131200 R14=00010954 R15=000105f0
PSR=200001d3 --C- A svc32
Aborted


It can be fixed by rebuild a new qemu (still 0.12.3), but loss the auto VNC connected window. I had to open a VNC client manually....


The above issue fixed by:
qemu-system-arm segmentation fault in Ubuntu Lucid « Balau
http://balau82.wordpress.com/2010/05/23/qemu-system-arm-segmentation-fault-in-ubuntu-lucid/
adding the memory option “-m 128M”


pci_add_option_rom: failed to find romfile “pxe-rtl8139.bin”
http://www.moe.co.uk/2011/01/07/pci_add_option_rom-failed-to-find-romfile-pxe-rtl8139-bin/
apt-get install kvm-pxe


Ubuntu -- Details of package kvm-pxe in lucid
http://packages.ubuntu.com/lucid/kvm-pxe
Etherboot is a free software package for making boot ROMS for booting Linux and other operating systems on x86 PCs over a network using Internet Protocols, i.e. bootp/DHCP and tftp.

This package contains PXE ROM's made especially to pxeboot kvm vm's.

kvm-pxe isn't really needed, but just to remove the error message.

Building Qemu from source
git clone git://git.debian.org/git/pkg-qemu/qemu.git
git clone git://git.qemu.org/qemu.git

Qemu stuff will be installed to ${DESTDIR}/${prefix}.
Default prefix is /usr/local, DESTDIR is "".

./configure --target-list=arm-linux-user
./configure --target-list=arm-linux-user,arm-softmmu
./configure --target-list=arm-linux-user,arm-softmmu --prefix=/usr

make

make install
make install DESTDIR=$(pwd)/target

I have only build v0.12.1 successfully on Ubuntu 10.04....
Error: zlib check failed
Make sure to have the zlib libs and headers installed.

FIX: apt-get install zlib1g-dev

Error: Building qemu v0.13.0..v0.14.1 on Ubuntu 10.04 failed
Not fixed yet.

Error: Building qemu v0.15.0..v1.0-rc4 on Ubuntu 10.04 failed
Even after all the required package is installed:
apt-get install libxen3 libxen3-dev libcurl3-dbg libxen3 libxen3-dev libbluetooth-dev libgnutls-dev check libcurl4-gnutls-dev libbrlapi-dev libvdeplug2-dev xfslibs-dev libpng12-dev libjpeg62-dev

But configuring qemu still failed with some strange compile error...
Not fixed yet.

(not verified) Ubuntu 11.10 can build v1.0-rc0.

User Mode Emulation
SYSROOT=/path/to/your/sysroot
qemu-arm -L ${SYSROOT} ${SYSROOT}/usr/bin/flex -V;

mkdir /etc/qemu-binfmt -p && rm /etc/qemu-binfmt/arm && ln -s ${SYSROOT} /etc/qemu-binfmt/arm;

# qemu-arm ${SYSROOT}/usr/bin/flex -V;
flex 2.5.35
# qemu-arm ${SYSROOT}/bin/gcc /test.c -o /test
gcc: error trying to exec '/tools/arm-2009q1/arm-none-linux-gnueabi/libc/bin/../libexec/gcc/arm-none-linux-gnueabi/4.3.3/cc1': execv: Exec format error


Prebuilt image
QEMU - Download
http://wiki.qemu.org/Download
(Provide Releases, Latest Source Code, QEMU disk images, QEMU Linux user mode emulation tests for basic testing)

ARM disk image arm-test-0.2.tar.gz
http://wiki.qemu.org/download/arm-test-0.2.tar.gz
Refer to the README in the tarball. Cannot work with Ubuntu 10.04 installed qemu, but work with a newly built qemu.

Debian images of various CPU for QEMU
http://people.debian.org/~aurel32/qemu/

Linux Support for the ARM Architecture - ARM
http://www.arm.com/community/software-enablement/linux.php
(in tab "Linux OS Downloads", section "Pre-built Kernel Images")
(has no luck trying any of those images)

Build images from source
(not verified) 2.6.35+qemu v1.0-rc0+(config?) will work...
-M realview-pb-a8 --cpu cortex-a8 -m 512M -kernel zImage -initrd ramdisk.img.gz -nographic --append "root=/dev/ram0 rw init=/linuxrc mem=512M console=ttyAMA0 debug" -net nic -net tap,ifname=tap0,script=no

mkl Note: [QEMU] Running Linux 2.6.33 ARM versatilepb
http://mkl-note.blogspot.com/2012/01/qemu-running-linux-2633-arm-versatilepb.html


Computer emulation

without network
./qemu-system-arm -M vexpress-a9 --cpu cortex-a9 -m 512M -kernel /path/to/zImage -initrd /path/to/ramdisk.img.gz -nographic --append "root=/dev/ram0 rw init=/linuxrc mem=512M console=ttyAMA0 debug"

with network
./qemu-system-arm -M vexpress-a9 --cpu cortex-a9 -m 512M -kernel /path/to/zImage -initrd /path/to/ramdisk.img.gz -nographic --append "root=/dev/ram0 rw init=/linuxrc mem=512M console=ttyAMA0 debug" -net nic -net tap,ifname=tap0,script=no


Setup network in HOST system
tunctl
tunctl -d tap0
ifconfig tap0 up
brctl addif br0 tap0
brctl delif br0 tap0


Documentation/Networking - QEMU
http://wiki.qemu.org/Documentation/Networking
You can also use -net nic,model=? to get a list of valid network devices that you can pass to the -net nic option. [If you'd like to know all of the virtual network devices that are currently provided in QEMU, a search for "NetClientInfo" in the source code may be useful.]

Ubuntu qumu 0.12.3
qemu: Supported NIC models: ne2k_pci,i82551,i82557b,i82559er,rtl8139,e1000,pcnet,virtio



QEMU/Networking
http://en.wikibooks.org/wiki/QEMU/Networking

[wiki] QEMU
http://en.wikipedia.org/wiki/QEMU

QEMU - Debian Wiki
http://wiki.debian.org/QEMU

Compiling Linux kernel for QEMU ARM emulator
http://balau82.wordpress.com/2010/03/22/compiling-linux-kernel-for-qemu-arm-emulator/

Debian ARM Linux on Qemu
http://909ers.apl.washington.edu/~dushaw/ARM/

Running Linux for ARM processors under QEMU
http://iomem.com/archives/2-Running-Linux-for-ARM-processors-under-QEMU.html

How To: Running Fedora-ARM under QEMU
http://fedoraproject.org/wiki/Architectures/ARM/HowToQemu

User Mode Emulation
http://qemu-buch.de/cgi-bin/moin.cgi/UserModeEmulation

Debugging non-native programs with QEMU + GDB
http://tinkering-is-fun.blogspot.com/2009/12/debugging-non-native-programs-with-qemu.html

Running ARM Linux on your desktop PC: The foreign chroot way
http://tinkering-is-fun.blogspot.com/2009/12/running-arm-linux-on-your-desktop-pc_12.html

Running ARM Linux on your desktop PC: The foreign chroot way (Debian)
http://tinkering-is-fun.blogspot.com/2009/12/running-arm-linux-on-your-desktop-pc_12.html

2011年7月23日 星期六

Linux kernel from 0.0.1 to 3.0

Here's a unified kernel git repo covering 0.0.1 to the present.
http://www.spinics.net/lists/kernel/msg1216887.html

Ever done a "git annotate" that stops at 2.6.12-rc2, and wanted to see the full history? Here's an repository that goes all the way back to 0.0.1 (through bitkeeper and all those old tarballs), which otherwise works as normal (git pull updates it from Linus's tree, you can commit
to it and branch from it, etc)

Here's the tarball:
http://www.kernel.org/pub/linux/kernel/people/landley/linux-fullhist.tar.bz2

To install it:

1) Download, extract, cd into the directory.
2) git checkout -f
3) git pull

Then use as normal.

This is based on the work of http://padator.org/linux.php with some trivial cleanups.

2011年7月19日 星期二

kernbench

kernbench
http://freshmeat.net/projects/kernbench/

kernbench is a CPU throughput benchmark. It is designed to compare kernels on the same machine, or to compare hardware. It runs a kernel compile at various numbers of concurrent jobs: 1/2 number of CPUs, optimal (default is 4xnumber of CPUs), and maximal job count. Optionally it can also run single threaded. It then prints out a number of useful statistics for the average of each group of runs.


Kernbench Review
http://www.obsecurities.com/reviews/8-kernbench-review

Index of /kernbench
http://ck.kolivas.org/kernbench/

Index of /pub/linux/kernel/people/ck/apps/kernbench
http://www.kernel.org/pub/linux/kernel/people/ck/apps/kernbench/

2011年7月7日 星期四

Disable auto gc

git-gc(1) Manual Page
http://www.kernel.org/pub/software/scm/git/docs/git-gc.html

git config --global gc.auto 0

2011年7月6日 星期三

warning: `X' uses 32-bit capabilities (legacy support in use)

warning: `proftpd' uses 32-bit capabilities (legacy support in use)
http://forums.proftpd.org/smf/index.php?topic=3401.0

It looks like the warning:

warning: `proftpd' uses 32-bit capabilities (legacy support in use)

is coming from the use of the libcap library. A newer version of the libcap library (called the "libcap2-dev" package on some Linux distributions) is now available.

To remove the above warning, you will need to update/install the newer libcap2 package on your system, and re-build proftpd (using version 1.3.2rc1 or later) in order to compile and link against the newer libcap library.


#464712 - bump shlibs to >= 2.10 - Debian Bug report logs
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=464712

vsftpd+TLS

Add the following lines to vsftpd.conf:



ssl_enable=YES
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO

allow_anon_ssl=YES
force_local_data_ssl=NO
force_local_logins_ssl=NO

rsa_cert_file=/path/to/your/certificate
rsa_private_key_file=/path/to/your/private/key



/usr/local/ssl/bin/openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout /etc/vsftpd.pem -out /etc/vsftpd.pem





技術 - vsftpd+TLS 實現安全FTP資料傳輸
http://forum.slime.com.tw/thread191637.html

Configuring vsftpd for secure connections (TLS/SSL/SFTP)
http://wiki.vpslink.com/Configuring_vsftpd_for_secure_connections_%28TLS/SSL/SFTP%29

Vsftpd SSL / TLS FTP Server Configuration
http://www.cyberciti.biz/tips/configure-vsfptd-secure-connections-via-ssl-tls.html

Manpage of VSFTPD.CONF
http://vsftpd.beasts.org/vsftpd_conf.html

Chapter 14 - FTP Server
http://www.brennan.id.au/14-FTP_Server.html

土地面積換算

土地面積換算
http://www.southnews.com.tw/snews_entrace/%E5%9C%9F%E5%9C%B0%E9%9D%A2%E7%A9%8D%E6%8F%9B%E7%AE%97.htm

地籍測量常用面積單位換算:
1平方公尺 = 0.3025坪
1坪 = 3.3058平方公尺
1公頃 = 10000平方公尺 = 3025坪 = 1.03102甲
1甲 = 10分 = 2934坪 = 0.96992公頃
1平方公里 = 100公頃

2011年7月4日 星期一

Page size

Large pages, large blocks, and large problems
http://lwn.net/Articles/250335/

CS 1550 Second Midterm Exam
ftp://cs.pitt.edu/courses/1550/solutions/exam2-spring05.pdf

What are some advantages and disadvantages of increasing the page size of a system that uses
paged virtual memory?
Advantage:
Less page faults
Smaller page tables
Disadvantage:
Larger page size, more fragment
Longer disk transfer
More page fault if no locality


Multiple Page Size Support
http://www.solarisinternals.com/wiki/index.php/Multiple_Page_Size_Support

Practical, transparent operating system support for superpages
http://www.cs.uah.edu/~weisskop/Notes690/A16_MemMgt-SuperPages.ppt