Transplantation of Uclinux-2008r1-rc8 (bf561) to VDSP5 (58)

Source: Internet
Author: User

Uclinux-2008r1-rc8 (bf561) to VDSP5 Transplant (MB): Unable to open an initial console blog.

Encountered a depressed problem, prompted "Unable to open a initial console" after no later.

The location where this error occurred is searched, in the Init_post function:

if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
 printk(KERN_WARNING "Warning: unable to open an initial console./n");

Just started to think that is not the reason for the correct establishment of/dev/console, but after tracking in to find not so,/dev/console has been correctly created, the problem appears in the Tty_open function.

In this function, it first obtains the tty_driver of the console:

if (device == MKDEV(TTYAUX_MAJOR,1)) {
 driver = console_device(&index);
 if (driver) {
  /* Don't let /dev/console block */
  filp->f_flags |= O_NONBLOCK;
  noctty = 1;
  goto got_driver;
 }
 mutex_unlock(&tty_mutex);
 return -ENODEV;
}

Look at the implementation of the Console_device:

/*
 * Return the console tty driver structure and its associated index
 */
struct tty_driver *console_device(int *index)
{
     struct console *c;
     struct tty_driver *driver = NULL;

     acquire_console_sem();
     for (c = console_drivers; c != NULL; c = c->next) {
         if (!c->device)
              continue;
         driver = c->device(c, index);
         if (driver)
              break;
     }
     release_console_sem();
     return driver;
}

It looks for all available console, finds a console that provides Tty_driver, and returns. In the kernel, the actual console used is described by the global variable Bfin_serial_console (DRIVERS/SERIAL/BFIN_5XX.C). The device callback function is provided in this structure to obtain the tty_driver used by this console:

static struct console bfin_serial_console = {
     .name         = BFIN_SERIAL_NAME,
     .write        = bfin_serial_console_write,
     .device       = uart_console_device,
     .setup        = bfin_serial_console_setup,
     .flags        = CON_PRINTBUFFER,
     .index        = -1,
     .data         = &bfin_serial_reg,
};

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.