Shell problem reloaded
Levend Sayar
levend.sayar at karel.com.tr
Wed Jun 13 05:59:56 UTC 2007
Hi, all and Denis,
At last I found a chance to turn back to my porting project. I was trying to
port linux on my 386 based embedded board. I stopped since I could not get a
working shell.
kernel:2.4.32
busybox:1.5.1
gcc: 3.3.3
Lastly I tried this in the kernel code init/main.c
if (open("/dev/console", O_RDWR, 0) < 0)
printk("Warning: unable to open an initial console.\n");
(void) dup(0);
(void) dup(0);
{
while (1) {
char buffer[64];
int n = read(0,buffer,sizeof(buffer));
if (n > 0)
write(1,buffer,n);
}
}
It simply echoes what I write in the console after enter pressed. This code
does NOT work. But if I change the code as
if (open("/dev/console", O_RDWR | O_NONBLOCK, 0) < 0)
it does work. If we come back to busybox, ash changes the file flag if it is
opened as non blocking (ash.c/preadfd), and therefore it turns back to first
situation namely can not get my commands and not work.
Before digging into code, I wanted to try here, hoping I can buy time a
little bit ...
TIA
_lvnd_
(^_^)
More information about the busybox
mailing list