Hi guys,
  I've done more work with trying to get sh to work but to no avail. I have 
made the 
hello world test from the busybox FAQ at http://busybox.net/FAQ.html#init and 
hello world 
works.

So, I decided to make an execl() program to see whether spawning /bin/sh 
directy will 
actually do anything. I put init=/bin/testit as one of the LINUX boot options.

(Note: the program has been tested on UBUNTU and it does work as expected.) 
First do a 
"ls" exec() as a check

testit.c
********************************************
#include <stdio.h>
#include <unistd.h>

int main()
{
  fprintf(stderr, "Launching ...\n");
  execl("/bin/ls", "/bin/ls", "-r", "-t", 
"-l", NULL);
  //  execl("/bin/sh", "/bin/sh", NULL);

    fprintf(stderr, "Done!!!!\n");
  sleep(999999999);
  return 0;
}
********************************************
and the result is:
********************************************
RAMDISK: gzip image found at block 0                                            
          
                         
VFS: Mounted root (ext2 filesystem) readonly on device 1:0.                     
          
                         
Freeing init memory: 84K                                                        
          
                         
Launching ...                                                                   
          
                         
drwxrwxr-x    3 root     root          1024 Nov 30  2011 var                    
          
                         
drwxr-xr-x    2 root     root          1024 Jan  7  2012 sys                    
          
                         
drwxrwxr-x    2 root     root          1024 Jan  7  2012 root                   
          
                         
drwxrwxr-x    2 root     root          1024 Jan  7  2012 proc                   
          
                         
drwxrwxr-x    2 root     root          1024 Jan  7  2012 opt                    
          
                         
drwxrwxr-x    6 root     root          1024 Jan  7  2012 usr                    
          
                         
drwxrwxrwt    3 root     root          1024 Jan  7  2012 tmp                    
          
                         
drwxr-xr-x    3 root     root          1024 Jan  7  2012 mnt                    
          
                         
drwxrwxr-x    4 root     root          1024 Jan  7  2012 home                   
          
                         
drwxr-xr-x    6 root     root          3072 Jan  7  2012 dev                    
          
                         
lrwxrwxrwx    1 root     root            11 Jan 14  2012 linuxrc -> bin/busybox 
       
                            
drwxrwxr-x    2 root     root          1024 Jan 14  2012 sbin                   
          
                         
drwxrwxr-x    3 root     root          1024 Jan 14  2012 lib                    
          
                         
drwxr-xr-x    5 root     root          1024 Jan 14  2012 etc                    
          
                         
drwxrwxr-x    2 root     root          2048 Jan 14  2012 bin                    
          
                         
drwx------    2 root     root        139264 Jan 14  2012 lost+found             
          
                         
s3c24xx_serial_stop_rx: port=c01e8058    
Kernel panic - not syncing: Attempted to kill init!
            
*******************************************************************

Notice serial port stopping and kernel panic at the end. Why?

Now, I try spawning /bin/sh by commenting out the /bin/ls line:

********************************************************

#include <stdio.h>
#include <unistd.h>

int main()
{
  fprintf(stderr, "Launching ...\n");
  //execl("/bin/ls", "/bin/ls", "-r", "-t", 
"-l", NULL);
    execl("/bin/sh", "/bin/sh", NULL);

    fprintf(stderr, "Done!!!!\n");
  sleep(999999999);
  return 0;
}

****************************************************
And the results are
****************************************************

VFS: Mounted root (ext2 filesystem) readonly on device 1:0.                     
          
                         
Freeing init memory: 84K                                                        
          
                         
Launching ...                                                                   
          
                         
s3c24xx_serial_stop_rx: port=c01e8058                                           
          
                         
Kernel panic - not syncing: Attempted to kill init!                             
          
                         
s3c2410-ohci s3c2410-ohci: auto-stop root hub  

******************************************************

And there's no shell!

Any pointers?

Thanks!


_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to