Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
20 years ago

Bypass prompt for "nios2" login and password

Hi,

After uClunix boots, I would like to bypass the "nios2" login and "uClinux" password prompts and go straight to a shell prompt.

I already modified my initab file so that the console output is directed towards the serial UART instead of the JTAG UART so that the uClinux kernel will boot without requiring the "nios2-terminal" running first.

Based on information provided by smcnutt (a.k.a. Scott) in this thread:

how do i cancel uclinux user login ? (http://www.niosforum.com/forum/index.php?act=st&f=18&t=2183&hl=login)

I again modified the following line in my initab file from this:

ttys0:vt100:/bin/agetty 115200 ttys0

To this:

ttys0:vt100:/bin/sh

However, booting with this modification in place does not provide neither a login prompt or a shell prompt after all the initial boot status display traffic has passed.

I haven't tried this, but If I create an empty /etc/singleboot file will that work or is there something else I'm missing?

Any help would be appreciated.

Sincerely,

Brad.

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Brad,

    > However, booting with this modification in place does not provide neither a login prompt or a

    > shell prompt after all the initial boot status display traffic has passed.

    Sorry, my bad ... this does not work 8-P

    > I haven't tried this, but If I create an empty /etc/singleboot file will that work or is there

    > something else I'm missing?

    This does work as I have actually used this with the 1.4 release. Also, you _should_ be able to

    just add "single" to the kernel command line. Note that booting single will not execute your rc script.

    There are a few other things you can do:

    1. Delete init ... in which case the kernel should simply run /bin/sh as the init process.

    2. Write your own /bin/login, that does:

    fflush (stdout);
    chdir ("/home"); /* Or whatever you want */
    execl("/bin/sh", "/bin/sh", 0);

    With the second option you can keep the stock init, inittab and have your rc script executed.

    My apologies for the bad info.

    Regards,

    --Scott
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hi Brad and Scott

    How to bypass the login stuff----------------------

    Create a project with the example init in the Microtronics dist. Change the **boot_signle(**)** function code in simpleinit.c to

    int i;

    for(i = 1; i < argc; i++) {

    if(argv && !strcmp(argv, "single")) singlearg = 1;

    }

    do_rc(); //to load the rc scripts

    fflush(stdout);

    chdir("/home"); //or what ever

    execl("/bin/sh", "/bin/sh", 0);

    return 0;

    Compile the project and copy the init.exe to your file system project. Then compile the file system project, upload and VWOALAHHH..

    You can also change the login.c file to look like Scott&#39;s sugestion.

    Have fun

    Rual
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Scott and Rual --

    It took me almost 2 weeks but I finally got around to trying the suggestion made by Rual to modify the simpleinit.c function to bypass the login prompt.

    After the specified modification was made, complied, copied to the file system, and uploaded.....vwoalahhh...no login prompt.

    Thank you both for your help.

    Brad.