[feels like I am talking to myself in this thread ...] After copying the /usr/src/sbin/init/ directory from HEAD to 8.3-RELEASE and building init there (without changes), things started working again, and the image now succesfully boots. Thanks for that. The downside of this approach is the lack of logging of the output of the console output. I've tried quickly to throw together a 'null' console which would make the console output at least appear in the output of 'dmesg -a', but that change requires a tty device, which I couldn' be asked to throw together. Ed was going to think this over, especially because a null console might come in handy in jails. Hope this is of use to anyone. Nick Hibma nick_at_van-laarhoven.org How many todos are on YOUR To Do lists? - GTD On 19 Feb 2013, at 10:03, Nick Hibma wrote: > Ed sent me a answer to my ramblings: > > "It is indeed true that init(8) is a bit picky when you don't have a > console. If /dev/console cannot be opened, init(8) will just break > completely. This has been fixed in FreeBSD -HEAD, where I've extended > init(8) to handle this gracefully, specifically for cases where you > have hardware without a console or potentially want to run init(8) in > a jail (though we're not there yet)." > > http://svnweb.freebsd.org/base?view=revision&revision=232977 > > I'll try that, and will follow up here. > > Nick Hibma > nick_at_van-laarhoven.org > > Collect, process, organize, review and do. - GTD > > On 18 Feb 2013, at 20:30, Nick Hibma <nick_at_van-laarhoven.org> wrote: > >> We run our NanoBSD images on Soekris and ALIX hardware. In some cases we need all available serial ports for other hardware like GPS, and modems. The boards have no video, so with all serial ports unavailable as a console no other console is available. >> >> The problem is that FreeBSD does not handle well the case where there is no console at all: >> >> 1) http://www.freebsd.org/cgi/query-pr.cgi?pr=bin/102515 >> >> fsck_ufs crashes (6.1-STABLE). Because of the unitialised console libc somehow gets corrupted and crashes fsck_ufs. This problem can be circumvented by replacing 'fsck -p' with 'fsck < /dev/null > /dev/null'. >> >> 2) In 8.3-RELEASE init exits prematurely because it cannot open /dev/console for reading and writing in setctty(). Removing the calls to _exit(1) in that function makes the boot complete. I haven't checked whether the fsck_ufs problem still appears as our builds run with a patched rc.d script. >> >> >> As far as I can see this is still a problem in CURRENT. >> >> >> My attempt at resolving this was to create a null terminal in dev/null/null.c, see the patch below, but that did not work as expected. After booting the system with a modified init the response to 'echo > /dev/console' was 'Device not configured'. I've added another CN_* priority to make sure a null console does not take precedence over for example gdb console. >> >> >> Any pointers as to who/how to resolve this issue? Any reason why the null console approach does not work? >> >> Nick Hibma >> nick_at_van-laarhoven.org >> >> GTD: Time management for chaotic people. >> >> Index: /usr/src/sys/sys/cons.h >> =================================================================== >> --- /usr/src/sys/sys/cons.h (revision 242660) >> +++ /usr/src/sys/sys/cons.h (working copy) >> _at__at_ -69,10 +69,11 _at__at_ >> >> /* values for cn_pri - reflect our policy for console selection */ >> #define CN_DEAD 0 /* device doesn't exist */ >> -#define CN_LOW 1 /* device is a last restort only */ >> -#define CN_NORMAL 2 /* device exists but is nothing special */ >> -#define CN_INTERNAL 3 /* "internal" bit-mapped display */ >> -#define CN_REMOTE 4 /* serial interface with remote bit set */ >> +#define CN_NULL 1 /* no console at all */ >> +#define CN_LOW 2 /* device is a last restort only */ >> +#define CN_NORMAL 3 /* device exists but is nothing special */ >> +#define CN_INTERNAL 4 /* "internal" bit-mapped display */ >> +#define CN_REMOTE 5 /* serial interface with remote bit set */ >> >> /* Values for cn_flags. */ >> #define CN_FLAG_NODEBUG 0x00000001 /* Not supported with debugger. */ >> Index: /usr/src/sys/dev/null/null.c >> =================================================================== >> --- /usr/src/sys/dev/null/null.c (revision 242660) >> +++ /usr/src/sys/dev/null/null.c (working copy) >> _at__at_ -41,6 +41,9 _at__at_ >> #include <sys/bus.h> >> #include <sys/filio.h> >> >> +#include <sys/cons.h> >> +#include <sys/consio.h> >> + >> #include <machine/bus.h> >> >> /* For use with destroy_dev(9). */ >> _at__at_ -173,3 +176,45 _at__at_ >> >> DEV_MODULE(null, null_modevent, NULL); >> MODULE_VERSION(null, 1); >> + >> +static cn_probe_t null_cnprobe; >> +static cn_init_t null_cninit; >> +static cn_term_t null_cnterm; >> +static cn_getc_t null_cngetc; >> +static cn_putc_t null_cnputc; >> + >> +CONSOLE_DRIVER(null); >> + >> +static void >> +null_cnprobe(struct consdev *cp) >> +{ >> + sprintf(cp->cn_name, "null"); >> + cp->cn_pri = CN_NULL; >> +} >> + >> +static void >> +null_cninit(struct consdev *cp) >> +{ >> +} >> + >> + >> +static void >> +null_cnputc(struct consdev *cp, int c) >> +{ >> + (void) cp; >> + >> + (void) c; >> +} >> + >> +static int >> +null_cngetc(struct consdev * cp) >> +{ >> + (void) cp; >> + >> + return -1; >> +} >> + >> +static void >> +null_cnterm(struct consdev * cp) >> +{ >> +} >> > > _______________________________________________ > freebsd-current_at_freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-current > To unsubscribe, send any mail to "freebsd-current-unsubscribe_at_freebsd.org"Received on Tue Feb 26 2013 - 21:42:06 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:35 UTC