Friday, June 17, 2011

Creating jffs2 image


 Hello people!   Last time I wrote that we had some problems in generating jffs2 file system image. So I read on the internet about a bug when using -v option in mkfs.jffs2. I tried to generate the jffs2 image by taping the command and I think that I got it.


So, you'll need:
- mkfs.jffs2 (from mtd-tools)
- file system (it's generated when compiling uClinux in the uClinux-dist directory named as romfs)
- dev_table.txt (located at uClinux/vendors/EmbeddedArtists/LPC2468OEM_Board/dev_table.txt)

To better comprehension let's copy dev_table.txt to uClinux-dist directory:
cd uClinux-dist
cp ./vendors/EmbeddedArtists/LPC2468OEM_Board/dev_table.txt ./
Now let's generate the jffs2 image by taping:
mkfs.jffs2 -d ./romfs -D ./dev_table.txt -l -o ./images/jffs2.img -e 128 -n -m none -p
If you want to understand what we are doing, take a look on mkfs.jffs2 man page, it's not that complicated!

That's it!
Marcelo Jo
Read more ►

Tuesday, June 14, 2011

Compiling uClinux with kernel linux-2.6.21

Hello everybody!
Today I'll show you what I did to compile the kernel.. First of all I'm assuming that you
have already installed build-essentials and mtd-tools packages.
Now let's begin the hard work! =D









  1) Download all these packages:
  - uClinux-dist-20070130.tar.gz
  - ea-uClinux-081020.diff.gz
  - ea-v3_1_incr1.diff.gz
  - linux-2.6.21.tar.gz
  - arm-linux-tools-20061213.tar.gz
  - arm-elf-tools-20040427.sh
  - mkimage (used to generate uLinux.bin)

2) untar toolchain 1. (It will untar in the same directory where you download it. I add this path to the $PATH)
tar -zxvf arm-linux-tools-20061213.tar.gz
export PATH=$PATH:path-to-the-download-directory/usr/local/bin

Note: You can either move this directory to a directory in the PATH or add the path into the $PATH in your /home/user/.bashrc. In this way you don't have to export everytime you open a new console.

install toolchain 2.
./arm-elf-tools-20040427.sh
I had a problem when installing this toolchain. If you get an error too, edit this file and try changing:
tail +${SKIP} ${SCRIPT} | gunzip | tar xvf -
by
tail -n +43 ${SCRIPT} | gunzip | tar xvf -
Copy mkimage to /usr/local/bin and set it as executable
sudo chmod +x /usr/local/bin/mkimage

3) untar uClinux and then remove old kernel
tar -zxvf uClinux-dist-20070130.tar.gz
rm -r ./uClinux-dist/linux-2.*
4) untar linux-2.6.21 and move it to uClinux-dist
tar -zxvf linux-2.6.21
mv ./linux-2.6.21 ./uClinux-dist/linux-2.6.x
5) apply both patchs
cd ./uClinux-dist
gunzip -c ../ea-uClinux-081029.diff.gz | patch –p1
gunzip -c ../ea-v3_1_incr1.diff.gz | patch –p1
6) Configure & Compile.
a)Choose vendor Embedded Artists and board LPC2468
b)Disable i2c in device drivers > I2C support > <> I2C support
make menuconfig
make ARCH=arm CROSS_COMPILE=arm-elf-
After make, you will get an error. You must include <linux/limits.h>  in the file ./linux-2.6.x/scripts/mod/sumversion.c. Make again and go take a coffe.
The images will be in the folder ./images
-rw-r--r--  1 user user 1012K 2011-06-14 14:13 cramfs.img
-rw-r--r--  1 user user  4.2M 2011-06-14 14:13 image.bin
-rw-r--r--  1 user user     0 2011-06-14 14:13 jffs2.img
-rwxr-xr-x  1 user user  162K 2011-06-14 14:13 linux.data
-rw-r--r--  1 user user  1.1M 2011-06-14 14:13 linux.gz
-rwxr-xr-x  1 user user  2.1M 2011-06-14 14:13 linux.text
-rw-r--r--  1 user user  1.9M 2011-06-14 14:13 romfs.img
-rw-r--r--  1 user user  1.1M 2011-06-14 14:13 uLinux.bin

It's weird that we need 2 toolchain... I don't know why, but arm-linux- is used to compile the kernel (actually the kernel complains that the toolchain arm-elf is too old). It has been forced to, even if you set CROSS_COMPILE=arm-elf-. The rest is compiled with arm-elf-, so, be sure that both toolchain is in the path.

Until today, jffs2 file system can't be generated following these instructions. I'll check later! =D

Next post we'll update u-boot and boot the kernel! Wait and you'll see! =D
That's all

Marcelo Jo
Read more ►

Friday, June 10, 2011

Toolchain for ARM


  Hi people,
  I'm following some instructions from Embedded Artists to build my own toolchain, compile and upgrade board's u-boot. I'm working with Kubuntu 11.04 and using the followings packages:

  - u-boot 1.16 with 2 incremental patchs from EA.
  - uClinux-dist-20070130.tar.gz
  - kernel linux-2.6.21
  - arm-linux-tools-20061213.tar.gz
  - arm-elf-tools-20040427.sh

  It's strange that we need two toolchains, arm-linux and arm-elf. Actually I couldn't compile the kernel yet and than I downloaded the uLinux.bin and romfs.img from EA website.
  We can't compile the kernel with arm-elf because this toolchain is too old (according to error message). So we have to compile the kernel using arm-linux. I'm not sure yet why two toolchain.. anyway we move on... =D

  Marcelo Jo
Read more ►

Embedded artists LPC2468 demo board

  Hi people,
  I'm currently working on the LPC2468 board from Embedded Artists. This is an overview of the board and processor:


  LPC2468
  - Processor ARM7TDMI-S core with speed up to 72 MHz
  - 512 KB internal flash
  - 98 KB RAM
  - 4xUART, 3xI2C, 2xCAN, 1xSPI, 2xSSP, 1xI2S
  - Full-Speed USB 2.0 Device/Host/OTG
  - 10/100 Ethernet MAC

  Board
  - 128 MB NAND + 4 MB NOR
  - 32 MB SDRAM
  - 256 Kbit I2C E2PROM


It's an "old" board that runs uClinux instead of Linux. It comes with u-boot. So, I'm learning how it works and how develop device drivers for it. In the nexts posts I'll show you what I'm doing with this little board!

  Marcelo Jo
Read more ►

First Post!

  Hello folks!

  This is my very new post here. Before we start, let me present myself. My name is Marcelo I'm from Brazil but I live in Canada since 2007 (so, I'm sorry for my bad english lol). I'm an electronic engineer graduated at UTFPR in 2003 and I work with electronics since 2001.
  My experience is in 8/16 bits systems and that's why I'm creating this blog.... I'm moving to a 32 bits world with an OS. I would like study FPGA/VHDL and digital image processing too. So, this blog is not only about embedded linux.

  Before put hands on dirty, let me show some books that help me a lot to learn about those subjects:

Linux Embedded Primer
It's a very good book that explain in deep about how embedded linux works. As a beginner I enjoyed it a lot.
It covers linux boot, some boot loaders as u-boot, device driver development basis, kernel debugging technics, etc.
Actually my friend Sérgio Prado told me about this book!







Linux Device Drivers
It's also a very good book about linux device drivers. It explain in detail about types of device drivers, device driver development techniques, some debugging tools, timers, memory allocation, interrupt handling and of course how to write one. In the link above you can read online this book, so, if you don't want to buy a copy, you can read it first! I bought one because I think that it's a good idea have one copy for reference!





Linux Kernel Development
I have the second edition, but the third edition is already available. I didn't finish it, but I read some chapters. This book teaches about the linux kernel like process management, process scheduling, system calls, memory management, etc.
I think that it's a must have to full understand the kernel.






Circuit Design with VHDL
This book is a good book to learn VHDL. It covers from basic until intermediate level of VHDL. I read once but I have to read again. I thought a good book because it explain the language and after show a example. There is lots of example in the book.
But this book don't explain how to program and configurate a FPGA, it's intend to teach VHDL only. There is a small tutorial in appendix.
Professor Pedroni was my teacher at university, I did only one course with him and it was about FPGA.



FPGA Prototyping by VHDL Examples: Xilinx Spartan-3 Version
Since I have a dev board from Digilent with a Spartan 3, this book is perfect to apply all the knowledge acquired. This book is the hands on, all theorical stuff that we learned with Pedroni's book, we can apply now.
If you know already VHDL, this book is very good to learn how to put everything in practice in a FPGA.






Computer Vision
I didn't read this book yet, only firsts chapters. But this book is a good book for everyone that don't have any knowledge in computer vision, digital image processing, etc. But it's intend for people who has an engineering background, so, it's a little technical and it covers more computer vision than image processing techniques (as the title suggest derrrr)
It covers all the concepts to process an image, it explain concepts about the problems in computer vision systems, images representation, binary images analysis, pattern recognition, filters, image segmentation, image matching, etc.



Digital Image Processing
I didn't read this book either (no free time). This book is more about image processing and it's very technical. It teaches from the human eye until object recognition, so it might be very complete. I read several reviews at amazon and people are used to like this book.
Actually I have a friend who works in this field and he suggested me those two books! =D





That's all folks!!!

Marcelo Jo
Read more ►