Skip to contentSkip to conversation

building uClinux using OE

DISCUSSION Sergey 'Jin' Bostandzhyan 3 participants 6 messages Feb 14, 2008 – Feb 22, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

I'd like to be able to build uClinux using OE and I hope to gather some pointers to the right direction.

I think it would generally be a nice thing to have, so I would like to do the work in a way that it could be incorporated in OE, provided that you guys are interested.

According to the post below the toolchain should not be a problem:
http://mailman.uclinux.org/pipermail/uclinux-dev/2007-May/042993.html
"uClinux development on ARM now uses a standard arm-linux targeted tool chain.
We add the elf2flt tool, but it is otherwise a standard arm-linux toolchain."

As far as I know the uClinux/ARM kernel patches are already in the mainline:
http://opensrc.sec.samsung.com/

uClibc is also already supported by OE, not sure if I would have to add an option for uC-libc.

So basically it seems that almost everything that is needed is already there.

What is missing?

- applying elf2flt processing to produced binaries

- have a way of knowing that the particular build is done for the uClinux targets (maybe for some tweaks in .bb files if required or to apply patches only when necessary, allthough ifdef __uClinux__ defines could be used)

- not sure what else?

I do not have any uClinux experience yet, and it seems to be quite difficult to gather all the bits and pieces of information, so I'd appreciate comments and suggestions, especially if you see that I am missing something.

I'd also be interested in your thoughts on what would be the best way to integrate it into OE.

Kind regards,
Jin

#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sergey 'Jin' Bostandzhyan schreef:

| Hi,
|
| I'd like to be able to build uClinux using OE and I hope to gather some
| pointers to the right direction.
|
| I think it would generally be a nice thing to have, so I would like to do
| the work in a way that it could be incorporated in OE, provided that you
| guys are interested.
|
| According to the post below the toolchain should not be a problem:
| http://mailman.uclinux.org/pipermail/uclinux-dev/2007-May/042993.html
| "uClinux development on ARM now uses a standard arm-linux targeted

tool chain.
| We add the elf2flt tool, but it is otherwise a standard arm-linux toolchain."
|
| As far as I know the uClinux/ARM kernel patches are already in the mainline:

| http://opensrc.sec.samsung.com/
|
| uClibc is also already supported by OE, not sure if I would have to add
| an option for uC-libc.
|
| So basically it seems that almost everything that is needed is already
there.
|
| What is missing?
|
| - applying elf2flt processing to produced binaries

That should happen automagically, we just need to stage some more binutils-cross headers for elf2flt to build

| - have a way of knowing that the particular build is done for the uClinux
| targets (maybe for some tweaks in .bb files if required or to apply
patches

|   only when necessary, allthough ifdef __uClinux__ defines could be used)
|
| - not sure what else?

Since you can't (practically) do shared libraries, all packaging (and probably staging) will be wrong, since you won't have libfoo.so.1, but something different.

| I do not have any uClinux experience yet, and it seems to be quite difficult
| to gather all the bits and pieces of information, so I'd appreciate comments

| and suggestions, especially if you see that I am missing something.
|
| I'd also be interested in your thoughts on what would be the best way to
| integrate it into OE.

I had a go at this a while ago, but I had to halt working on it since the uboot on the blackfin site refuses to load the uImage on the blackfin site, leaving me without a good testing target.
I think forcing static linking would be the fastest way to get an image built, we can work on details (flat, shared-flat, fdpic, etc) after that.

regards,

Koen

- --
[email protected] will go go away in december 2007, please use [email protected] instead.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFHtHCLMkyGM64RGpERAl7KAJ4sD85YqG+OrTVUx+eLuCb9js4TvQCffI35 7wUmhJZu6YpoBfu6e4kbEg0=
=Ez6i
-----END PGP SIGNATURE-----

#2 lore raw

Hi,

On Thu, Feb 14, 2008 at 05:47:07PM +0100, Koen Kooi wrote:

[...]

Quoted 6 lines
| What is missing?
|
| - applying elf2flt processing to produced binaries

That should happen automagically, we just need to stage some more binutils-cross headers for elf2flt to build

OK, I'll see that I get elf2flt to build, I'll surely have some questions about the "automagically" part later on :)

Quoted 10 lines

| - have a way of knowing that the particular build is done for the uClinux
| targets (maybe for some tweaks in .bb files if required or to apply
patches

|   only when necessary, allthough ifdef __uClinux__ defines could be used)
|
| - not sure what else?

Since you can't (practically) do shared libraries, all packaging (and probably staging) will be wrong, since you won't have libfoo.so.1, but something different.

OK, I'll keep that in mind.

Quoted 9 lines

| I do not have any uClinux experience yet, and it seems to be quite difficult
| to gather all the bits and pieces of information, so I'd appreciate comments

| and suggestions, especially if you see that I am missing something.
|
| I'd also be interested in your thoughts on what would be the best way to
| integrate it into OE.
Quoted 5 lines

I had a go at this a while ago, but I had to halt working on it since the uboot on the blackfin site refuses to load the uImage on the blackfin site, leaving me without a good testing target.
I think forcing static linking would be the fastest way to get an image built, we can work on details (flat, shared-flat, fdpic, etc) after that.

How far did you come with the stuff you did back then? Did you merge anything of it into OE and if yes, could you please point me to the things you did so I can pick up from there?

Thanks,
Jin

#3 lore raw
In reply to Koen Kooi

Hi Koen,

Quoted 2 lines · Koen Kooi

That should happen automagically, we just need to stage some more binutils-cross headers for elf2flt to build

OK... I am not sure if I got the idea, so please correct me if I am wrong:
elf2flt needs to be told what target arch it will be used for, but it should be compiled using native libiberty.a and libbfd.a?

At least running ./elf2flt without any options prints me "Compiled for arm architecture" at the end of the usage summary.

I am not yet sure if it produces any meaningful output or how I could test it to be sure (it asks for some relocation info files), so any hints would be greatly appreciated.

And also... how would this "automagically" part work, what do I do next?

Quoted 5 lines

I had a go at this a while ago, but I had to halt working on it since the uboot on the blackfin site refuses to load the uImage on the blackfin site, leaving me without a good testing target.
I think forcing static linking would be the fastest way to get an image built, we can work on details (flat, shared-flat, fdpic, etc) after that.

I found your elf2flt_svn.bb recipe and used it as a starting point.

I had to apply the patch from here in order to compile binutils with uclibc:
http://bugs.openembedded.org/show_bug.cgi?id=3178

I attached my diffs.

Kind regards,
Jin

Quoted 9 lines

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iD8DBQFHtHCLMkyGM64RGpERAl7KAJ4sD85YqG+OrTVUx+eLuCb9js4TvQCffI35 7wUmhJZu6YpoBfu6e4kbEg0=
=Ez6i
-----END PGP SIGNATURE-----

Quoted 4 lines

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

elf2flt_svn.bb renamed from ../../../org.openembedded.dev/packages/uclibc/elf2flt_svn.bb +3 -2
@@ -9,7 +9,8 @@
 
 S = "${WORKDIR}/${PN}"
 
-EXTRA_OECONF = " --with-libbfd=${STAGING_DIR}/${TARGET_SYS}/lib/libbfd.a \
-                 --with-libiberty=${STAGING_DIR}/${TARGET_SYS}/lib/libiberty.a \
+EXTRA_OECONF = " --with-libbfd=${STAGING_LIBDIR_NATIVE}/libbfd.a \
+                 --with-libiberty=${STAGING_LIBDIR_NATIVE}/libiberty.a \
                  --with-bfd-include-dir=${STAGING_DIR}/${TARGET_SYS}/include \
                "
+
binutils-2.18/binutils-uclibc-configure-add-libm.patch renamed from ../../../org.openembedded.dev/packages/binutils/binutils-2.18/binutils-uclibc-configure-add-libm.patch +12 -0
diff -Naur ../../../../org.openembedded.dev/packages/binutils/binutils-2.18/binutils-uclibc-configure-add-libm.patch ./binutils-2.18/binutils-uclibc-configure-add-libm.patch
@@ -0,0 +1,12 @@
+*** binutils-2.18/gas/configure.orig	2007-11-08 10:44:45.000000000 +0100
+--- binutils-2.18/gas/configure	2007-11-08 10:43:50.000000000 +0100
+*************** _ACEOF
+*** 12855,12860 ****
+--- 12855,12861 ----
+  fi
+  done
+  
++ need_libm=yes
+  # do we need the math library?
+  case "${need_libm}" in
+  yes)
binutils.inc renamed from ../../../org.openembedded.dev/packages/binutils/binutils.inc +5 -0
@@ -84,9 +84,14 @@
 	install -m 0644 ${S}/include/dis-asm.h ${STAGING_INCDIR}/
 	install -m 0644 ${S}/include/symcat.h ${STAGING_INCDIR}/
 	install -m 0644 ${S}/include/libiberty.h ${STAGING_INCDIR}/
+	install -m 0644 ${S}/include/filenames.h ${STAGING_INCDIR}/
 	install -m 0644 ${S}/include/ansidecl.h ${STAGING_INCDIR}/
 	install -m 0644 ${S}/include/bfdlink.h ${STAGING_INCDIR}/
 	install -m 0644 bfd/bfd.h ${STAGING_INCDIR}/
+    
+    mkdir -p ${STAGING_INCDIR}/elf
+	install -m 0644 ${S}/include/elf/arm.h ${STAGING_INCDIR}/elf
+	install -m 0644 ${S}/include/elf/reloc-macros.h ${STAGING_INCDIR}/elf
 }
 
 do_install () {
binutils-cross.inc renamed from ../../../org.openembedded.dev/packages/binutils/binutils-cross.inc +3 -0
@@ -10,6 +10,9 @@
 
 do_stage () {
 	oe_runmake install
+   
+    oe_libinstall -a -C ${B}/libiberty libiberty ${STAGING_LIBDIR_NATIVE}/
+    oe_libinstall -a -C ${B}/bfd libbfd ${STAGING_LIBDIR_NATIVE}/
 
 	# We don't really need these, so we'll remove them...
 	rm -rf ${CROSS_DIR}/lib/ldscripts
binutils_2.18.bb renamed from ../../../org.openembedded.dev/packages/binutils/binutils_2.18.bb +1 -0
@@ -11,6 +11,7 @@
      file://binutils-uclibc-300-001_ld_makefile_patch.patch;patch=1 \
      file://binutils-uclibc-300-006_better_file_error.patch;patch=1 \
      file://binutils-uclibc-300-012_check_ldrunpath_length.patch;patch=1 \
+     file://binutils-uclibc-configure-add-libm.patch;patch=1 \
      "
 
 # powerpc patches
#4 lore raw
In reply to Sergey 'Jin' Bostandzhyan

Hi Jin,

2008/2/14, Sergey 'Jin' Bostandzhyan <[email protected]>:

Quoted 1 line

Hi,

sic

Quoted 4 lines

uClibc is also already supported by OE, not sure if I would have to add an option for uC-libc.

Although uC-libc is not so "up to date" I think it can be important to device with small flash memory (like Netburn MOD5272) since it create smallest binary footprint.

Quoted 10 lines

So basically it seems that almost everything that is needed is already there.

What is missing?

- applying elf2flt processing to produced binaries

- have a way of knowing that the particular build is done for the uClinux targets (maybe for some tweaks in .bb files if required or to apply patches only when necessary, allthough ifdef __uClinux__ defines could be used)

Quoted 9 lines

- not sure what else?

I do not have any uClinux experience yet, and it seems to be quite difficult to gather all the bits and pieces of information, so I'd appreciate comments and suggestions, especially if you see that I am missing something.

I'd also be interested in your thoughts on what would be the best way to integrate it into OE.

Do you add all kernels supported by uClinux distro (2.0.x, 2.4.x and 2.6.x) ?

I think your idea to add uClinux support on OE is fantastic!

Quoted 10 lines

Kind regards,
Jin

_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-devel

#5 lore raw

Hi,

Quoted 6 lines · Alan Carvalho de Assis
Quoted 3 lines

uClibc is also already supported by OE, not sure if I would have to add an option for uC-libc.

Although uC-libc is not so "up to date" I think it can be important to device with small flash memory (like Netburn MOD5272) since it create smallest binary footprint.

I will probably start with uClibc since it's already in OE, I am not sure if my project requires uC-libc, I guess I will look at that when I get a little further.

Quoted 9 lines
Quoted 7 lines

I do not have any uClinux experience yet, and it seems to be quite difficult to gather all the bits and pieces of information, so I'd appreciate comments and suggestions, especially if you see that I am missing something.

I'd also be interested in your thoughts on what would be the best way to integrate it into OE.

Do you add all kernels supported by uClinux distro (2.0.x, 2.4.x and 2.6.x) ?

I will focus on 2.6.x, I do not have any hardware to test with the older kernels and the project I am working on also requires a 2.6.x version.

Quoted 1 line

I think your idea to add uClinux support on OE is fantastic!

Let's hope we succeed in doing so :)

Kind regards,
Jin