Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

Problems with BusyBox

Altera_Forum
Honored Contributor II
1,403 Views

I'm trying to use busybox for my root filesystem instead of the standard filesystem. 

Following the Reference Guide I was able to create the busybox, the symlinks, the inittab and rcS file. 

In this configuration the kernel boots well, but the shell will start without the login prompt; so I tried to modify the inittab as follows 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

#::askfirst:-/bin/sh 

::respawn:/sbin/getty -L ttyS0 115200 vt100[/b] 

--- Quote End ---  

 

to get back the login prompt, but when the system boots I cannot log in with the standard username and password (nios and uClinux). 

What&#39;s wrong ? 

Furthermore, using the standard filesystem, I have built a second romfs filesystem, succesfully mounted into a custom directory (/usr/apps), but when I try to boot using the busybox and the same mount command into the rcS file (mount -t romfs /dev/mtdblock1 /usr/apps -n), I get the following 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

microtronix[mtd]: RAM probe address=0x200000 size=0x600000 

Creating 2 MTD partitions on "RAM": 

0x00000000-0x00400000 : "ROMfs" 

0x00400000-0x00500000 : "USERfs" 

microtronix[mtd]: set ROMfs to be root filesystem 

VFS: Mounted root (romfs filesystem) readonly. 

Freeing unused kernel memory: 44k freed (0x11c4000 - 0x11ce000) 

mount: Mounting /dev/mtdblock1 on /usr/apps failed: Permission denied 

/usr/apps/mytestapp: not found 

expand: from=/ramfs.img to=/dev/ram0 

.[/b] 

--- Quote End ---  

 

 

I don&#39;t know which kind of permissions I need, nor where to set them. 

 

Thanks 

Fab
0 Kudos
8 Replies
Altera_Forum
Honored Contributor II
527 Views

Hi, I&#39;m glad to hear that you got Busybox up and running alright. 

 

In regards to the whole getty situation... it sounds like the getty supplied in Busybox is the "real deal" in that it may be attempting to read a passwd file in order to authenticate users. Unfortunately, we&#39;ve never ported or tested the passwd suite under Linux for Nios or Nios II. 

 

My recommendation at this point would be to  

 

(1) Build a new filesystem project with agetty support in it. 

(2) copy over the agetty.exe file from the new filesystem project over to your project containing busybox. 

(3) modify the inittab in the filesystem project with busybox to launch agetty instead of getty. 

 

I haven&#39;t had a chance to try it but I&#39;ve got a fair amount of confidence in it succeeding. 

 

As for your second question... 

 

I&#39;m not sure why mount is giving you grief regarding permissions. Can you give me the following info? 

 

(1) are you using busybox mount? 

(2) what are the permissions for /dev/mtdblock1 and the permissions for /usr/apps?
0 Kudos
Altera_Forum
Honored Contributor II
527 Views

Hi Ken, 

thanks for replying. 

 

As you suggested I tried to put the agetty.exe into bin dir, and I modified the inittab file to use it instead of the busybox getty; I tried the following command line into inittab: 

<div class='quotetop'>QUOTE </div> 

--- Quote Start ---  

::respawn:/bin/agetty 115200 ttyS0[/b] 

--- Quote End ---  

 

but the login behavior seems to be the same,"Login incorrect". May be I&#39;m using a wrong cmd line ... (?) 

The delay between the username insert and the password request seems to be a bit greater than using the standard filesystem. 

 

As for the mount question : 

 

1) yes, I&#39;m using the busybox mount cmd 

2) the file system permissions for /dev/mtdblock1 are "brw-------" and for /usr/apps directory are "drwxr-xr-x" 

 

I built the filesystem using the NiosII IDE, but I didn&#39;t find any place there where to change files and dirs permissions. 

 

Thanks 

Fab
0 Kudos
Altera_Forum
Honored Contributor II
527 Views

Re: agetty, I&#39;ll give it a try on my end and see what type of results I get.... 

 

Re: /dev/mtdblock1, I&#39;ll talk to one of the other developers here, he&#39;s said that he&#39;s encountered a similar issue. Once I&#39;ve done that, I&#39;ll get back to you on that as well.
0 Kudos
Altera_Forum
Honored Contributor II
527 Views

I&#39;m sooo sorry. I&#39;ve been tied up with a bunch of other work these past few days at work so I haven&#39;t been able to get around to asking about the issues your facing. I&#39;ll take care of it today and get back to you.

0 Kudos
Altera_Forum
Honored Contributor II
527 Views

Thank you very much !! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/biggrin.gif

0 Kudos
Altera_Forum
Honored Contributor II
527 Views

Alright... I think I have a solution!  

 

(1) In my busybox filesystem, I added the following executables from the filesystem packages provided with the Nios II Linux distribution: 

 

<project>/target/bin/agetty.exe 

<project>/target/bin/login.exe 

 

(2) I updated my inittab to look like: 

 

::sysinit:/bin/sh /etc/init.d/rcS ::ctrlaltdel:/sbin/reboot ::shutdown:umount -a -r ::restart:/sbin/init ::respawn:/bin/agetty 115200 ttyJ0 

 

(3) rebuilt my filesystem project 

(4) uploaded my filesystem project 

 

And I got a login prompt + the usual password prompt. (username = nios, password = uClinux) 

 

--- 

 

Notes: 

 

To get your hands on the usual agetty and login executables, the easiest thing to do would be to create a filesystem project with all packages installed. At that point, you can pick and choose which executables to copy over to your filesystem project with busybox installed. 

 

My default console is ttyJ0, but you can mod that to be ttyS0 if you&#39;re using an Altera avalon uart as your default console. 

 

Finally, I think you can use the busybox version of getty as long as you use the login.exe from the filesystem packages provided with the Nios II Linux Distribution. If you use a different login executable, it may attempt to reference the passwd file which isn&#39;t supported at this time. 

 

Good luck, and let me know how it goes.
0 Kudos
Altera_Forum
Honored Contributor II
527 Views

Wow, it works fine !! 

 

I also tried the same way for the mount problem: using the mount executable from the standard filesystem, instead of the busybox one, I can mount the second filesystem well. 

This is enough for me to start using a busybox based filesystem. 

 

Thanks a lot ! http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/tongue.gif  

Fab
0 Kudos
Altera_Forum
Honored Contributor II
527 Views

Great to hear! Good luck with your project. http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/smile.gif

0 Kudos
Reply