52879048ac17927b7521485ef91e33361f8fdf85
[csit.git] / resources / tools / disk-image-builder / ubuntu / scripts-remote / serial-console.sh
1 #!/bin/sh -e
2
3 # Copyright (c) 2016 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 ##
17 ## Serial console
18 ##
19 echo "********** CONFIGURING SERIAL CONSOLE AND DISABLING IPV6 **********"
20 cat - > /etc/init/ttyS0.conf <<"_EOF"
21 # ttyS0 - getty
22 #
23 # This service maintains a getty on ttyS0 from the point the system is
24 # started until it is shut down again.
25
26 start on stopped rc RUNLEVEL=[12345]
27 stop on runlevel [!12345]
28
29 respawn
30 exec /sbin/getty -L 115200 ttyS0 vt102
31 _EOF
32
33 cat - > /etc/default/grub <<"_EOF"
34 # If you change this file, run 'update-grub' afterwards to update
35 # /boot/grub/grub.cfg.
36 # For full documentation of the options in this file, see:
37 #   info -f grub -n 'Simple configuration'
38
39 GRUB_DEFAULT=0
40 GRUB_TIMEOUT=1
41 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
42 GRUB_CMDLINE_LINUX="console=tty0 console=ttyS0,115200n8 ipv6.disable=1"
43
44 GRUB_TERMINAL=serial
45 GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
46
47 # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
48 #GRUB_DISABLE_LINUX_UUID=true
49
50 # Uncomment to disable generation of recovery mode menu entries
51 #GRUB_DISABLE_RECOVERY="true"
52
53 # Uncomment to get a beep at grub start
54 #GRUB_INIT_TUNE="480 440 1"
55 _EOF
56
57 update-grub