안녕하세요,

저희가 만든 보드에 linux를 올렸고 요즘 USB keyboard와 LCD를 이용해서 LCD 창에 console을 띄어 보려고 하는데요,

(사실 지난 번에 유영창 사장님 도움도 받았습니다.. 현재 USB memory는 붙는데 keyboard와 terminal 연결이 안되네요..)

몇 가지만 여쭤 봅니다. 아시는 분은 쉬운 내용일 것 같은데요..

 

1. busybox 시작하면서 console_init()이라는 부분이 있는데 거기서 CONSOLE 또는 console 이라는 환경변수를 검사하는데요,

print해 보면 CONSOLE이나 console은 모두 null입니다. 강제로 ramdisk의 /sbin/init 에 export console=/dev/tty2 라고 해 주고 busybox init해 주면 console 값이 /dev/tty2로 보이기는 하는데 원래 그렇게 하는 것인가요?

2. 그리고 linux kernel 시작하면서 boot argument에서 "console=ttyS0,.." 라고 넘겨 주는데 이것은 busybox로 넘어가는 값이 아닌가 보네요?

3. 그리고 console support on frame buffer 등을 kernel config에 추가한 상태로 했을 때 LCD에 console을 특정 /dev/tty?로 어떻게 정해 주는 것인가요?

 

참고로 아래는 busybox의 console_init() 부분입니다.

 

static void console_init(void)
{  
#ifdef VT_OPENQRY
    int vtno;
#endif
    char *s;
   
    s = getenv("CONSOLE");
    if (!s)
        s = getenv("console");
    if (s) {
        int fd = open(s, O_RDWR | O_NONBLOCK | O_NOCTTY);
        if (fd >= 0) {
            dup2(fd, STDIN_FILENO);
            dup2(fd, STDOUT_FILENO);
            xmove_fd(fd, STDERR_FILENO);
        }
        dbg_message(L_LOG, "console='%s'", s);
    } else {
        /* Make sure fd 0,1,2 are not closed
         * (so that they won't be used by future opens) */
        bb_sanitize_stdio();
// Users report problems
//      /* Make sure init can't be blocked by writing to stderr */
//      fcntl(STDERR_FILENO, F_SETFL, fcntl(STDERR_FILENO, F_GETFL) | O_NONBLOCK);
    }

    s = getenv("TERM");
#ifdef VT_OPENQRY
    if (ioctl(STDIN_FILENO, VT_OPENQRY, &vtno) != 0) {
        /* Not a linux terminal, probably serial console.
         * Force the TERM setting to vt102
         * if TERM is set to linux (the default) */
        if (!s || strcmp(s, "linux") == 0)
            putenv((char*)"TERM=vt102");
        if (!ENABLE_FEATURE_INIT_SYSLOG)
            log_console = NULL;
    } else
#endif 
    if (!s)
        putenv((char*)"TERM=" CONFIG_INIT_TERMINAL_TYPE);
}