powerpc: question concerning insmod

Rob Landley rob at landley.net
Tue Jul 8 12:34:03 UTC 2008


On Thursday 03 July 2008 14:57:21 beck0778 at umn.edu wrote:
> Hello,
>
> I am attempting to build busybox-1.11.0 for powerpc. I have unsuccessfully
> tried:
>
> 1) custom-built cross compiling toolchain built with crosstool (gcc 4.1.0,
> glibc 2.3.6)
>
> 2) vendor-provided cross compiling toolchain (gcc 3.4.3, glibc 2.3.3)
>
> 3) vendor-provided native powerpc toolchain (gcc 3.4.3, glibc 2.3.3)

Well, I've got it working for PowerPC in my firmware linux project.

I haven't done a release with the new busybox version yet, so the binaries 
I've got up are old, but you could try this:

  wget http://landley.net/hg/firmware/archive/tip.tar.bz2
  tar xvjf tip.tar.bz2
  cd firmware-*
  ./build.sh powerpc

Then to get a shell prompt running under powerpc, either run the copy out of 
the build directory via:

  ./emulator-build.sh powerpc

Or extract the tarball build/system-image-powerpc.tar.bz2 somewhere and run 
one of the shell scripts out of that: run-emulator.sh just gives you a shell 
prompt, run-with-home.sh sets up a 2 gigabyte /dev/hdb disk image mounted 
on /home to give you some empty disk space to work with, and 
run-with-distcc.sh hooks up the powerpc cross compiler it build to distcc so 
when you build stuff under qemu it's merely uncomfortably slow rather than 
painfully slow.

More information at http://landley.net/code/firmware (I really need to update 
the docs and move the mailing list to the new server)...

> For all three toolchains, I get the following error messages:
>
>   CC modutils/insmod.o modutils/insmod.c: In function
> 'arch_apply_relocation': modutils/insmod.c:864: error: 'ifile' undeclared
> (first use in this function) modutils/insmod.c:864: error: (Each undeclared
> identifier is reported only once modutils/insmod.c:864: error: for each
> function it appears in.) modutils/insmod.c:836: warning: unused parameter
> 'f' make[1]: *** [modutils/insmod.o] Error 1 make: *** [modutils] Error 2
>
> I looked into the source file indicated, and it seems like the variable
> ifile is defined in this section, which does not include a " ||
> defined(__powerpc__)" condition:
>
> #if defined(__arm__) || defined(__i386__) || defined(__mc68000__) \
>
>  || defined(__sh__) || defined(__s390__) || defined(__x86_64__)
>
>         struct arch_file *ifile = (struct arch_file *) f;
> #endif

Try getting it to work without modutils first.  (I'm not using a modular 
kernel, that's probably why I haven't hit this.)  It's not a cross-compiler 
issue, it's a target architecture issue.  It doesn't look like insmod has 
been implemented/tested for PowerPC yet.

> Here it looks like USE_PLT_ENTRIES is defined for powerpc, but the ifile
> variable isn't defined for powerpc.
>
> I'm guessing that someone else has had success cross compiling
> busybox-1.11.0 for powerpc, and this is a problem with my setup. If anyone
> has run into this before, or has any suggestions, I would really appreciate
> any help.

It looks like nobody's tested insmod on powerpc recently.  (A lot of embedded 
systems use static kernels, you can have a fully working busybox without ever 
testing insmod.  My FWL project builds itself from source code using busybox 
to provide almost all of the susv3 command line utilities.  That's a pretty 
decent smoke test for busybox.  I haven't tried to rebuild powerpc under 
itself yet, but that's on the todo list...

I haven't tried it, but I'd guess it has a 50-50 chance of working fine if you 
just add __powerpc__ to the list you mentioned.

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.



More information about the busybox mailing list