1

I have compiled Linux for NiosII. I have a filesystem in RAM. I am using busybox, buildroot to make the file system. Then the kernel is compiled with the file system previously created.

Once Linux starts if I run a command like ls (since I wanted to list the directories in the current folder) it causes SEGV (segmentation fault)

dtlinux login: root
Password: 
login[547]: root login on 'ttyJ0'

BusyBox v1.23.1 (2015-03-17 16:38:07 CDT) hush - the humble shell
Enter 'help' for a list of built-in commands.

~ # ls
SEGV
~ # 

I have no other programs developed by me in the system. I am just trying busybox 1.23.1 with hush

If I run help this happens:

~ # help
Built-in commands:
------------------
.         Run commands in a file
bg        Resume a job in the background
break     Exit from a loop
...
... (I shortened this it was to long to post)
...
wait      Wait for process
~ #

This makes me think that busybox was compiled right.

Has anyone faced a similar problem?

1 Answers1

1

Yes, the ls program is probably crashing possibly on undefined behavior, with a segmentation violation. Check that ls is not a builtin (perhaps with which ls or using echo $PATH)

Perhaps your libc (or the ls command, from coreutils maybe) was misbuilt (or some dynamic linking issue).

Try to (cross-)compile some statically linked program (maybe even some hello world) then try to copy that program to the target system then run it. If it runs, it means that the kernel is able to service some system calls and might suggest a misbuilt libc or dynamic linking issue.

(I hope you are running Linux on your desktop, since you need to be familiar with Linux to debug your issue)

Community
  • 1
  • 1
Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547
  • I wanted to be very concise in the problem I am facing. However, I can provide info that you would want. I have no program other than busybox in my system. I am running only ls, since I wanted to list the directories in the current folder. This is frustrating me because I have reviewed and tried to fix it only going through the different settings for busybox and the kernel. – David Terrazas Mar 18 '15 at 06:32