rootfile system porting for FPGA [/bin/sh: can't access tty; job control turned off]
Hi, I am newbie to linux kernel,doing kernel porting on a arm926ej-s FPGA board (only timer & uart hardware is available in the board) I'm using busybox for rootfs(busy box binary is built with "static" option enabled) After file system is mounted,I can see the below message, "VFS: Mounted root (cramfs filesystem) readonly on device 1:0." "Freeing init memory: 80K" I am expecting to get to shell prompt and give some commands (ls,clear) after file system gets mounted. *I am ending up in the shell prompt with the message as below:* "entered linuxrc script" "/bin/sh: can't access tty; job control turned off / $" I am getting no response from terminal for any commands entered in the shel lafter this. I went through this FAQ in http://www.busybox.net/FAQ.html#job_control I could not follow this exactly. my kernel commad line is "mem=32M console=ttySAC0,115200 root=/dev/ram0 init=/linuxrc initrd=0x80800000,8M user_debug=31" *I could see 2 issues here:* 1. I am using shell on /dev/console which is not correct as mentioned in busybox FAQ 2. linuxrc and /etc/inittab files may not be correct. I think the problem could be in both above 2 cases. Below are my /linuxrc and /etc/inittab file contents *linuxrc: *#!/bin/sh /bin/echo "entered linuxrc script" /bin/sh exec /sbin/init * /etc/inittab:* id:3:initdefault: # System initialization. si::sysinit:/etc/rc.d/rc. sysinit l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 l3:3:wait:/etc/rc.d/rc 3 l4:4:wait:/etc/rc.d/rc 4 l5:5:wait:/etc/rc.d/rc 5 l6:6:wait:/etc/rc.d/rc 6 # Trap CTRL-ALT-DELETE ca::ctrlaltdel:/sbin/shutdown -t3 -r now # When our UPS tells us power has failed, assume we have a few minutes # of power left. Schedule a shutdown for 2 minutes from now. # This does, of course, assume you have powerd installed and your # UPS connected and working correctly. pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down" # If power was restored before the shutdown kicked in, cancel it. pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled" # Run gettys in standard runlevels 3:2345:respawn:/sbin/getty 115200 ttySAC0 Can some experts suggest how to fix this two problems and get a shell prompt working?
did u check whether /dev/console is registered...it is possible that it is not created On 07-May-2012 6:21 PM, "pcuser p" <pcuser.mails@gmail.com> wrote:
Hi, I am newbie to linux kernel,doing kernel porting on a arm926ej-s FPGA board (only timer & uart hardware is available in the board)
I'm using busybox for rootfs(busy box binary is built with "static" option enabled)
After file system is mounted,I can see the below message, "VFS: Mounted root (cramfs filesystem) readonly on device 1:0." "Freeing init memory: 80K"
I am expecting to get to shell prompt and give some commands (ls,clear) after file system gets mounted.
*I am ending up in the shell prompt with the message as below:* "entered linuxrc script" "/bin/sh: can't access tty; job control turned off / $"
I am getting no response from terminal for any commands entered in the shel lafter this.
I went through this FAQ in http://www.busybox.net/FAQ.html#job_control I could not follow this exactly.
my kernel commad line is "mem=32M console=ttySAC0,115200 root=/dev/ram0 init=/linuxrc initrd=0x80800000,8M user_debug=31"
*I could see 2 issues here:* 1. I am using shell on /dev/console which is not correct as mentioned in busybox FAQ 2. linuxrc and /etc/inittab files may not be correct.
I think the problem could be in both above 2 cases.
Below are my /linuxrc and /etc/inittab file contents *linuxrc:
*#!/bin/sh /bin/echo "entered linuxrc script" /bin/sh exec /sbin/init
* /etc/inittab:*
id:3:initdefault: # System initialization. si::sysinit:/etc/rc.d/rc. sysinit l0:0:wait:/etc/rc.d/rc 0 l1:1:wait:/etc/rc.d/rc 1 l2:2:wait:/etc/rc.d/rc 2 l3:3:wait:/etc/rc.d/rc 3 l4:4:wait:/etc/rc.d/rc 4 l5:5:wait:/etc/rc.d/rc 5 l6:6:wait:/etc/rc.d/rc 6
# Trap CTRL-ALT-DELETE ca::ctrlaltdel:/sbin/shutdown -t3 -r now
# When our UPS tells us power has failed, assume we have a few minutes # of power left. Schedule a shutdown for 2 minutes from now. # This does, of course, assume you have powerd installed and your # UPS connected and working correctly. pf::powerfail:/sbin/shutdown -f -h +2 "Power Failure; System Shutting Down"
# If power was restored before the shutdown kicked in, cancel it. pr:12345:powerokwait:/sbin/shutdown -c "Power Restored; Shutdown Cancelled"
# Run gettys in standard runlevels 3:2345:respawn:/sbin/getty 115200 ttySAC0
Can some experts suggest how to fix this two problems and get a shell prompt working?
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
my kernel commad line is "mem=32M console=ttySAC0,115200 root=/dev/ram0 init=/linuxrc initrd=0x80800000,8M user_debug=31"
Below are my /linuxrc and /etc/inittab file contents linuxrc:
#!/bin/sh /bin/echo "entered linuxrc script" /bin/sh
No need to run shell here, your /sbin/init actually points to the the busybox binary. You juts need to instruct the system to run getty on the console which will launch the login program. login will further provide you with a shell to type cmds etc.
exec /sbin/init
This should point to /bin/busybox
/etc/inittab:
# Run gettys in standard runlevels 3:2345:respawn:/sbin/getty 115200 ttySAC0
Busybox init did not used support runlevels (not sure of the latest versions). I'm running BB 1.16.2 and that has the following line for spawning getty on the console: tts/0::respawn:/sbin/getty -L tts/0 115200 Try adding this line to inittab (modify according to your setup). BTW, what version of BB are you running? HTH, -mandeep
Can some experts suggest how to fix this two problems and get a shell prompt working?
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
On Mon, May 07, 2012 at 06:21:05PM +0530, pcuser p wrote:
I am ending up in the shell prompt with the message as below: "entered linuxrc script" "/bin/sh: can't access tty; job control turned off / $"
my kernel commad line is "mem=32M console=ttySAC0,115200 root=/dev/ram0 init=/linuxrc initrd= 0x80800000,8M user_debug=31"
In my kernel command line(with busybox), init=/sbin/init, I drop commands into /etc/profile.
Below are my /linuxrc and /etc/inittab file contents linuxrc:
#!/bin/sh /bin/echo "entered linuxrc script" /bin/sh exec /sbin/init
Don't run sh before init, this makes the warning.
/etc/inittab:
# Run gettys in standard runlevels 3:2345:respawn:/sbin/getty 115200 ttySAC0
runlevels makes no sense here, but it should be OK. And, I use busybox to build the rootfs for kernel debugging: https://github.com/adam8157/kernel-studio the rootfs making script is at here right now: https://github.com/adam8157/kernel-studio/blob/master/mkrootfs Might helps. -- Regards, Adam Lee -------------------------------- E-mail: adam8157@gmail.com Website: http://adam8157.info --------------------------------
Thanks all for ur replies. I gave a try to create a new rootfile system (ext2) by following the procedure in free-electrons.com and examples in the busybox folder. Surprisingly, it got built properly and run upto the same point and doesn't accept any commands i'm typing. I haven't added serial related stuff (gettty) in the inittab/rcS file as I am still not much clear about it. *My board setup is :* I am using JTAG debugger to load the kernel and root file system (DRAM controller initilization is done through JTAG) & then kernel and rootfs are loaded. I am getting the "printk" messages in terminal program (tera-term running in PC) Since,I am not using bootloader ,I enable console prints in the call to cosole_init in start_kernel (by adding the flags CONSOLE_PRINTBUFFER | CON_ENABLED in the struct console) Once call to console_init happens,I am starting to get print messages. *My query is:* At later point after file system mounted, is this same console used for login? (i'm having only one UART port in my board -> ttySAC0) Am I getting this err (/bin/sh: can't access tty; job control turned off) because console is locked already for printk's? *What changes are needed in the inittab & /etc/init.d/rcS file to get the working shell prompt* *for this scenario*? *below are the console messages:* RAMDISK: ext2 filesystem found at block 0 RAMDISK: Loading 3072KiB [1 disk] into ram disk... \ done. VFS: Mounted root (ext2 filesystem) readonly on device 1:0. Freeing init memory: 80K */bin/sh: can't access tty; job control turned off* / # * /etc/inittab file contents* # This is run first script ::sysinit:/etc/init.d/rcS # Start an "askfirst" shell on the console ::askfirst:/bin/sh # Stuff to do when restarting the init process ::restart:/sbin/init # Stuff to do before rebooting ::ctrlaltdel:/sbin/reboot ::shutdown:/bin/umount a r */etc/init.d/rcS file contents * #!/bin/sh mount t proc none /proc mount t sysfs none /sys exec /sbin/sh /bin/sh plz suggest me the changes required to get working shell prompt.. Thanks, On Mon, May 7, 2012 at 7:31 PM, Adam Lee <adam8157@gmail.com> wrote:
On Mon, May 07, 2012 at 06:21:05PM +0530, pcuser p wrote:
I am ending up in the shell prompt with the message as below: "entered linuxrc script" "/bin/sh: can't access tty; job control turned off / $"
my kernel commad line is "mem=32M console=ttySAC0,115200 root=/dev/ram0 init=/linuxrc initrd= 0x80800000,8M user_debug=31"
In my kernel command line(with busybox), init=/sbin/init, I drop commands into /etc/profile.
Below are my /linuxrc and /etc/inittab file contents linuxrc:
#!/bin/sh /bin/echo "entered linuxrc script" /bin/sh exec /sbin/init
Don't run sh before init, this makes the warning.
/etc/inittab:
# Run gettys in standard runlevels 3:2345:respawn:/sbin/getty 115200 ttySAC0
runlevels makes no sense here, but it should be OK.
And, I use busybox to build the rootfs for kernel debugging: https://github.com/adam8157/kernel-studio the rootfs making script is at here right now: https://github.com/adam8157/kernel-studio/blob/master/mkrootfs Might helps.
-- Regards, Adam Lee -------------------------------- E-mail: adam8157@gmail.com Website: http://adam8157.info --------------------------------
On Tue, May 08, 2012 at 06:13:10PM +0530, pcuser p wrote:
Thanks all for ur replies. I gave a try to create a new rootfile system (ext2) by following the procedure in free-electrons.com and examples in the busybox folder. Surprisingly, it got built properly and run upto the same point and doesn't accept any commands i'm typing. I haven't added serial related stuff (gettty) in the inittab/rcS file as I am still not much clear about it.
My query is: At later point after file system mounted, is this same console used for login? (i'm having only one UART port in my board -> ttySAC0) Am I getting this err (/bin/sh: can't access tty; job control turned off) because console is locked already for printk's? What changes are needed in the inittab & /etc/init.d/rcS file to get the working shell prompt for this scenario?
Because *your* /bin/sh is running on /dev/console
below are the console messages: RAMDISK: ext2 filesystem found at block 0 RAMDISK: Loading 3072KiB [1 disk] into ram disk... \ done. VFS: Mounted root (ext2 filesystem) readonly on device 1:0. Freeing init memory: 80K /bin/sh: can't access tty; job control turned off / #
/etc/inittab file contents # This is run first script ::sysinit:/etc/init.d/rcS # Start an "askfirst" shell on the console ::askfirst:/bin/sh # Stuff to do when restarting the init process ::restart:/sbin/init # Stuff to do before rebooting ::ctrlaltdel:/sbin/reboot ::shutdown:/bin/umount a r
/etc/init.d/rcS file contents #!/bin/sh mount t proc none /proc mount t sysfs none /sys exec /sbin/sh /bin/sh
Remove the last two lines and add a line "exec /bin/sh" might works. And, I suggest you write rcS as examples/bootfloppy/etc/inittab in busybox src tree, and do not drop sh lines in rcS # examples/bootfloppy/etc/inittab: ::sysinit:/etc/init.d/rcS ::respawn:-/bin/sh tty2::askfirst:-/bin/sh ::ctrlaltdel:/bin/umount -a -r -- Regards, Adam Lee -------------------------------- E-mail: adam8157@gmail.com Website: http://adam8157.info --------------------------------
participants (4)
-
Adam Lee -
Anirban Roy -
Mandeep Sandhu -
pcuser p