Difference between revisions of "Running Ubuntu Core"

From DAVE Developer's Wiki
Jump to: navigation, search
(Created page with "{{InfoBoxTop}} {{Applies To Linux}} {{AppliesToNaon}} {{AppliesToLizard}} {{InfoBoxBottom}} =Introduction= [http://www.canonical.com/ Canonical], the company behind the well...")
 
m (Ubuntu Core - Quick Guide)
Line 21: Line 21:
  
 
== Ubuntu Core - Quick Guide ==
 
== Ubuntu Core - Quick Guide ==
 +
 +
== Enabling the serial console ==
 +
 +
The following instructions show how to enable the serial console (eg: ttyO0)
 +
 +
* Create the /etc/init/serial-auto-detect-console.conf file with the following contents:
 +
 +
<pre>
 +
# serial-auto-detect-console - starts getty on serial console
 +
#
 +
# This service starts a getty on the serial port given in the 'console' kernel argument.
 +
#
 +
 +
start on runlevel [23]
 +
stop on runlevel [!23]
 +
 +
respawn
 +
 +
exec /bin/sh /bin/serial-console
 +
 +
</pre>
 +
 +
* Create the /bin/serial-console file with the following contents:
 +
 +
<pre>
 +
for arg in $(cat /proc/cmdline)
 +
do
 +
    case $arg in
 +
        console=*)
 +
            tty=${arg#console=}
 +
            tty=${tty#/dev/}
 +
 +
            case $tty in
 +
                tty[a-zA-Z]* )
 +
                    PORT=${tty%%,*}
 +
 +
                    # check for service which do something on this port
 +
                    if [ -f /etc/init/$PORT.conf ];then continue;fi
 +
 +
                    tmp=${tty##$PORT,}
 +
                    SPEED=${tmp%%n*}
 +
                    BITS=${tmp##${SPEED}n}
 +
 +
                    # 8bit serial is default
 +
                    [ -z $BITS ] && BITS=8
 +
                    [ 8 -eq $BITS ] && GETTY_ARGS="$GETTY_ARGS -8 "
 +
 +
                    [ -z $SPEED ] && SPEED='115200,57600,38400,19200,9600'
 +
 +
                    GETTY_ARGS="$GETTY_ARGS $SPEED $PORT"
 +
                    exec /sbin/getty $GETTY_ARGS
 +
            esac
 +
    esac
 +
done
 +
</pre>
 +
 +
* Create the /etc/init/ttyO0.conf file with the following contents:
 +
 +
<pre>
 +
# ttyO0 - getty
 +
#
 +
# This service maintains a getty on ttyO0 from the point the system is
 +
# started until it is shut down again.
 +
 +
start on runlevel [23] and (
 +
            not-container or
 +
            container CONTAINER=lxc or
 +
            container CONTAINER=lxc-libvirt)
 +
 +
stop on runlevel [!23]
 +
 +
respawn
 +
exec /sbin/getty -8 115200 ttyO0
 +
</pre>

Revision as of 15:43, 29 November 2012

Info Box
Tux.png Applies to Linux
Naon am387x-dm814x.png Applies to Naon
Lizard.jpg Applies to Lizard

Introduction[edit | edit source]

Canonical, the company behind the well-known [www.ubuntu.com Ubuntu] GNU/Linux distribution, is now sharing a minimal filesystem for ARM architecture called Ubuntu Core. This basic root file system works perfectly with platforms based on the Sitara processors, as Naon and Lizard. It contains the APT software so the file system can be easily customized installing additional packages.

References[edit | edit source]


Ubuntu Core - Quick Guide[edit | edit source]

Enabling the serial console[edit | edit source]

The following instructions show how to enable the serial console (eg: ttyO0)

  • Create the /etc/init/serial-auto-detect-console.conf file with the following contents:
# serial-auto-detect-console - starts getty on serial console
#
# This service starts a getty on the serial port given in the 'console' kernel argument.
#

start on runlevel [23]
stop on runlevel [!23]

respawn

exec /bin/sh /bin/serial-console

  • Create the /bin/serial-console file with the following contents:
for arg in $(cat /proc/cmdline)
do
    case $arg in
        console=*)
            tty=${arg#console=}
            tty=${tty#/dev/}
 
            case $tty in
                tty[a-zA-Z]* )
                    PORT=${tty%%,*}
 
                    # check for service which do something on this port
                    if [ -f /etc/init/$PORT.conf ];then continue;fi 
 
                    tmp=${tty##$PORT,}
                    SPEED=${tmp%%n*}
                    BITS=${tmp##${SPEED}n}
 
                    # 8bit serial is default
                    [ -z $BITS ] && BITS=8
                    [ 8 -eq $BITS ] && GETTY_ARGS="$GETTY_ARGS -8 "
 
                    [ -z $SPEED ] && SPEED='115200,57600,38400,19200,9600'
 
                    GETTY_ARGS="$GETTY_ARGS $SPEED $PORT"
                    exec /sbin/getty $GETTY_ARGS
            esac
    esac
done
  • Create the /etc/init/ttyO0.conf file with the following contents:
# ttyO0 - getty
#
# This service maintains a getty on ttyO0 from the point the system is
# started until it is shut down again.

start on runlevel [23] and (
            not-container or
            container CONTAINER=lxc or
            container CONTAINER=lxc-libvirt)

stop on runlevel [!23]

respawn
exec /sbin/getty -8 115200 ttyO0