Thursday, November 8, 2007
Embedded Linux intro
most of the slides taken from the great site: http://www.free-electrons.com
for help and other learning materials
visit our site: Bina
Saturday, September 29, 2007
OSK board tutorial
the Embedded linux section is updated
for help and other learning materials
visit our site: Bina
Embedded Linux - Loading The Kernel
we want to load the kernel inside the board flash memory and mount the file system in out host computer. this is very useful in the development process because the only thing we should do to download out application/driver to the target is to copy it from one directory to another on the host computer
restart the device and press a key to get u-boot shell
the easiest way to load files from host to target is to use tftp server on the host.
start the tftp server and place the kernel image (uImage.cc) in the server directory
on the target uboot shell:
# setenv serverip [your tftp server ip address]
# tftpboot 0x10000000 uImage.cc
after this you will get a number in hex format - REMEMBER IT
now we should erase the flash memory : (bank 8 to 20)
# erase 1:8-20
# cp.b 0x10000000 0x100000 [the number above]
now set the bootargs variable:
# setenv bootargs console=ttyS0,115200n8 noinitrd ip=${OSK_IP}:
${PC_IP}:${GATEWAY_IP}:${NETMASK}:osk:eth0:off root=
/dev/nfs rw nfsroot=${PC_IP}:/data/rootfs2.6,nolock mem=32M
# saveenv
to test the board restart it or:
# bootm 0x100000
after all the messages , you will get a prompt with the file system on the host
now you can use the toolchain to build applications and drivers, copy the output files to the root filesystem directory and execute/load it from the target
for help and other learning materials
visit our site: Bina
Embedded Linux - Root File System
there are many ways to do that. we are using busybox
busybox creates a single file that implements many tools from the file system
you can download it and configure it using "make menuconfig"
the only thing you should remember is to copy the .so files from the lib directory in your toolchain (usr/local/arm/3.4.1/arm-linux/lib) to the lib directory in the root file system
for already made file system click here
after creating the file system place it in a directory and update the file /etc/exports with access rights :
/opt/osk/rootfs2.6 *(rw,no_root_squash)
restart the nfs server
for help and other learning materials
visit our site: Bina
Friday, September 28, 2007
Embedded Linux - building the kernel
you should download the kernel source and a patch
download kernel 2.6.20 (from http://www.kernel.org/)
download the board kernel patch
now follow this:
# tar -xjvf ${DOWLOADDIR}/linux-${VERSION}.tar.bz2
# cp ${DOWLOADDIR}/patch-${VERSION}-omap1.bz2 .
# bunzip2 patch-${VERSION}-omap1.bz2
# cd linux-${VERSION}/
# cat ../patch-${VERSION}-omap1 | patch -p1
# make clean
# make omap_osk_5912_defconfig
make sure that the following options are set:
CONFIG_NFS_FS=y
CONFIG_NFS_V3=y
CONFIG_ROOT_NFS=y
# make
now the kernel image is ready but we have to convert it to U-BOOT format
# arm-linux-objcopy -O binary -R .note -R .comment S
arch/arm/boot/compressed/vmlinux linux.bin
# gzip -9 linux.bin
# ${U-BOOTDIR}/tools/mkimage -A arm -O linux -T kernel -C gzip -a 0x10c08000 -e 0x10c08000 -n Linux Kernel Image -d linux.bin.gz uImage.cc
uImage.cc is ready
for already made uImage.cc click here
for help and other learning materials
visit our site: Bina
Embedded Linux - boot loader
the OSK board comes with already installed U-BOOT,
we can replace it but we don't need
we do need a tool: mkimage to convert the kernel image to U_BOOT format
to build the tool download U-BOOT source
do the following:
# tar -xjvf ${DOWLOADDIR}/u-boot-1.1.2.tar.bz2
# cd u-boot-1.1.2
# make distclean
# make omap5912osk_config
# make tools
you can also run make to create the binary image of u-boot boot loader so you can replace it on the board but we don't need it (future post)
if you look inside the tools directory you will find the tool mkimage
for help and other learning materials
visit our site: Bina
Wednesday, September 26, 2007
Embedded Linux - Toolchain
we need a toolchain for ARM processor
Building a new toolchain can be complicated mission
in general you should download:
- binutils - http://ftp.gnu.org/gnu/binutils/
- gcc - http://ftp.gnu.org/gnu/gcc/
- C library - http://ftp.gnu.org/gnu/glibc/
- some extensions
for our purpose we can use an already made toolchain from here
extract the archive:
# tar -xjvf ${DOWLOADDIR}/arm-linux-gcc-3.4.1.tar.bz2
look at the path: ${EXTRACTEDDIR}/usr/local/arm/3.4.1/bin
(all the binary tools to compile, link and debug an ARM code)
add the above path to your PATH environment variable :
# export PATH=/usr/local/arm/3.4.1/bin/:$PATH
now we can build everything with this toolchain
for help and other learning materials
visit our site: Bina
Tuesday, September 11, 2007
Embedded Linux - Connecting to the device
the next step is to connect it using RS232 (null modem cable) to your host machine
to see the device terminal you can use windows or linux
On Windows Host
use hyperterminal : set the connection to the correct COM port with the following settings: 115200 baud, no parity, 8 data bits, 1 stop bit , no flow control
connect the device to power and push the reset button on it (small white button)
On Linux Host
first setup minicom
# minicom -s
select serial port setup
set the following:
- Serial device - /dev/ttyS0 (or other number based on your com port)
- Bps/pas/Bits - 115200 8N1
- No software flow
- No hardware flow
save setting and Exit (to minicom)
(the setup step is required only once so next time just run minicom)
push the reset button on the board
You can now play with the system and with some demos provided from MontaVista
We dont want to use kernel 2.4 and also want to build our system with free software so we will not use Montavista distribution
Note: The porpose of this posts is to study embedded linux and thats why we dont use the commercial distribution. there is no real free software, if you use Montavista or other commercial distribution you pay (around 15000$ for developer) but you get full support and much work have been done for you (BSP,device drivers and sample programs). when you use the "free" tools you have to spend time to solve problems and creating the BSP and you know - "time is money"
for help and other learning materials
visit our site: Bina
Monday, September 10, 2007
Embedded Linux - Setting up host
Install one of the Linux desktop distributions on your host
make sure that it includes:
- C/C++ development tools
- NFS server
I'm using Open SUSE 10 on one workstation and fedora code 3 on another
for help and other learning materials
visit our site: Bina
Embedded Linux - Starter Kit
to buy it go to: this site
the board is based on ARM processor with DSP Processor and you can evaluate also Montavista distribution (kernel 2.4)
we will use it to with only free software tools includes:
- Toolchain
- Boot loader
- Kernel
- Root file system
for help and other learning materials
visit our site: Bina
Embedded Linux - Overview
The perfect way to learn it is by doing it yourself with step by step instructions
here we will post some articles to help new embedded linux developers
enjoy
for help and other learning materials
visit our site: Bina