[ Aleph One home page | Company Information | Security Privacy and Terms of sale | Search ]



Aleph One
Logo

Getting ELF working under ARMLinux


After a lot of trying and re-trying, I finally compiled a working kernel with ELF support. I did not test the kernel a lot (I compiled it last night and found it this morning and it did boot), but I did some little things with it (mv, cp, rm, vi, configure, make) and these worked ...

Please note that this is probably not the only way (for sure) and it could be done more easier, I suppose. But this is the way I did it :)

How I did it :

First I updated some packages which were needed to get an up to date toolchain ... Versions are :

- Autoconf 			2.13
- Automake			1.4
- Gawk				3.05
- Gettext			0.10.35
- Make				3.79
- Patch				2.5.4
- Perl				5.6.0
- Texinfo			4.0
- Modutils			2.3.13
- Fpem				4.07, 
compiled for kernel 2.2.x (download it from ftp://ftp.arm.linux.org.uk/pub/armlinux/fpemulator or something. Maybe it is also on the CD ... But I didn't look). (Some packages depend on others, so compile these first ... Best to start with Perl ...)

For all packages (with exeption of Perl) do : ./configure --prefix=/usr (the default is /usr/local), because all packages are stored in /usr/bin and not in /usr/local/bin. Only if you want to keep the older ones, use the default and make sure that the new versions are find first. Do this by adding /usr/local/bin in front of PATH.

Now we start making the ELF toolchain.

- Binutils 2.9.5.0.14 (which I used. At the moment I am compiling the latest version 2.10.0.12 as a test).

  ./configure arm-linux --prefix=/usr/local/arm-elf

(please note the prefix ... This causes the binutils to NOT override the aout binutils. These will be installed in /usr/local/arm-elf).
  make
  make install

- GCC 2.95.2
change the file ./gcc/config/arm/t-linux
Add to line 3 (the first line after the comments ...
TARGET_LIBGCC2_CFLAGS) : -Dinhibit_libc -D__gthr_posix_h

  ./configure arm-linux --prefix=/usr/local/arm-elf --enable-languages="C"
  make

Near the end of the compilation, when libgcc.a is made, the compilation will stop with an error (because the new libgcc.a is made (with the new gcc) and this needs the new binutils).
  OLDPATH = $PATH
  (store the old path)
  PATH = /usr/local/arm-elf/bin:$PATH
(make sure the new binutils are found first)
  make
(this continues the making of libgcc.a)
  make install

change the specs file ... because of an incompatibility between the flags of ld and gcc
(I forgot to write this down, so this is from memory)
cd /usr/local/arm-elf/lib/gcc-lib/2.95.2/arm-linux
vi specs
change the end of of the *link line which hold -melfarm26 and -melfarm (or armelf, I am not sure) into -melf_armlinux26 and -melf_armlinux

OK, WE HAVE AN ELF TOOLCHAIN, AND NOW THE KERNEL

- please use kernel 2.4.0-test5 with patch 2.4.0-test5-rmk2 (this is the latest at the moment and the first one I got to work :) ).

  NEWPATH = $PATH
  PATH = $OLDPATH
  (use the old aout toolchain)
  make rpc_config
  make config
  (I used the defaults)
  gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -o scripts/mkdep
scripts/mkdep.c
  PATH = $NEWPATH
  (use elf toolchain)
  make dep
  PATH = $OLDPATH
  gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -o
scripts/split-include scripts/split-include.c
  cd drivers/char
  gcc -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer -o conmakehash
conmakehash.c
  cd ../..
  PATH = $NEWPATH
  make zImage
  make modules
  make modules_install

and when you boot linux from a kernel on the ADFS partition, copy it to your ADFS partition (I used IscaFS) from ./arch/arm/boot, otherwise do a :

cp /boot/vmlinuz /boot/vmlinuz.bak
cat arch/arm/boot/zImage > /boot/vmlinuz
loadmap -v

OK, NOW WE HAVE A KERNEL, now we need to prepare something before booting.

- Modutils 2.3.13

./configure arm-linux
make

if you do a 'make install' now, you cannot boot into the 2.0.36 kernel correctly (not completely try, but the fpemu will not be loaded and this gives some trouble when you try to run fsck. And maybe more trouble).

I did a :

mv /sbin/insmod /sbin/insmod-old
cp ./insmod/insmod /sbin/insmod

edited the /etc/rc.d/rc.sysinfo file and checked which kernel is used and which version of insmod I needed to use and which version of fpem-4.07.o should be used.

mv /lib/modules/misc/fpem-4.07.o /lib/modules/misc/fpem-4.07.o.old
copy the new fpem-4.07.o (which is ELF) into /lib/modules/misc

(I used some links to the old/new version of the binutils, depending on which version of the kernel I am using. For this I hacked the rc.sysinfo file. But when you want to use the new kernel only, then this is not needed. But as I didn't test it as much yet, I want to go back to the old kernel when needed).

(Something else you could do, is make a backup of the old modutils and do a make install. Then when booting an older kernel, it will give an error on the insmod fpem, but continues booting. Then after the boot finished and you logged in ...

type: path to old insmod/old insmod path to old fpem/old fpem

This will load the old fpem by hand ...)

And then reboot and see if the kernel works ...

Hope this info helps to make a new kernel for ARM linux ...

I will test the new kernel a bit further and see if it is stable. If you have some questions about this, please let me know.


Angelo Melis
Technical Specialist
AINO N.V.
email: a.melis@aino.nl

Valid HTML 3.2  Last Updated: 2000.08.23 Use any browser

[ Aleph One home page | Company Information | Security Privacy and Terms of sale | Search ]