On the openwrt kernel, and init

Lluís Batlle i Rossell viriketo at gmail.com
Mon Nov 29 16:24:22 EST 2010


On Wed, Nov 24, 2010 at 09:30:05AM +0800, Xiangfu Liu wrote:
> On 11/23/2010 07:25 AM, Lluís Batlle i Rossell wrote:
> > Hello,
> > 
> > I've been trying to make a bootable rootfs for the nanonote, while I use the
> > openwrt 2.6.35 kernel.
> > 
> > I noticed that the openwrt kernel uses /etc/preinit as init script. I prepared
> > that in the rootfs. I also have the same NAND map as set in the kernel for
> > qi_lb60 (three partitions).
> > 
> > I also see that the qi_lb60 platform defines a keymap - why that keymap does not
> > include a kernel scroll-up/scroll-down? Page up/down mapped to the right volume
> > keys would work great, and a userland keymap load can override that later.
> 
> scroll-up/scroll-down is map to "SHIFT + Volume-up/Volume-down"
That kernel does not have that map, for what I tried.
Finally I managed to get a userland map to set this, but the kernel itself did
not do that.
For those interested, kyak (or kristianpaul, I can't recall)
helped me setting some notes on the state of the kernels available for openwrt,
and their use on distributions. Here they are:
http://vicerveza.homeunix.net/~viric/cgi-bin/nanonixos/doc/trunk/doc/distributions.wiki

> > 
> > I also saw that uboot sets these command arguments for the kernel:
> > mem=32M console=tty0 console=ttyS0,57600n8 ubi.mtd=2 rootfstype=ubifs root=ubi0:rootfs rw rootwait
> > 
> > As the last console is the serial port, it means that /dev/console will be the
> > serial port and not tty0. Why is so?
> 
> thanks for point out. I don't know the last one will be /dev/console.  I just 
> want both serial and tty0  have kernel message. so what is your advice?
> remove the ttyS0 is better or just move it to begin. :)

I had troubles having an enabled console, with the ttyS0 at the second part. In
my situation, I disabled totally the ttyS0; for example, I found it annoying
that, as I was not running an init that started a login prompt on tty1 (I was
running simply 'sh'), I was not getting it on the framebuffer.
But even once you have 'init' working... all messages of the rc scripts will go
to the serial port I think. The tty1 will only have the kernel messages.  For
users not having a serial port, they may prefer the framebuffer as being
/dev/console.
I found that about the order of the console= parameters in the
serial-console.txt of linux.

> > Looking at the serial port, thought, I could not see the usual busybox 'init'
> > (my /etc/preinit run #!/bin/sh\nexec /sbin/init)
> > invitation to open a console pressing Enter. Instead, there I see:
> > [   11.090000] Freeing unused kernel memory: 144k freed
> > [   11.240000] Algorithmics/MIPS FPU Emulator v1.5
> > /bin/sh: can't access tty; job control turned off
> > 
> > And the last thing that appears on tty0 is, the Algorithmics kernel line.
> > 
> > So I guess the proper way to boot something is to have inittab spawning an
> > interactive process on tty0, instead of expecting /dev/console to work on the
> > screen/keyboard. Right?
> 
> is there /dev/console and /dev/null in your rootfs?

If /dev/console or /dev/null fail to be there, sysvinit 'init' fails to start,
but back then I was starting /bin/sh.
In that my case, I think I had a broken /dev - a lot changed since then in my
tests. I was using the mkfs.ubifs device table parameter, and I had forgotten
the creation of the /dev directory there. mkfs.ubifs did not complain at all,
but left a totally broken rootfs regarding devices. :)

Thank you,
Lluís.




More information about the discussion mailing list


interactive