SERIAL CONSOLE.
Denys Vlasenko
vda.linux at googlemail.com
Fri Feb 22 23:06:28 UTC 2008
On Saturday 23 February 2008 00:02, Denys Vlasenko wrote:
> On Friday 22 February 2008 00:50, Ezequiel Larrarte wrote:
> > I 'm trying to build a very simple system using: static
> > kernel+initramfs+busybox+uclibc+serial console:
>
> Which version of busybox?
>
> > 1 - compile a static kernel -> /boot/vmlinuz
> >
> > 2 - generate an initramfs.cpio.gz file with busybox+uclibc ->
> > /boot/initramfs.cpio.gz
> > /etc/inittab:
> > ::sysinit:/etc/init.d/sysup.sh
> > ::shutdown:/etc/init.d/sysdown.sh
> > tty1:;respawn:/sbin/getty 38400 tty1
> > tty2:;respawn:/sbin/getty 38400 tty2
>
> I suppose ";" is a typo? Should be ":"
>
> > ttyS0::respawn:/sbin/getty -L 38400 ttyS0 vt100
> >
> > /etc/init.d/sysup.sh:
> > #!/bin/sh
> > echo "-------------------------------------------"
> > echo "INIT"
> > echo "-------------------------------------------"
> >
> > 3 - put all these things together inside a pendrive with grub:
> > /boot/grub/menu.lst:
> > timeout 10
> >
> > serial --unit=0 --speed=38400 --parity=no --words=8 --stop=1
> > terminal --timeout=5 serial console
> >
> > title test (vga)
> > kernel /boot/vmlinuz rdinit=/sbin/init console=tty0
> > initrd /boot/initramfs.cpio.gz
> >
> > title test (serial)
> > kernel /boot/vmlinuz rdinit=/sbin/init console=ttyS0,38400n8
> > initrd /boot/initramfs.cpio.gz
> >
> > 4 - Try booting with "test (vga)" ... everything is working fine, here
> > is the output:
> > -------------------------------------------
> > INIT
> > -------------------------------------------
> >
> > Welcome!
> > linux login: _
> >
> > 5 - When I try "test (serial)" ... this is my output:
> > Welcome!
> > linux login: _
> >
> > There is no /sbin/init output on the serial console ...
> >
> > 6 - Try without any /etc/inittab and "test (serial)":
> > -------------------------------------------
> > INIT
> > -------------------------------------------
> >
> > /$ _
> >
> > It works! ... something wrong with the /etc/inittab file?
>
> I really doubt it. If you have no /etc/inittab,
> what printed "---- INIT ----" banner in this case?
>
>
> > 7 - put a "sleep 2" at the bottom of /etc/init.d/sysup.sh, with my
> > /etc/inittab and "test (serial)":
> > -------------------------------------------
> > INIT
> > -------------------------------------------
> >
> > Welcome!
> > linux login: _
> >
> > It works!
> > I 'm trying this with my Pentium IV 3.0 Ghz ... I tried with another PC,
> > it 's the same.
> >
> > And sometimes I get this output:
> > ---------------
> >
> > Welcome!
> > linux login: _
> >
> >
> >
> > Timing problem? serial port flush bug? busybox-init bug?
>
> Seems vaguely like second one. getty on ttyS0 seems to do something
> to the port so that it loses buffered output.
Possible fix: in init.c, add tcdrain() as shown below:
static void run_actions(int action_type)
{
struct init_action *a, *tmp;
for (a = init_action_list; a; a = tmp) {
tmp = a->next;
if (a->action_type == action_type) {
// Pointless: run() will error out if open of device fails.
///* a->terminal of "" means "init's console" */
//if (a->terminal[0] && access(a->terminal, R_OK | W_OK)) {
// //message(L_LOG | L_CONSOLE, "Device %s cannot be opened in RW mode", a->terminal /*, strerror(errno)*/);
// delete_init_action(a);
//} else
if (a->action_type & (SYSINIT | WAIT | CTRLALTDEL | SHUTDOWN | RESTART)) {
waitfor(run(a));
+ tcdrain(1);
+ tcdrain(2);
delete_init_action(a);
}
--
vda
More information about the busybox
mailing list