Hush cant replace lash for my situation

Denys Vlasenko vda.linux at googlemail.com
Sun Jan 6 03:52:23 UTC 2008


On Friday 04 January 2008 19:48, Martinb_ARM_NOMMU_KISSDVD wrote:
> First I have to say that I need to make a small change to some file before I
> can crosscompile busybox
> So I will give you the exact way I compile busybox so I will not forget some
> part (I’m not a skilled user so its possible I make a stupid error on the
> first part)
> 
> 1- decompress busybox (1.9.0) on my linux fedora
> 2- with make menuconfig I deselect all except the hush (config is included)
> 3- run the following line to compile:
> 
>  make ARCH=arm CROSS_COMPILE=arm-uclinux-elf-
> EXTRA_CFLAGS="-D__uClinux__ -DBB_NOMMU -DSKIP_STRIP=y"
> LDFLAGS="-Wl,-elf2flt" install
> 
> and after some time this will give me the following error:
> 
> ==========
> /usr/local/cross-arm/20050902/lib/gcc/arm-uclinux-elf/3.4.3/../../../../arm-
> uclinux-elf/bin/ld.real: --gc-sections and -r may not be used together
> collect2: ld returned 1 exit status
> make: *** [busybox_unstripped] Fout 1
> ==========
> 
> 4- I remove the first 3 --gc-sections i find in the /scripts/trylink
> 5- it now finish compiling and linking
> 
> on older versions I needed much more modifications (disable strip etc) and I
> don’t think this modifications is the source of the problem, but please if
> there is a more elegant way to compile please let me know

It seems you do everything right, apard from -DBB_NOMMU. busybox does
not expect that variable to be set like that. I typically
just replace 

#if defined __UCLIBC__ && __UCLIBC_MAJOR__ >= 0 && __UCLIBC_MINOR__ >= 9 && \
    __UCLIBC_SUBLEVEL__ > 28 && !defined __ARCH_USE_MMU__

by

#if 1

in platform.h.

Try doing that, and not passing -DBB_NOMMU.
This is unlikely to be a reason for your problems, tho.

On the more extended note, I think it makes sense for you to learn
how to build YOUR OWN uclibc and toolchain instead of using
pre-packaged one. This can help checking whether this is a bug
in older uclibc, etc.

Start from:

http://busybox.net/~vda/HOWTO_bbox_with_uclibc.txt

I will try to help you if you hit a problem;
this will also help making this HOWTO more solid.
If you will do it and need to ask questions,
start a new thread (do not reply to this message).

> I cant really use the same config because I have to use "build busybox as
> static binary" for the ARM
> 
> But if I remove that option from i386 then it compiling and running ok on my
> linux

I built busybox against uclibc-0.9.29 for x86 with your .config
(with NOMMU hacked to 1) and it works for me
(my uclibc's .config is different, though).
 
> about the other questions I hope I can give the correct answer:
>
> >Which libc do you build against?
> >If it is uclibc, post uclibc .config.
> 
> I don’t really know for sure
> I guess its uclibc 0.9.26

Quite old.

> I did create the toolchain from a script I got from some developer
> (I can send the buildscript if someone is interested, its 21KB)
> I did include  the uclibc .config (renamed to uclibc.config)
> Also the .config file (renamed to bus.config)
> 
> Some (probably unnecessary) thoughts I have about this
> 
> 1- almost all the applets do work for me so its not a "simple" error in the
> toolchain
> 2- if it is the toolchain why does the lash script does work for me (for a
> active shell)
> 3- the hush does work for scripting , it just don’t work as a shell
> 4- some commands do work (like help and cd so all internal commands do work)
> 5- its not a "console screen problem" , all external command just give me a
> new console line and just don’t get executed
> 
> I think its related to the fact I don’t have a MMU but then why I’m the only
> person with this problem ?

Well, for me NOMMU build works.

Let's try to figure out what's going on (where it hits the problem).

hush.c has the following at the top:

/* If you comment out one of these below, it will be #defined later
 * to perform debug printfs to stderr: */
#define debug_printf(...)        do {} while (0)
/* Finer-grained debug switches */
#define debug_printf_parse(...)  do {} while (0)
#define debug_print_tree(a, b)   do {} while (0)
#define debug_printf_exec(...)   do {} while (0)
#define debug_printf_jobs(...)   do {} while (0)
#define debug_printf_expand(...) do {} while (0)
#define debug_printf_clean(...)  do {} while (0)

Comment out define debug_printf_exec:

//#define debug_printf_exec(...)   do {} while (0)

and rebuild busybox.

Now run it and type "ls". For me, it shows this:

$ ls
parse_stream_outer: run_list
run_list entered
: run_list_real with 1 members
run_list_real start lvl 1
: rword=0 if_code=0 next_if_code=0 skip_more=12
: run_pipe_real with 1 members
run_pipe_real start: single_fg=1
: pipe member 'ls' '(null)'...
execing 'ls'
AUTHORS                 TODO_config_nommu       console-tools           ipsvd                   runit
Config.in               applets                 coreutils               libbb                   scripts
INSTALL                 arch                    debianutils             libpwdgrp               selinux
LICENSE                 archival                docs                    loginutils              shell
Makefile                busybox                 e2fsprogs               miscutils               sysklogd
Makefile.custom         busybox_ldscript        editors                 modutils                testsuite
Makefile.flags          busybox_old             examples                networking              util-linux
Makefile.help           busybox_unstripped      findutils               procps
README                  busybox_unstripped.map  include                 ps1
TODO                    busybox_unstripped.out  init                    ps2
run_pipe_real return -1
: checkjobs returned 0
: setting last_return_code=0
: rword=0 if_code=0 next_if_code=0 skip_more=12
run_list_real lvl 1 return 0
run_list return 0
$

What do you see?
--
vda



More information about the busybox mailing list