Page 1 of 3
help for beginner
Posted: Mon Sep 07, 2015 8:44 am
by lamenace
Hi,
I've setup my crosscompiling toolchain and copy the hello executable to my vocore. File is chmoded +x but when I type ./hello it says command not found
Looks like busybox is playing with me.
How to exec external programs ?
I've installed nano, and I have the same problem with it
Re: help for beginner
Posted: Mon Sep 07, 2015 12:51 pm
by noblepepper
Did you put hello in the root directory? i.e. what does
- Code: Select all
ls -l /hello
show?
You may want to check out
this post
Re: help for beginner
Posted: Mon Sep 07, 2015 3:36 pm
by lamenace
it shows
root@OpenWrt:~# ls -al
drwxr-xr-x 1 root root 0 Sep 7 14:47 .
drwxr-xr-x 1 root root 0 Jan 1 1970 ..
-rwxr-xr-x 1 root root 6522 Sep 7 09:16 hello
Re: help for beginner
Posted: Tue Sep 08, 2015 3:05 pm
by noblepepper
Try
- Code: Select all
file hello
on the box you cross compiled on. What does that show?
How did you install nano?
Re: help for beginner
Posted: Wed Sep 09, 2015 8:34 am
by lamenace
hello: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked (uses shared libs), not stripped
I installed nano using : opkg install nano
Re: help for beginner
Posted: Fri Sep 11, 2015 1:56 pm
by lamenace
so ?
Re: help for beginner
Posted: Fri Sep 18, 2015 12:13 pm
by noblepepper
I lost the CPU on my development box, couldn't compile anything, all better now
I just compiled a basic openwrt (released version of chaos calmer) and then followed Vonger's
instructions.
file gives me this:
- Code: Select all
file hello
hello: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, dynamically linked, interpreter /lib/ld-uClibc.so.0, not stripped
However, there are several file versions about, run this to see if you have the same as I do:
- Code: Select all
file -v
file-5.22
magic file from /etc/magic:/usr/share/misc/magic
See if compiling with the --static flag gives you an executable that works, if it does there is something wrong with your libraries.
- Code: Select all
./staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-gcc --static -g hello.c -o hello
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
mipsel-openwrt-linux-gcc: warning: environment variable 'STAGING_DIR' not defined
$ file hello
hello: ELF 32-bit LSB executable, MIPS, MIPS32 rel2 version 1, statically linked, not stripped
Re: help for beginner
Posted: Mon Sep 21, 2015 10:46 am
by lamenace
file-5.14
magic file from /etc/magic:/usr/share/misc/magic
I will try the static build, maybe it will take time, because I think I've fucked my system :/ need to reflash it
And how do you have uClibc toolchain ? I did a crosscompiling environment like on the wiki and I only have musl toolchain
Re: help for beginner
Posted: Mon Sep 21, 2015 12:19 pm
by noblepepper
The version or magic file is probably why file is not showing as much information as I get. I use debian 8.1 which installs file 5.22. In any case linking against a library that isn't on the target will definitely cause problems.
And how do you have uClibc toolchain ? I did a crosscompiling environment like on the wiki and I only have musl toolchain
I think a more relevant question is how you got a musl toolchain. You are not the first, see
this postI started working on a topic about setting up a development environment from start to finish on my
wiki but got sidetracked trying figure out how my hosting company hosed the icons.
Until I get that done I recommend using the new stable release of openwrt. If you install git on your development box you can get started with:
- Code: Select all
git clone git://git.openwrt.org/15.05/openwrt.git
./scripts/feeds update -a
./scripts/feeds install -a
Change the firmware size in targets/linux/ramips/dts/VOCORE.dts from
- Code: Select all
partition@50000 {
label = "firmware";
reg = <0x50000 0x7b0000>;
};
to
- Code: Select all
partition@50000 {
label = "firmware";
reg = <0x50000 0xfb0000>;
};
then use make menuconfig to set everything up how you want it. The most important settings are
- Code: Select all
Target System (Ralink RT288x/RT3xxx)
Subtarget (RT3x5x/RT5350 based boards)
Target Profile (VoCore)
I recommend marking LUCI as part of the image (with a * not a m) so it is available after you flash the image.
Re: help for beginner
Posted: Tue Sep 22, 2015 7:38 am
by lamenace
Ok so I did a test compiling the hello sample with musel-gcc using static lib. It's WORKING!!!
So default image is using musl library, that explain why all the package I installed did not work