2005年11月9日

Install Ser SIP server

Files needed:
ser-0.9.4_src.tar.gz
mysqld/mysqladmin
phpMyAdmin-2.6.4-pl3.tar.bz2

1. Compilation
# tar zxvf ser-0.9.4_src.tar.gz
# cd ser-0.9.4
# make
# make modules
# make install
// The default installed path is /usr/local/sbin.
// The configuration file will be placed under /usr/local/etc/ser.

2. Activate Ser service
# cp ser-0.9.4/rpm/ser.ini /etc/init.d/ser
# chkconfig ser reset
# chkconfig ser on
# service ser start

3. Activate and Configure MySQL
# chkconfig mysqld on
# service mysqld start
// Setup password for MySQL. (root/root)
# mysqladmin –u root password root
//Setup Ser database in MySQL:
# /usr/sbin/ser_mysql.sh create

4. Install phpMyAdmin to manage MySQL:
# tar jxvf phpMyAdmin-2.6.4-pl3.tar.bz2
# vi /etc/httpd/conf/httpd.conf
// Alias /php /home/phpMyAdmin-2.6.4-pl3
// Run http://IP-Address/php and use phpMyAdmin to modify permission and password of Ser service.

5. Add SIP users
# export SIP_DOMAIN=”porter10.mydomain.intra” serctl add
# /usr/local/sbin/serctl add 230 230 230@192.168.1.1
# /usr/local/sbin/serctl add 232 232 232@192.168.1.1

2005年9月26日

Booting from CF card

Using CF card or micro hardisk to construct a simple embedded system:

1. Format CF card (The CF card is connected to Slave IDE-1.)
# fdisk /dev/hdc
// d 1 (Delete the partition)→ n (Create a new partition)→ w (Confirm the change and store the setting.)
# mke2fs /dev/hdc1 (Do Ext2 format) or
# mke2fs –j /dev/hdc1 (Do Ext3 format) or
# mkfs.ext3 /dev/hdc1 (Do Ext3 format)

2. Create new directories and files
# cd /mnt
# mkdir CF
# mount –t ext2 /dev/hdc1 CF
# mkdir CF/boot
# mkdir CF/boot/grub
# cp /boot/grub/* CF/boot/grub/
// Copy all grub relevance files to CF card.

3. Modify grub.conf and menu.lst
{
default=0
timeout=10
#splashimage=(hd0,0)/grub/splash.xpm.gz
title Embedded Linux On CF
root (hd0,0)
kernel (hd0,0)/boot/vmlinuz ro root=/dev/hdc1
#CF card is on Slave IDE,thus the root is /dev/hdc1.
initrd (hd0,0)/boot/initrd-new.img
}

4. Construct boot sector on CF card
# grub > root (hd1,0)
// Since the CF card is not current bootup hard disk, thus the parameter here is hd1, not hd0
// The fist is hd0, 2nd is hd1, ....
# grub > setup (hd1)
// Install grub to CF card.
# grub > quit

5. Create kernel image.
The CF card is on the same x86 machine, thus we can use the original vmlinuz image which is under /boot directory.

6. Create root file system.
The CF card is on the same x86 machine, thus we can use the original initrd image which is under /boot directory.

2005年5月5日

Build ARM ToolChain - II

Do the same building test with some updated sources.

Files needed:
binutils-2.14.tar.gz
gcc-3.2.1.tar.gz
glibc-2.2.3.tar.gz
glibc-linuxthreaders-2.2.3.tar.gz

1. Binutils
// Same with Compilation - I.

2. Bootstrap compiler GCC
#cd ${PROJECT-PATH}/build-tools/
#tar zxvf gcc-3.2.1.tar.gz
#cd ${PROJECT-PATH}/build-tools/build-boot-gcc
// Do not do the compilation under the original untar directory.
#../gcc-3.2.1/configure --target=arm-linux --prefix=${PROJECT-PATH}/tools --with-headers=/usr/include --with-newlib --enable-languages=c --disable-shared
// The gcc 3.2.1 won't be created successfully without the flag "--disable-shared" for configuring.
// Headers for "--with-headers" actually should be generated by glibc building first.

3. Glibc
#cd ${PROJECT-PATH}/build-tools/
#tar zxvf glibc-2.2.3.tar.gz
#tar -zxvf glibc-linuxthreaders-2.2.3.tar.gz \ > --directory=glibc-2.2.3
#cd ${PROJECT-PATH}/build-tools/build-glibc/
// Do not do the compilation under the original untar directory.
#CC=arm-linux-gcc ../glibc-2.2.3/configure --host=arm-linux --prefix=”/usr” --enable-add-ons --with-headers=${PROJECT-PATH}/tools/arm-linux/include –-disable-profile –-without-fp
#make
// If errors on "weak precede definition" are found, we can modify the execution order of:
// ${PROJECT-PATH}/build-tools/glibc-2.2.3/sysdeps/unix/sysv/linux/arm/errlst.c (42L)
// 1. weak_alias (__old_sys_nerr, _old_sys_nerr)
// 2. strong_alias (__old_sys_nerr, _old_sys_nerr);
// 3. /*weak_alias (__old_sys_nerr, _old_sys_nerr)*/
#make install_root=${PROJECT-PATH}/tools/arm-linux \ > prefix=”” install
// If the following errors are found:
// ./stdio.texi:3269: First argument to cross-reference may not be empty.
// ./stdio.texi:3270: First argument to cross-reference may not be empty.
// Directly modify build-tools/glibc-2.2.3/manual/stdio.texi, and remove @ref{} to pass the compilation.
// Then several libraries will be generated under tools/arm-linux/lib.
// Modify ${PROJECT-PATH}/tools/arm-linux/lib/libc.so to remove absolute path, GROUP( libc.so.6 libc_nonshared.a )

4. GCC Compiler
#cd ${PROJECT-PATH}/build-tools/build-gcc/
// Do not do the compilation under the original untar directory.
#../gcc-3.2.1/configure --target=arm-linux --prefix=${PROJECT-PATH}/tools --enable-languages=c,c++ --with-headers=${PROJECT-PATH}/tools/arm-linux/include --with-libs=${PROJECT-PATH}/tools/lib --with-float=soft --enable-threads
#make all
#make install

I cannot build KS8695P-2.4.16-rmk2 kernel successfully with my arm-linux-gcc v3.2.1 tool, and will suffer hardware fp and software fp compiling errors. Didn't solve the issue yet, maybe the kernel source is too old, should have a try on 2.4.18 later version.

2005年4月29日

Build ARM ToolChain - I (Cont.)

4. GCC compiler
# cd ${PROJECT-PATH}/build-tools/build-gcc/
// Do not do the compilation under the original untar directory
// ../gcc-2.95.3/configure --target=arm-linux \
// --prefix=${PROJECT-PATH}/tools \
// --enable-languages=c,c++
// make all
// If there is no --with-headers and --with-libs flags, the compilation will be failed.
#../gcc-2.95.3/configure --target=arm-linux --prefix=${PROJECT-PATH}/tools --enable-languages=c,c++ --with-headers=${PROJECT-PATH}/tools/arm-linux/include --with-libs=${PROJECT-PATH}/tools/lib --with-float=soft --enable-threads
#make all
#make install
// Then, arm-linux-g++, arm-linux-c++, etc. will be created under tools/bin/ and overwrite previous bootstrap compiler binaries.

5. uClibc
// We need uClibc for our target, an embedded device.
#cd ${PROJECT-PATH}/build-tools/
#tar jxvf uClibc-0.9.16.tar.bz2
#cd ${PROJECT-PATH}/build-tools/uClibc-0.9.16
#make CROSS=arm-linux- menuconfig
// Configure the menu:
// Linux kernel header location = “${PROJECT-PATH}/kernel/linux-2.4.16-rmk2”
// Shared library loader path = /lib
// uClibc development environment directory = “${PROJECT-PATH}/tools/uClibc”
// Have to check FPU option, otherwise the compilation will complain symbolic errors.
#make CROSS=arm-linux-
#make CROSS=arm-linux- PREFIX=”” install
// Finally, uClibc components will be installed to ${PROJECT-PATH}/tools/uclibc.
// And arm-uclibc-gcc will be created as well.

Those new arm-uclibc-XXX, not arm-linux-XXX, binaries are what we needed for our embedded target. Those wrappers will help our applications to be built and linked with uClibc.

Build ARM ToolChain - I

Following building instructions described in "Building Embedded Linux Systems" book, I had built a ARM toolchain for my private KS8695P platform for testing purpose.

Files needed:
binutils-2.10.1.tar.gz
gcc-2.95.3.tar.gz
glibc-2.2.3.tar.gz
glibc-linuxthreaders-2.2.3.tar.gz
uClibc-0.9.16

Make a new directory “${PROJECT-PATH}/build-tools” to store new toolchains, and new directories build-binutils, build-boot-gcc, build-glibc, and build-uClibc under build-tools/ directory to store new compiled tools, and for those new binary tools and libraries will be installed to tools/ and tools/arm-linux/ directory. The following steps are showing how to compile each tool for my target(KS8695P Board).
(In my experimental machine, ${PROJECT-PATH}= /home/porter/projects/ks8695p/myself-2.4.16-2.95.3/)

1. Binutils
// Include all needed header files provided by KS8695P vendor.
#mkdir ${PROJECT-PATH}/tools/arm-linux/include
#cp –r {kernel}/include/linux/ arm-linux/include
#cp –r {kernel}/include/asm-arm/ arm-linux/include/asm
#cp –r {kernel}/include/asm-generic arm-linux/include
#cd ${PROJECT-PATH}/buld-tools/
#tar zxvf binutils-2.10.1.tar.gz
#cd ${PROJECT-PATH}/build-tools/build-binutils
// Do not do the compilation under the original untar directory.
#../binutils-2.10.1/configure --target=arm-linux --prefix=${PROJECT-PATH}/tools
// Using absolute path for --prefix argument.
#make
#make install
// All binary utilities will be installed to tools/ directory, and we will have arm-linux-addrline、arm-linux-ar、arm-linux-as, etc. under tools/bin/ directory.

2. Bootstrap compiler GCC
#cd ${PROJECT-PATH}/build-tools/
#tar zxvf gcc-2.95.3.tar.gz
#cd ${PROJECT-PATH}/build-tools/build-boot-gcc
//
Do not do the compilation under the original untar directory.
#../gcc-2.95.3/configure --target=arm-linux --prefix=${PROJECT-PATH}/tools --without-headers --with-newlib --enable-languages=c
// To prevent compiling error, "can't find pthread.h", we can change the flag from "--without-headers" to "--with-headers=/usr/include".
#make all-gcc
#make install-gcc
// Under tools/bin, one new arm-linux-gcc tool will be generated.

3. Glibc
#cd ${PROJECT-PATH}/build-tools/
#tar zxvf glibc-2.2.3.tar.gz
#tar zxvf glibc-linuxthreaders-2.2.3.tar.gz –-directory=glibc-2.2.3
#cd ${PROJECT-PATH}/build-tools/build-glibc
//
Do not do the compilation under the original untar directory.
#CC=arm-linux-gcc ../glibc-2.2.3/configure --host=arm-linux --prefix=”/usr” --enable-add-ons --with-headers=${PROJECT-PATH}/tools/arm-linux/include
// Add --disable-profile argument to not use statistics library.
// Add --enable-add-ons=linuxthreads due to we only use
linuxthreads addon.
// Add --without-fp for targets without FPU support.
// Here, the flag, --prefix="/usr", actually is used to pass configuring, we won't install the lib to /usr.
#make
#make install_root=${PROJECT-PATH}/tools/arm-linux prefix=”” install
// Install libraries and headers to "install_root" directory, not the previsous defined "--prefix".
// If the following errors found:
// ./stdio.texi:3270: Cross reference to nonexistent node `bison.info'.
// ./stdio.texi:3269: Cross reference to nonexistent node `flex.info'.
// makeinfo: Removing output file `${PROJECT-PATH}/build-tools/glibc-2.2.3/manual/
// libc.info' due to errors; use --force to preserve.
// Directly modify build-tools/glibc-2.2.3/manual/stdio.texi, and remove @ref{*} to pass the compilation.
// Then several libraries will be created under tools/arm-linux/lib.
// Besides, modify ${PROJECT-PATH}/tools/arm-linux/lib/libc.so, remove the absolute path "/lib/" for our taret platform, GROUP( libc.so.6 libc_nonshared.a ).

To be continued...

2005年4月28日

Useful configurations in Apache

1. Being able to display Chinese characters
# vi /etc/httpd/conf/httpd.conf
// Modify [AddDefaultCharset ISO-8895-1] to [AddDefaultCharset null], let browser to decide which character encoding to use.
// or to [AddDefaultCharset big5], only for Chinese Big-5.

2. Prohibit to list/browse directory
# vi /etc/httpd/conf/httpd.conf
// Find , remove "Indexes".