2010-03-24 12:14:56     Add Aplicattions to Kernel

Document created by Aaronwu Employee on Aug 21, 2013
Version 1Show Document
  • View in full screen mode

2010-03-24 12:14:56     Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 87669   

 

Hi guys, I am trying to add pulseaudio or icecast to the uclinux kernel(2009 version) so they can add as a server for MPD. Can anyone help me with adding these applications to the kernel? I have already went trough the documentation wiki, but I am not sure of what to put in the Makefile for each application (the same goes for the libraries on which these programs depend on).

 

 

 

Thank You

QuoteReplyEditDelete

 

 

2010-03-24 12:47:21     Re: Add Aplicattions to Kernel

Mike Frysinger (UNITED STATES)

Message: 87672   

 

since those packages are normal configure + make systems, it should be easy.  look at something like lib/lzo/ as a simple example.

QuoteReplyEditDelete

 

 

2010-03-24 14:07:26     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 87673   

 

I went to lib/lzo as you told, and copied that makefile to the folder of the libraries i wanted to add (and changed the name of the file from lib-lzo to the name of the new library). I have tried this with 2 different libraries, but when i do make libsamplerate_single(for example) I get these errors:

 

make[4]: *** No rule to make target `../../libsamplerate-0.1.7/tests/Makefile.am', needed by `../../libsamplerate-0.1.7/tests/Makefile.in'. Stop.

make[4]: Leaving directory `/home/renatolas/blackfinwork/uClinux-dist/lib/libsamplerate/build-libsamplerate-0.1.7/tests'

make[3]: *** [install-recursive] Error 1

make[3]: Leaving directory `/home/renatolas/blackfinwork/uClinux-dist/lib/libsamplerate/build-libsamplerate-0.1.7'

make[2]: *** [all] Error 2

make[2]: Leaving directory `/home/renatolas/blackfinwork/uClinux-dist/lib/libsamplerate'

make[1]: *** [libsamplerate_only] Error 2

make[1]: Leaving directory `/home/renatolas/blackfinwork/uClinux-dist/lib'

make: *** [lib/libsamplerate_only] Error 2

 

 

 

 

what can be wrong?

 

 

 

Thank you

QuoteReplyEditDelete

 

 

2010-03-24 16:20:04     Re: Add Aplicattions to Kernel

Mike Frysinger (UNITED STATES)

Message: 87675   

 

no idea.  sounds like a bug in libsamplerate itself.  did you remove the Makefile.am or something ?

QuoteReplyEditDelete

 

 

2010-03-24 19:54:36     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 87677   

 

nope I have not touched either Makefile.am or Makefile.in ..

 

But similiar errors happen when I try to add other libraries tan limsamplerate

QuoteReplyEditDelete

 

 

2010-03-25 13:00:47     Re: Add Aplicattions to Kernel

Mike Frysinger (UNITED STATES)

Message: 87696   

 

i just tried libsamplerate myself and it worked fine, so i dont know you did it.  ive added it to svn trunk.

QuoteReplyEditDelete

 

 

2010-04-12 05:59:24     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 88321   

 

Hi, I have gathered all the dependencies and was able to configure pulseaudio and icecast folders, using CC=bfin/uclinux/gcc ./configure -- host=bfin-linux-uclibc

 

But now i dont know how to do the Makefiles for them.

 

-Am I supposed to install these applications in uClinux-dist/user/icecast(or pulseaudio) and then write the makefiles?

 

-Or I just need to copy those folder to uClinux-dist and put a makefile next to them?

 

-And what should I put on these makefiles, so that I can use these applications when I boot the board?(I am using BF533-Stamp)

 

 

 

Thank you

QuoteReplyEditDelete

 

 

2010-04-12 08:27:37     Re: Add Aplicattions to Kernel

Mike Frysinger (UNITED STATES)

Message: 88329   

 

every app should have it's own user/foo/ folder.  every app should also have a small makefile that takes care of compiling/installing it.  look at any of the existing user/*/Makefile's as examples.  you need to support the targets: all clean romfs

QuoteReplyEditDelete

 

 

2010-04-12 09:32:11     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 88331   

 

So for normal aplications wich have a makefile included, a makefile like

 

VER = (application folder)

 

all: $(VER)/Makefile

    $(MAKE) -C $(VER)

clean:

    $(MAKE) -C $(VER) clean

romfs:

    $(MAKE) -C $(VER) romfs

 

.PHONY: all clean romfs

 

 

 

Would be sufficient?

QuoteReplyEditDelete

 

 

2010-04-12 09:44:19     Re: Add Aplicattions to Kernel

Mike Frysinger (UNITED STATES)

Message: 88334   

 

it depends on the application.  for makefile-only (no configure), the all/clean steps will probably work.  that romfs target wont though -- *you* have to define the romfs steps.  the packages will have no idea what "romfs" means.

QuoteReplyEditDelete

 

 

2010-04-12 12:14:18     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 88338   

 

And how do I do that? from what I have seen from other Makefiles the only thing that is different is something like

 

romfs:

    $(ROMFSINST) -d $(STAGEDIR)/usr/bin/(applicationname) /usr/bin/(applicationname)

 

 

or

QuoteReplyEditDelete

 

 

2010-04-12 12:22:54     Re: Add Aplicattions to Kernel

Mike Frysinger (UNITED STATES)

Message: 88339   

 

that's what you have to do

QuoteReplyEditDelete

 

 

2010-04-14 12:18:25     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 88422   

 

Thank you, I now have icecast on the board. But I am having another problem when I try to make an image with pulseaudio, i cant compile libsndfile. I am able to configure using CC=bfin-uclinux-gcc ./configure --host=bfin-linux-uclibc but when i hit make i get the following:

 

 

make[4]: Entering directory `/home/renato/uClinux-dist/lib/libsndfile/build-libsndfile-1.0.21/examples'

 

  LINK  sfprocess

 

  LINK  list_formats

 

  LINK  make_sine

 

  LINK  generate

 

make_sine.o: In function `main':

 

../../libsndfile-1.0.21/examples/make_sine.c:69: undefined reference to `_sf_open'

 

../../libsndfile-1.0.21/examples/make_sine.c:89: undefined reference to `_sf_write_int'

 

../../libsndfile-1.0.21/examples/make_sine.c:91: undefined reference to `_sf_strerror'

 

../../libsndfile-1.0.21/examples/make_sine.c:93: undefined reference to `_sf_close'

 

collect2: ld returned 1 exit status

 

make[4]: *** [make_sine] Error 1

 

make[4]: *** Waiting for unfinished jobs....

 

list_formats.o: In function `main':

 

../../libsndfile-1.0.21/examples/list_formats.c:49: undefined reference to `_sf_command'

 

../../libsndfile-1.0.21/examples/list_formats.c:56: undefined reference to `_sf_command'

 

../../libsndfile-1.0.21/examples/list_formats.c:57: undefined reference to `_sf_command'

 

../../libsndfile-1.0.21/examples/list_formats.c:62: undefined reference to `_sf_command'

 

../../libsndfile-1.0.21/examples/list_formats.c:69: undefined reference to `_sf_command'

 

../../libsndfile-1.0.21/examples/list_formats.c:74: undefined reference to `_sf_format_check'

 

collect2: ld returned 1 exit status

 

make[4]: *** [list_formats] Error 1

 

sfprocess.o: In function `main':

 

../../libsndfile-1.0.21/examples/sfprocess.c:86: undefined reference to `_sf_open'

 

../../libsndfile-1.0.21/examples/sfprocess.c:99: undefined reference to `_sf_open'

 

../../libsndfile-1.0.21/examples/sfprocess.c:108: undefined reference to `_sf_read_double'

 

../../libsndfile-1.0.21/examples/sfprocess.c:110: undefined reference to `_sf_write_double'

 

../../libsndfile-1.0.21/examples/sfprocess.c:114: undefined reference to `_sf_close'

 

../../libsndfile-1.0.21/examples/sfprocess.c:115: undefined reference to `_sf_close'

 

../../libsndfile-1.0.21/examples/sfprocess.c:101: undefined reference to `_sf_strerror'

 

collect2: ld returned 1 exit status

 

make[4]: *** [sfprocess] Error 1

 

generate.o: In function `encode_file':

 

../../libsndfile-1.0.21/examples/generate.c:101: undefined reference to `_sf_open'

 

../../libsndfile-1.0.21/examples/generate.c:109: undefined reference to `_sf_format_check'

 

../../libsndfile-1.0.21/examples/generate.c:110: undefined reference to `_sf_close'

 

../../libsndfile-1.0.21/examples/generate.c:115: undefined reference to `_sf_open'

 

../../libsndfile-1.0.21/examples/generate.c:122: undefined reference to `_sf_write_float'

 

../../libsndfile-1.0.21/examples/generate.c:121: undefined reference to `_sf_read_float'

 

../../libsndfile-1.0.21/examples/generate.c:124: undefined reference to `_sf_close'

 

../../libsndfile-1.0.21/examples/generate.c:125: undefined reference to `_sf_close'

 

../../libsndfile-1.0.21/examples/generate.c:117: undefined reference to `_sf_strerror'

 

collect2: ld returned 1 exit status

 

make[4]: *** [generate] Error 1

 

make[4]: Leaving directory `/home/renato/uClinux-dist/lib/libsndfile/build-libsndfile-1.0.21/examples'

 

make[3]: *** [install-recursive] Error 1

 

make[3]: Leaving directory `/home/renato/uClinux-dist/lib/libsndfile/build-libsndfile-1.0.21'

 

make[2]: *** [all] Error 2

 

make[2]: Leaving directory `/home/renato/uClinux-dist/lib/libsndfile'

 

make[1]: *** [libsndfile_only] Error 2

 

make[1]: Leaving directory `/home/renato/uClinux-dist/lib'

 

make: *** [lib/libsndfile_only] Error 2

 

 

 

 

I have no Idea what is wrong, yesterday this library compiled fine.

QuoteReplyEditDelete

 

 

2010-04-14 13:21:16     Re: Add Aplicattions to Kernel

Mike Frysinger (UNITED STATES)

Message: 88424   

 

it too probably has a linker version script that needs tweaking with the ABI prefix

QuoteReplyEditDelete

 

 

2010-04-14 13:31:05     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 88426   

 

I already went to src/Symbols.linux and edited it so all functions had an underscore in the beginning but i still have tha same mistake, am I doing it in the wrong place?

QuoteReplyEditDelete

 

 

2010-04-14 13:47:16     Re: Add Aplicattions to Kernel

Mike Frysinger (UNITED STATES)

Message: 88427   

 

you need to relink things after editing the file.  the build system wont do it automatically.

QuoteReplyEditDelete

 

 

2010-04-14 14:12:57     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 88428   

 

sorry but i am very new to linux, what command shoud I use?

QuoteReplyEditDelete

 

 

2010-04-14 14:15:57     Re: Add Aplicattions to Kernel

Mike Frysinger (UNITED STATES)

Message: 88429   

 

if you want to clean things, then use `make clean`

 

QuoteReplyEditDelete

 

 

2010-04-15 09:29:15     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 88452   

 

thank you, that sorted the problem for libsndfile. But when I ran the make clean, icecast does not compile anymore. i get the error

 

/usr/lib/libvorbis.so: could not read symbols: File in wrong format

collect2: ld returned 1 exit status

 

 

From what i understand of it, libtool is looking for the libraries in /usr/lib instead of looking in my staging directory. I went to

 

https://docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:existing_libraries#using_external_libraries_from_the_staging_directory

 

And ran -isystem, used CF and LDF flags and even made the make_vendor_staging_install and still the same error. Even when I set the PKG_CONFIG_PATH to my staging/usr/lib/pkgconfig/ directory it still searches in /usr/lib. Is there anyother variable that can be used to set this right?

 

As for pulseaudio i have this error

 

../../pulseaudio-0.9.21/src/modules/module-cli.c: In function ‘module_cli_LTX_pa__init’:

../../pulseaudio-0.9.21/src/modules/module-cli.c:108: error: ‘O_CLOEXEC’ undeclared (first use in this function)

../../pulseaudio-0.9.21/src/modules/module-cli.c:108: error: (Each undeclared identifier is reported only once

../../pulseaudio-0.9.21/src/modules/module-cli.c:108: error: for each function it appears in.)

make[6]: *** [module-cli.lo] Error 1

 

 

do you know what it is?

 

Thank you

QuoteReplyEditDelete

 

 

2010-04-15 12:33:15     Re: Add Aplicattions to Kernel

Mike Frysinger (UNITED STATES)

Message: 88465   

 

for icecast, i would have to see the full log output

 

you'll have to define O_CLOEXEC yourself.  just put it into your CFLAGS:

-DO_CLOEXEC=02000000

QuoteReplyEditDelete

 

 

2010-04-15 13:34:17     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 88469   

 

I've attached the config.log for icecast and will try now to do what you said to pulseaudio

 

config.log

QuoteReplyEditDelete

 

 

2010-04-15 14:03:14     Re: Add Aplicattions to Kernel

Mike Frysinger (UNITED STATES)

Message: 88471   

 

something in the icecast configuer is adding -I and -L paths to /usr itself.  you'll have to read and fix it because all of those tests are now broken.

 

your pkg-config is also not being set to the wrapper ... the host `pkg-config` isnt going to work.

QuoteReplyEditDelete

 

 

2010-04-15 14:47:24     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 88474   

 

I have removed the makefile and went to the folder of icecast and did ./configure LDFLAGS=-'L/home/renatolas/svn/staging/usr/lib' CPPFLAGS='-I/home/renatolas/svn/staging/usr/include' --with-xslt-config='/home/renato/uClinux-dist/staging/usr/bin/xslt-config' --without-curl  --host=bfin-linux-uclibc

 

 

followed by a make and a make DESTDIR=(path to staging) install and it worked just fine. Is the application installed if I just leave it like this? As for pkgconfig i have a folder with some .pc files, i think i used to have another file called pkg-config but it has dissapeared from staging.

 

 

 

I tried adding it to pulseaudio, and I advanced further on until I encounter this:

 

pasuspender-pasuspender.o: In function `_start_child':

../../pulseaudio-0.9.21/src/utils/pasuspender.c:(.text+0x306): warning: fork: this function is not implemented on no-mmu systems

/home/renato/uClinux-dist/user/pulseaudio/build-pulseaudio-0.9.21/src/.libs/libpulsecommon-0.9.21.so: undefined reference to `_madvise'

collect2: ld returned 1 exit status

make[6]: *** [pasuspender] Error 1

make[6]: *** Waiting for unfinished jobs....

./.libs/libpulse.so: warning: fork: this function is not implemented on no-mmu systems

/home/renato/uClinux-dist/user/pulseaudio/build-pulseaudio-0.9.21/src/.libs/libpulsecommon-0.9.21.so: undefined reference to `_madvise'

collect2: ld returned 1 exit status

make[6]: *** [pactl] Error 1

./.libs/libpulse.so: warning: fork: this function is not implemented on no-mmu systems

/home/renato/uClinux-dist/user/pulseaudio/build-pulseaudio-0.9.21/src/.libs/libpulsecommon-0.9.21.so: undefined reference to `_madvise'

collect2: ld returned 1 exit status

make[6]: *** [pacat] Error 1

./.libs/libpulse.so: warning: fork: this function is not implemented on no-mmu systems

/home/renato/uClinux-dist/user/pulseaudio/build-pulseaudio-0.9.21/src/.libs/libpulsecommon-0.9.21.so: undefined reference to `_madvise'

collect2: ld returned 1 exit status

make[6]: *** [pacmd] Error 1

make[6]: Leaving directory `/home/renato/uClinux-dist/user/pulseaudio/build-pulseaudio-0.9.21/src'

make[5]: *** [install] Error 2

make[5]: Leaving directory `/home/renato/uClinux-dist/user/pulseaudio/build-pulseaudio-0.9.21/src'

make[4]: *** [install-recursive] Error 1

make[4]: Leaving directory `/home/renato/uClinux-dist/user/pulseaudio/build-pulseaudio-0.9.21'

make[3]: *** [install] Error 2

make[3]: Leaving directory `/home/renato/uClinux-dist/user/pulseaudio/build-pulseaudio-0.9.21'

make[2]: *** [all] Error 2

make[2]: Leaving directory `/home/renato/uClinux-dist/user/pulseaudio'

make[1]: *** [pulseaudio_only] Error 2

make[1]: Leaving directory `/home/renato/uClinux-dist/user'

make: *** [user/pulseaudio_only] Error 2

 

 

 

I notice during the configuration that

 

checking vfork.h usability... no

checking vfork.h presence... no

checking for vfork.h... no

checking for fork... yes

checking for vfork... yes

checking for working fork... cross

configure: WARNING: result yes guessed because of cross compilation

checking for working vfork... (cached) yes

 

 

so the cross compiler is wrongly assuming that I have working fork..

 

config.log

QuoteReplyEditDelete

 

 

2010-04-15 18:22:48     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 88480   

 

please could you help me port one of these apps to blackfin. I really needed a server to stream my output of mpd to finish my project

 

Thank you

QuoteReplyEditDelete

 

 

2010-04-15 20:27:19     Re: Add Aplicattions to Kernel

Mike Frysinger (UNITED STATES)

Message: 88481   

 

so fix the configure script or force the result with the autoconf cache variable like the other tests.  fork() wont work on nommu systems, but vfork() will.

 

madvise() is not available as it doesnt make sense.  you can simply stub it out to return 0 all the time.

#define madvise(...) 0

QuoteReplyEditDelete

 

 

2010-04-16 10:06:19     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 88523   

 

I went to the configure file of pulseaudio and changed:

 

$as_echo "#define #define HAVE_POSIX_MADVISE 0" >>confdefs.h

$as_echo "#define #define HAVE_WORKING_FORK 0" >>confdefs.h

$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h

 

 

 

on the configuration it now appears correct,

 

checking for posix_madvise... no

 

 

checking vfork.h usability... no

checking vfork.h presence... no

checking for vfork.h... no

checking for fork... yes

checking for vfork... yes

checking for working fork... no

checking for working vfork... (cached) yes

 

 

but compilation stops at the same place.

 

 

 

In Icecast I changed all the flags and it still stops in libvorbis.so, even when i do --without-libvorbis.. isn't there another way to stream an output from mpd?

QuoteReplyEditDelete

 

 

2010-04-19 09:12:56     Re: Add Aplicattions to Kernel

Bob Flat (TURKEY)

Message: 88583   

 

Mike, could you please have a look at at least one of these applications? I need to make sure that the error is not mine, or that these applications cannot be ported.

 

Thank you

QuoteReplyEditDelete

 

 

2010-04-19 11:20:46     Re: Add Aplicattions to Kernel

Mike Frysinger (UNITED STATES)

Message: 88590   

 

posix_madvise() is not the same thing as madvise()

 

as for fork(), the code base might not respect HAVE_FORK, which means you'll have to find out whether the app/lib is something you can ingore (not use the component), or something you'll have to fix (use vfork/convert to threads).

Attachments

Outcomes