2018年9月3日 星期一
embededed system with CentOS boot setting terminal.
## CentOS boot setting.
** CentOS 6.9 boot setting.
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=0 serial console
default=1
timeout=5
#splashimage=(hd0,0)/grub/splash.xpm.gz
#hiddenmenu
title Accusys 1U Switch Core (3nd Generation V2)
root (hd0,0)
kernel /vmlinuz-2.6.32-696.el6.x86_64 ro root=/dev/sda3 crashkernel=auto console=ttyS0,115200n8 acscfg=1
initrd /initramfs-2.6.32-696.el6.x86_64.img
title Accusys 1U Switch Core (3nd Generation V2) Dev
root (hd0,0)
kernel /bzImage ro root=/dev/sda3 crashkernel=auto console=ttyS0,115200n8 acscfg=1
initrd /initramfs-2.6.32-696.el6.x86_64.img
title CentOS 6 (2.6.32-696.el6.x86_64) Default boot setting
root (hd0,0)
kernel /vmlinuz-2.6.32-696.el6.x86_64 ro root=UUID=4df0d800-6b42-47f8-99da-5b50987f3824 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-696.el6.x86_64.img
** CentOS 5.8 boot setting.
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=0 serial console
default=2
timeout=5
title Accusys 1U Switch Core (3nd Generation)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-308.el5 ro root=/dev/sda1 crashkernel=128M@16M console=ttyS0,115200n8 acscfg=1
initrd /boot/initrd-2.6.18-308.el5.img
title Accusys 1U Switch Core (3nd Generation safe mode)
root (hd0,0)
kernel /boot/bzImage ro root=/dev/sda1 crashkernel=128M@16M console=ttyS0,115200n8 acscfg=1
initrd /boot/initrd-2.6.18-308.el5.img
title Accusys 1U Switch Core (3nd Generation Sam Debug mode)
root (hd0,0)
kernel /root/bzImage ro root=/dev/sda1 crashkernel=128M@16M console=ttyS0,115200n8 acscfg=1
initrd /boot/initrd-2.6.18-308.el5.img
## BIOS/GRUB/Kernel/XEN輸出重定向到串口的配置:
將BIOS輸出重定向到串口
這一功能需要主板支援,在BIOS中設置,比如我的設置為:
Server ManagementConsole RedirectionConsole Redirection設置為”Serial Port A”
將GRUB輸出重定向到串口(Edit /boot/grub/grub.conf)
serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1
terminal --timeout=5 console serial
grub引導過程中,會將輸出同時發送到終端螢幕和串口. grub引導過程中將在終端和連接到串口的超級終端上提示Press any key to continue,
每秒鐘提示一次,共5次,可修改menu.lst檔terminal行中的--timeout=10改變提示次數,在這一段時間內,可以在終端的鍵盤,
或者連接到串口的超級終端中按任意鍵進入grub選擇功能表.如果5秒內沒有在終端和連接串口的超級終端上按任意鍵,
則grub的選擇功能表將出現在console上,如果希望默認情況下, grub選擇功能表出現在串口上,則可修改grub.conf將console serial修改為serial console.
將kernel輸出資訊輸出到串口(編輯/boot/grub/grub.conf有的為menu.lst)
增加kernel引導參數如下:
kernel /boot/vmlinuz-2.6.32-29 root=/dev/hda1 ro console=ttyS0,115200n8 console=tty0
則kernel會將輸出資訊同時輸出到串口(ttyS0即COM1)和終端tty0。
其中,“ttyS0”表示串口使用COM1;“115200”表示串列傳輸速率為115200bps;“n”表示無校驗位;“8”表示有8位元資料位元
## kernel login message 修正為 Accusys login message
"cat /etc/issue"
Accusys PCIE SAN 1U Switch
Kernel \r on an \m
## To auto login to linux console on boot
edit /etc/init/tty.conf (但是Switch 是ttys0設定方式不同)
修正 /etc/init/tty.conf
"exec /sbin/mingetty $TTY"
改為
"exec /sbin/mingetty --autologin root $TTY"
[root@localhost ~]# cat /etc/init/tty.conf
# tty - getty
#
# This service maintains a getty on the specified device.
#
# Do not edit this file directly. If you want to change the behaviour,
# please create a file tty.override and put your changes there.
stop on runlevel [S016]
respawn
instance $TTY
#exec /sbin/mingetty $TTY
exec /sbin/mingetty --autologin root $TTY
usage 'tty TTY=/dev/ttyX - where X is console id'
[root@localhost ~]#
## To auto login to linux serial console on boot
edit /etc/init/serial.conf
修正 /etc/init/serial.conf
"exec /sbin/agetty /dev/$DEV $SPEED vt100-nav"
改為
"exec /sbin/agetty -n -l /usr/sbin/autologin /dev/$DEV $SPEED vt100-nav"
但是 /usr/sbin 找不到 autologin
我們要自己準備 autologin.c, code 如下,
#include "unistd.h"
int main()
{
execlp( "login", "login", "-f", "root", NULL);
}
產生執行檔
gcc autologin.c -o autologin, 將檔案放在你要存放的位子
[root@localhost ~]# cat /etc/init/serial.conf
# Automatically start a configured serial console
#
# How this works:
#
# On boot, a udev helper examines /dev/console. If a serial console is the
# primary console (last console on the commandline in grub), the event
# 'fedora.serial-console-available <port name> <speed>' is emitted, which
# triggers this script. It waits for the runlevel to finish, ensures
# the proper port is in /etc/securetty, and starts the getty.
#
# If your serial console is not the primary console, or you want a getty
# on serial even if it's not the console, create your own event e.g.
# /etc/init/ttyS0.conf with content:
# # ttyS0 - agetty
# #
# # This service maintains a agetty on ttyS0.
#
# stop on runlevel [S016]
# start on runlevel [23]
#
# respawn
# exec agetty -h -L -w /dev/ttyS0 115200 vt102
#
# Do not edit this file directly. If you want to change the behaviour,
# please create a file serial.override and put your changes there.
start on fedora.serial-console-available DEV=* and stopped rc RUNLEVEL=[2345]
stop on runlevel [S016]
instance $DEV
respawn
pre-start exec /sbin/securetty $DEV
#exec /sbin/agetty /dev/$DEV $SPEED vt100-nav
exec /sbin/agetty -n -l /root/autologin /dev/$DEV $SPEED vt100-nav
post-stop exec /sbin/initctl emit --no-wait fedora.serial-console-available DEV=$DEV SPEED=$SPEED
usage 'DEV=ttySX SPEED=Y - where X is console id and Y is baud rate'
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言