help for beginner

lamenace
 
Posts: 17
Joined: Wed Mar 04, 2015 3:18 pm

help for beginner

Mon Sep 07, 2015 8:44 am

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

noblepepper
 
Posts: 240
Joined: Sat Nov 29, 2014 3:22 pm

Re: help for beginner

Mon Sep 07, 2015 12:51 pm

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

lamenace
 
Posts: 17
Joined: Wed Mar 04, 2015 3:18 pm

Re: help for beginner

Mon Sep 07, 2015 3:36 pm

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

noblepepper
 
Posts: 240
Joined: Sat Nov 29, 2014 3:22 pm

Re: help for beginner

Tue Sep 08, 2015 3:05 pm

Try
Code: Select all
file hello
on the box you cross compiled on. What does that show?

How did you install nano?

lamenace
 
Posts: 17
Joined: Wed Mar 04, 2015 3:18 pm

Re: help for beginner

Wed Sep 09, 2015 8:34 am

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

lamenace
 
Posts: 17
Joined: Wed Mar 04, 2015 3:18 pm

Re: help for beginner

Fri Sep 11, 2015 1:56 pm

so ?

noblepepper
 
Posts: 240
Joined: Sat Nov 29, 2014 3:22 pm

Re: help for beginner

Fri Sep 18, 2015 12:13 pm

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

lamenace
 
Posts: 17
Joined: Wed Mar 04, 2015 3:18 pm

Re: help for beginner

Mon Sep 21, 2015 10:46 am

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

noblepepper
 
Posts: 240
Joined: Sat Nov 29, 2014 3:22 pm

Re: help for beginner

Mon Sep 21, 2015 12:19 pm

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 post

I 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.

lamenace
 
Posts: 17
Joined: Wed Mar 04, 2015 3:18 pm

Re: help for beginner

Tue Sep 22, 2015 7:38 am

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

Next
Return to VoCore & VoCore+Dock

Who is online

Users browsing this forum: No registered users and 1 guest