Showing posts with label embedded. Show all posts
Showing posts with label embedded. Show all posts

Thursday, July 2, 2015

Run Pidora on Raspberry Pi Model B+

Inroduction

Pidora is a Fedora Remix optimized for the Raspberry Pi computer. So, it is a good candidate choice for implementation if you are familiar with Fedora.
Here, I present the installation steps of installing Pidora 20 on Raspberry Pi Model B+ board. All the preparing works are done on Fedora 20.


Download image file

http://pidora.ca/pidora/releases/20/images/Pidora-2014-R3.zip


Write image file to SD card

dd (convert and copy a file) is a command-line utility for Unix/Linux, I use dd to write Pidora-2014-R3.img file to SD card.

# unzip Pidora-2014-R3.zip (uncompress to Pidora-2014-R3.img)
# dd if=Pidora-2014-R3.img of=/dev/sdb bs=4M (The SD card is at /dev/sdb)

On Windows, you can write image file by Win32 Disk Image.

After the dd command has done, remove the SD card and plug into socket, again. It would be mounted at 2 path:
/run/media/{user}/BOOT
/run/media/{user}/rootfs



Extra works

The default running job is display X window on TV/Monitor via HDMI interface, and the default network is using dynamic IP address. If you want to run it on console mode with static IP address, there is some extra work that you should do.

# vi /run/media/{user}/BOOT/headless
IPADDR=192.168.1.19         # the static IP address
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
RESIZE         # extend the SD card size to its real size
SWAP=512

# vi /run/media/{user}/rootfs/etc/sysconfig/network-scripts/ifcfg-Wired_connection_1
TYPE=Ethernet
BOOTPROTO=none
IPADDR0=192.168.1.19    # the static IP address
PREFIX0=24
GATEWAY0=192.168.1.1
DNS1=168.95.1.1
DNS2=168.95.192.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME="Wired connection 1"
UUID=b2df4348-a75e-4e80-ab3f-470154e1fc8c
ONBOOT=yes


Install/Update application packages

Some of my works is done by python with serial communication, therefore, I have to install some packages:


# yum update
# yum install python-setuptools
# yum install python-pip
# easy_install pyerial   <== serial communication package
# yum install python-devel
# yum install libxml2 libxslt
# yum install libxslt-devel
# pip install RPi.GPIO   <== GPIO control package
# pip install cython
# reboot


Conclusion

Except the write image to SD card process and disk partition policy is different from Fedora on PC, other works are same as you work on Fedora environment.


Reference

Pidroa official site
Win32 Disk Image

Sunday, November 4, 2012

USB camera and image processing + image analysis

    The experience of developing an USB camera and the demo program is an exciting activities. Here I show that I have done for it.



    After the decision of chipset solution, functions, and components size, I began to design the circuit schematics.


    One of the components is the development board, all my development and test are done by this development board.


    Finally, the finished USB camera.


    After I had made the USB camera work, the next step is to develop a demo program. You can download it, CameraCaptureDemo.




    Special functions for Wizign's USB camera: external/software triggering one shot mode capture.



Wednesday, November 26, 2008

Mounting File system - Porting Linux kernel 2.6.25 (Android version) to SAMSUNG S3C2440A

  Previous time, when linux kernel run at:

Freeing init memory: 140K

the system is halted, after some test, I find that it is the problem of cross-compiled gcc.

  The ARM core of SAMSUNG S3C2440A is ARM920T, therefore, I rebuild the cross-compiled gcc of generic arm with little endian version, the problem has fixed.

The success process of booting linux:


Starting kernel ...

Uncompressing Linux........................................................................................................... done, booting the kernel.
Linux version 2.6.25 (armdev@test.intra.wizign.com) (gcc version 4.1.2) #3 Tue Nov 25 01:55:06 CST 2008
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
Machine: SBZ2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C244X: core 399.651 MHz, memory 133.217 MHz, peripheral 66.608 MHz
S3C24XX Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (2.116 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 16256
Kernel command line: root=/dev/nfs rw noinitrd console=ttySAC0,115200 init=/linuxrc nfsroot=192.168.1.12:/vdisk/armdev_fs ip=192.168.1.30:192.168.1.12:1
92.168.1.1:255.255.255.0:android:eth0:off
irq: clearing pending ext status 00000080
irq: clearing subpending status 00000003
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
timer tcon=00500000, tcnt d8d2, tcfg 00000200,00000000, usec 0000170f
Console: colour dummy device 80x30
console [ttySAC0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 64MB = 64MB total
Memory: 61184KB available (3040K code, 507K data, 140K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
net_namespace: 152 bytes
NET: Registered protocol family 16
S3C2410 Power Management, (c) 2004 Simtec Electronics
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4800000, irq 33
DMA channel 1 at c4800040, irq 34
DMA channel 2 at c4800080, irq 35
DMA channel 3 at c48000c0, irq 36
S3C244X: Clock Support, DVS off
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
fuse init (API version 7.9)
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler deadline registered
io scheduler cfq registered
Console: switching to colour frame buffer device 30x40
fb0: s3c2410fb frame buffer device
lp: driver loaded but no devices found
ppdev: user-space parallel port driver
Serial: 8250/16550 driver $Revision: 1.90 $ 4 ports, IRQ sharing enabled
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
loop: module loaded
dm9000 Ethernet Driver, V1.30
eth0: dm9000 at c485e300,c4860304 IRQ 51 MAC: 08:00:3e:26:0a:5b (chip)
Uniform Multi-Platform E-IDE driver
ide: Assuming 50MHz system bus speed for PIO modes; override with idebus=xx
BAST NOR-Flash Driver, (c) 2004 Simtec Electronics
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=1, 7ns Twrph0=4 30ns, Twrph1=1 7ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks
Creating 2 MTD partitions on "NAND 64MiB 3,3V 8-bit":
0x00000000-0x00200000 : "Kernel"
0x00200000-0x04000000 : "root partition"
usbmon: debugfs is not available
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
mice: PS/2 mouse device common for all mice
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 378 KHz
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
logger: created 64K log 'log_main'
logger: created 64K log 'log_events'
logger: created 64K log 'log_radio'
TCP cubic registered
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
eth0: link up, 100Mbps, full-duplex, lpa 0x45E1
IP-Config: Complete:
device=eth0, addr=192.168.1.30, mask=255.255.255.0, gw=192.168.1.1,
host=android, domain=, nis-domain=(none),
bootserver=192.168.1.12, rootserver=192.168.1.12, rootpath=
Looking up port of RPC 100003/2 on 192.168.1.12
Looking up port of RPC 100005/1 on 192.168.1.12
VFS: Mounted root (nfs filesystem).
Freeing init memory: 140K
--------mount /proc as proc
--------mount /sys as sysfs
init started: BusyBox v1.12.1 (2008-11-25 00:32:40 CST)
starting pid 777, tty '': '/etc/rc.d/startup'
mkdir: cannot create directory '/dev/pts': File exists
mkdir: cannot create directory '/dev/shm': File exists
--------start mdev
--------mount tmpfs
OK
--------mount devpts
mount: mounting devpts on /dev/pts failed: No such file or directory
FAIL
Setting system clock: hwclock: can't open '/dev/misc/rtc': No such file or directory
FAIL
Setting hostname: OK
Cleaning up system: OK
Setting up interface lo: OK
Running start scripts.
Starting syslogd: syslogd: invalid number '80kb'
FAIL
Starting klogd: OK
Setting up interface eth0: OK
starting pid 800, tty '': '-/bin/login'
android login: root
ash: id -u: bad number
# uname -a
Linux android 2.6.25 #3 Tue Nov 25 01:55:06 CST 2008 armv4tl unknown
# hostname
android

Thursday, October 30, 2008

Build Cross-Compiled gcc for ARM by myself

This work is done by studying Cross-Compiled Linux From Scratch - Embedded (Version SVN-0.0.1-20080109-arm) material, The steps of building cross compiled gcc for ARM:

[Adding the ARMDEV User]

$ su -
# groupadd armdev
# useradd -s /bin/bash -g armdev -m -k /dev/null armdev
# useradd -s /bin/bash -g wizign -m armdev
# passwd armdev
# chown -Rv armdev ${ARMDEV}


[Preparing a New Partition]

# export ARMDEV='/mnt/armdev'
# install -dv ${ARMDEV}
# mkdir /vdisk/arm_disk
# mkdir -pv ${ARMDEV}
# mount --bind /vdisk/arm_disk ${ARMDEV}

[Create source directory]
# mkdir -v ${ARMDEV}/sources
# chmod -v a+wt ${ARMDEV}/sources

[Check and download packages]

$ su - armdev

[]Binutils (2.18)
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.18.tar.bz2

[]Busybox (1.4.1)
$ wget http://busybox.net/downloads/busybox-1.4.1.tar.bz2

[]CLFS-Bootscripts (1.0-pre4)
$ wget http://cross-lfs.org/files/packages/embedded-0.0.1/clfs-embedded-bootscripts-1.0-pre4.tar.bz2

[]E2fsprogs (1.39)
$ wget http://prdownloads.sourceforge.net/e2fsprogs/e2fsprogs-1.39.tar.gz

[]GCC (4.1.2)
$ wget http://ftp.gnu.org/gnu/gcc/gcc-4.1.2/gcc-4.1.2.tar.bz2

[]Iana-Etc (2.20)
$ wget http://www.sethwklein.net/projects/iana-etc/downloads/iana-etc-2.20.tar.bz2

[]Linux (2.6.20.1)
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.20.1.tar.bz2

[]Linux-Headers (2.6.20.1-02252007)
$ wget http://cross-lfs.org/files/packages/embedded-0.0.1/linux-headers-2.6.20.1-02252007.tar.bz2

[]uClibc (0.9.29)
$ wget http://www.uclibc.org/downloads/uClibc-0.9.29.tar.bz2

[]Zlib (1.2.3)
$ wget http://www.zlib.net/zlib-1.2.3.tar.gz

[Check and download patched]

[]Binutils Posix Patch
$ wget http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-sysroot/patches/binutils-2.18-posix-1.patch

[]Binutils Posix Patch
$ wget http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-embedded/patches/binutils-2.17-posix-1.patch

[]Binutils uClibc Patch
$ wget http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-embedded/patches/binutils-2.17-uclibc-1.patch

[]Busybox Fixes Patch
$ wget http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-embedded/patches/busybox-1.8.2-fixes-1.patch

[]GCC Cross Search Paths Patch
$ wget http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-embedded/patches/gcc-4.1.2-cross_search_paths-1.patch

[]GCC Posix Patch
$ wget http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-embedded/patches/gcc-4.1.2-posix-1.patch

[]GCC uClibc Patch
$ wget http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-embedded/patches/gcc-4.1.2-uclibc-1.patch

[]Zlib DESTDIR Patch
$ wget http://svn.cross-lfs.org/svn/repos/cross-lfs/branches/clfs-embedded/patches/zlib-1.2.3-DESTDIR-1.patch

[Final Preparations]

[]Setting up the environment

$ cat > ~/.bash_profile << "EOF"
> exec env -i HOME=${HOME} TERM=${TERM} PS1='\u:\w\$ ' /bin/bash
> EOF

$ cat > ~/.bashrc << "EOF"
> set +h
> umask 022
> ARMDEV=/mnt/armdev
> LC_ALL=POSIX
> PATH=${ARMDEV}/cross-tools/bin:/bin:/usr/bin
> export ARMDEV LC_ALL PATH
> EOF

$ source ~/.bash_profile

[]Creating directories

$ mkdir -pv ${ARMDEV}/build
$ mkdir -pv ${ARMDEV}/{bin,boot,dev,{etc/,}opt,home,lib/{firmware,modules},mnt}
$ mkdir -pv ${ARMDEV}/{proc,media/{floppy,cdrom},sbin,srv,sys}
$ mkdir -pv ${ARMDEV}/var/{lock,log,mail,run,spool}
$ mkdir -pv ${ARMDEV}/var/{opt,cache,lib/{misc,locate},local}
$ install -dv -m 0750 ${ARMDEV}/root
$ install -dv -m 1777 ${ARMDEV}{/var,}/tmp
$ mkdir -pv ${ARMDEV}/usr/{,local/}{bin,include,lib,sbin,src}
$ mkdir -pv ${ARMDEV}/usr/{,local/}share/{doc,info,locale,man}
$ mkdir -pv ${ARMDEV}/usr/{,local/}share/{misc,terminfo,zoneinfo}
$ mkdir -pv ${ARMDEV}/usr/{,local/}share/man/man{1,2,3,4,5,6,7,8}
$ mkdir -pv ${ARMDEV}/cross-tools{,/bin}
$ for dir in ${ARMDEV}/usr{,/local}; do
> ln -sv share/{man,doc,info} ${dir}
> done


[]Creating the passwd, group, and log Files

$ ln -svf ../proc/mounts ${ARMDEV}/etc/mtab

$ cat > ${ARMDEV}/etc/passwd << "EOF"
> root::0:0:root:/root:/bin/ash
> bin:x:1:1:bin:/bin:/bin/false
> daemon:x:2:6:daemon:/sbin:/bin/false
> adm:x:3:16:adm:/var/adm:/bin/false
> lp:x:10:9:lp:/var/spool/lp:/bin/false
> mail:x:30:30:mail:/var/mail:/bin/false
> news:x:31:31:news:/var/spool/news:/bin/false
> uucp:x:32:32:uucp:/var/spool/uucp:/bin/false
> operator:x:50:0:operator:/root:/bin/ash
> postmaster:x:51:30:postmaster:/var/spool/mail:/bin/false
> nobody:x:65534:65534:nobody:/:/bin/false
> EOF


$ cat > ${ARMDEV}/etc/group << "EOF"
> root:x:0:
> bin:x:1:
> sys:x:2:
> kmem:x:3:
> tty:x:4:
> tape:x:5:
> daemon:x:6:
> floppy:x:7:
> disk:x:8:
> lp:x:9:
> dialout:x:10:
> audio:x:11:
> video:x:12:
> utmp:x:13:
> usb:x:14:
> cdrom:x:15:
> adm:x:16:root,adm,daemon
> console:x:17:
> cdrw:x:18:
> mail:x:30:mail
> news:x:31:news
> uucp:x:32:uucp
> users:x:100:
> nogroup:x:65533:
> nobody:x:65534:
> EOF


$ touch ${ARMDEV}/var/run/utmp ${ARMDEV}/var/log/{btmp,lastlog,wtmp}
$ chmod -v 664 ${ARMDEV}/var/run/utmp ${ARMDEV}/var/log/lastlog


[Constructing Cross-Compile Tools]

[]Build CFLAGS
$ echo "Build CFLAGS"
$ echo unset CFLAGS >> ~/.bashrc
$ echo unset CXXFLAGS >> ~/.bashrc

# Application Binary Interface (ABI) for the ARM Architecture
# ABI Variables
# Table 6.1. List of Build Variables
# ABI BUILD=Value
# ------------------------- --------------------------------
# 32-Bit MIPS -mabi=32
# 32-Bit All Others -m32
# N32 MIPS -mabi=n32
# 64-Bit MIPS -mabi=64
# 64-Bit All Others -m64
echo "ABI Variables"
export BUILD="-m32"

# Build Variables
# Table 6.2. Processor Type and Target Triplets
# Processor Target Triplet
# ---------------------------------------------- -----------------------------------------
# Generic arm, little endian arm-unknown-linux-uclibc
# Generic arm, version 5, little endian armv5l-unknown-linux-uclibc
# Generic arm, version 5, big endian armv5b-unknown-linux-uclibc

$ export ARM_HOST="$(echo $MACHTYPE | sed "s/$(echo $MACHTYPE | cut -d- -f2)/cross/")"
# Generic arm, little endian
$ export ARM_TARGET="arm-unknown-linux-uclibc"
$ echo export ARM_HOST=\""${ARM_HOST}\"" >> ~/.bashrc
$ echo export ARM_TARGET=\""${ARM_TARGET}\"" >> ~/.bashrc

[]Linux-Headers-2.6.20.1-02252007

$ mkdir ${ARMDEV}/build
$ cd ${ARMDEV}/build
$ tar -jxvf ${ARMDEV}/sources/linux-headers-2.6.20.1-02252007.tar.bz2
$ install -dv ${ARMDEV}/usr/include
$ cp -av ${ARMDEV}/build/linux-headers-2.6.20.1/include/{asm-generic,linux,mtd,scsi,sound} ${ARMDEV}/usr/include
$ cp -av ${ARMDEV}/build/linux-headers-2.6.20.1/include/asm-arm ${ARMDEV}/usr/include/asm


[]Cross Binutils-2.17

$ cd ${ARMDEV}/build
$ tar -jxvf ${ARMDEV}/sources/binutils-2.17.tar.bz2
$ cd binutils-2.17
$ patch -Np1 -i ${ARMDEV}/sources/binutils-2.17-posix-1.patch
$ patch -Np1 -i ${ARMDEV}/sources/binutils-2.17-uclibc-1.patch
$ mkdir -v ../binutils-build
$ cd ../binutils-build
$ ../binutils-2.17/configure --prefix=${ARMDEV}/cross-tools --host=${ARM_HOST} --target=${ARM_TARGET} --with-sysroot=${ARMDEV} --disable-nls --enable-shared --disable-multilib
$ make configure-host
$ make
$ make install
$ cp -v ../binutils-2.17/include/libiberty.h ${ARMDEV}/usr/include


[]uClibc-0.9.29

$ cd ${ARMDEV}/build
$ tar -jxvf ${ARMDEV}/sources/uClibc-0.9.29.tar.bz2
$ cd uClibc-0.9.29

$ cp extra/Configs/Config.arm extra/Configs/Config.arm.orig
$ sed -e "/default/s:OABI:EABI:" extra/Configs/Config.arm.orig > extra/Configs/Config.arm
$ cp Makefile{,.orig}
$ sed -e 's/$(LN) -fs/cp/g' Makefile.orig > Makefile
$ for file in `find libc/sysdeps/linux -name Makefile`; do
> cp $file{,.orig}
> sed -e 's/$(LN) -fs/cp/g' -e 's@../libc/@$(TOPDIR)libc/@g' $file.orig > $file
> done

$ make defconfig ARCH=arm
$ cp .config{,.orig}
$ sed -e "/^CROSS_COMPILER_PREFIX/s:=.*:=\"${ARM_TARGET}-\":" -e "/^KERNEL_HEADERS/s:=.*:=\"${ARMDEV}/usr/include\":" -e "/^SHARED_LIB_LOADER_PREFIX/s:=.*:=\"/lib\":" -e "/^DEVEL_PREFIX/s:=.*:=\"/usr\":" -e "/^RUNTIME_PREFIX/s:=.*:=\"/\":" .config.orig > .config

$ UCLIBC_OPTIONS="DO_C99_MATH UCLIBC_HAS_RPC UCLIBC_HAS_CTYPE_CHECKED UCLIBC_HAS_WCHAR UCLIBC_HAS_HEXADECIMAL_FLOATS LDSO_PRELOAD_FILE_SUPPORT UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE UCLIBC_HAS_PRINTF_M_SPEC UCLIBC_HAS_IPV6 UCLIBC_HAS_GLIBC_CUSTOM_PRINTF UCLIBC_USE_NETLINK UCLIBC_HAS_FTW"
$ for config in $UCLIBC_OPTIONS; do
> cp .config{,.orig}
> sed -e "s:# ${config} is not set:${config}=y:" .config.orig > .config
> done
$ UCLIBC_OPTIONS="UCLIBC_HAS_CTYPE_UNSAFE"
$ for config in $UCLIBC_OPTIONS; do
> cp .config{,.orig}
> sed -e "s:${config}=y:# ${config} is not set:" .config.orig > .config
> done
$ echo "UCLIBC_HAS_FULL_RPC=y" >> .config
$ echo "UCLIBC_HAS_REENTRANT_RPC=y" >> .config

# If your ARM system is Big Endian, you will need at add the following lines to your configuration:

$ echo "ARCH_ANY_ENDIAN=y" >> .config
$ echo "ARCH_BIG_ENDIAN=y" >> .config
$ echo "ARCH_WANTS_BIG_ENDIAN=y" >> .config

# If your ARM system is Little Endian, you will need at add the following lines to your configuration:

$ echo "ARCH_ANY_ENDIAN=y" >> .config
$ echo "ARCH_LITTLE_ENDIAN=y" >> .config
$ echo "ARCH_WANTS_LITTLE_ENDIAN=y" >> .config

$ make oldconfig
$ make headers
$ mkdir ${ARMDEV}/usr/include/bits
$ make PREFIX=${ARMDEV} install_headers

[]Cross GCC-4.1.2 - Static

$ cd ${ARMDEV}/build
$ tar -jxvf ${ARMDEV}/sources/gcc-4.1.2.tar.bz2
$ cd gcc-4.1.2
$ patch -Np1 -i ${ARMDEV}/sources/gcc-4.1.2-posix-1.patch
$ patch -Np1 -i ${ARMDEV}/sources/gcc-4.1.2-uclibc-1.patch
$ patch -Np1 -i ${ARMDEV}/sources/gcc-4.1.2-cross_search_paths-1.patch
$ mkdir -v ../gcc-build
$ cd ../gcc-build
$ ../gcc-4.1.2/configure --prefix=${ARMDEV}/cross-tools --host=${ARM_HOST} --target=${ARM_TARGET} --disable-multilib --with-sysroot=${ARMDEV} --without-headers --disable-nls --disable-shared --disable-threads --enable-languages=c
$ make all-gcc
$ make install-gcc


[]ToolChain Variables

$ export CC="${ARM_TARGET}-gcc"
$ export CXX="${ARM_TARGET}-g++"
$ export AR="${ARM_TARGET}-ar"
$ export AS="${ARM_TARGET}-as"
$ export LD="${ARM_TARGET}-ld"
$ export RANLIB="${ARM_TARGET}-ranlib"
$ export STRIP="${ARM_TARGET}-strip"


[]uClibc-0.9.29

$ cd ${ARMDEV}/build
$ cd uClibc-0.9.29

$ make CC="${CC}"
$ make PREFIX=${ARMDEV} install


[]Clear ToolChain Variables

$ unset CC
$ unset CXX
$ unset AR
$ unset AS
$ unset LD
$ unset RANLIB
$ unset STRIP

[]GCC-4.1.2 - Cross Compiler Final

$ cd ${ARMDEV}/build
$ rm -fr gcc-4.1.2
$ tar -jxvf ${ARMDEV}/sources/gcc-4.1.2.tar.bz2
$ cd gcc-4.1.2
$ patch -Np1 -i ${ARMDEV}/sources/gcc-4.1.2-posix-1.patch
$ patch -Np1 -i ${ARMDEV}/sources/gcc-4.1.2-uclibc-1.patch
$ patch -Np1 -i ${ARMDEV}/sources/gcc-4.1.2-cross_search_paths-1.patch
$ rm -fr ../gcc-build
$ mkdir -v ../gcc-build
$ cd ../gcc-build
$ ../gcc-4.1.2/configure --prefix=${ARMDEV}/cross-tools --host=${ARM_HOST} --target=${ARM_TARGET} --disable-multilib --with-sysroot=${ARMDEV} --disable-nls --enable-shared --enable-languages=c,c++ --enable-__cxa_atexit --enable-c99 --enable-long-long --enable-threads=posix
$ make
$ make install