Difference between revisions of "MINI2440 embedded projects"

From Kenneth Noyens
Jump to: navigation, search
(Compile kernel)
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
This page is currently under constructions, I'm doing this all over with the new versions of all the software
+
- [[Mini2440 Linux]]
 +
- [[Mini2440 Openembedded]]
 +
- [[Mini2440 Windows Embedded CE 6.0 Trail]]
 +
- [[Mini2440 Qt]]
 +
- [[Mini2440 Boot from SD]]
  
== Toolchain ==
+
tips and tricks:
First of all, we need a toolchain containing some command-line tools for our ARM platform:
+
- [[Mini2440 Shifted screen problem]]
<ul>
+
- [[Mini2440 MD5 checksum problems]]
<li>C and C++ compilers</li>
 
<li>assembler</li>
 
<li>linker</li>
 
<li>C and C++ runtime libraries</li>
 
<li>GNU debugger</li>
 
</ul>
 
<br>
 
I'm going to use the Sourcery G++ Lite ARM that is available for free.<br>
 
You can get the last version from http://www.codesourcery.com/sgpp/lite/arm/portal/subscription3053<br>
 
=== Downloading and unpacking ===
 
<pre>
 
mkdir mini2440
 
cd mini2440
 
wget http://www.codesourcery.com/sgpp/lite/arm/portal/package5353/public/arm-none-eabi/arm-2009q3-68-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
 
tar jxf arm-2009q3-68-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
 
export PATH=/home/ttts/mini2440/arm-2009q3/bin:$PATH
 
</pre>
 
The last line will add the bin directory the $PATH variable so that we can use the commands in that directory like normal commands.<br>
 
Every time you open a terminal, you have to enter that last line. (or you can add it to your .bashrc file)
 
 
 
== Uboot ==
 
=== Download uboot for mini2440 ===
 
<pre>
 
mkdir uboot
 
cd uboot
 
git clone git://repo.or.cz/u-boot-openmoko/mini2440.git
 
</pre>
 
 
 
=== Compile uboot ===
 
<pre>
 
export CROSS_COMPILE=arm-none-eabi-
 
cd mini2440
 
make mini2440_config
 
make all
 
</pre>
 
When I tried to compile uboot I got an error about some weak declarations in lib_arm/board.c and common/main.c<br>
 
I'm using the 4.4.x gcc, and the 4.3.x does not cause that error. You can downgrade your gcc or remove the "weak" definitions in those files like I did
 
 
 
=== Compile upload tool ===
 
<pre>
 
cd ~/mini2440
 
wget http://mini2440.googlecode.com/files/s3c2410_boot_usb-20060807.tar.bz2
 
tar jxf s3c2410_boot_usb-20060807.tar.bz2
 
cd s3c2410_boot_usb
 
make
 
</pre>
 
When make fails because he can not find the file "usb.h" install the ubuntu/debian package libusb-dev.
 
 
 
=== Upload the file ===
 
Open a terminal to the serial connection of the mini2440 board.<br>
 
Put the NOR switch to NOR and power the board.<br>
 
Now you get a "FriendlyARM BIOS"/supervivi menu, choose q to go to the supervivi shell.<br>
 
In this shell you typ "load flash 0 232188 u"<br>
 
Where "232188" is the size of the uboot.bin file you are going to send. (ls -la mini2240/uboot/mini2440 | grep u-boot.bin)<br>
 
Send the file from your linux terminal:
 
<pre>
 
./s3c2410_boot_usb ../uboot/u-boot.bin
 
</pre>
 
Sometimes the upload tool says that the upload is failed, but don't trust it :P<br>
 
The upload of uboot didn't work for me at first but just keep trying
 
 
 
== Kernel ==
 
=== Download kernel ===
 
<pre>
 
cd ~/mini2240
 
mkdir kernel
 
cd kernel
 
git clone git://repo.or.cz/linux-2.6/mini2440.git
 
cd mini2440
 
</pre>
 
=== Config kernel ===
 
<pre>
 
mkdir ../kernel-bin
 
CROSS_COMPILE=arm-none-eabi- ARCH=arm make O=../kernel-bin/ mini2440_defconfig
 
CROSS_COMPILE=arm-none-eabi- ARCH=arm make O=../kernel-bin/ menuconfig
 
</pre>
 
After the last command you will get a menu where you can select the kernel options you want.<br><br>
 
I had a problem compiling my kernel in the next stap and found this solution:<br>
 
[http://www.mail-archive.com/uclinux-dev@uclinux.org/msg05562.html Mail-archive.com solution]<br>
 
Quote from the website above:<br>
 
Try this:<br>
 
in Kernel config<br>
 
-->"User Space Binary formats"<br>
 
-->un-check "Kernel support for a.out and ECOFF binaries"<br>
 
 
 
=== Compile kernel ===
 
<pre>
 
CROSS_COMPILE=arm-none-eabi- ARCH=arm make O=../kernel-bin/
 
</pre>
 
 
 
=== Make kernel image ===
 
Because uboot expects some headers you have to add some headers to your fresh compiled kernel.<br>
 
<pre>
 
cd ~/mini2240
 
./uboot/mini2440/tools/mkimage -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d kernel/kernel-bin/arch/arm/boot/zImage linux-image
 
</pre>
 
A => Architecture<br>
 
O => Operating system<br>
 
T => image typ<br>
 
C => compression<br>
 
a => load adres in hex<br>
 
e => entry point<br>
 
d => image data <br>
 
 
 
=== Load the kernel in the board ===
 
''All command are entered as root
 
==== DHCP server ====
 
Install DHCP server:
 
<pre>
 
apt-get install dhcp3-server
 
</pre>
 
Put your pc on a static IP, edit /etc/network/interfaces
 
<pre>
 
auto eth1
 
iface eth1 inet static
 
    address 192.168.0.2
 
    network 192.168.0.0
 
    netmask 255.255.255.0
 
    broadcast 192.168.0.255
 
    gateway 192.168.0.1
 
</pre>
 
I use a special setup with a subnet behind NAT<br>
 
eth0 is connected directly to my lan, eth1 is connected to a router where the mini2440 is connected<br>
 
You don't want to run a DHCP server on a LAN where there is already a DHCP server!!<br>
 
Open /etc/dhcp3/dhcd.conf with your favorite editor and add the folow lines:
 
<pre>
 
subnet 192.168.0.0 netmask 255.255.255.0
 
{
 
        range 192.168.0.10 192.168.0.240;
 
        option routers 192.168.0.1;
 
        option domain-name-servers 8.8.8.8;
 
}
 
host mini2440   
 
{
 
        filename "linux";
 
        server-name "192.168.0.2";
 
        next-server 192.168.0.2;
 
        hardware ethernet 08:08:11:18:12:27;
 
        fixed-address 192.168.0.9;
 
}
 
</pre>
 
Change the hardware address to the MAC address of your board<br>
 
If you don't known the MAC address of your board, you can find this in the uboot console during boot<br>
 
You can change the IP addresses to fit your needs.<br>
 
8.8.8.8 is the open DNS server from google<br>
 
192.168.0.1 => router<br>
 
192.168.0.2 => debian server<br>
 
192.168.0.9 => mini2440<br><br>
 
Reboot DHCP server:
 
<pre>
 
invoke-rc.d dhcp3-server restart
 
</pre>
 
==== TFTP server ====
 
Install tftp server and client (client for testing):
 
<pre>
 
apt-get install tftpd tftp
 
/etc/init.d/openbsd-inetd restart
 
</pre>
 
Copy the linux-image to /srv/tftp/linux:
 
<pre>
 
cp /home/ttts/mini2440/linux-image /srv/tftp/linux
 
</pre>
 
Typ "dhcp" in the uboot console of the mini2440 board, normaly you should see the kernel loading.
 
 
 
== Filesystem ==
 
'' All commands are entered as root ''
 
<pre>
 
cd /home/ttts/mini2240
 
mkdir filesystem
 
cd filesystem
 
debootstrap --arch=armel --foreign lenny grip/ http://www.emdebian.org/grip/
 
</pre>
 
=== Install kernel modules in the filesystem ===
 
<pre>
 
cd ../kernel/mini2440/
 
CROSS_COMPILE=arm-none-eabi- ARCH=arm make INSTALL_MOD_PATH=/home/ttts/mini2440/filesystem/grip/ modules_install
 
</pre>
 
=== Config the filesystem ===
 
<pre>
 
cd ../../filesystem/grip/
 
echo "proc /proc proc none 0 0" > etc/fstab
 
echo "mini2440" > etc/hostname
 
mknod dev/console c 5 1
 
mknod dev/ttySAC0 c 204 64
 
echo "deb http://www.emdebian.org/grip/ lenny main" > etc/apt/sources.list
 
</pre>
 
 
 
=== NFS server ===
 
<pre>
 
apt-get install nfs-kernel-server
 
</pre>
 
edit /etc/exports and add the folow line:
 
<pre>
 
/home/ttts/mini2440/filesystem/grip    *(rw,no_root_squash,no_subtree_check,async)
 
</pre>
 
=== Boot the system ===
 
The first time we boot the board we are not goining to load init but just sh that we get a shell to finish debootstrap<br>
 
Open a serial console to the board, and power the board.<br>
 
In the uboot console you enter this:
 
<pre>
 
setenv bootargs console=ttySAC0,115200 noinitrd init=/bin/sh mini2440=0tb ip=dhcp root=/dev/nfs rw nfsroot=192.168.0.2:/home/ttts/mini2440/filesystem/grip
 
dhcp
 
bootm 0x32000000
 
</pre>
 
mini2440=0tb for the 3,5" screen and =1tb for the 7" screen.<br>
 
After entering the last command, the linux kernel will start booting and drop you in a shell<br><br>
 
First see that the clock of the board is correct!<br>
 
If the clock is not correct, the debootstrap command may fail.<br>
 
Check and set the system clock and hardware clock.<br>
 
<pre>
 
date
 
date -s "20 JAN 2010 15:20:00"
 
hwclock -systohw
 
</pre>
 
Finish the debootstrap install:
 
<pre>
 
mount /proc /proc -t proc
 
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 
/debootstrap/debootstrap --second-stage
 
</pre>
 

Latest revision as of 17:56, 21 April 2010

- Mini2440 Linux
- Mini2440 Openembedded
- Mini2440 Windows Embedded CE 6.0 Trail
- Mini2440 Qt
- Mini2440 Boot from SD

tips and tricks:

- Mini2440 Shifted screen problem
- Mini2440 MD5 checksum problems