Bug 195 - init does not correctly detect console as a serial port on some platform
Summary: init does not correctly detect console as a serial port on some platform
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Standard Compliance (show other bugs)
Version: unspecified
Hardware: Other Linux
: P2 minor
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-03-18 17:58 UTC by Fred Germain
Modified: 2009-03-20 07:55 UTC (History)
1 user (show)

See Also:
Host: PC ubuntu 8.4
Target: sh4-linux
Build:


Attachments
Test for Linux console in a more generic and sensible way (1.62 KB, patch)
2009-03-19 02:33 UTC, Denys Vlasenko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fred Germain 2009-03-18 17:58:46 UTC
in console_init (init/init.c), the ioctl TIOCGSERIAL might always fails on some platform.
This is because init.c has its own definition of struct serial_struct, and some architecture (sh to give one) defines TIOCGSERIAL this way :
#define TIOCGSERIAL     _IOR('T', 30, struct serial_struct)
So TIOCGSERIAL depends of sizeof(struct serial_struct), which is different in the kernel and init.c.

One solution would be to include the header #include <linux/serial.h> in init.c, but i understand that this would create a build dependency of busybox to the kernel headers.
Another one would be to use another serial port specific ioctl. Maybe TIOCSERGWILD or TIOCSERCONFIG would do the trick ?
And one would be to change the kernel headers, but that's seems quite extreme :-)




And one little remark, it is not possible to give a console= environment variable from the kernel cmdline to busybox, as it is already a standard option for the kernel. So it is only possible to use it from an initramfs.
Would it be possible to change the console= option in console_init() by a init_console= ?...
Comment 1 Denys Vlasenko 2009-03-19 02:33:50 UTC
Created attachment 161 [details]
Test for Linux console in a more generic and sensible way

Please try attached patch.
Comment 2 Denys Vlasenko 2009-03-19 02:36:16 UTC
Applied as rev 25747, please confirm it works for you.
Comment 3 Fred Germain 2009-03-19 10:50:57 UTC
This patch works fine in my environment.
Thank you !