summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-10-27 15:47:49 +0000
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2015-10-30 17:14:10 +0000
commit7f35f3f675f5b51f2658520a58e981cfd9f588ad (patch)
tree818b5dd4d9b6009b417bd412741498a8b0e0f027
parent0056d99aa0b88c9f9eb877096cda6bbc2c954184 (diff)
downloaddefinitions-baserock/pedroalvarez/gdp-rebase3.tar.gz
extensions: Add genivi.configure and use it in GENIVI systemsGENIVI-K1.0.1baserock/pedroalvarez/gdp-rebase3
This extension allow us to do at configure time: - Configure different weston.ini files (for GENIVI baseline and GDP) - Enable weston.service - Set different backends in weston.service Change-Id: Idfdb8b3d0e881d2da43eeefe86e42ca6876bb790
-rw-r--r--clusters/ci.morph6
-rw-r--r--clusters/gdp-jetson-upgrade.morph3
-rw-r--r--clusters/release.morph6
-rw-r--r--extensions/genivi.configure124
-rw-r--r--extensions/genivi.configure.help25
-rw-r--r--systems/genivi-baseline-system-armv7lhf-jetson.morph1
-rw-r--r--systems/genivi-baseline-system-armv7lhf-versatile.morph1
-rw-r--r--systems/genivi-baseline-system-x86_64-generic.morph1
-rw-r--r--systems/genivi-demo-platform-armv7lhf-jetson.morph1
-rw-r--r--systems/genivi-demo-platform-x86_64-generic.morph1
10 files changed, 169 insertions, 0 deletions
diff --git a/clusters/ci.morph b/clusters/ci.morph
index c4784e60..240e3d4f 100644
--- a/clusters/ci.morph
+++ b/clusters/ci.morph
@@ -65,6 +65,9 @@ systems:
location: genivi-baseline-system-x86_64-generic.img
DISK_SIZE: 4G
KERNEL_ARGS: vga=788
+ GENIVI_WESTON_BACKEND: fbdev
+ GENIVI_WESTON_CONFIG: baseline
+ GENIVI_WESTON_AUTOSTART: False
- morph: systems/genivi-baseline-system-armv7lhf-jetson.morph
deploy:
genivi-baseline-system-armv7lhf-jetson:
@@ -78,6 +81,9 @@ systems:
BOOTLOADER_INSTALL: none
KERNEL_ARGS: cma=256M console=tty0 console=ttyS0,115200n8 no_console_suspend=1
nouveau.pstate=1
+ GENIVI_WESTON_BACKEND: drm
+ GENIVI_WESTON_CONFIG: baseline
+ GENIVI_WESTON_AUTOSTART: True
- morph: systems/openstack-system-x86_64.morph
deploy:
openstack-system-x86_64:
diff --git a/clusters/gdp-jetson-upgrade.morph b/clusters/gdp-jetson-upgrade.morph
index 2147454a..33eb8ec1 100644
--- a/clusters/gdp-jetson-upgrade.morph
+++ b/clusters/gdp-jetson-upgrade.morph
@@ -10,6 +10,9 @@ systems:
BOOTLOADER_INSTALL: "none"
KERNEL_ARGS: cma=256M console=tty0 console=ttyS0,115200n8 no_console_suspend=1 nouveau.pstate=1
FSTAB_SRC: LABEL=src /src auto defaults,rw,noatime,nofail 0 2
+ GENIVI_WESTON_BACKEND: drm
+ GENIVI_WESTON_CONFIG: gdp
+ GENIVI_WESTON_AUTOSTART: True
deploy:
self:
type: extensions/ssh-rsync
diff --git a/clusters/release.morph b/clusters/release.morph
index dee5b2de..a34a87e3 100644
--- a/clusters/release.morph
+++ b/clusters/release.morph
@@ -63,6 +63,9 @@ systems:
KERNEL_ARGS: vga=788
INITRAMFS_PATH: boot/initramfs.gz
HOSTNAME: genivi-baseline-system-x86-64-generic
+ GENIVI_WESTON_BACKEND: fbdev
+ GENIVI_WESTON_CONFIG: baseline
+ GENIVI_WESTON_AUTOSTART: False
subsystems:
- morph: systems/initramfs-x86_64.morph
deploy:
@@ -83,3 +86,6 @@ systems:
KERNEL_ARGS: cma=256M console=tty0 console=ttyS0,115200n8 no_console_suspend=1
nouveau.pstate=1
HOSTNAME: genivi-baseline-system-armv7lhf-jetson
+ GENIVI_WESTON_BACKEND: drm
+ GENIVI_WESTON_CONFIG: baseline
+ GENIVI_WESTON_AUTOSTART: False
diff --git a/extensions/genivi.configure b/extensions/genivi.configure
new file mode 100644
index 00000000..c5f6dc4f
--- /dev/null
+++ b/extensions/genivi.configure
@@ -0,0 +1,124 @@
+#!/bin/sh
+
+# Copyright (C) 2015 Codethink Limited
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+set -e
+
+ROOT="$1"
+
+enable(){
+ ln -sf "/usr/lib/systemd/system/$1.service" \
+ "$ROOT/etc/systemd/system/multi-user.target.wants/$1.service"
+}
+
+unnaceptable(){
+ eval echo Unexpected value \$$1 for $1 >&2
+ exit 1
+}
+
+check_bool(){
+ case "$(eval echo \"\$$1\")" in
+ True)
+ eval "$1=true"
+ ;;
+ False|'')
+ eval "$1=false"
+ ;;
+ *)
+ unnaceptable "$1"
+ ;;
+ esac
+}
+
+check_weston_config(){
+ weston_ini_folder="$ROOT/usr/share/doc/weston"
+ case "$GENIVI_WESTON_CONFIG" in
+ 'baseline'|'')
+ weston_ini_file=ivi-shell-weston.ini
+ ;;
+ 'gdp')
+ weston_ini_file=gdp-weston.ini
+ ;;
+ *)
+ unnaceptable "GENIVI_WESTON_CONFIG"
+ ;;
+ esac
+ weston_ini_file="$weston_ini_folder/$weston_ini_file"
+ if [ ! -f "$weston_ini_file" ]; then
+ echo ERROR: Failed to locate weston config file: $weston_ini_file
+ exit 1
+ fi
+}
+
+check_weston_backend (){
+ # If nothing defined, use drm-backend.so
+ if [ "x$GENIVI_WESTON_BACKEND" == "x" ]; then
+ echo GENIVI_WESTON_BACLEND not set, defaulting to drm-backend.so
+ GENIVI_WESTON_BACKEND=drm-backend.so
+ fi
+
+ backends_folder="$ROOT/usr/lib/weston"
+ backend_file="$backends_folder/$GENIVI_WESTON_BACKEND"
+ # Check that the backend exists
+ echo Checking for "$backend_file" ...
+ if [ ! -f "$backend_file" ]; then
+ echo "File $backend_file doesn't exist"
+ GENIVI_WESTON_BACKEND="$GENIVI_WESTON_BACKEND-backend.so"
+ backend_file="$backends_folder/$GENIVI_WESTON_BACKEND"
+ echo Checking for "$backend_file" ...
+ if [ ! -f "$backend_file" ]; then
+ echo "File $backend_file doesn't exist"
+ echo ERROR: Failed to find Weston backend in the system
+ exit 1
+ fi
+ fi
+ echo Backend $backend_file found
+}
+
+##########################################################################
+# Check variables
+##########################################################################
+
+check_bool GENIVI_WESTON_AUTOSTART
+check_weston_config
+check_weston_backend
+
+######################################
+# Create and enable weston.service #
+######################################
+
+cat > "$ROOT/usr/lib/systemd/system/weston.service" <<EOF
+[Unit]
+Description=Weston reference Wayland compositor
+After=dbus.service
+
+[Service]
+ExecStart=/usr/bin/weston-launch -u root -- --log=/tmp/weston.log --backend="$GENIVI_WESTON_BACKEND"
+ExecStop=/usr/bin/killall -s KILL weston
+
+[Install]
+WantedBy=multi-user.target
+EOF
+
+if "$GENIVI_WESTON_AUTOSTART"; then
+ enable weston
+fi
+
+######################################
+# Set weston.ini file #
+######################################
+
+install -d "$ROOT/etc/xdg/weston"
+install -m 0644 $weston_ini_file "$ROOT/etc/xdg/weston/weston.ini"
diff --git a/extensions/genivi.configure.help b/extensions/genivi.configure.help
new file mode 100644
index 00000000..6616f871
--- /dev/null
+++ b/extensions/genivi.configure.help
@@ -0,0 +1,25 @@
+help: |
+ This extension configures GENIVI systems. It uses the following
+ configuration variables:
+
+ * `GENIVI_WESTON_CONFIG` (optional, defaults to `baseline`)
+ the weston configuration file to use. The GENIVI baseline system
+ uses a different one than the GENIVI Demo Platform.
+
+ Possibles values here are `baseline` and `gdp`. Other values will
+ fail. The extension will copy the relevant configuration file
+ from `/usr/share/doc/weston/` to `/etc/xdg/weston/weston.ini`
+ to make it the default configuration for Weston.
+
+ * `GENIVI_WESTON_BACKEND` (optional, defaults to 'drm-backend.so')
+ the backend to use with Weston. This backend will be used in
+ the `weston.service` systemd unit overriding the default backend
+ specified when building Weston.
+
+ The extension looks for the backend in the system, failing if
+ it's not present. It will also try to append `-backend.so` to
+ the variable so that (e.g) you can set this variable to `fbdev`
+ and to `fbdev-backend.so`.
+
+ * `GENIVI_WESTON_AUTOSTART`(optional. defaults to 'False')
+ boolean. If `True` it will enable the `weston.service`.
diff --git a/systems/genivi-baseline-system-armv7lhf-jetson.morph b/systems/genivi-baseline-system-armv7lhf-jetson.morph
index d4ead848..59e2c86f 100644
--- a/systems/genivi-baseline-system-armv7lhf-jetson.morph
+++ b/systems/genivi-baseline-system-armv7lhf-jetson.morph
@@ -47,3 +47,4 @@ configuration-extensions:
- extensions/strip-gplv3
- extensions/fstab
- extensions/install-essential-files
+- extensions/genivi
diff --git a/systems/genivi-baseline-system-armv7lhf-versatile.morph b/systems/genivi-baseline-system-armv7lhf-versatile.morph
index daf461d2..6a69e3b2 100644
--- a/systems/genivi-baseline-system-armv7lhf-versatile.morph
+++ b/systems/genivi-baseline-system-armv7lhf-versatile.morph
@@ -45,3 +45,4 @@ configuration-extensions:
- extensions/strip-gplv3
- extensions/fstab
- extensions/install-essential-files
+- extensions/genivi
diff --git a/systems/genivi-baseline-system-x86_64-generic.morph b/systems/genivi-baseline-system-x86_64-generic.morph
index 36fb42dd..693437b4 100644
--- a/systems/genivi-baseline-system-x86_64-generic.morph
+++ b/systems/genivi-baseline-system-x86_64-generic.morph
@@ -48,3 +48,4 @@ configuration-extensions:
- extensions/install-files
- extensions/strip-gplv3
- extensions/install-essential-files
+- extensions/genivi
diff --git a/systems/genivi-demo-platform-armv7lhf-jetson.morph b/systems/genivi-demo-platform-armv7lhf-jetson.morph
index 4078e2fe..d683a33e 100644
--- a/systems/genivi-demo-platform-armv7lhf-jetson.morph
+++ b/systems/genivi-demo-platform-armv7lhf-jetson.morph
@@ -68,3 +68,4 @@ configuration-extensions:
- extensions/install-files
- extensions/fstab
- extensions/install-essential-files
+- extensions/genivi
diff --git a/systems/genivi-demo-platform-x86_64-generic.morph b/systems/genivi-demo-platform-x86_64-generic.morph
index ad4a56a0..7b92faf1 100644
--- a/systems/genivi-demo-platform-x86_64-generic.morph
+++ b/systems/genivi-demo-platform-x86_64-generic.morph
@@ -70,3 +70,4 @@ configuration-extensions:
- extensions/install-files
- extensions/fstab
- extensions/install-essential-files
+- extensions/genivi