What exactly does "enableserial" do?



  • I just finished setting up a full-install running off of a microdrive on a Soekris 4801.  I followed the instructions in the wiki and the installer for 1.2.2, and I chose the embedded kernel when it asked me during setup.  It booted fine and I have my boot console over serial, etc.

    I have the system running and I'm poking around Advanced config (/system_advanced.php), and the first option is Enable Serial console (in the code, this is $config['system']['enableserial'])

    Am I going to screw up my currently functional serial console by enabling this?  I looked through /etc/inc/pfsense-utils.inc and found this code:

    
    function setup_serial_port() {
            global $g, $config;
            conf_mount_rw();
            /* serial console - write out /boot.config */
            if(file_exists("/boot.config"))
                    $boot_config = file_get_contents("/boot.config");
            else
                    $boot_config = "";
    
            if($g['platform'] <> "cdrom") {
                    $boot_config_split = split("\n", $boot_config);
                    $fd = fopen("/boot.config","w");
                    if($fd) {
                            foreach($boot_config_split as $bcs) {
                                    if(stristr($bcs, "-D")) {
                                            /* DONT WRITE OUT, WE'LL DO IT LATER */
                                    } else {
                                            if($bcs <> "")
                                                    fwrite($fd, "{$bcs}\n");
                                    }
                            }
                            if(isset($config['system']['enableserial'])) {
                                    fwrite($fd, "-D");
                            }
                            fclose($fd);
                    }
                    /* serial console - write out /boot/loader.conf */
                    $boot_config = file_get_contents("/boot/loader.conf");
                    $boot_config_split = split("\n", $boot_config);
                    $fd = fopen("/boot/loader.conf","w");
                    if($fd) {
                            foreach($boot_config_split as $bcs) {
                                    if(stristr($bcs, "console")) {
                                            /* DONT WRITE OUT, WE'LL DO IT LATER */
                                   } else {
                                            if($bcs <> "")
                                                    fwrite($fd, "{$bcs}\n");
                                    }
                            }
                            if(isset($config['system']['enableserial'])) {
                                    fwrite($fd, "console=\"comconsole\"\n");
                            }
                            fclose($fd);
                    }
            }
            $ttys = file_get_contents("/etc/ttys");
            $ttys_split = split("\n", $ttys);
            $fd = fopen("/etc/ttys", "w");
            foreach($ttys_split as $tty) {
                    if(stristr($tty, "ttyd0")) {
                            if(isset($config['system']['enableserial'])) {
                                    fwrite($fd, "ttyd0      \"/usr/libexec/getty bootupcli\"
            dialup  on      secure\n");
                            } else {
                                    fwrite($fd, "ttyd0      \"/usr/libexec/getty bootupcli\"
            dialup  off     secure\n");
                            }
                    } else {
                            fwrite($fd, $tty . "\n");
                    }
            }
            fclose($fd);
            if(isset($config['system']['disableconsolemenu'])) {
                    auto_login(false);
            } else {
                    auto_login(true);
            }
            conf_mount_ro();
            return;
    }
    
    

    It looks to me like the only thing happening here is that the boot messages get dumped to a file, and if you have any DIALUP ttys setup in /etc/ttys some additional info is added there, but I don't see much else going on.  So again I ask, will I screw up my working system by enabling this, or is it just going to help out by giving me more logging?  It warns that it will disable VGA & PS2 input, but I'm not sure how this would happen given this code.  It looks like the only major change is editing /boot/loader.conf and adding "console=comconsole".  Is this unnecessary because I'm running the embedded kernel?

    For what it's worth, I'm using a refurbished 4GB Hitachi Microdrive that I got on eBay.  With the latest 4801 BIOS (1.33) and pfSense 1.2.2, the Microdrive is actually running at UDMA33 - no nasty interrupts due to PIO4 mode.  :)  The only hitch I ran into was that I had to change one config option on the Soekris BIOS to get it to boot "80" - IDE0, aka the microdrive.  The config option I was using previously for CF boot (I believe it was 0D or 0C) was not working with the microdrive at all.


Log in to reply