[Gelöst] bash cross compilation für die Fritz!Box Wlan 3170

cryostat

Neuer User
Mitglied seit
30 Sep 2011
Beiträge
10
Punkte für Reaktionen
0
Punkte
0
Hallo allen Fritz!Box Besitzern!

Ich würde gerne bash auf meiner Box zum laufen bekommen, scheitere aber leider am cross compilen.

Ich habe mir das toolchain nach folgender Anleitung installiert und es funktioniert auch soweit: http://wehavemorefun.de/fritzbox/index.php/Cross-Compile_Toolchain

Danach habe ich die Source von bash-4.2 geladen und versucht das ganze analog zu der Anleitung für die busybox zu compilieren: http://wehavemorefun.de/fritzbox/index.php/Busybox_ersetzen#Cross-Compiling_Umgebung

Also:
Code:
export PATH=/usr/mipsel-linux-uclibc/bin:${PATH}
export CC=/usr/mipsel-linux-uclibc/bin/mipsel-linux-uclibc-gcc
export LDFLAGS=-L/usr/mipsel-linux-uclibc/lib
export CPPFLAGS=-I/usr/mipsel-linux-uclibc/include
export CPP=/usr/mipsel-linux-uclibc/bin/mipsel-linux-uclibc-cpp
export CROSS_COMPILE=mipsel-linux-uclibc- 
export ARCH=mipsel-linux

./configure

Leider scheitert das ganze mit:
Code:
checking whether the C compiler works... configure: error: in `/home/cryostat/Desktop/bash-4.2':
configure: error: cannot run C compiled programs.

Wär super wenn ihr mir sagen könntet was ich falsch machen oder ob ich irgendwas nicht beachtet hab!

Vielen Dank schon mal!

Ciao
 
Zuletzt bearbeitet:
Du könntest die bash-4.2 auch mit freetz compilieren:
Code:
...
ls -l bash
-rwxr-xr-x 1 gm users 677893  1. Okt 10:56 bash
mipsel-linux-size bash
   text    data     bss     dec     hex filename
 523248    6544   16332  546124   8554c bash
make[1]: Leaving directory `/home/gm/myfreetz/freetz7636/freetz-trunk/source/target-mipsel_uClibc-0.9.31.1/bash-4.2'
mkdir -p packages/target-mipsel_uClibc-0.9.31.1/bash-4.2/root/bin/; cp source/target-mipsel_uClibc-0.9.31.1/bash-4.2/bash packages/target-mipsel_uClibc-0.9.31.1/bash-4.2/root/bin/bash; /home/gm/myfreetz/freetz7636/freetz-trunk/toolchain/build/mipsel_gcc-4.5.3_uClibc-0.9.31.1/mipsel-linux-uclibc/bin/mipsel-linux-uclibc-strip --remove-section={.comment,.note,.pdr} packages/target-mipsel_uClibc-0.9.31.1/bash-4.2/root/bin/bash;
done.
Code:
:~/myfreetz/freetz7636/freetz-trunk> file packages/target-mipsel_uClibc-0.9.31.1/bash-4.2/root/bin/bash
packages/target-mipsel_uClibc-0.9.31.1/bash-4.2/root/bin/bash: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), dynamically linked (uses shared libs), with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x3040000, stripped
Code:
root@fritz:/var/media/ftp/uStor01/archiv# ldd ./bash
        libdl.so.0 => /lib/libdl.so.0 (0x2aabe000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2aad1000)
        libc.so.0 => /lib/libc.so.0 (0x2aaef000)
        ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)
Code:
root@fritz:/var/media/ftp/uStor01/archiv# ./bash --help
[COLOR=red][B]GNU bash, version 4.2.0(2)-release-(mipsel-unknown-linux-gnu)[/B][/COLOR]
Usage:  ./bash [GNU long option] [option] ...
        ./bash [GNU long option] [option] script-file ...
GNU long options:
        --debug
        --debugger
        --dump-po-strings
        --dump-strings
        --help
        --init-file
        --login
        --noediting
        --noprofile
        --norc
        --posix
        --protected
        --rcfile
        --verbose
        --version
Shell options:
        -irsD or -c command or -O shopt_option          (invocation only)
        -abefhkmnptuvxBCHP or -o option
Type `./bash -c "help set"' for more information about shell options.
Type `./bash -c help' for more information about shell builtin commands.
Use the `bashbug' command to report bugs.
 
Hi! Danke für die super schnelle Antwort!

Leider häng ich jetzt schon wieder. Ich habe folgendes gemacht:

Code:
677  svn co http://svn.freetz.org/tags/freetz-1.1.4/
678  cd freetz-1.1.4/
679  make menuconfig 
680  make

Jetzt bricht er aber mit folgendem error ab:

Code:
STEP 2: MODIFY
*** buffer overflow detected ***: /home/eric/Desktop/freetz/freetz-1.1.4/./tools/tar terminated
....
40543000-40544000 rw-p 0001a000 08:01 5505885    /lib/i386-linux-gnu/libgcc_s.so.1
bf98a000-bf9ab000 rw-p 00000000 00:00 0          [stack]
applying patches
ERROR: No HTML directory given.
make: *** [firmware-nocompile] Error 1

Hätte da auch noch eine Frage zum generellen verständnis. Wenn ich freetz erfolgreich kompiliert habe kopiere ich einfach bash mit den abhängigkeiten auf die Fritz!Box? Ich brauche nur bash und will freetz nich auf die Box flashen.

Danke, Ciao
 
Leider häng ich jetzt schon wieder.
Versuch mal mit dem trunk:
Code:
svn co http://svn.freetz.org/trunk freetz-trunk
Wenn ich freetz erfolgreich kompiliert habe kopiere ich einfach bash mit den abhängigkeiten auf die Fritz!Box?
Ja. Evtl. sind die Abhängigkeiten schon auf der Box vorhanden. Einfach probieren.

EDIT:


In Freetz reicht ein "make bash-precompiled". Vorher musst Du die Datei "bash.mk" anpassen:
Code:
$(call PKG_INIT_BIN, [COLOR=red][B]4.2[/B][/COLOR])
$(PKG)_SOURCE_MD5:=[COLOR=red][B]3fb927c7c33022f1c327f14a81c0d4b0[/B][/COLOR]
Die Patches aus dem Verzeichnis "make/bash/patches" musst Du löschen (oder anpassen).
 
Zuletzt bearbeitet:
Hi!

Also ich habe jetzt die stable 1.2 verwendet weil im trunk "make menuconfig" nicht funktioniert. "make bash-precompiled" ist erfolgreich durchgelaufen aber leider gibt mir bash auf der Fritz!Boxfolgende Fehlermeldung:

Code:
symbol 'stdout': can't handle reloc type 0x7e

Danke für die Hilfe!!!

EDIT:
Ok das war mein Fehler. Bin an einem anderen Rechner als zuvor.
 
Zuletzt bearbeitet:
Also ich habe jetzt die stable 1.2 verwendet weil im trunk "make menuconfig" nicht funktioniert.
In so einem Fall benutzt man nicht den aktuellen trunk. Versuch es mal mit der trunk rev. 7636. Hat bei mir funktioniert:
Code:
svn co http://svn.freetz.org/trunk freetz-trunk [COLOR=red]-r 7636[/COLOR]
 
Die letzten 5 rev. hatten auch nicht funktioniert. Wusste nicht das ich so weit zurück muss.

Jetzt hängt er leider mit folgender Fehlermeldung:
Code:
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/home/eric/Desktop/freetz/freetz-trunk/source/host-tools/fakeroot-1.17/build/biarch':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** [/home/eric/Desktop/freetz/freetz-trunk/source/host-tools/fakeroot-1.17/build/biarch/.configured] Error 77

Die log häng ich auch noch an. Danke Danke Danke!
 

Anhänge

  • config.txt
    9.8 KB · Aufrufe: 1
Das Problem mit fakeroot lag an mir. Musste bei dem 64bit Rechner noch "libc6-dev-i386" und "gcc-multilib" nachinstallieren.

Ich bin jetzt schon so weit dass ich auf der Fritz!Box folgendes bekomme:
Code:
./bash
./bash: can't load library 'libreadline.so.6'

Habe mir auch ldd kompiliert aber das will leider auch nicht:
Code:
# ./ldd -help

./ldd: symbol 'stderr': can't handle reloc type 0x7e

Wie kann ich für bash die Bibliotheken einbinden und wie finde ich raus welche ich alle brauche?
 
Wie kann ich für bash die Bibliotheken einbinden und wie finde ich raus welche ich alle brauche?
Mit "ldd /Pfad/zur/bash".
Wenn bash die "libreadline.so.6" will, dann hast Du mit readline kompiliert:
Code:
config FREETZ_PACKAGE_BASH
    bool "bash 4.2 (binary only)"
    default n
    help
        Bash is an sh-compatible command language interpreter that
        executes commands read from the standard input or from a file.
        Bash also incorporates useful features from the Korn and C
        shells (ksh and csh).(roundabout 540K minimal and 840K full featured)

config FREETZ_PACKAGE_BASH_MINIMAL
    bool "minimal config"
    depends on FREETZ_PACKAGE_BASH
    default n
    help
        This produces a shell with minimal features, close to the
        historical Bourne shell (saves ~300KB).

[COLOR=red]config FREETZ_PACKAGE_BASH_READLINE
    bool "enable command line editing and history"
    depends on FREETZ_PACKAGE_BASH
    select FREETZ_LIB_libncurses
    select FREETZ_LIB_libreadline
    select FREETZ_LIB_libhistory
    default n
    help
        Enable command line editing and history. This feature needs ncurses and readline.[/COLOR]

config FREETZ_PATCH_BASH_LOGIN_SHELL
    bool "add bash to the list of login shells"
    depends on FREETZ_PACKAGE_BASH
    default n
    help
        Add bash to /etc/shells. This allows bash to be used as a login shell.
Diese libraries sucht die bash im Verzeichnis "usr/lib/freetz":
Code:
root@fritz:/var/mod/root# find / -iname 'libreadline.so.6'
[COLOR=red]/usr/lib/freetz[/COLOR]/libreadline.so.6
Ohne Freetz auf deiner Box wird es kompiliziert. Evtl kompilierst Du die bash so, dass diese mit den libs aus der AVM-original-Firmware klar kommt:
Code:
root@fritz:/var/mod/root# [COLOR=red]ldd /var/media/ftp/uStor01/archiv/bash[/COLOR]
        libdl.so.0 => /lib/libdl.so.0 (0x2aabe000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x2aad1000)
        libc.so.0 => /lib/libc.so.0 (0x2aaef000)
        ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x2aaa8000)
 
Die Box zu freetzen würde ich gerne vermeiden. Außerdem schaffe ich es nicht einmal ein Image für meine WLAN 3170 mit bash zu erstellen ohne den Fehler "too big" zu bekommen. Auch mit allen Remove Patches.

Hatte versucht die lib nach "/usr/lib/freetz/libreadline.so.6" zu kopieren aber da meldet er mir "read only file system". Kann ich bash nicht beibringen an einem anderen Ort nach den libs zu suchen? Oder das ganze statisch zu kompilieren? Weiß leider nicht wie ich gegen die original Bibliotheken von AVM kompilieren kann.

Danke für die Geduld!
 
Oder das ganze statisch zu kompilieren?
Ja, das geht auch. Versuch es mal mit dem Paket (Patch) aus dem Anhang. Das Verzeichnis "make/bash" vorher löschen.
Code:
:~/myfreetz/freetz7636/freetz-trunk> [B]file[/B] packages/target-mipsel_uClibc-0.9.31.1/bash-4.2/root/bin/[B]bash[/B]
packages/target-mipsel_uClibc-0.9.31.1/bash-4.2/root/bin/bash: ELF 32-bit LSB executable, MIPS, MIPS32 version 1 (SYSV), [COLOR=red][B]statically linked[/B][/COLOR], with unknown capability 0xf41 = 0x756e6700, with unknown capability 0x70100 = 0x3040000, stripped
Code:
root@fritz:/var/media/ftp/uStor01/archiv# [B]ldd[/B] ./bash
        not a [COLOR=red]dynamic[/COLOR] executable
Code:
root@fritz:/var/media/ftp/uStor01/archiv# [B]./bash --help[/B]
GNU bash, version 4.2.0(1)-release-(mipsel-unknown-linux-gnu)
Usage:  ./bash [GNU long option] [option] ...
        ./bash [GNU long option] [option] script-file ...
GNU long options:
        --debug
        --debugger
        --dump-po-strings
        --dump-strings
        --help
        --init-file
        --login
        --noediting
        --noprofile
        --norc
        --posix
        --protected
        --rcfile
        --verbose
        --version
Shell options:
        -irsD or -c command or -O shopt_option          (invocation only)
        -abefhkmnptuvxBCHP or -o option
Type `./bash -c "help set"' for more information about shell options.
Type `./bash -c help' for more information about shell builtin commands.
Use the `bashbug' command to report bugs.
 

Anhänge

  • bash_4_2_static.patch.txt
    5.3 KB · Aufrufe: 9
Es funktioniert!!! Wie geil :)

Vielen Vielen Dank!!!
 

Zurzeit aktive Besucher

Statistik des Forums

Themen
244,832
Beiträge
2,219,108
Mitglieder
371,534
Neuestes Mitglied
vignajeanniegolabek
Holen Sie sich 3CX - völlig kostenlos!
Verbinden Sie Ihr Team und Ihre Kunden Telefonie Livechat Videokonferenzen

Gehostet oder selbst-verwaltet. Für bis zu 10 Nutzer dauerhaft kostenlos. Keine Kreditkartendetails erforderlich. Ohne Risiko testen.

3CX
Für diese E-Mail-Adresse besteht bereits ein 3CX-Konto. Sie werden zum Kundenportal weitergeleitet, wo Sie sich anmelden oder Ihr Passwort zurücksetzen können, falls Sie dieses vergessen haben.