[BusyBox] console problem?
du chunlei
chunlei.du at samsung.com
Mon May 10 04:50:09 UTC 2004
Hi all,
I built a ramdisk based on BusyBox-1.00-pre8.
Linux-2.4.20 can work with it soomthly.
However linux-2.6.0 went wrong. I made a workaround by making following
modifications in Busybox source codes. Since the ramdisk can work with
Linux-2.4.20 without any modifications. I have been struggling
against this problem for a long period and look forward to any hints.
Following is what modifications I have made and the corresponding results.
After I added a few message() statements to somewhere in init_main() function
in init/init.c like followings, it began to work partly, but the shell
could not exit successful.
/* Figure out where the default console should be */
console_init();
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//$$$$$$$$$$$$$ I added following message() $$$$$$$
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
message(CONSOLE, "\r After console_init() and before close(0/1/2)!\n");
/* Close whatever files are open, and reset the console. */
close(0);
close(1);
close(2);
if (device_open(console, O_RDWR | O_NOCTTY) == 0) {
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//$$$$$$$$$$$$$ I added following message() $$$$$$$
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
message(CONSOLE, "\rbefore set_term()!\n");
set_term(0);
close(0);
}
Then I added a few out1str() statements in exitshell() function in shell/ash.c
like followings, it could exit successful and everything seemed ok.
void
exitshell(void)
{
struct jmploc loc;
char *p;
int status;
int jmp;
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//$$$$$$$$$$$$$ I added following out1str $$$$$$$$$
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
out1str("Entered exitshell()!\n");
jmp = setjmp(loc.loc);
status = exitstatus;
TRACE(("pid %d, exitshell(%d)\n", getpid(), status));
if (jmp)
goto out;
handler = &loc;
if ((p = trap[0]) != NULL && *p != '\0') {
trap[0] = NULL;
evalstring(p);
}
flushall();
#ifdef CONFIG_FEATURE_COMMAND_SAVEHISTORY
if (iflag && rootshell) {
const char *hp = lookupvar("HISTFILE");
if(hp != NULL )
save_history ( hp );
}
#endif
out:
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
//$$$$$$$$$$$$$ I added following out1str $$$$$$$$$
//$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
out1str("Just before _exit()!\n");
_exit(status);
/* NOTREACHED */
}
Thanks in advance.
Du
More information about the busybox
mailing list