From: David McCullough (davidm@lineo.com)
Date: Fri Jun 01 2001 - 03:53:49 EDT
Jivin studentgroups lays it down ...
> stanley,
>
> > stanley wrote:
> > a) I configured gcc and binutils with --prefix=/opt/uClinux-LEON/tools
> > b) to generate init.elf, i uses sparc-rtems-gcc and using write(1, "A",
> 1) in the program.
> > c) elf2flt.c is from uclinux.org.... but i can't trace which sources it
> was from. My apology for that...
You can get the most up-to-date elf2flt from:
http://www.uclinux.org/pub/uClinux/m68k-elf-tools/
It is a fairly contained task to get is going on a different arch if you
follow the relocations it needs to support.
You do not need a PIC compiler to build working uClinux systems, the
elf2flt above can generate fully relocatable exe's that the kernel knows
how to load. This means that there can be relocations in the code and the
data.
look through the build script to work out how to best set up your
toolchain.
> now this is something that we can work on right now.
> but as for the userland hello world that you are
> talking about below does not seem to possible as
> yet. the points 1,2,4 that you are talking about are major
> ones.
If you do not have a libc then you could write your own init process that
calls system calls directly to output some data. There are macros in the
kernel headers that the C libraries use to create a systems call. For
example, something like this might get you started:
_syscall3(int, write, int, fd, void *, buf, int, len);
Then you can have a simple init program like:
...
#include <asm/unistd.h>
...
_syscall3(int, write, int, fd, void *, buf, int, len);
main()
{
while (1)
write(0, "Hello world\n", 12);
}
> what we can try doing is that we first try and complete the
> booting process of uClinux and see that we don't get hung up
> at the point that we do right now.
Put some trace in fs/binfmt_flat.c so you know that it is dying when
it runs and application. Actually, turn on debug in this file by finding
the "#undef DEBUG" and changing it to a "#define DEBUG 1". It will give
you lots of useful info on program loading.
I would suggest the current uClibc from CVS to get a working libc.
It seems a lot of the work you need to do can be lifted/taken from glibc.
This is a reasonable task to get the sysdeps portion of the work done
but the pay off is big once you are their.
Hope this helps,
Cheers,
Davidm
> > Hi joe
> > > Are you linking the program with uClibc? It sounds like you're not
> > > making the syscalls to the OS but rather using a statically linked
> > > printf function which pipes to tsim instead of sending output to the
> > > kernel with a write call
> >
> > Indeed, my program is not making any syscalls to the OS, but rather using
> a
> > statically linked printf function which pipes to tsim instead of sending
> > output to the kernel with a write call. Currently, uClibc has not been
> > successfully to the platform i am working on, thus i can't link my
> userland
> > to it.
> >
> > Please correct me if i am wrong, to run a program with uClinux, i will
> need
> > the following:
> > 1) Create a libc with syscalls to the OS
> > 2) a PIC compiler that compiles libc
> > 3) a simple program which should contains what, i am not too sure
> > 4) elf2flt
> >
> > Currently items 1, 2 and 4 aren't ported to LEON yet. For item 3, i looked
> > into busybox and its init is very complex. I need a simple program that
> can
> > output something to the console, this demostrate items 1, 2 and 4 are
> > wokring correctly.
> >
> > Perhaps you can give an estimate of the manpower and time required to
> > accomplish items 1, 2 and 4. It seems that i have underestimated it by 2
> > engineers with 2 months each.
> >
> > By the way, does redhat has any related stuffs similar to what i mentioned
> > here ?, something workable ?
--
David McCullough: Ph: +61 7 3435 2815 Lineo (The Embedded Solutions Company)
davidm@lineo.com Fx: +61 7 3891 3630 PO Box 925, Kenmore QLD 4069, Australia
This message resent by the uclinux-dev@uclinux.org list server http://www.uClinux.org/
This archive was generated by hypermail 2.1.4 : Thu Sep 19 2002 - 13:19:46 EDT