diff options
Diffstat (limited to 'src/etc/inc')
-rw-r--r-- | src/etc/inc/config.console.inc | 280 | ||||
-rw-r--r-- | src/etc/inc/config.inc | 87 | ||||
-rw-r--r-- | src/etc/inc/config.lib.inc | 42 | ||||
-rw-r--r-- | src/etc/inc/pfsense-utils.inc | 152 |
4 files changed, 223 insertions, 338 deletions
diff --git a/src/etc/inc/config.console.inc b/src/etc/inc/config.console.inc index b4783da..3cf185d 100644 --- a/src/etc/inc/config.console.inc +++ b/src/etc/inc/config.console.inc @@ -47,14 +47,9 @@ function set_networking_interfaces_ports() { $iflist = get_interface_list(); - /* Function flow is based on $key and $auto_assign or the lack thereof */ + /* Function flow is based on $key or the lack thereof */ $key = null; - /* Only present auto interface option if running from the installer media and interface mismatch*/ - if ((preg_match("/cdrom/", $g['platform'])) && is_interface_mismatch()) { - $auto_assign = false; - } - echo <<<EOD Valid interfaces are: @@ -81,15 +76,6 @@ EOD; } } - if ($auto_assign) { - echo <<<EOD - - !!! Installation Media Detected: Auto Interface Option !!!! -BEGIN MANUAL CONFIGURATION OR THE SYSTEM WILL PROCEED WITH AUTO CONFIGURATION. - -EOD; - } - echo "\n" . gettext("Do VLANs need to be set up first?"); echo "\n" . gettext( @@ -98,211 +84,147 @@ EOD; "\n"; echo "\n" . gettext("Should VLANs be set up now [y|n]?") . " "; - if ($auto_assign) { - $key = timeout(); - } else { - $key = chop(fgets($fp)); - } - - if (!isset($key) and $auto_assign) { // Auto Assign Interfaces - do { - echo <<<EOD + $key = chop(fgets($fp)); - !!! Auto Assigning Interfaces !!! - -For setup purposes, there must be at least one NIC connected for -the LAN. If a second NIC is connected, it will be assigned to the -WAN. Otherwise, WAN will be temporarily assigned to the next -available NIC found regardless of activity. The WAN interface -should then be assigned and configured as required. - -Please make the pfSense NIC connections now. -The system will continue checking until they have been made. - -Searching for active interfaces... - -EOD; - unset($wanif, $lanif); + //Manually assign interfaces + if (in_array($key, array('y', 'Y'))) { + vlan_setup(); + } - $media_iflist = $plugged_in = array(); - $media_iflist = get_interface_list("media"); - foreach ($media_iflist as $iface => $ifa) { - if ($ifa['up']) { - $plugged_in[] = $iface; - } - } + if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) { - $lanif = array_shift($plugged_in); - $wanif = array_shift($plugged_in); + echo "\n\n" . gettext("VLAN interfaces:") . "\n\n"; + foreach ($config['vlans']['vlan'] as $vlan) { - if (isset($lanif) && !isset($wanif)) { - foreach ($iflist as $iface => $ifa) { - if ($iface != $lanif) { - $wanif = $iface; - break; - } - } - } + echo sprintf("% -16s%s\n", "{$vlan['if']}_vlan{$vlan['tag']}", + "VLAN tag {$vlan['tag']}, parent interface {$vlan['if']}"); - echo <<<EOD + $iflist[$vlan['if'] . '_vlan' . $vlan['tag']] = array(); + $ifsmallist = $ifsmallist . $vlan['if'] . '_vlan' . $vlan['tag'] . " "; + } + } -Assigned WAN to : $wanif -Assigned LAN to : $lanif + echo <<<EOD -If these assignments are not suitable, -press any key to go back to manual configuration. +If the names of the interfaces are not known, auto-detection can +be used instead. To use auto-detection, please disconnect all +interfaces before pressing 'a' to begin the process. EOD; - $key = timeout(20); - if (isset($key)) { - return; - } - } while (!isset($wanif)); - - $config['system']['enablesshd'] = 'enabled'; - $key = 'y'; - } else { - //Manually assign interfaces - if (in_array($key, array('y', 'Y'))) { - vlan_setup(); + do { + echo "\n" . gettext("Enter the WAN interface name or 'a' for auto-detection") . " "; + printf(gettext("%s(%s or a): "), "\n", trim($ifsmallist)); + $wanif = chop(fgets($fp)); + if ($wanif === "") { + return; } - - if (is_array($config['vlans']['vlan']) && count($config['vlans']['vlan'])) { - - echo "\n\n" . gettext("VLAN interfaces:") . "\n\n"; - foreach ($config['vlans']['vlan'] as $vlan) { - - echo sprintf("% -16s%s\n", "{$vlan['if']}_vlan{$vlan['tag']}", - "VLAN tag {$vlan['tag']}, parent interface {$vlan['if']}"); - - $iflist[$vlan['if'] . '_vlan' . $vlan['tag']] = array(); - $ifsmallist = $ifsmallist . $vlan['if'] . '_vlan' . $vlan['tag'] . " "; - } + if ($wanif === "a") { + $wanif = autodetect_interface("WAN", $fp); + } else if (!array_key_exists($wanif, $iflist)) { + printf(gettext("%sInvalid interface name '%s'%s"), "\n", $wanif, "\n"); + unset($wanif); + continue; } + $ifsmallist = str_replace(" " . $wanif . " ", " ", $ifsmallist); + } while (!$wanif); - echo <<<EOD + do { + printf(gettext("%sEnter the LAN interface name or 'a' for auto-detection %s" . + "NOTE: this enables full Firewalling/NAT mode.%s" . + "(%s a or nothing if finished):%s"), "\n", "\n", "\n", trim($ifsmallist), " "); -If the names of the interfaces are not known, auto-detection can -be used instead. To use auto-detection, please disconnect all -interfaces before pressing 'a' to begin the process. + $lanif = chop(fgets($fp)); -EOD; + if ($lanif == "exit") { + exit; + } - do { - echo "\n" . gettext("Enter the WAN interface name or 'a' for auto-detection") . " "; - printf(gettext("%s(%s or a): "), "\n", trim($ifsmallist)); - $wanif = chop(fgets($fp)); - if ($wanif === "") { - return; - } - if ($wanif === "a") { - $wanif = autodetect_interface("WAN", $fp); - } else if (!array_key_exists($wanif, $iflist)) { - printf(gettext("%sInvalid interface name '%s'%s"), "\n", $wanif, "\n"); - unset($wanif); - continue; - } - $ifsmallist = str_replace(" " . $wanif . " ", " ", $ifsmallist); - } while (!$wanif); + if ($lanif == "") { + /* It is OK to have just a WAN, without a LAN so break if the user does not want LAN. */ + break; + } - do { - printf(gettext("%sEnter the LAN interface name or 'a' for auto-detection %s" . - "NOTE: this enables full Firewalling/NAT mode.%s" . - "(%s a or nothing if finished):%s"), "\n", "\n", "\n", trim($ifsmallist), " "); + if ($lanif === "a") { + $lanif = autodetect_interface("LAN", $fp); + } else if (!array_key_exists($lanif, $iflist)) { + printf(gettext("%sInvalid interface name '%s'%s"), "\n", $lanif, "\n"); + unset($lanif); + continue; + } + $ifsmallist = str_replace(" " . $lanif . " ", " ", $ifsmallist); + } while (!$lanif); - $lanif = chop(fgets($fp)); + /* optional interfaces */ + $i = 0; + $optif = array(); - if ($lanif == "exit") { - exit; + if ($lanif <> "") { + while (1) { + if ($optif[$i]) { + $i++; } + $io = $i + 1; - if ($lanif == "") { - /* It is OK to have just a WAN, without a LAN so break if the user does not want LAN. */ - break; + if ($config['interfaces']['opt' . $io]['descr']) { + printf(gettext("%sOptional interface %s description found: %s"), "\n", $io, $config['interfaces']['opt' . $io]['descr']); } - if ($lanif === "a") { - $lanif = autodetect_interface("LAN", $fp); - } else if (!array_key_exists($lanif, $iflist)) { - printf(gettext("%sInvalid interface name '%s'%s"), "\n", $lanif, "\n"); - unset($lanif); - continue; - } - $ifsmallist = str_replace(" " . $lanif . " ", " ", $ifsmallist); - } while (!$lanif); - - /* optional interfaces */ - $i = 0; - $optif = array(); + printf(gettext("%sEnter the Optional %s interface name or 'a' for auto-detection%s" . + "(%s a or nothing if finished):%s"), "\n", $io, "\n", trim($ifsmallist), " "); - if ($lanif <> "") { - while (1) { - if ($optif[$i]) { - $i++; - } - $io = $i + 1; - - if ($config['interfaces']['opt' . $io]['descr']) { - printf(gettext("%sOptional interface %s description found: %s"), "\n", $io, $config['interfaces']['opt' . $io]['descr']); - } + $optif[$i] = chop(fgets($fp)); - printf(gettext("%sEnter the Optional %s interface name or 'a' for auto-detection%s" . - "(%s a or nothing if finished):%s"), "\n", $io, "\n", trim($ifsmallist), " "); - - $optif[$i] = chop(fgets($fp)); - - if ($optif[$i]) { - if ($optif[$i] === "a") { - $ad = autodetect_interface(gettext("Optional") . " " . $io, $fp); - if ($ad) { - $optif[$i] = $ad; - } else { - unset($optif[$i]); - } - } else if (!array_key_exists($optif[$i], $iflist)) { - printf(gettext("%sInvalid interface name '%s'%s"), "\n", $optif[$i], "\n"); + if ($optif[$i]) { + if ($optif[$i] === "a") { + $ad = autodetect_interface(gettext("Optional") . " " . $io, $fp); + if ($ad) { + $optif[$i] = $ad; + } else { unset($optif[$i]); - continue; } - $ifsmallist = str_replace(" " . $optif[$i] . " ", " ", $ifsmallist); - } else { + } else if (!array_key_exists($optif[$i], $iflist)) { + printf(gettext("%sInvalid interface name '%s'%s"), "\n", $optif[$i], "\n"); unset($optif[$i]); - break; + continue; } + $ifsmallist = str_replace(" " . $optif[$i] . " ", " ", $ifsmallist); + } else { + unset($optif[$i]); + break; } } + } - /* check for double assignments */ - $ifarr = array_merge(array($lanif, $wanif), $optif); + /* check for double assignments */ + $ifarr = array_merge(array($lanif, $wanif), $optif); - for ($i = 0; $i < (count($ifarr)-1); $i++) { - for ($j = ($i+1); $j < count($ifarr); $j++) { - if ($ifarr[$i] == $ifarr[$j]) { - echo <<<EOD + for ($i = 0; $i < (count($ifarr)-1); $i++) { + for ($j = ($i+1); $j < count($ifarr); $j++) { + if ($ifarr[$i] == $ifarr[$j]) { + echo <<<EOD Error: The same interface name cannot be assigned twice! EOD; - fclose($fp); - return; - } + fclose($fp); + return; } } + } - echo "\n" . gettext("The interfaces will be assigned as follows:") . "\n\n"; + echo "\n" . gettext("The interfaces will be assigned as follows:") . "\n\n"; - echo "WAN -> " . $wanif . "\n"; - if ($lanif != "") { - echo "LAN -> " . $lanif . "\n"; - } - for ($i = 0; $i < count($optif); $i++) { - echo "OPT" . ($i+1) . " -> " . $optif[$i] . "\n"; - } - - echo "\n" . gettext("Do you want to proceed [y|n]?") . " "; - $key = chop(fgets($fp)); + echo "WAN -> " . $wanif . "\n"; + if ($lanif != "") { + echo "LAN -> " . $lanif . "\n"; } + for ($i = 0; $i < count($optif); $i++) { + echo "OPT" . ($i+1) . " -> " . $optif[$i] . "\n"; + } + + echo "\n" . gettext("Do you want to proceed [y|n]?") . " "; + $key = chop(fgets($fp)); if (in_array($key, array('y', 'Y'))) { if ($lanif) { @@ -316,7 +238,7 @@ EOD; } $config['interfaces']['lan']['if'] = $lanif; $config['interfaces']['lan']['enable'] = true; - } elseif (!platform_booting() && !$auto_assign) { + } elseif (!platform_booting()) { echo "\n" . gettext("You have chosen to remove the LAN interface.") . "\n"; echo "\n" . gettext("Would you like to remove the LAN IP address and \nunload the interface now [y|n]?") . " "; diff --git a/src/etc/inc/config.inc b/src/etc/inc/config.inc index 3efd2f3..f074ac7 100644 --- a/src/etc/inc/config.inc +++ b/src/etc/inc/config.inc @@ -98,63 +98,44 @@ if (platform_booting(true)) { /* check if there's already an fstab (NFS booting?) */ if (!file_exists("{$g['etc_path']}/fstab")) { echo "."; - if (strstr($g['platform'], "cdrom")) { - /* config is on floppy disk for CD-ROM version */ - $cfgdevice = $cfgpartition = "fd0"; - $_gb = exec('/sbin/dmesg -a', $dmesg); - if (preg_match("/da0/", $dmesg) == true) { - $cfgdevice = $cfgpartition = "da0" ; - if (mwexec("/sbin/mount -r /dev/{$cfgdevice} /cf")) { - /* could not mount, fallback to floppy */ - $cfgdevice = $cfgpartition = "fd0"; + /* probe kernel known disks until we find one with config.xml */ + $disks = explode(" ", get_single_sysctl("kern.disks")); + foreach ($disks as $mountdisk) { + /* skip mfs mounted filesystems */ + if (strstr($mountdisk, "md")) { + continue; + } + if (mwexec("/sbin/mount -r /dev/{$mountdisk}a {$g['cf_path']}") == 0) { + if (file_exists("{$g['cf_conf_path']}/config.xml")) { + /* found it */ + $cfgdevice = $mountdisk; + $cfgpartition = $cfgdevice . "a"; + $cfgfstype = "ufs"; + printf(gettext("Found configuration on %s.%s"), $cfgdevice, "\n"); + } + + mwexec("/sbin/umount -f {$g['cf_path']}"); + + if ($cfgdevice) { + break; } } - unset($dmesg); - $cfgfstype = "msdosfs"; - echo gettext("CDROM build") . "\n"; - echo " " . gettext("CFG:") . " {$cfgpartition}\n"; - echo " " . gettext("TYPE:") . " {$cfgfstype}\n"; - } else { - echo "."; - /* probe kernel known disks until we find one with config.xml */ - $disks = explode(" ", get_single_sysctl("kern.disks")); - foreach ($disks as $mountdisk) { - /* skip mfs mounted filesystems */ - if (strstr($mountdisk, "md")) { - continue; + if (mwexec("/sbin/mount -r /dev/{$mountdisk}d {$g['cf_path']}") == 0) { + if (platform_booting()) { + echo "."; } - if (mwexec("/sbin/mount -r /dev/{$mountdisk}a {$g['cf_path']}") == 0) { - if (file_exists("{$g['cf_conf_path']}/config.xml")) { - /* found it */ - $cfgdevice = $mountdisk; - $cfgpartition = $cfgdevice . "a"; - $cfgfstype = "ufs"; - printf(gettext("Found configuration on %s.%s"), $cfgdevice, "\n"); - } - - mwexec("/sbin/umount -f {$g['cf_path']}"); - - if ($cfgdevice) { - break; - } + if (file_exists("{$g['cf_conf_path']}/config.xml")) { + /* found it */ + $cfgdevice = $mountdisk; + $cfgpartition = $cfgdevice . "d"; + $cfgfstype = "ufs"; + printf(gettext("Found configuration on %s.%s"), $cfgdevice, "\n"); } - if (mwexec("/sbin/mount -r /dev/{$mountdisk}d {$g['cf_path']}") == 0) { - if (platform_booting()) { - echo "."; - } - if (file_exists("{$g['cf_conf_path']}/config.xml")) { - /* found it */ - $cfgdevice = $mountdisk; - $cfgpartition = $cfgdevice . "d"; - $cfgfstype = "ufs"; - printf(gettext("Found configuration on %s.%s"), $cfgdevice, "\n"); - } - - mwexec("/sbin/umount -f {$g['cf_path']}"); - - if ($cfgdevice) { - break; - } + + mwexec("/sbin/umount -f {$g['cf_path']}"); + + if ($cfgdevice) { + break; } } } diff --git a/src/etc/inc/config.lib.inc b/src/etc/inc/config.lib.inc index c7bf59c..d2e5a19 100644 --- a/src/etc/inc/config.lib.inc +++ b/src/etc/inc/config.lib.inc @@ -228,32 +228,20 @@ function parse_config_bootup() { $lockkey = lock('config'); if (!file_exists("{$g['conf_path']}/config.xml")) { if (platform_booting()) { - if (strstr($g['platform'], "cdrom")) { - /* try copying the default config. to the floppy */ - echo gettext("Resetting factory defaults...") . "\n"; - reset_factory_defaults(true, false); - if (!file_exists("{$g['conf_path']}/config.xml")) { - echo gettext("No XML configuration file found - using factory defaults.\n" . - "Make sure that the configuration floppy disk with the conf/config.xml\n" . - "file is inserted. If it isn't, the configuration changes will be lost\n" . - "on reboot.\n"); - } - } else { - $last_backup = discover_last_backup(); - if ($last_backup) { - log_error("No config.xml found, attempting last known config restore."); - file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", ""); - restore_backup("/cf/conf/backup/{$last_backup}"); - } - if (!file_exists("{$g['conf_path']}/config.xml")) { - echo sprintf(gettext("XML configuration file not found. %s cannot continue booting."), $g['product_name']) . "\n"; - unlock($lockkey); - mwexec("/sbin/halt"); - exit; - } - log_error("Last known config found and restored. Please double check the configuration file for accuracy."); - file_notice("config.xml", gettext("Last known config found and restored. Please double check the configuration file for accuracy."), "pfSenseConfigurator", ""); + $last_backup = discover_last_backup(); + if ($last_backup) { + log_error("No config.xml found, attempting last known config restore."); + file_notice("config.xml", gettext("No config.xml found, attempting last known config restore."), "pfSenseConfigurator", ""); + restore_backup("/cf/conf/backup/{$last_backup}"); + } + if (!file_exists("{$g['conf_path']}/config.xml")) { + echo sprintf(gettext("XML configuration file not found. %s cannot continue booting."), $g['product_name']) . "\n"; + unlock($lockkey); + mwexec("/sbin/halt"); + exit; } + log_error("Last known config found and restored. Please double check the configuration file for accuracy."); + file_notice("config.xml", gettext("Last known config found and restored. Please double check the configuration file for accuracy."), "pfSenseConfigurator", ""); } else { unlock($lockkey); log_error(gettext("Could not find a usable configuration file! Exiting....")); @@ -811,10 +799,6 @@ function get_backups() { function backup_config() { global $config, $g; - if ($g['platform'] == "cdrom") { - return; - } - conf_mount_rw(); /* Create backup directory if needed */ diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index 236d02c..c258f1f 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -1083,92 +1083,90 @@ function setup_serial_port($when = "save", $path = "") { } $serialspeed = (is_numeric($config['system']['serialspeed'])) ? $config['system']['serialspeed'] : "115200"; - if ($g['platform'] != "cdrom") { - $serial_only = false; + $serial_only = false; - if (($g['platform'] == "nanobsd") && isset($g['enableserial_force'])) { + if (($g['platform'] == "nanobsd") && isset($g['enableserial_force'])) { + $serial_only = true; + } else { + $specific_platform = system_identify_specific_platform(); + if ($specific_platform['name'] == 'RCC-VE' || + $specific_platform['name'] == 'RCC' || + $specific_platform['name'] == 'RCC-DFF') { $serial_only = true; - } else { - $specific_platform = system_identify_specific_platform(); - if ($specific_platform['name'] == 'RCC-VE' || - $specific_platform['name'] == 'RCC' || - $specific_platform['name'] == 'RCC-DFF') { - $serial_only = true; - } } + } - $boot_config_split = explode("\n", $boot_config); - $fd = fopen($boot_config_file, "w"); - if ($fd) { - foreach ($boot_config_split as $bcs) { - if (stristr($bcs, "-D") || stristr($bcs, "-h")) { - /* DONT WRITE OUT, WE'LL DO IT LATER */ - } else { - if ($bcs <> "") { - fwrite($fd, "{$bcs}\n"); - } - } - } - if ($serial_only === true) { - fwrite($fd, "-S{$serialspeed} -h"); - } else if (is_serial_enabled()) { - fwrite($fd, "-S{$serialspeed} -D"); - } - fclose($fd); - } - - /* serial console - write out /boot/loader.conf */ - if ($when == "upgrade") { - system("echo \"Reading {$loader_conf_file}...\" >> /conf/upgrade_log.txt"); - } - $boot_config = file_get_contents($loader_conf_file); - $boot_config_split = explode("\n", $boot_config); - if (count($boot_config_split) > 0) { - $new_boot_config = array(); - // Loop through and only add lines that are not empty, and which - // do not contain a console directive. - foreach ($boot_config_split as $bcs) { - if (!empty($bcs) && - (stripos($bcs, "console") === false) && - (stripos($bcs, "boot_multicons") === false) && - (stripos($bcs, "boot_serial") === false) && - (stripos($bcs, "hw.usb.no_pf") === false) && - (stripos($bcs, "hint.uart.0.flags") === false) && - (stripos($bcs, "hint.uart.1.flags") === false)) { - $new_boot_config[] = $bcs; - } - } - - if ($serial_only === true) { - $new_boot_config[] = 'boot_serial="YES"'; - $new_boot_config[] = 'console="comconsole"'; - } else if (is_serial_enabled()) { - $new_boot_config[] = 'boot_multicons="YES"'; - $new_boot_config[] = 'boot_serial="YES"'; - $primaryconsole = isset($g['primaryconsole_force']) ? $g['primaryconsole_force'] : $config['system']['primaryconsole']; - switch ($primaryconsole) { - case "video": - $new_boot_config[] = 'console="vidconsole,comconsole"'; - break; - case "serial": - default: - $new_boot_config[] = 'console="comconsole,vidconsole"'; + $boot_config_split = explode("\n", $boot_config); + $fd = fopen($boot_config_file, "w"); + if ($fd) { + foreach ($boot_config_split as $bcs) { + if (stristr($bcs, "-D") || stristr($bcs, "-h")) { + /* DONT WRITE OUT, WE'LL DO IT LATER */ + } else { + if ($bcs <> "") { + fwrite($fd, "{$bcs}\n"); } } - $new_boot_config[] = 'comconsole_speed="' . $serialspeed . '"'; + } + if ($serial_only === true) { + fwrite($fd, "-S{$serialspeed} -h"); + } else if (is_serial_enabled()) { + fwrite($fd, "-S{$serialspeed} -D"); + } + fclose($fd); + } - $specplatform = system_identify_specific_platform(); - if ($specplatform['name'] == 'RCC-VE' || - $specplatform['name'] == 'RCC' || - $specplatform['name'] == 'RCC-DFF') { - $new_boot_config[] = 'comconsole_port="0x2F8"'; - $new_boot_config[] = 'hint.uart.0.flags="0x00"'; - $new_boot_config[] = 'hint.uart.1.flags="0x10"'; + /* serial console - write out /boot/loader.conf */ + if ($when == "upgrade") { + system("echo \"Reading {$loader_conf_file}...\" >> /conf/upgrade_log.txt"); + } + $boot_config = file_get_contents($loader_conf_file); + $boot_config_split = explode("\n", $boot_config); + if (count($boot_config_split) > 0) { + $new_boot_config = array(); + // Loop through and only add lines that are not empty, and which + // do not contain a console directive. + foreach ($boot_config_split as $bcs) { + if (!empty($bcs) && + (stripos($bcs, "console") === false) && + (stripos($bcs, "boot_multicons") === false) && + (stripos($bcs, "boot_serial") === false) && + (stripos($bcs, "hw.usb.no_pf") === false) && + (stripos($bcs, "hint.uart.0.flags") === false) && + (stripos($bcs, "hint.uart.1.flags") === false)) { + $new_boot_config[] = $bcs; + } + } + + if ($serial_only === true) { + $new_boot_config[] = 'boot_serial="YES"'; + $new_boot_config[] = 'console="comconsole"'; + } else if (is_serial_enabled()) { + $new_boot_config[] = 'boot_multicons="YES"'; + $new_boot_config[] = 'boot_serial="YES"'; + $primaryconsole = isset($g['primaryconsole_force']) ? $g['primaryconsole_force'] : $config['system']['primaryconsole']; + switch ($primaryconsole) { + case "video": + $new_boot_config[] = 'console="vidconsole,comconsole"'; + break; + case "serial": + default: + $new_boot_config[] = 'console="comconsole,vidconsole"'; } - $new_boot_config[] = 'hw.usb.no_pf="1"'; + } + $new_boot_config[] = 'comconsole_speed="' . $serialspeed . '"'; - file_put_contents($loader_conf_file, implode("\n", $new_boot_config) . "\n"); + $specplatform = system_identify_specific_platform(); + if ($specplatform['name'] == 'RCC-VE' || + $specplatform['name'] == 'RCC' || + $specplatform['name'] == 'RCC-DFF') { + $new_boot_config[] = 'comconsole_port="0x2F8"'; + $new_boot_config[] = 'hint.uart.0.flags="0x00"'; + $new_boot_config[] = 'hint.uart.1.flags="0x10"'; } + $new_boot_config[] = 'hw.usb.no_pf="1"'; + + file_put_contents($loader_conf_file, implode("\n", $new_boot_config) . "\n"); } $ttys = file_get_contents($ttys_file); $ttys_split = explode("\n", $ttys); @@ -1208,7 +1206,7 @@ function is_serial_enabled() { if (!isset($g['enableserial_force']) && !isset($config['system']['enableserial']) && - ($g['platform'] == $g['product_name'] || $g['platform'] == "cdrom")) { + ($g['platform'] == $g['product_name'])) { return false; } |