Sean Rhodes has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/59052 )
Change subject: WIP: CC ......................................................................
WIP: CC
Signed-off-by: Sean Rhodes sean@starlabs.systems Change-Id: I505ebd2151c78dfed222fbc6fb611c6fb1e20454 --- A util/coreboot-configurator/README.md A util/coreboot-configurator/contrib/PKGBUILD A util/coreboot-configurator/contrib/README.md A util/coreboot-configurator/contrib/debian/changelog A util/coreboot-configurator/contrib/debian/compat A util/coreboot-configurator/contrib/debian/control A util/coreboot-configurator/contrib/debian/files A util/coreboot-configurator/contrib/debian/rules A util/coreboot-configurator/contrib/debian/source/format A util/coreboot-configurator/contrib/flatpak/coreboot-configurator.json A util/coreboot-configurator/contrib/flatpak/org.coreboot.coreboot-configurator.json A util/coreboot-configurator/meson.build A util/coreboot-configurator/meson_options.txt A util/coreboot-configurator/screenshots/coreboot-configurator.gif A util/coreboot-configurator/screenshots/coreboot-configurator.png A util/coreboot-configurator/src/application/aboutwindow.cpp A util/coreboot-configurator/src/application/aboutwindow.h A util/coreboot-configurator/src/application/aboutwindow.ui A util/coreboot-configurator/src/application/categories.yaml A util/coreboot-configurator/src/application/configuration.cpp A util/coreboot-configurator/src/application/configuration.h A util/coreboot-configurator/src/application/corebootconfigurator.cpp A util/coreboot-configurator/src/application/corebootconfigurator.h A util/coreboot-configurator/src/application/corebootconfigurator.ui A util/coreboot-configurator/src/application/images.qrc A util/coreboot-configurator/src/application/main.cpp A util/coreboot-configurator/src/application/meson.build A util/coreboot-configurator/src/application/nvramtoolcli.cpp A util/coreboot-configurator/src/application/nvramtoolcli.h A util/coreboot-configurator/src/application/qtyaml.h A util/coreboot-configurator/src/application/toggle-off.svg A util/coreboot-configurator/src/application/toggle-on.svg A util/coreboot-configurator/src/application/toggleswitch.cpp A util/coreboot-configurator/src/application/toggleswitch.h A util/coreboot-configurator/src/application/util.h A util/coreboot-configurator/src/meson.build A util/coreboot-configurator/src/static/aboutIcon.png A util/coreboot-configurator/src/static/categories.yaml A util/coreboot-configurator/src/static/coreboot-configurator.desktop A util/coreboot-configurator/src/static/coreboot_configurator.svg A util/coreboot-configurator/src/static/meson.build A util/coreboot-configurator/src/static/org.coreboot.nvramtool.policy A util/coreboot-configurator/src/static/org.coreboot.reboot.policy 43 files changed, 3,174 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/52/59052/1
diff --git a/util/coreboot-configurator/README.md b/util/coreboot-configurator/README.md new file mode 100644 index 0000000..f174e36 --- /dev/null +++ b/util/coreboot-configurator/README.md @@ -0,0 +1,67 @@ +# coreboot-configurator ![alt text](https://cdn.shopify.com/s/files/1/2059/5897/files/Star_50x.png?v=1513954416 "Star Labs Systems") + +A simply GUI to change settings in coreboot's CBFS, via the nvramtool utility. + +![coreboot-configurator](screenshots/coreboot-configurator.gif) +# How to install +## Ubuntu, Linux Mint, elementary OS, Zorin OS and other derivates +##### Install +``` +sudo add-apt-repository ppa:starlabs/ppa +sudo apt update +sudo apt install coreboot-configurator +``` +##### Uninstall +``` +sudo apt purge coreboot-configurator +``` + +## Debian +##### Install +``` +echo "deb http://ppa.launchpad.net/starlabs/ppa/ubuntu focal main" | sudo tee -a /etc/apt/sources.list.d/starlabs-ubuntu-ppa-focal.list +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 17A20BAF70BEC3904545ACFF8F21C26C794386E3 +sudo apt update +sudo apt install coreboot-configurator +``` + +##### Uninstall +``` +sudo apt purge coreboot-configurator +``` + +## Manjaro +##### Install +``` +sudo pacman -Syu coreboot-configurator +``` +##### Uninstall +``` +sudo pacman -Rns coreboot-configurator +``` + +## Other Distributions +##### Install +``` +git clone https://github.com/StarLabsLtd/coreboot-configurator.git +cd coreboot-configurator +meson build +ninja -C build install +``` +##### Uninstall +``` +sudo ninja -C uninstall +``` + +# Advanced Mode +Enabling advanced mode will all you to see all settings contained inside coreboot. Tread carefully :) + +## Copying or Reusing +Included scripts are free software licensed under the terms of the [GNU General Public License, version 2](https://www.gnu.org/licenses/gpl-2.0.txt). + +Thanks to [corevantage](https://github.com/JaGoLi/corevantage) that this was orignally forked and inspired from. + +# [© Star Labs® / All Rights Reserved.](https://starlabs.systems) +Any issues or questions, please contact us at [support@starlabs.systems](mailto:supportstarlabs.systems) + +View our full range of Linux laptops at: [https://starlabs.systems%5D(https://starlabs.systems) diff --git a/util/coreboot-configurator/contrib/PKGBUILD b/util/coreboot-configurator/contrib/PKGBUILD new file mode 100644 index 0000000..6db5ca1 --- /dev/null +++ b/util/coreboot-configurator/contrib/PKGBUILD @@ -0,0 +1,32 @@ +# Maintainer: Bernhard Landauer bernhard@manjaro.org + +pkgname=coreboot-configurator +pkgver=7.f +pkgrel=1 +pkgdesc="A graphical interface to set options on devices with coreboot firmware" +arch=('x86_64') +url="https://github.com/StarLabsLtd/coreboot-configurator" +license=('GPL3') +depends=('nvramtool' 'qt5-base') +makedepends=('inkscape' 'meson' 'qt5-tools') +source=("$pkgname-$pkgver.tar.gz::$url/archive/refs/tags/$pkgver.tar.gz") +sha256sums=('ac69e0b96447729021545d7f83dcb03411abebf557d5e57db463c063af946ba6') + +prepare() { + cd "$pkgname-$pkgver" + find . -type f -exec sed -i 's|/usr/sbin|/usr/bin|g' {} ; +} + +build() { + arch-meson "$pkgname-$pkgver" build + meson compile -C build +} + +package() { + meson install -C build --destdir "$pkgdir" + + # There's probably a way to change the path before building + install -d "$pkgdir/usr/bin/" + mv "$pkgdir/usr/sbin/$pkgname" "$pkgdir/usr/bin/" + rm -rf "$pkgdir/usr/sbin/" +} diff --git a/util/coreboot-configurator/contrib/README.md b/util/coreboot-configurator/contrib/README.md new file mode 100644 index 0000000..7316b79 --- /dev/null +++ b/util/coreboot-configurator/contrib/README.md @@ -0,0 +1,37 @@ +# Distribution Packages ![alt text](https://cdn.shopify.com/s/files/1/2059/5897/files/Star_50x.png?v=1513954416 "Star Labs Systems") + +The relevant packaging necessary to generate DEB, flatpak and PKG distribution packages is contained here. The generated packages can be used on a distribution such as Fedora, Debian, Ubuntu or Manjaro. + +# DEB packages +To build the DEBs, run these commands (from the root of your git checkout): +```bash +cp -r contrib/debian . +debuild --no-lintian +``` +To build source files, modify the [change log](debian/changelog) accordingly and run: +```bash +cp -r contrib/debian . +debuild -S +``` + +# PKG +A sample [PKGBUILD](PKGBUILD) is included. + +# Flatpak +To build the Flatpak, run these commands (from the root of your git checkout): +```bash +meson build --prefix=/usr +pushd build +meson dist +popd +cp contrib/flatpak/org.coreboot.coreboot-configurator.json . +flatpak-builder build-dir org.coreboot.coreboot-configurator.json +``` + +## Copying or Reusing +Included scripts are free software licensed under the terms of the [GNU General Public License, version 3](https://www.gnu.org/licenses/gpl-3.0.txt). + +# [© Star Labs® / All Rights Reserved.](https://starlabs.systems) +Any issues or questions, please contact us at [support@starlabs.systems](mailto:supportstarlabs.systems) + +View our full range of Linux laptops at: [https://starlabs.systems%5D(https://starlabs.systems) diff --git a/util/coreboot-configurator/contrib/debian/changelog b/util/coreboot-configurator/contrib/debian/changelog new file mode 100644 index 0000000..dc664b0 --- /dev/null +++ b/util/coreboot-configurator/contrib/debian/changelog @@ -0,0 +1,50 @@ +coreboot-configurator (8) impish; urgency=medium + + * Release version 8 + + -- Sean Rhodes sean@starlabs.systems Wed, 03 Nov 2021 21:06:03 +0000 + +coreboot-configurator (7+a) focal; urgency=medium + + * Version 7 to match coreboot 7 + + -- Sean Rhodes sean@starlabs.systems Tue, 24 Aug 2021 07:35:16 +0100 + +coreboot-configurator (6.h) hirsute; urgency=medium + + * Version 6 to match coreboot 6 + * Adds support to disable or enable VT-d, wireless, webcam, microphone and clock gating + * Adds support to select TDP + + -- Sean Rhodes sean@starlabs.systems Fri, 11 Jun 2021 08:40:38 +0100 + +coreboot-configurator (5) hirsute; urgency=medium + + * Version 5 to match coreboot 5 + * Adds support to disable or enable IME + + -- Sean Rhodes sean@starlabs.systems Thu, 29 Apr 2021 14:39:40 +0100 + +coreboot-configurator (3) hirsute; urgency=medium + + * Added qt5-default dependency + + -- Sean Rhodes sean@starlabs.systems Wed, 14 Apr 2021 16:44:13 +0100 + +coreboot-configurator (2) hirsute; urgency=medium + + * Fixed values that a read + + -- Sean Rhodes sean@starlabs.systems Tue, 13 Apr 2021 16:40:04 +0100 + +coreboot-configurator (1) hirsute; urgency=medium + + * Fixed icon + + -- Sean Rhodes sean@starlabs.systems Tue, 13 Apr 2021 11:47:04 +0100 + +coreboot-configurator (0) hirsute; urgency=medium + + * Initial release. + + -- Sean Rhodes sean@starlabs.systems Mon, 12 Apr 2021 21:14:48 +0100 diff --git a/util/coreboot-configurator/contrib/debian/compat b/util/coreboot-configurator/contrib/debian/compat new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/util/coreboot-configurator/contrib/debian/compat @@ -0,0 +1 @@ +10 diff --git a/util/coreboot-configurator/contrib/debian/control b/util/coreboot-configurator/contrib/debian/control new file mode 100644 index 0000000..4a06a34 --- /dev/null +++ b/util/coreboot-configurator/contrib/debian/control @@ -0,0 +1,11 @@ +Source: coreboot-configurator +Section: utils +Priority: optional +Maintainer: Star Labs admin@starlabs.systems +Build-Depends: debhelper (>= 7), build-essential, cmake, qtbase5-dev, inkscape, meson, libyaml-cpp-dev +Standards-Version: 4.1.1 + +Package: coreboot-configurator +Depends: nvramtool, ${shlibs:Depends}, ${misc:Depends}, libqt5gui5 +Architecture: all +Description: Graphical interface to change settings available in coreboot CBFS diff --git a/util/coreboot-configurator/contrib/debian/files b/util/coreboot-configurator/contrib/debian/files new file mode 100644 index 0000000..db63f72 --- /dev/null +++ b/util/coreboot-configurator/contrib/debian/files @@ -0,0 +1,2 @@ +coreboot-configurator_7+a_all.deb utils optional +coreboot-configurator_7+a_amd64.buildinfo utils optional diff --git a/util/coreboot-configurator/contrib/debian/rules b/util/coreboot-configurator/contrib/debian/rules new file mode 100755 index 0000000..a27f2125 --- /dev/null +++ b/util/coreboot-configurator/contrib/debian/rules @@ -0,0 +1,11 @@ +#!/usr/bin/make -f +#export DH_VERBOSE = 1 + +%: + dh $@ --buildsystem=meson + +override_dh_install: + dh_install + +override_dh_missing: + dh_missing --fail-missing diff --git a/util/coreboot-configurator/contrib/debian/source/format b/util/coreboot-configurator/contrib/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/util/coreboot-configurator/contrib/debian/source/format @@ -0,0 +1 @@ +3.0 (native) diff --git a/util/coreboot-configurator/contrib/flatpak/coreboot-configurator.json b/util/coreboot-configurator/contrib/flatpak/coreboot-configurator.json new file mode 100644 index 0000000..9650911 --- /dev/null +++ b/util/coreboot-configurator/contrib/flatpak/coreboot-configurator.json @@ -0,0 +1,3 @@ +{ + "skip-appstream-check": true +} diff --git a/util/coreboot-configurator/contrib/flatpak/org.coreboot.coreboot-configurator.json b/util/coreboot-configurator/contrib/flatpak/org.coreboot.coreboot-configurator.json new file mode 100644 index 0000000..b83bbce --- /dev/null +++ b/util/coreboot-configurator/contrib/flatpak/org.coreboot.coreboot-configurator.json @@ -0,0 +1,36 @@ +{ + "app-id": "org.coreboot.coreboot-configurator", + "runtime": "org.kde.Platform", + "runtime-version": "5.12", + "sdk": "org.kde.Platform", + "branch": "stable", + "command": "/usr/sbin/coreboot-configurator", + "modules": [ + { + "name": "coreboot-configurator", + "buildsystem": "meson", + "cleanup ": [ + "/usr/sbin/coreboot-configurator", + "/usr/share/coreboot-configurator/aboutIcon.png", + "/usr/share/polkit-1/actions/org.coreboot.nvramtool.policy", + "/usr/share/polkit-1/actions/org.coreboot.reboot.policy", + "usr/share/applications/coreboot-configurator.desktop", + "/usr/share/icons/hicolor/24x24/apps/coreboot-configurator.png", + "/usr/share/icons/hicolor/48x48/apps/coreboot-configurator.png", + "/usr/share/icons/hicolor/96x96/apps/coreboot-configurator.png", + "/usr/share/icons/hicolor/16x16/apps/coreboot-configurator.png", + "/usr/share/icons/hicolor/32x32/apps/coreboot-configurator.png", + "/usr/share/icons/hicolor/64x64/apps/coreboot-configurator.png", + "/usr/share/icons/hicolor/128x128/apps/coreboot-configurator.png", + "/usr/share/icons/hicolor/256x256/apps/coreboot-configurator.png", + "/usr/share/icons/hicolor/512x512/apps/coreboot-configurator.png" + ], + "sources": [ + { + "type": "archive", + "path": "build/meson-dist/coreboot-configurator-8.tar.xz" + } + ] + } + ] +} diff --git a/util/coreboot-configurator/meson.build b/util/coreboot-configurator/meson.build new file mode 100644 index 0000000..4813ade --- /dev/null +++ b/util/coreboot-configurator/meson.build @@ -0,0 +1,11 @@ +## SPDX-License-Identifier: GPL-2.0-only + +project('coreboot-configurator', + 'cpp', + version: '8', + license: ['GPL3', 'CC BY-SA 4.0'], + meson_version: '>= 0.52.0', + default_options: ['prefix=/usr'], +) + +subdir('src') diff --git a/util/coreboot-configurator/meson_options.txt b/util/coreboot-configurator/meson_options.txt new file mode 100644 index 0000000..2dedd74 --- /dev/null +++ b/util/coreboot-configurator/meson_options.txt @@ -0,0 +1,12 @@ +## SPDX-License-Identifier: GPL-2.0-only + +option('sizes', + type: 'array', + choices: ['24', '48', '96', '16', '32', '64', '128', '256', '512'], + description: 'Choose icon size(s)', +) + +option('mock', + type : 'boolean', + value : false +) diff --git a/util/coreboot-configurator/screenshots/coreboot-configurator.gif b/util/coreboot-configurator/screenshots/coreboot-configurator.gif new file mode 100644 index 0000000..7e187ad --- /dev/null +++ b/util/coreboot-configurator/screenshots/coreboot-configurator.gif Binary files differ diff --git a/util/coreboot-configurator/screenshots/coreboot-configurator.png b/util/coreboot-configurator/screenshots/coreboot-configurator.png new file mode 100644 index 0000000..6d07b61 --- /dev/null +++ b/util/coreboot-configurator/screenshots/coreboot-configurator.png Binary files differ diff --git a/util/coreboot-configurator/src/application/aboutwindow.cpp b/util/coreboot-configurator/src/application/aboutwindow.cpp new file mode 100644 index 0000000..080087c --- /dev/null +++ b/util/coreboot-configurator/src/application/aboutwindow.cpp @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <QIcon> +#include <QScreen> + +#include "aboutwindow.h" +#include "ui_aboutwindow.h" + +AboutWindow::AboutWindow(QWidget *parent) : + QDialog(parent), + ui(new Ui::aboutWindow) +{ + ui->setupUi(this); + + /* Set Title and Icon */ + this->setWindowTitle("About"); + this->setWindowIcon(QIcon::fromTheme("coreboot_configurator")); + + /* Close when saving */ + connect(ui->okButton, &QDialogButtonBox::accepted, this, &QWidget::close); +} + +AboutWindow::~AboutWindow() +{ + delete ui; +} diff --git a/util/coreboot-configurator/src/application/aboutwindow.h b/util/coreboot-configurator/src/application/aboutwindow.h new file mode 100644 index 0000000..e205371 --- /dev/null +++ b/util/coreboot-configurator/src/application/aboutwindow.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef ABOUTWINDOW_H +#define ABOUTWINDOW_H + +#include <QDialog> + +namespace Ui { + class aboutWindow; +} + +class AboutWindow : public QDialog +{ + Q_OBJECT + +public: + explicit AboutWindow(QWidget *parent = nullptr); + ~AboutWindow(); + +private: + Ui::aboutWindow *ui; +}; + +#endif diff --git a/util/coreboot-configurator/src/application/aboutwindow.ui b/util/coreboot-configurator/src/application/aboutwindow.ui new file mode 100644 index 0000000..e6a39a1 --- /dev/null +++ b/util/coreboot-configurator/src/application/aboutwindow.ui @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>aboutWindow</class> + <widget class="QWidget" name="aboutWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>475</width> + <height>245</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>475</width> + <height>245</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>475</width> + <height>245</height> + </size> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <layout class="QHBoxLayout" name="AboutCountainer"> + <item> + <layout class="QVBoxLayout" name="inner"> + <item> + <widget class="QLabel" name="Title"> + <property name="font"> + <font> + <family>DejaVu Sans</family> + <pointsize>16</pointsize> + <weight>75</weight> + <bold>true</bold> + </font> + </property> + <property name="text"> + <string>coreboot configurator</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="description"> + <item> + <widget class="QLabel" name="text"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>30</height> + </size> + </property> + <property name="text"> + <string><html><head/><body><p align="center">A simply GUI to change settings in coreboot's CBFS,</p><p align="center">via the nvramtool utility.</p></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignHCenter|Qt::AlignTop</set> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QHBoxLayout" name="support"> + <item> + <widget class="QLabel" name="email"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>100</width> + <height>0</height> + </size> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + <property name="text"> + <string><html><head/><body><p><a href="https://support.starlabs.systems%22%3E%3Cspan style=" text-decoration: underline; color:#0000ff;">starlabs.systems</span></a></p></body></html></string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + <property name="openExternalLinks"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QDialogButtonBox" name="okButton"> + <property name="minimumSize"> + <size> + <width>0</width> + <height>0</height> + </size> + </property> + <property name="standardButtons"> + <set>QDialogButtonBox::Ok</set> + </property> + <property name="centerButtons"> + <bool>true</bool> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> diff --git a/util/coreboot-configurator/src/application/categories.yaml b/util/coreboot-configurator/src/application/categories.yaml new file mode 100644 index 0000000..57eea16 --- /dev/null +++ b/util/coreboot-configurator/src/application/categories.yaml @@ -0,0 +1,115 @@ +processor: + displayName: Processor + hyper_threading: + displayName: Hyper-Threading + type: bool + help: Enable or disable Hyper-Threading + vtd: + displayName: Intel VT-d + type: bool + help: Enable or disable Intel VT-d (virtualisation) + power_profile: + displayName: Power Profile + type: enum + help: Select whether to maximise performance, battery life or both + me_state: + displayName: Intel Management Engine + type: bool + help: Enable or disable the Intel Management Engine + +devices: + displayName: Devices + wireless: + displayName: Wireless + type: bool + help: Enable or disable the built-in wireless card + wlan: + displayName: Wireless + type: bool + help: Enable or disable the built-in wireless card + bluetooth: + displayName: Bluetooth + type: bool + help: Enable or disable the built-in bluetooth + wwan: + displayName: Mobile Network + type: bool + help: Enable or disable the built-in mobile network + ethernet1: + displayName: Ethernet 1 + type: bool + help: Enable or disable the built-in Ethernet Port 1 + ethernet2: + displayName: Ethernet 2 + type: bool + help: Enable or disable the built-in Ethernet Port 2 + ethernet3: + displayName: Ethernet 3 + type: bool + help: Enable or disable the built-in Ethernet Port 3 + webcam: + displayName: Webcam + type: bool + help: Enable or disable the built-in webcam + microphone: + displayName: Microphone + type: bool + help: Enable or disable the built-in microphone + legacy_8254_timer: + displayName: Clock Gating + type: bool + help: Enable or disable the legacy 8254 timer. Reduces power consumption when enabled but must be disabled for certain distributions such as Qubes + usb_always_on: + displayName: USB Always On + type: bool + help: Allow the USB ports to provide power to connected devices when the computer is suspended + touchpad: + displayName: Touchpad + type: bool + help: Enable or disable the built-in touchpad + trackpoint: + displayName: Trackpoint + type: bool + help: Enable or disable the built-in trackpoint + sata_mode: + displayName: SATA Mode + type: enum + help: Set the mode of the SATA controller from AHCI or Compatible + +system: + displayName: System + kbl_timeout: + displayName: Keyboard Backlight Timeout + type: enum + help: Adjust the amount of time before the keyboard backlight turns off when un-used + fn_ctrl_swap: + displayName: Fn Ctrl Reverse + type: bool + help: Swap the functions of the [Fn] and [Ctrl] keys + max_charge: + displayName: Max Charge + type: enum + help: Set the maximum level the battery will charge to + fan_mode: + displayName: Fan Mode + type: enum + help: Adjust the fan curve to priotise performance or noise levels + f1_to_f12_as_primary: + displayName: Function Lock + type: bool + help: Make the F-keys behave as if you are holding down the Fn key + +advanced: + displayName: Advanced + boot_option: + displayName: Boot Options + type: enum + help: Change the boot device in the event of a failed boot + debug_level: + displayName: Debug Level + type: enum + help: Set the verbosity of the debug output + power_on_after_fail: + displayName: Power on Behaviour + type: enum + help: Select whether to power on in the event of a power failure diff --git a/util/coreboot-configurator/src/application/configuration.cpp b/util/coreboot-configurator/src/application/configuration.cpp new file mode 100644 index 0000000..2e03234 --- /dev/null +++ b/util/coreboot-configurator/src/application/configuration.cpp @@ -0,0 +1,42 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include "configuration.h" + +#include <QFile> +#include <QString> +#include <QTextStream> + +#include "util.h" + +QMap<QString, QString> Configuration::fromFile(const QString &curr_path) +{ + QFile curr_file(curr_path); + + if ( !curr_file.open(QFile::ReadOnly) + || !curr_file.isReadable() + || curr_file.atEnd()) { + return {}; + } + + auto result = Util::parseParameters(curr_file); + + curr_file.close(); + return result; +} + + +bool Configuration::toFile(const QString &curr_path, const Parameters ¶ms) +{ + QFile output(curr_path); + + if(!output.open(QFile::WriteOnly|QFile::Truncate)){ + return false; + } + QTextStream outStream(&output); + for(auto it = params.begin(); it != params.end(); ++it){ + outStream << it.key() << " = " << it.value() << "\n"; + } + + output.close(); + return true; +} diff --git a/util/coreboot-configurator/src/application/configuration.h b/util/coreboot-configurator/src/application/configuration.h new file mode 100644 index 0000000..1d370d5 --- /dev/null +++ b/util/coreboot-configurator/src/application/configuration.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef READCFG_H +#define READCFG_H + +#include <QObject> +#include <QMap> +#include <QString> +#include <QFile> + +namespace Configuration { + + using Parameters = QMap<QString,QString>; + + Parameters fromFile(const QString& curr_path); + bool toFile(const QString& curr_path, const Parameters& params); + +} + +#endif diff --git a/util/coreboot-configurator/src/application/corebootconfigurator.cpp b/util/coreboot-configurator/src/application/corebootconfigurator.cpp new file mode 100644 index 0000000..f44903d --- /dev/null +++ b/util/coreboot-configurator/src/application/corebootconfigurator.cpp @@ -0,0 +1,386 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <QDebug> +#include <QFileDialog> +#include <QProcess> +#include <QPushButton> +#include <QScreen> +#include <QShortcut> +#include <QHBoxLayout> +#include <QLabel> +#include <QCheckBox> +#include <QComboBox> +#include <QTableWidget> +#include <QHeaderView> +#include <QtGlobal> +#include <QtGui> + +#include "qtyaml.h" +#include "nvramtoolcli.h" + +#include "corebootconfigurator.h" +#include "./ui_corebootconfigurator.h" +#include "toggleswitch.h" + +static auto s_errorWindowTitle = "Error Occured"; +static auto s_nvramErrorMessage = "Nvramtool was not able to access cmos settings. Look at documentation for possible causes of errors."; + +QString makeNvramErrorMessage(const QString& error){ + if(!error.trimmed().isEmpty()){ + return QString("%1<br><br>Error message:<br><tt>%2</tt>").arg(s_nvramErrorMessage, + Qt::convertFromPlainText(error)); + } + return s_nvramErrorMessage; +} + +static auto s_metadataErrorMessage = "Can't load categories metadata file. Check your installation."; +static constexpr char s_sudoProg[] = "/usr/bin/pkexec"; + + +CorebootConfigurator::CorebootConfigurator(QWidget *parent) + : QMainWindow(parent) + , ui(new Ui::coreboot_configurator) +{ + ui->setupUi(this); + + /* Set Title and Icon */ +#if MOCK + this->setWindowTitle("coreboot configurator [MOCKED DATA]"); +#else + this->setWindowTitle("coreboot configurator"); +#endif + this->setWindowIcon(QIcon::fromTheme("coreboot_configurator")); + + QFile catFile(":/config/categories.yaml"); + + if(!catFile.open(QFile::ReadOnly)){ + QMessageBox::critical(this, s_errorWindowTitle, s_metadataErrorMessage); + this->close(); + return; + } + + m_categories = YAML::Load(catFile.readAll()); + + if(m_categories.IsNull() || !m_categories.IsDefined()){ + QMessageBox::critical(this, s_errorWindowTitle, s_metadataErrorMessage); + this->close(); + return; + } + + /* Connect About */ + connect(ui->actionAbout_2, &QAction::triggered, this, [=](){ + AboutWindow about_win(this); + about_win.exec(); + }); + + /* Centre Window */ + move(QGuiApplication::screens().at(0)->geometry().center() - frameGeometry().center()); + + /* Bind [enter] to "OK" */ + QShortcut* returnAction = new QShortcut(QKeySequence("Ctrl+Return"), this); + connect(returnAction, &QShortcut::activated, this, &CorebootConfigurator::saveAndClose); + + /* Read and save file */ + connect(ui->actionImport_from_File, &QAction::triggered, this, &CorebootConfigurator::getFromFile); + connect(ui->actionSave_to_File, &QAction::triggered, this, &CorebootConfigurator::writeSettings); + + /* Close file */ + connect(ui->confirmBox, &QDialogButtonBox::rejected, this, &QMainWindow::close); + connect(ui->confirmBox, &QDialogButtonBox::accepted, this, &CorebootConfigurator::saveAndClose); + + connect(ui->actionExit, &QAction::triggered, this, &QMainWindow::close); + connect(ui->actionSave_and_Exit, &QAction::triggered, this, &CorebootConfigurator::saveAndClose); + + getSettings(); + displaySettings(); +} + +CorebootConfigurator::~CorebootConfigurator() +{ + delete ui; +} + +void CorebootConfigurator::showRebootWindow(void) { + + QMessageBox reboot_win(this); + + reboot_win.setWindowTitle("Reboot System"); + reboot_win.setWindowIcon(QIcon::fromTheme("coreboot_configurator")); + reboot_win.setText("Do you want to reboot your system now?"); + reboot_win.setInformativeText("Changes to bios settings have been successfully applied"); + reboot_win.setIcon(QMessageBox::Question); + + QPushButton* reboot_but = reboot_win.addButton("Reboot Now", QMessageBox::YesRole); + reboot_win.addButton("Reboot Later", QMessageBox::NoRole); + + eboot_win.exec(); + if (reboot_win.clickedButton() == reboot_but) { + /* Reboot */ + QProcess::startDetached(s_sudoProg, {"/usr/sbin/reboot"}); + } +} + +void CorebootConfigurator::saveAndClose() { + ui->centralwidget->setEnabled(false); + QString error; + if(NvramToolCli::writeParameters(m_parameters, &error)){ + showRebootWindow(); + this->close(); + return; + } + + QMessageBox::critical(this, s_errorWindowTitle, makeNvramErrorMessage(error)); + ui->centralwidget->setEnabled(true); + +} + +void CorebootConfigurator::getFromFile(){ + /* Dialog Box */ + auto filename = QFileDialog::getOpenFileName(this, + "Select File", + QDir::homePath(), + "Coreboot Configuration Files (*.cfg)"); + + if(filename.isEmpty()){ + return; + } + + auto configValues = Configuration::fromFile(filename); + + for(auto it = configValues.begin(); it != configValues.end(); ++it){ + if(!m_parameters.contains(it.key())){ + continue; + } + m_parameters[it.key()]=it.value(); + emit updateValue(it.key()); + } +} + +void CorebootConfigurator::writeSettings() { + auto fileName = QFileDialog::getSaveFileName(this, "Enter File to Save", QDir::homePath(), "Coreboot Configuration Files (*.cfg)"); + + if(fileName.isEmpty()){ + return; + } + writeToFile(fileName); +} + +void CorebootConfigurator::getSettings() { + QString error; + m_parameters = NvramToolCli::readParameters(&error); + + if(m_parameters.isEmpty()){ + QMessageBox::critical(this, s_errorWindowTitle, makeNvramErrorMessage(error)); + + /* we need delayed close as initialization error happened before event loop start so we can't stop application properly */ + QTimer::singleShot(0, this, &CorebootConfigurator::close); + } +} + +QComboBox* CorebootConfigurator::textToDisplay(const QString& in_string) { + auto box = new QComboBox(this); + + auto opts = NvramToolCli::readOptions(in_string); + + box->addItems(opts); + box->setCurrentText(m_parameters[in_string]); + + connect(ui->advancedCheckBox, &QCheckBox::clicked, this, [box](bool clicked){ + box->setEditable(clicked); + }); + + connect(this, &CorebootConfigurator::updateValue, this, [box, this, in_string](const QString& name){ + if(in_string!=name || m_parameters[name]==box->currentText()){ + return; + } + box->setCurrentText(m_parameters[name]); + }); + + connect(box, &QComboBox::currentTextChanged, this, [in_string, this](const QString& value){ + if(value==m_parameters[in_string]){ + return; + } + m_parameters[in_string] = value; + emit updateValue(in_string); + }); + + return box; +} + +QString boolToString(bool value){ + return value?QStringLiteral("Enable"):QStringLiteral("Disable"); +} + +bool stringToBool(const QString& str){ + return str==QStringLiteral("Enable"); +} + +QCheckBox* CorebootConfigurator::checkToDisplay(const QString& in_string) { + auto box = new ToggleSwitch(this); + + box->setChecked(stringToBool(m_parameters[in_string])); + + connect(this, &CorebootConfigurator::updateValue, this, [box, this, in_string](const QString& name){ + + if(in_string!=name + || m_parameters[name]==boolToString(box->isChecked())){ + return; + } + auto newValue = stringToBool(m_parameters[name]); + + box->setChecked(newValue); + }); + + connect(box, &QCheckBox::clicked, this, [in_string, this](bool checked){ + auto value = boolToString(checked); + if(value==m_parameters[in_string]){ + return; + } + m_parameters[in_string] = value; + emit updateValue(in_string); + }); + + return box; +} + +QTableWidget *CorebootConfigurator::createRawTable() +{ + /* Create Raw values table */ + auto table = new QTableWidget(m_parameters.size(), 2); + table->setHorizontalHeaderLabels({"Key","Value"}); + table->horizontalHeader()->setSectionResizeMode(0,QHeaderView::Stretch); + table->verticalHeader()->hide(); + table->setSelectionBehavior(QTableWidget::SelectRows); + connect(table, &QTableWidget::cellChanged, this, [table, this](int row, int column){ + if(column != 1 || row >= table->rowCount() || row < 0 ){ + /* Weird state when changed cell is not a value cell */ + return; + } + auto keyItem = table->item(row, 0); + auto valueItem = table->item(row, 1); + + if(keyItem == nullptr || valueItem == nullptr){ + /* Invalid cells */ + return; + } + + if(valueItem->text()==m_parameters[keyItem->text()]){ + return; + } + + m_parameters[keyItem->text()] = valueItem->text(); + emit updateValue(keyItem->text()); + }); + + auto it = m_parameters.begin(); + for(int i = 0; i<m_parameters.size(); i++, ++it){ + + auto item = new QTableWidgetItem(it.key()); + item->setFlags(item->flags() ^ Qt::ItemIsEditable); + table->setItem(i,0,item); + + item = new QTableWidgetItem(it.value()); + connect(this, &CorebootConfigurator::updateValue, this, [item, it, this](const QString& name){ + if(it.key()!=name || m_parameters[name]==item->text()){ + return; + } + item->setText(m_parameters[name]); + }); + + table->setItem(i,1,item); + } + return table; +} + +void CorebootConfigurator::displaySettings() { + if(!m_categories.IsMap()){ + return; + } + for(const auto& category : m_categories){ + if(!category.second.IsMap()){ + continue; + } + auto name = category.second["displayName"].as<QString>(); + + auto layout = new QVBoxLayout; + + auto tabPage = new QWidget(this); + tabPage->setLayout(layout); + + ui->tabWidget->addTab(tabPage, name); + + for(const auto& value : category.second){ + if(!value.second.IsMap() || !m_parameters.contains(value.first.as<QString>())){ + continue; + } + auto displayName = value.second["displayName"]; + if(!displayName.IsDefined()){ + continue; + } + auto type = value.second["type"]; + if(!type.IsDefined()){ + continue; + } + + auto controlLayout = new QHBoxLayout(); + + auto help = value.second["help"]; + + if(help.IsDefined()){ + auto labelWithTooltip = new QWidget; + labelWithTooltip->setToolTip(help.as<QString>()); + labelWithTooltip->setCursor({Qt::WhatsThisCursor}); + labelWithTooltip->setLayout(new QHBoxLayout); + + auto helpButton = new QLabel(); + helpButton->setPixmap(QIcon::fromTheme("help-hint").pixmap(24,24)); + + { + auto layout = qobject_cast<QHBoxLayout*>(labelWithTooltip->layout()); + layout->addWidget(new QLabel(displayName.as<QString>())); + layout->addWidget(helpButton,1); + } + controlLayout->addWidget(labelWithTooltip, 0); + } else { + controlLayout->addWidget(new QLabel(displayName.as<QString>()), 0); + } + + controlLayout->addStretch(1); + + QWidget* res = nullptr; + + if(type.as<QString>() == QStringLiteral("bool")){ + res = checkToDisplay(value.first.as<QString>()); + } else if (type.as<QString>() == QStringLiteral("enum")){ + res = textToDisplay(value.first.as<QString>()); + } else { + controlLayout->deleteLater(); + continue; + } + res->setObjectName(value.first.as<QString>()); + + controlLayout->addWidget(res, 0); + + layout->addLayout(controlLayout); + + } + + } + + auto table = createRawTable(); + + connect(ui->advancedCheckBox, &QCheckBox::clicked, this, [table,this](bool clicked){ + if(clicked && ui->tabWidget->widget(ui->tabWidget->count()-1) != table){ + ui->tabWidget->addTab(table, "Raw"); + } else if(!clicked && ui->tabWidget->widget(ui->tabWidget->count()-1) == table) { + ui->tabWidget->removeTab(ui->tabWidget->count()-1); + } + }); +} + +void CorebootConfigurator::writeToFile(const QString& out_file) { + if(!Configuration::toFile(out_file, m_parameters)){ + QMessageBox::critical(this, "Error Occured", "Can't open file to write"); + this->close(); + } +} diff --git a/util/coreboot-configurator/src/application/corebootconfigurator.h b/util/coreboot-configurator/src/application/corebootconfigurator.h new file mode 100644 index 0000000..3e730dd --- /dev/null +++ b/util/coreboot-configurator/src/application/corebootconfigurator.h @@ -0,0 +1,65 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef COREBOOT_CONFIGURATOR_H +#define COREBOOT_CONFIGURATOR_H + +#include <QMainWindow> +#include <QMessageBox> +#include <QVBoxLayout> + +#include <yaml-cpp/yaml.h> + +#include "aboutwindow.h" +#include "configuration.h" + +class QCheckBox; +class QComboBox; +class QTableWidget; + +QT_BEGIN_NAMESPACE +namespace Ui { class coreboot_configurator; } +QT_END_NAMESPACE + +class CorebootConfigurator : public QMainWindow +{ + Q_OBJECT + +public: + CorebootConfigurator(QWidget *parent = nullptr); + ~CorebootConfigurator(); + +private slots: + /* Window Actions */ + void showRebootWindow(void); + void saveAndClose(void); + + /* Read Settings */ + void getSettings(void); + void getFromFile(void); + void displaySettings(); + + /* Write Settings */ + void writeSettings(void); + void writeToFile(const QString& out_file); + +signals: + void updateValue(const QString& name); + +private: + /* Config filename */ + QString m_fileName; + /* Configuration values */ + Configuration::Parameters m_parameters; + + /* YAML with metadata */ + YAML::Node m_categories; + + /* Read Settings */ + QComboBox *textToDisplay(const QString &in_string); + QCheckBox *checkToDisplay(const QString &in_string); + QTableWidget *createRawTable(); + + Ui::coreboot_configurator *ui; +}; + +#endif diff --git a/util/coreboot-configurator/src/application/corebootconfigurator.ui b/util/coreboot-configurator/src/application/corebootconfigurator.ui new file mode 100644 index 0000000..ce1b1a8 --- /dev/null +++ b/util/coreboot-configurator/src/application/corebootconfigurator.ui @@ -0,0 +1,581 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>coreboot_configurator</class> + <widget class="QMainWindow" name="coreboot_configurator"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>585</width> + <height>390</height> + </rect> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>585</width> + <height>390</height> + </size> + </property> + <property name="maximumSize"> + <size> + <width>585</width> + <height>390</height> + </size> + </property> + <property name="palette"> + <palette> + <active> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Light"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Midlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Dark"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Mid"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="BrightText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>246</red> + <green>245</green> + <blue>244</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Shadow"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="AlternateBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>220</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="PlaceholderText"> + <brush brushstyle="SolidPattern"> + <color alpha="128"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </active> + <inactive> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Light"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Midlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Dark"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Mid"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="BrightText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>246</red> + <green>245</green> + <blue>244</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Shadow"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="AlternateBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>220</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="PlaceholderText"> + <brush brushstyle="SolidPattern"> + <color alpha="128"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </inactive> + <disabled> + <colorrole role="WindowText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Button"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Light"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Midlight"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Dark"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Mid"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>170</red> + <green>170</green> + <blue>170</blue> + </color> + </brush> + </colorrole> + <colorrole role="Text"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="BrightText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ButtonText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>127</red> + <green>127</green> + <blue>127</blue> + </color> + </brush> + </colorrole> + <colorrole role="Base"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Window"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="Shadow"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="AlternateBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>255</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipBase"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>255</red> + <green>255</green> + <blue>220</blue> + </color> + </brush> + </colorrole> + <colorrole role="ToolTipText"> + <brush brushstyle="SolidPattern"> + <color alpha="255"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + <colorrole role="PlaceholderText"> + <brush brushstyle="SolidPattern"> + <color alpha="128"> + <red>0</red> + <green>0</green> + <blue>0</blue> + </color> + </brush> + </colorrole> + </disabled> + </palette> + </property> + <property name="focusPolicy"> + <enum>Qt::NoFocus</enum> + </property> + <property name="windowTitle"> + <string>coreboot configurator</string> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QVBoxLayout" name="verticalLayout"> + <property name="spacing"> + <number>8</number> + </property> + <item> + <widget class="QTabWidget" name="tabWidget"> + <property name="autoFillBackground"> + <bool>false</bool> + </property> + <property name="currentIndex"> + <number>-1</number> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="bottomPanelLayout"> + <item> + <widget class="QCheckBox" name="advancedCheckBox"> + <property name="text"> + <string>Advanced mode</string> + </property> + </widget> + </item> + <item> + <widget class="QDialogButtonBox" name="confirmBox"> + <property name="standardButtons"> + <set>QDialogButtonBox::Save</set> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>585</width> + <height>25</height> + </rect> + </property> + <widget class="QMenu" name="menuFile"> + <property name="title"> + <string>File</string> + </property> + <addaction name="actionSave_to_File"/> + <addaction name="actionImport_from_File"/> + <addaction name="separator"/> + </widget> + <widget class="QMenu" name="menuHelp"> + <property name="title"> + <string>Help</string> + </property> + <addaction name="separator"/> + <addaction name="actionAbout_2"/> + </widget> + <addaction name="menuFile"/> + <addaction name="menuHelp"/> + </widget> + <action name="actionInformation"> + <property name="text"> + <string>Information</string> + </property> + </action> + <action name="actionAbout"> + <property name="text"> + <string>About</string> + </property> + </action> + <action name="actionAbout_2"> + <property name="text"> + <string>About</string> + </property> + </action> + <action name="actionSave_to_File"> + <property name="text"> + <string>Save to File...</string> + </property> + </action> + <action name="actionImport_from_File"> + <property name="text"> + <string>Import from File...</string> + </property> + </action> + <action name="actionExit"> + <property name="text"> + <string>Exit</string> + </property> + </action> + <action name="actionSave_and_Exit"> + <property name="text"> + <string>Save and Exit</string> + </property> + </action> + </widget> + <resources> + <include location="images.qrc"/> + </resources> + <connections/> +</ui> diff --git a/util/coreboot-configurator/src/application/images.qrc b/util/coreboot-configurator/src/application/images.qrc new file mode 100644 index 0000000..d23ff03 --- /dev/null +++ b/util/coreboot-configurator/src/application/images.qrc @@ -0,0 +1,9 @@ +<RCC> + <qresource prefix="/toggle"> + <file>toggle-off.svg</file> + <file>toggle-on.svg</file> + </qresource> + <qresource prefix="/config"> + <file>categories.yaml</file> + </qresource> +</RCC> diff --git a/util/coreboot-configurator/src/application/main.cpp b/util/coreboot-configurator/src/application/main.cpp new file mode 100644 index 0000000..eba1df7 --- /dev/null +++ b/util/coreboot-configurator/src/application/main.cpp @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <QApplication> + +#include "corebootconfigurator.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + CorebootConfigurator w; + w.show(); + return a.exec(); +} diff --git a/util/coreboot-configurator/src/application/meson.build b/util/coreboot-configurator/src/application/meson.build new file mode 100644 index 0000000..678bdfb --- /dev/null +++ b/util/coreboot-configurator/src/application/meson.build @@ -0,0 +1,35 @@ +## SPDX-License-Identifier: GPL-2.0-only + +install_dir = 'sbin' +qt5 = import('qt5') +qt5_dep = dependency('qt5', modules : ['Core', 'Gui', 'Widgets', 'Svg']) +yamlcpp_dep = dependency('yaml-cpp', version: '>= 0.5.1', required: true) + +prep = qt5.preprocess( + moc_headers : ['aboutwindow.h', + 'corebootconfigurator.h', + 'configuration.h', + 'toggleswitch.h'], + ui_files : ['aboutwindow.ui', + 'corebootconfigurator.ui'], + qresources : ['images.qrc'], +) +mock = get_option('mock') + +if mock + add_project_arguments('-DMOCK', language : 'cpp') +endif + +executable(meson.project_name(), + sources : ['aboutwindow.cpp', + 'corebootconfigurator.cpp', + 'main.cpp', + 'configuration.cpp', + 'toggleswitch.cpp', + 'nvramtoolcli.cpp', + prep], + dependencies : [qt5_dep, yamlcpp_dep], + cpp_args : '-std=c++11', + install : true, + install_dir : install_dir +) diff --git a/util/coreboot-configurator/src/application/nvramtoolcli.cpp b/util/coreboot-configurator/src/application/nvramtoolcli.cpp new file mode 100644 index 0000000..9636ac1 --- /dev/null +++ b/util/coreboot-configurator/src/application/nvramtoolcli.cpp @@ -0,0 +1,121 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "nvramtoolcli.h" + +#include <QProcess> +#include <QTextStream> + +#include "util.h" + +static constexpr char s_sudoProg[] = "/usr/bin/pkexec"; +static constexpr char s_nvramToolProg[] = "/usr/sbin/nvramtool"; + +#if MOCK + +QMap<QString, QString> NvramToolCli::readParameters(QString *error) { + return QMap<QString,QString>({ + {"boot_option","Normal"}, + {"reboot_counter","0x0"}, + {"debug_level","Spew"}, + {"vtd","Enable"}, + {"power_profile","Performance"}, + {"wireless","Enable"}, + {"webcam","Enable"}, + {"microphone","Enable"}, + {"legacy_8254_timer","Enable"}, + {"usb_always_on","Disable"}, + {"kbl_timeout","Never"}, + {"fn_ctrl_swap","Enable"}, + {"max_charge","100%"}, + {"power_on_after_fail","Disable"}, + {"fn_lock_state","0x2"}, + {"trackpad_state","0x40"}, + {"kbl_brightness","0xc4"}, + {"kbl_state","0x22"} + }); +} + +QStringList NvramToolCli::readOptions(const QString ¶meter, QString *error){ + return (parameter=="power_profile")? + QStringList{ + "Power Saver","Balanced","Performance" + } : QStringList{}; +} + +#else + +QMap<QString, QString> NvramToolCli::readParameters(QString *error) +{ + QProcess nvramtoolProcess; + nvramtoolProcess.start(s_sudoProg, {s_nvramToolProg, "-a"}); + + nvramtoolProcess.waitForFinished(); + + if(error) *error = nvramtoolProcess.readAllStandardError(); + + if(nvramtoolProcess.exitCode() != 0){ + return {}; + } + + return Util::parseParameters(nvramtoolProcess); +} + +QStringList NvramToolCli::readOptions(const QString ¶meter, QString *error) +{ + QStringList result; + + QProcess nvramtoolProcess; + nvramtoolProcess.start(s_sudoProg, {s_nvramToolProg, "-e", parameter}); + nvramtoolProcess.waitForFinished(); + + if(error) *error = nvramtoolProcess.readAllStandardError(); + + while (nvramtoolProcess.canReadLine()) { + result.append(nvramtoolProcess.readLine().trimmed()); + } + + return result; +} +#endif + +bool NvramToolCli::writeParameters(const QMap<QString, QString> ¶meters, QString *error) +{ + +#if MOCK + QTextStream outStream(stdout); +#else + QProcess nvramtoolProcess; + nvramtoolProcess.start(s_sudoProg, {s_nvramToolProg, "-i"}); + nvramtoolProcess.waitForStarted(); + QTextStream outStream(&nvramtoolProcess); +#endif + for(auto it = parameters.begin(); it != parameters.end(); ++it){ + outStream << it.key() << " = " << it.value() << "\n"; + } + + outStream.flush(); +#if MOCK + return true; +#else + nvramtoolProcess.closeWriteChannel(); + nvramtoolProcess.waitForFinished(); + + if(error){ + *error = nvramtoolProcess.readAllStandardError(); + } + + return nvramtoolProcess.exitCode()==0; +#endif +} + + + +QString NvramToolCli::version() +{ + QProcess nvramtoolProcess; + nvramtoolProcess.start(s_nvramToolProg, {"-v"}); + + nvramtoolProcess.waitForFinished(); + + return nvramtoolProcess.readAll(); +} diff --git a/util/coreboot-configurator/src/application/nvramtoolcli.h b/util/coreboot-configurator/src/application/nvramtoolcli.h new file mode 100644 index 0000000..aeb8e1f --- /dev/null +++ b/util/coreboot-configurator/src/application/nvramtoolcli.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +#include <QMap> +#include <QString> +#include <QList> + +#include "configuration.h" + +/* + * Namespace for convinient functions to work with nvramtool CLI utility + */ + +namespace NvramToolCli { + + Configuration::Parameters readParameters(QString* error = nullptr); + QStringList readOptions(const QString& parameter, QString* error = nullptr); + bool writeParameters(const Configuration::Parameters& parameters, QString* error = nullptr); + QString version(); +} diff --git a/util/coreboot-configurator/src/application/qtyaml.h b/util/coreboot-configurator/src/application/qtyaml.h new file mode 100644 index 0000000..c3fa54b --- /dev/null +++ b/util/coreboot-configurator/src/application/qtyaml.h @@ -0,0 +1,180 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef QTYAML_H +#define QTYAML_H + +#include <yaml-cpp/yaml.h> + +#include <QtCore/QString> +#include <QtCore/QMap> +#include <QtCore/QVector> +#include <QtCore/QList> +#include <QtCore/QPair> + +namespace YAML { + +/* QString */ +template<> +struct convert<QString> +{ + static Node encode(const QString& rhs) + { + return Node(rhs.toStdString()); + } + + static bool decode(const Node& node, QString& rhs) + { + if (!node.IsScalar()) + return false; + rhs = QString::fromStdString(node.Scalar()); + return true; + } +}; + +/* QMap */ +template<typename Key, typename Value> +struct convert<QMap<Key, Value> > +{ + static Node encode(const QMap<Key,Value>& rhs) + { + Node node(NodeType::Map); + auto it = rhs.constBegin(); + while (it != rhs.constEnd()) + { + node.force_insert(it.key(), it.value()); + ++it; + } + return node; + } + + static bool decode(const Node& node, QMap<Key, Value>& rhs) + { + if (!node.IsMap()) + return false; + + rhs.clear(); + const_iterator it = node.begin(); + while (it != node.end()) + { + rhs[it->first.as<Key>()] = it->second.as<Value>(); + ++it; + } + return true; + } +}; + +/* QVector */ +template<typename T> +struct convert<QVector<T> > +{ + static Node encode(const QVector<T>& rhs) + { + Node node(NodeType::Sequence); + foreach (T value, rhs) { + node.push_back(value); + } + return node; + } + + static bool decode(const Node& node, QVector<T>& rhs) + { + if (!node.IsSequence()) + return false; + + rhs.clear(); + const_iterator it = node.begin(); + while (it != node.end()) + { + rhs.push_back(it->as<T>()); + ++it; + } + return true; + } +}; + +/* QList */ +template<typename T> +struct convert<QList<T> > +{ + static Node encode(const QList<T>& rhs) + { + Node node(NodeType::Sequence); + foreach (T value, rhs) { + node.push_back(value); + } + return node; + } + + static bool decode(const Node& node, QList<T>& rhs) + { + if (!node.IsSequence()) + return false; + + rhs.clear(); + const_iterator it = node.begin(); + while (it != node.end()) + { + rhs.push_back(it->as<T>()); + ++it; + } + return true; + } +}; + +/* QPair */ +template<typename T, typename U> +struct convert<QPair<T,U> > +{ + static Node encode(const QPair<T,U>& rhs) + { + Node node(NodeType::Sequence); + node.push_back(rhs.first); + node.push_back(rhs.second); + return node; + } + + static bool decode(const Node& node, QPair<T,U>& rhs) + { + if (!node.IsSequence()) + return false; + if (node.size() != 2) + return false; + + rhs.first = node[0].as<T>(); + rhs.second = node[1].as<U>(); + return true; + } +}; + +/* QStringList */ +template<> +struct convert<QStringList> +{ + static Node encode(const QStringList& rhs) + { + Node node(NodeType::Sequence); + for (const auto &value: rhs) { + node.push_back(value); + } + return node; + } + + static bool decode(const Node& node, QStringList& rhs) + { + if (!node.IsSequence()) + return false; + + rhs.clear(); + const_iterator it = node.begin(); + while (it != node.end()) + { + rhs.push_back(it->as<QString>()); + ++it; + } + return true; + } +}; + +} + +#endif // QTYAML_H diff --git a/util/coreboot-configurator/src/application/toggle-off.svg b/util/coreboot-configurator/src/application/toggle-off.svg new file mode 100644 index 0000000..504ea58 --- /dev/null +++ b/util/coreboot-configurator/src/application/toggle-off.svg @@ -0,0 +1,4 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="40" height="20" viewBox="0 0 40 20"> + <rect x="2" y="2" width="36" height="16" ry="8" fill="#000000" fill-opacity=".26"/> + <circle cx="10" cy="10" r="6" fill="#ffffff"/> +</svg> diff --git a/util/coreboot-configurator/src/application/toggle-on.svg b/util/coreboot-configurator/src/application/toggle-on.svg new file mode 100644 index 0000000..0b8e618 --- /dev/null +++ b/util/coreboot-configurator/src/application/toggle-on.svg @@ -0,0 +1,65 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + inkscape:version="1.0rc1 (1.0rc1+100)" + sodipodi:docname="toggle-on.svg" + id="svg6" + version="1.1" + viewBox="0 0 40 20" + height="20" + width="40"> + <metadata + id="metadata12"> + rdf:RDF + <cc:Work + rdf:about=""> + dc:formatimage/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + </cc:Work> + </rdf:RDF> + </metadata> + <defs + id="defs10" /> + <sodipodi:namedview + inkscape:current-layer="svg6" + inkscape:window-maximized="1" + inkscape:window-y="28" + inkscape:window-x="65" + inkscape:cy="10" + inkscape:cx="20.062112" + inkscape:zoom="32.2" + showgrid="false" + id="namedview8" + inkscape:window-height="1020" + inkscape:window-width="1855" + inkscape:pageshadow="2" + inkscape:pageopacity="0" + guidetolerance="10" + gridtolerance="10" + objecttolerance="10" + borderopacity="1" + bordercolor="#666666" + pagecolor="#ffffff" /> + <rect + style="fill:#0068bf;fill-opacity:1" + id="rect2" + fill="#1a73e8" + ry="8" + height="16" + width="36" + y="2" + x="2" /> + <circle + id="circle4" + fill="#ffffff" + r="6" + cy="10" + cx="30" /> +</svg> diff --git a/util/coreboot-configurator/src/application/toggleswitch.cpp b/util/coreboot-configurator/src/application/toggleswitch.cpp new file mode 100644 index 0000000..ff8ae6b --- /dev/null +++ b/util/coreboot-configurator/src/application/toggleswitch.cpp @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include "toggleswitch.h" + +#include <QPalette> +#include <QPainter> +#include <QEvent> +#include <QTimer> +#include <QGuiApplication> + +static inline QByteArray readSvg(const QString& name){ + QFile svgFile(name); + if(!svgFile.open(QFile::ReadOnly)){ + return {}; + } + return svgFile.readAll(); +} + +const QByteArray ToggleSwitch::s_toggleOffSvgContent = readSvg(QStringLiteral(":/toggle/toggle-off.svg")); +const QByteArray ToggleSwitch::s_toggleOnSvgContent = readSvg(QStringLiteral(":/toggle/toggle-on.svg")); +const int ToggleSwitch::s_colorPosInToggleOn = ToggleSwitch::s_toggleOnSvgContent.indexOf("#1a73e8"); + +ToggleSwitch::ToggleSwitch(QWidget *parent) : QCheckBox(parent){ + + setFixedWidth(50); + setFixedHeight(width()/2); + + m_svgr.setAspectRatioMode(Qt::KeepAspectRatio); + m_toggleOnSvgContentColored = s_toggleOnSvgContent; +} + +void ToggleSwitch::paintEvent(QPaintEvent *event){ + QPainter p(this); + + if(isChecked()){ + auto accent = palette().highlight().color(); + m_toggleOnSvgContentColored = m_toggleOnSvgContentColored.replace(s_colorPosInToggleOn, 7, accent.name().toLatin1()); + + m_svgr.load(m_toggleOnSvgContentColored); + } else { + m_svgr.load(s_toggleOffSvgContent); + } + + m_svgr.render(&p, this->rect()); + p.end(); +} diff --git a/util/coreboot-configurator/src/application/toggleswitch.h b/util/coreboot-configurator/src/application/toggleswitch.h new file mode 100644 index 0000000..1100973 --- /dev/null +++ b/util/coreboot-configurator/src/application/toggleswitch.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#pragma once + +#include <QObject> +#include <QCheckBox> +#include <QSvgRenderer> +#include <QFile> + +/* + * The ToggleSwitch class represents Toggle Switch widget based on QCheckBox and toggles svg with colorscheme support + */ + +class ToggleSwitch : public QCheckBox { + Q_OBJECT +public: + explicit ToggleSwitch(QWidget* parent = nullptr); + +private: + QSvgRenderer m_svgr; + + static const QByteArray s_toggleOnSvgContent; + static const QByteArray s_toggleOffSvgContent; + static const int s_colorPosInToggleOn; + +QByteArray m_toggleOnSvgContentColored; + +/* QWidget interface */ +protected: + void paintEvent(QPaintEvent *event) override; + +/* QAbstractButton interface */ +protected: + bool hitButton(const QPoint &pos) const override + { + /* needs to be clickable on */ + return rect().contains(pos); + } +}; diff --git a/util/coreboot-configurator/src/application/util.h b/util/coreboot-configurator/src/application/util.h new file mode 100644 index 0000000..dfa9b02 --- /dev/null +++ b/util/coreboot-configurator/src/application/util.h @@ -0,0 +1,28 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + + +#pragma once + +#include <QMap> +#include <QString> +#include <QIODevice> + +namespace Util { + + + inline QMap<QString,QString> parseParameters(QIODevice& dev){ + QString curr_line; + QMap<QString, QString> result; + + while (!dev.atEnd()) { + curr_line = dev.readLine().trimmed(); + + auto split = curr_line.split('='); + if (split.size() != 2) + continue; + + result.insert(split[0].trimmed(), split[1].trimmed()); + } + return result; + } +} diff --git a/util/coreboot-configurator/src/meson.build b/util/coreboot-configurator/src/meson.build new file mode 100644 index 0000000..439f075 --- /dev/null +++ b/util/coreboot-configurator/src/meson.build @@ -0,0 +1,4 @@ +## SPDX-License-Identifier: GPL-2.0-only + +subdir('application') +subdir('static') diff --git a/util/coreboot-configurator/src/static/aboutIcon.png b/util/coreboot-configurator/src/static/aboutIcon.png new file mode 100644 index 0000000..1adbfca --- /dev/null +++ b/util/coreboot-configurator/src/static/aboutIcon.png Binary files differ diff --git a/util/coreboot-configurator/src/static/categories.yaml b/util/coreboot-configurator/src/static/categories.yaml new file mode 100644 index 0000000..9f4ea28 --- /dev/null +++ b/util/coreboot-configurator/src/static/categories.yaml @@ -0,0 +1,115 @@ +processor: + displayName: Processor + hyper_threading: + displayName: Hyper-Threading + type: bool + help: Enable or disable Hyper-Threading + vtd: + displayName: Intel VT-d + type: bool + help: Enable or disable Intel VT-d (virtualisation) + power_profile: + displayName: Power Profile + type: enum + help: Select whether to maximise performance, battery life or both + me_state: + displayName: Intel Management Engine + type: bool + help: Enable or disable the Intel Management Engine + +devices: + displayName: Devices + wireless: + displayName: Wireless + type: bool + help: Enable or disable the built-in wireless card + wlan: + displayName: Wireless + type: bool + help: Enable or disable the built-in wireless card + bluetooth: + displayName: Bluetooth + type: bool + help: Enable or disable the built-in bluetooth + wwan: + displayName: Mobile Network + type: bool + help: Enable or disable the built-in mobile network + ethernet1: + displayName: Ethernet 1 + type: bool + help: Enable or disable the built-in Ethernet Port 1 + ethernet2: + displayName: Ethernet 2 + type: bool + help: Enable or disable the built-in Ethernet Port 2 + ethernet3: + displayName: Ethernet 3 + type: bool + help: Enable or disable the built-in Ethernet Port 3 + webcam: + displayName: Webcam + type: bool + help: Enable or disable the built-in webcam + microphone: + displayName: Microphone + type: bool + help: Enable or disable the built-in microphone + legacy_8254_timer: + displayName: Clock Gating + type: bool + help: Enable or disable the legacy 8254 timer. Reduces power consumption when enabled but must be disabled for certain distributions such as Qubes + usb_always_on: + displayName: USB Always On + type: bool + help: Allow the USB ports to provide power to connected devices when the computer is suspended + touchpad: + displayName: Touchpad + type: bool + help: Enable or disable the built-in touchpad + trackpoint: + displayName: Trackpoint + type: bool + help: Enable or disable the built-in trackpoint + sata_mode: + displayName: SATA Mode + type: enum + help: Set the mode of the SATA controller from AHCI or Compatible + +system: + displayName: System + kbl_timeout: + displayName: Keyboard Backlight Timeout + type: enum + help: Adjust the amout of time before the keyboard backlight turns off when un-used + fn_ctrl_swap: + displayName: Fn Ctrl Reverse + type: bool + help: Swap the functions of the [Fn] and [Ctrl] keys + max_charge: + displayName: Max Charge + type: enum + help: Set the maximum level the battery will charge to + fan_mode: + displayName: Fan Mode + type: enum + help: Adjust the fan curve to priotise performance or noise levels + f1_to_f12_as_primary: + displayName: Function Lock + type: bool + help: Make the F-keys behave as if you are holding down the Fn key + +advanced: + displayName: Advanced + boot_option: + displayName: Boot Options + type: enum + help: Change the boot device in the event of a failed boot + debug_level: + displayName: Debug Level + type: enum + help: Set the verbosity of the debug output + power_on_after_fail: + displayName: Power on Behaviour + type: enum + help: Select whether to power on in the event of a power failure diff --git a/util/coreboot-configurator/src/static/coreboot-configurator.desktop b/util/coreboot-configurator/src/static/coreboot-configurator.desktop new file mode 100644 index 0000000..4b07fcf --- /dev/null +++ b/util/coreboot-configurator/src/static/coreboot-configurator.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Name=coreboot configurator +StartupWMCLass=coreboot_configurator +Exec=/usr/sbin/coreboot-configurator +Icon=coreboot-configurator.png +Type=Application +Categories=Settings;System +Comment=A graphical interface to set options on devices with coreboot firmware. +Keywords=Coreboot;BIOS;Firmware; diff --git a/util/coreboot-configurator/src/static/coreboot_configurator.svg b/util/coreboot-configurator/src/static/coreboot_configurator.svg new file mode 100644 index 0000000..33a7229 --- /dev/null +++ b/util/coreboot-configurator/src/static/coreboot_configurator.svg @@ -0,0 +1,748 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:xlink="http://www.w3.org/1999/xlink" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="512" + height="512" + viewBox="0 0 135.46667 135.46667" + version="1.1" + id="svg8" + inkscape:version="1.0.2 (1.0.2+r75+1)" + sodipodi:docname="corevantage.svg" + inkscape:export-filename="/home/sean/Documents/corevantage-x200-1.2/icon/16x16png.png" + inkscape:export-xdpi="3" + inkscape:export-ydpi="3"> + <defs + id="defs2"> + <linearGradient + inkscape:collect="always" + id="linearGradient1476"> + <stop + style="stop-color:#27f7d0;stop-opacity:1;" + offset="0" + id="stop1472" /> + <stop + style="stop-color:#2195f2;stop-opacity:1" + offset="1" + id="stop1474" /> + </linearGradient> + <filter + style="color-interpolation-filters:sRGB" + inkscape:label="Drop Shadow" + id="filter570"> + <feColorMatrix + type="hueRotate" + values="180" + result="color1" + id="feColorMatrix566" /> + <feColorMatrix + values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 -0.21 -0.72 -0.07 2 0 " + result="fbSourceGraphic" + id="feColorMatrix568" /> + <feColorMatrix + result="fbSourceGraphicAlpha" + in="fbSourceGraphic" + values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0" + id="feColorMatrix572" /> + <feColorMatrix + id="feColorMatrix574" + type="hueRotate" + values="180" + result="color1" + in="fbSourceGraphic" /> + <feColorMatrix + id="feColorMatrix576" + values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 -0.21 -0.72 -0.07 2 0 " + result="fbSourceGraphic" /> + <feColorMatrix + result="fbSourceGraphicAlpha" + in="fbSourceGraphic" + values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0" + id="feColorMatrix578" /> + <feColorMatrix + id="feColorMatrix580" + type="hueRotate" + values="180" + result="color1" + in="fbSourceGraphic" /> + <feColorMatrix + id="feColorMatrix582" + values="-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 -0.21 -0.72 -0.07 2 0 " + result="fbSourceGraphic" /> + <feColorMatrix + result="fbSourceGraphicAlpha" + in="fbSourceGraphic" + values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0" + id="feColorMatrix12032" /> + <feFlood + id="feFlood12034" + flood-opacity="0.698039" + flood-color="rgb(0,0,0)" + result="flood" + in="fbSourceGraphic" /> + <feComposite + in2="fbSourceGraphic" + id="feComposite12036" + in="flood" + operator="out" + result="composite1" /> + <feGaussianBlur + id="feGaussianBlur12038" + in="composite1" + stdDeviation="1.26667" + result="blur" /> + <feOffset + id="feOffset12040" + dx="0.9" + dy="1" + result="offset" /> + <feComposite + in2="fbSourceGraphic" + id="feComposite12042" + in="offset" + operator="atop" + result="composite2" /> + </filter> + <filter + style="color-interpolation-filters:sRGB" + inkscape:label="Bump" + id="filter10278"> + <feGaussianBlur + in="SourceGraphic" + stdDeviation="1.81244" + result="blur1" + id="feGaussianBlur10256" /> + <feColorMatrix + in="blur1" + values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 " + result="colormatrix1" + id="feColorMatrix10258" /> + <feColorMatrix + in="colormatrix1" + type="luminanceToAlpha" + result="colormatrix2" + id="feColorMatrix10260" /> + <feComposite + in2="blur1" + operator="arithmetic" + k2="1" + k3="0" + result="composite1" + id="feComposite10262" + k1="0" + k4="0" /> + <feGaussianBlur + in="composite1" + stdDeviation="2.99163" + result="blur2" + id="feGaussianBlur10264" /> + <feSpecularLighting + lighting-color="#ffffff" + surfaceScale="10.0614996" + specularConstant="0.72376299" + specularExponent="17" + result="lighting" + id="feSpecularLighting10268"> + <feDistantLight + azimuth="225" + elevation="45" + id="feDistantLight10266" /> + </feSpecularLighting> + <feFlood + flood-color="rgb(197,41,41)" + flood-opacity="1" + result="flood" + id="feFlood10270" /> + <feComposite + in="lighting" + in2="blur1" + operator="arithmetic" + k3="1" + k2="1" + result="composite2" + id="feComposite10272" + k1="0" + k4="0" /> + <feBlend + in2="SourceGraphic" + mode="normal" + result="blend" + id="feBlend10274" /> + <feComposite + in="blend" + in2="SourceGraphic" + operator="in" + result="fbSourceGraphic" + id="feComposite10276" /> + <feColorMatrix + result="fbSourceGraphicAlpha" + in="fbSourceGraphic" + values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0" + id="feColorMatrix14324" /> + <feGaussianBlur + id="feGaussianBlur14326" + in="fbSourceGraphic" + stdDeviation="0.276667" + result="blur1" /> + <feColorMatrix + id="feColorMatrix14328" + in="blur1" + values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 " + result="colormatrix1" /> + <feColorMatrix + id="feColorMatrix14330" + in="colormatrix1" + type="luminanceToAlpha" + result="colormatrix2" /> + <feComposite + in2="blur1" + id="feComposite14332" + operator="arithmetic" + k2="1" + k3="-49.8667" + result="composite1" + k1="0" + k4="0" /> + <feGaussianBlur + id="feGaussianBlur14334" + in="composite1" + stdDeviation="1.27667" + result="blur2" /> + <feSpecularLighting + id="feSpecularLighting14336" + lighting-color="#ffffff" + surfaceScale="10.0614996" + specularConstant="0.72376299" + specularExponent="17" + result="lighting"> + <feDistantLight + id="feDistantLight14338" + azimuth="225" + elevation="45" /> + </feSpecularLighting> + <feFlood + id="feFlood14340" + flood-color="rgb(197,41,41)" + flood-opacity="1" + result="flood" /> + <feComposite + in2="blur1" + id="feComposite14342" + in="lighting" + operator="arithmetic" + k3="1" + k2="1" + result="composite2" + k1="0" + k4="0" /> + <feBlend + in2="fbSourceGraphic" + id="feBlend14344" + mode="normal" + result="blend" /> + <feComposite + in2="fbSourceGraphic" + id="feComposite14346" + in="blend" + operator="in" + result="composite3" /> + </filter> + <clipPath + id="b-7-9"> + <path + id="path106-2-2" + d="m 18,102 h 86 v 16 H 18 Z m 0,0" + inkscape:connector-curvature="0" /> + </clipPath> + <clipPath + id="c-5-0"> + <path + id="path121-1-2" + d="m 16.496,28.445 h 96.176 c 4.418,0 8,3.575 8,7.989 v 73.578 c 0,4.414 -3.582,7.988 -8,7.988 H 16.496 c -4.418,0 -8,-3.574 -8,-7.988 V 36.434 c 0,-4.414 3.582,-7.989 8,-7.989 z m 0,0" + inkscape:connector-curvature="0" /> + </clipPath> + <linearGradient + gradientTransform="matrix(0.25,0,0,0.2496,0.495,57.398)" + y2="234.21899" + x2="94.021004" + y1="194.21899" + x1="94.021004" + gradientUnits="userSpaceOnUse" + id="d-3"> + <stop + id="stop37" + stop-color="#f9f06b" + offset="0" /> + <stop + id="stop39" + stop-color="#fcf7ac" + offset=".512" /> + <stop + id="stop41" + stop-color="#f9f06b" + offset="1" /> + </linearGradient> + <clipPath + id="e-5-9"> + <path + id="path118-6-2" + d="m 18,116 h 76 v 2 H 18 Z m 0,0" + inkscape:connector-curvature="0" /> + </clipPath> + <clipPath + id="f-62-2"> + <path + id="path115-3-8" + d="m 16.496,28.445 h 96.176 c 4.418,0 8,3.575 8,7.989 v 73.578 c 0,4.414 -3.582,7.988 -8,7.988 H 16.496 c -4.418,0 -8,-3.574 -8,-7.988 V 36.434 c 0,-4.414 3.582,-7.989 8,-7.989 z m 0,0" + inkscape:connector-curvature="0" /> + </clipPath> + <linearGradient + gradientTransform="matrix(0.25,0,0,0.2496,0.495,57.398)" + y2="234.78101" + x2="202.021" + y1="242.79401" + x1="202.021" + gradientUnits="userSpaceOnUse" + id="g-9"> + <stop + id="stop62" + stop-color="#c09608" + offset="0" /> + <stop + id="stop64" + stop-color="#f6ca30" + offset="1" /> + </linearGradient> + <clipPath + id="h-36"> + <path + id="path112-0-1" + d="m 98,115 h 6 v 3 h -6 z m 0,0" + inkscape:connector-curvature="0" /> + </clipPath> + <clipPath + id="i-12-2"> + <path + id="path109-2-9" + d="m 16.496,28.445 h 96.176 c 4.418,0 8,3.575 8,7.989 v 73.578 c 0,4.414 -3.582,7.988 -8,7.988 H 16.496 c -4.418,0 -8,-3.574 -8,-7.988 V 36.434 c 0,-4.414 3.582,-7.989 8,-7.989 z m 0,0" + inkscape:connector-curvature="0" /> + </clipPath> + <linearGradient + inkscape:collect="always" + xlink:href="#j-7" + id="linearGradient5088" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(3.2066783,0,0,3.2066783,432.07192,-765.09973)" + x1="37" + y1="249" + x2="37" + y2="254" /> + <linearGradient + gradientTransform="matrix(1.4285714,0,0,1.4285714,65.142859,-261.28571)" + y2="254" + x2="37" + y1="249" + x1="37" + gradientUnits="userSpaceOnUse" + id="j-7"> + <stop + id="stop2-6" + stop-color="#d5d1cc" + offset="0" /> + <stop + id="stop4-1-0" + stop-color="#f6f5f4" + offset=".183" /> + <stop + id="stop6-5" + stop-color="#fff" + offset=".395" /> + <stop + id="stop8-6" + stop-color="#d7d3ce" + offset=".784" /> + <stop + id="stop10-0" + stop-color="#c8c2bb" + offset="1" /> + </linearGradient> + <linearGradient + gradientTransform="matrix(1.4285714,0,0,1.4285714,36.571431,-224.85714)" + y2="259" + x2="18.608" + y1="253" + x1="17" + gradientUnits="userSpaceOnUse" + id="k-2"> + <stop + id="stop88" + stop-color="#f9f06b" + offset="0" /> + <stop + id="stop90" + stop-color="#fcf7ac" + offset=".512" /> + <stop + id="stop92" + stop-color="#f9f06b" + offset="1" /> + </linearGradient> + <linearGradient + gradientTransform="matrix(1.4285714,0,0,0.4761857,36.571431,11.332859)" + y2="259" + x2="18.608" + y1="253" + x1="17" + gradientUnits="userSpaceOnUse" + id="l-936"> + <stop + id="stop81-6" + stop-color="#f9f06b" + offset="0" /> + <stop + id="stop83" + stop-color="#fcf7ac" + offset=".512" /> + <stop + id="stop85" + stop-color="#f9f06b" + offset="1" /> + </linearGradient> + <linearGradient + gradientTransform="matrix(1.4285714,0,0,0.4761857,48.000002,-5.8099974)" + y2="259" + x2="18.608" + y1="253" + x1="17" + gradientUnits="userSpaceOnUse" + id="m-06"> + <stop + id="stop74" + stop-color="#f9f06b" + offset="0" /> + <stop + id="stop76" + stop-color="#fcf7ac" + offset=".512" /> + <stop + id="stop78" + stop-color="#f9f06b" + offset="1" /> + </linearGradient> + <linearGradient + gradientTransform="matrix(1.4285714,0,0,1.4285714,48.000002,-259.14285)" + y2="259" + x2="18.608" + y1="253" + x1="17" + gradientUnits="userSpaceOnUse" + id="n-2-6"> + <stop + id="stop67-5" + stop-color="#f9f06b" + offset="0" /> + <stop + id="stop69-0" + stop-color="#fcf7ac" + offset=".512" /> + <stop + id="stop71" + stop-color="#f9f06b" + offset="1" /> + </linearGradient> + <linearGradient + gradientTransform="matrix(1.4285714,0,0,0.4761857,48.000002,-22.952854)" + y2="259" + x2="18.608" + y1="253" + x1="17" + gradientUnits="userSpaceOnUse" + id="o-1"> + <stop + id="stop55" + stop-color="#f9f06b" + offset="0" /> + <stop + id="stop57" + stop-color="#fcf7ac" + offset=".512" /> + <stop + id="stop59" + stop-color="#f9f06b" + offset="1" /> + </linearGradient> + <linearGradient + gradientTransform="matrix(1.4285714,0,0,1.4285714,93.714287,-234.85714)" + y2="254" + x2="37" + y1="249" + x1="37" + gradientUnits="userSpaceOnUse" + id="p-61"> + <stop + id="stop44-8" + stop-color="#d5d1cc" + offset="0" /> + <stop + id="stop46" + stop-color="#f6f5f4" + offset=".183" /> + <stop + id="stop48" + stop-color="#fff" + offset=".395" /> + <stop + id="stop50" + stop-color="#d7d3ce" + offset=".784" /> + <stop + id="stop52" + stop-color="#c8c2bb" + offset="1" /> + </linearGradient> + <linearGradient + gradientTransform="matrix(1.4285714,0,0,-1.4285714,93.714287,465.14285)" + y2="254" + x2="37" + y1="249" + x1="37" + gradientUnits="userSpaceOnUse" + id="q-79"> + <stop + id="stop26" + stop-color="#d5d1cc" + offset="0" /> + <stop + id="stop28-8" + stop-color="#f6f5f4" + offset=".183" /> + <stop + id="stop30-7" + stop-color="#fff" + offset=".395" /> + <stop + id="stop32" + stop-color="#d7d3ce" + offset=".784" /> + <stop + id="stop34" + stop-color="#c8c2bb" + offset="1" /> + </linearGradient> + <linearGradient + inkscape:collect="always" + xlink:href="#r-2" + id="linearGradient5104" + gradientUnits="userSpaceOnUse" + gradientTransform="matrix(3.2066783,0,0,3.2066783,367.93856,-676.916)" + x1="37" + y1="249" + x2="37" + y2="254" /> + <linearGradient + gradientTransform="matrix(1.4285714,0,0,1.4285714,36.571431,-221.99999)" + y2="254" + x2="37" + y1="249" + x1="37" + gradientUnits="userSpaceOnUse" + id="r-2"> + <stop + id="stop95" + stop-color="#d5d1cc" + offset="0" /> + <stop + id="stop97" + stop-color="#f6f5f4" + offset=".183" /> + <stop + id="stop99" + stop-color="#fff" + offset=".395" /> + <stop + id="stop101-0" + stop-color="#d7d3ce" + offset=".784" /> + <stop + id="stop103-23" + stop-color="#c8c2bb" + offset="1" /> + </linearGradient> + <filter + inkscape:collect="always" + style="color-interpolation-filters:sRGB" + id="filter1525-3" + x="-0.012" + width="1.024" + y="-0.012" + height="1.024"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="0.063499999" + id="feGaussianBlur1527-6" /> + </filter> + <clipPath + id="clipPath24907" + clipPathUnits="userSpaceOnUse"> + <rect + inkscape:label="Square-Background" + style="fill:#319395;fill-opacity:1;stroke-width:0.315296" + id="rect24909" + width="12.170834" + height="12.170922" + x="-204.80406" + y="195.97275" + rx="2.2374113" /> + </clipPath> + <clipPath + id="clipPath24901" + clipPathUnits="userSpaceOnUse"> + <path + inkscape:connector-curvature="0" + d="M 52.848788,9.1555002 H 203.13314 c 24.20496,0 43.69115,19.4861378 43.69115,43.6911478 V 203.13271 c 0,24.2048 -19.48619,43.6912 -43.69115,43.6912 H 52.848788 c -24.204958,0 -43.6911479,-19.4864 -43.6911479,-43.6912 V 52.846648 c 0,-24.20501 19.4861899,-43.6911478 43.6911479,-43.6911478 z" + inkscape:label="Square-Background" + style="fill:#319395;fill-opacity:1;stroke-width:6.15696" + id="path24903" /> + </clipPath> + <linearGradient + inkscape:collect="always" + xlink:href="#p-61" + id="linearGradient1470" + x1="32.241405" + y1="52.764114" + x2="164.33501" + y2="52.764114" + gradientUnits="userSpaceOnUse" /> + <radialGradient + inkscape:collect="always" + xlink:href="#linearGradient1476" + id="radialGradient1478" + cx="518.65234" + cy="84.663773" + fx="518.65234" + fy="84.663773" + r="64.910637" + gradientTransform="matrix(2.9098159,0.04997269,-0.04502878,2.6219419,-986.71822,-163.23817)" + gradientUnits="userSpaceOnUse" /> + <linearGradient + inkscape:collect="always" + xlink:href="#p-61" + id="linearGradient1500" + gradientUnits="userSpaceOnUse" + x1="32.241405" + y1="52.764114" + x2="164.33501" + y2="52.764114" /> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="0.3160391" + inkscape:cx="144.17386" + inkscape:cy="37.998289" + inkscape:document-units="mm" + inkscape:current-layer="layer2" + inkscape:document-rotation="0" + showgrid="false" + units="px" + inkscape:window-width="928" + inkscape:window-height="1020" + inkscape:window-x="992" + inkscape:window-y="28" + inkscape:window-maximized="0" /> + <metadata + id="metadata5"> + rdf:RDF + <cc:Work + rdf:about=""> + dc:formatimage/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title /> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" /> + <g + inkscape:groupmode="layer" + id="layer2" + inkscape:label="Layer 2"> + <g + id="g1498" + transform="translate(-450.91873,-16.930479)"> + <rect + style="display:inline;opacity:0.2;fill:#000000;fill-opacity:1;stroke-width:0.329004;filter:url(#filter1525-3)" + id="rect24836" + width="12.7" + height="12.7" + x="0.11910726" + y="-0.044058971" + rx="2.3346901" + transform="matrix(10.416591,0,0,10.416666,451.26602,18.976929)" + inkscape:label="Square-Shadow" /> + <rect + rx="23.865547" + y="19.752666" + x="453.7417" + height="129.82222" + width="129.82127" + id="rect24838" + style="display:inline;fill:url(#radialGradient1478);fill-opacity:1;stroke-width:3.36314" + inkscape:label="Square-Background" /> + <path + style="fill:url(#linearGradient5088);stroke-width:3.20667" + inkscape:connector-curvature="0" + id="path4986" + d="m 486.58552,31.747108 c -1.77909,0 -3.20679,1.427114 -3.20679,3.206817 v 12.839519 h 6.41328 V 34.953925 c 0,-1.779673 -1.42683,-3.206817 -3.20679,-3.206817 z m 12.82685,0 c -1.77909,0 -3.2068,1.427114 -3.2068,3.206817 v 12.839519 h 6.41328 V 34.953925 c 0,-1.779673 -1.4268,-3.206817 -3.20679,-3.206817 z m 12.82656,0 c -1.77909,0 -3.2068,1.427114 -3.2068,3.206817 v 12.839519 h 6.41357 V 34.953925 c 0,-1.779673 -1.42681,-3.206817 -3.20708,-3.206817 z m 12.82684,0 c -1.77909,0 -3.20679,1.427114 -3.20679,3.206817 v 12.839519 h 6.41328 V 34.953925 c 0,-1.779673 -1.42681,-3.206817 -3.20679,-3.206817 z m 12.82656,0 c -1.77909,0 -3.20679,1.427114 -3.20679,3.206817 v 12.839519 h 6.41356 V 34.953925 c 0,-1.779673 -1.4268,-3.206817 -3.20708,-3.206817 z m 12.82684,0 c -1.77909,0 -3.20679,1.427114 -3.20679,3.206817 v 12.839519 h 6.41328 V 34.953925 c 0,-1.779673 -1.4268,-3.206817 -3.20679,-3.206817 z m 0,0" /> + <path + style="fill:url(#linearGradient5104);stroke-width:3.20667" + inkscape:connector-curvature="0" + id="path5078" + d="m 483.37904,121.54693 v 12.8267 c 0,1.77967 1.4268,3.20681 3.20677,3.20681 1.77909,0 3.20679,-1.42681 3.20679,-3.20681 v -12.8267 z m 12.82653,0 v 12.8267 c 0,1.77967 1.42683,3.20681 3.2068,3.20681 1.77909,0 3.20679,-1.42681 3.20679,-3.20681 v -12.8267 z m 12.82687,0 v 12.8267 c 0,1.77967 1.42681,3.20681 3.20677,3.20681 1.77909,0 3.20679,-1.42681 3.20679,-3.20681 v -12.8267 z m 12.82654,0 v 12.8267 c 0,1.77967 1.42683,3.20681 3.20679,3.20681 1.77909,0 3.20679,-1.42681 3.20679,-3.20681 v -12.8267 z m 12.82686,0 v 12.8267 c 0,1.77967 1.42681,3.20681 3.20678,3.20681 1.77909,0 3.20679,-1.42681 3.20679,-3.20681 v -12.8267 z m 12.82654,0 v 12.8267 c 0,1.77967 1.42683,3.20681 3.20708,3.20681 1.77909,0 3.20679,-1.42681 3.20679,-3.20681 v -12.8267 z m 0,0" /> + <path + style="fill:#3d3846;stroke-width:3.20667" + inkscape:connector-curvature="0" + id="path4980" + d="m 480.17224,50.999964 h 76.96021 a 9.6200357,9.6200357 0 0 1 9.62006,9.620094 v 54.513502 a 9.6200357,9.6200357 0 0 1 -9.62006,9.62006 h -76.96021 a 9.6200357,9.6200357 0 0 1 -9.62007,-9.62006 V 60.620058 a 9.6200357,9.6200357 0 0 1 9.62007,-9.620094 z m 0,0" /> + <path + style="fill:#262e36;fill-opacity:1;stroke-width:3.20667" + inkscape:connector-curvature="0" + id="path4988" + d="m 480.17224,41.379989 h 76.96021 a 9.6200357,9.6200357 0 0 1 9.62006,9.619975 v 57.720266 a 9.6200357,9.6200357 0 0 1 -9.62006,9.62003 h -76.96021 a 9.6200357,9.6200357 0 0 1 -9.62007,-9.62003 V 50.999964 a 9.6200357,9.6200357 0 0 1 9.62007,-9.619975 z m 0,0" /> + <path + d="m 453.74142,45.031249 v -1.41652 c 0,-13.22156 10.646,-23.86202 23.86745,-23.86202 h 82.08634 c 13.22156,0 23.86745,10.64046 23.86745,23.86202 v 1.41652 c 0,-13.22145 -10.64589,-23.86745 -23.86745,-23.86745 h -82.08634 c -13.22145,0 -23.86745,10.646 -23.86745,23.86745 z" + inkscape:label="Square-Top-Highlight" + style="display:inline;opacity:0.2;fill:#ffffff;fill-opacity:1;stroke-width:3.36313" + id="path24842" + inkscape:connector-curvature="0" /> + <path + id="path24840" + style="display:inline;opacity:0.2;fill:#000000;fill-opacity:1;stroke-width:3.36313" + inkscape:label="Square-Bottom-Highlight" + d="m 453.74142,124.29638 v 1.41663 c 0,13.22156 10.646,23.86191 23.86745,23.86191 h 82.08634 c 13.22156,0 23.86745,-10.64035 23.86745,-23.86191 v -1.41663 c 0,13.22156 -10.64589,23.86745 -23.86745,23.86745 h -82.08634 c -13.22145,0 -23.86745,-10.64589 -23.86745,-23.86745 z" + inkscape:connector-curvature="0" /> + <g + id="g237" + transform="matrix(0.50144561,0,0,0.50144561,469.36615,53.401791)" + style="fill:#d9d5d1;fill-opacity:1;stroke:url(#linearGradient1470)"> + <path + d="M 148.419,40.725 C 137.843,34.44 134.762,36.625 125.266,29.054 110.441,17.237 92.488,3.794 74.861,0 c 0,0 4.307,3.492 12.283,9.822 0.559,0.465 0.705,0.684 0.595,0.867 -0.169,0.287 -0.928,-0.046 -0.928,-0.046 -6.163,-2.345 -13.123,-3.675 -17.839,-3.37 -1.561,0.1 -2.061,0.352 -2.283,0.797 -0.104,0.209 -0.119,0.772 0.405,1.469 2.061,2.725 7.024,8.064 15.281,13.132 8.486,5.206 23.472,12.592 36.726,18.489 5.932,2.638 10.207,6.164 8.846,10.232 -1.52,4.533 -7.387,5.15 -12.074,3.275 C 112.065,53.144 108.506,48.37 102.725,41.966 92.709,30.868 87.956,26.441 71.335,29.825 63.003,31.522 55.141,38.341 48.853,45.538 44.657,50.83 42.64,55.232 42.032,60.54 c 0,0 -1.146,-2.105 -0.008,-7.49 1.989,-9.407 -2.341,-13.447 -2.341,-13.447 -21.925,31.092 9.261,59.202 33.301,32.281 0,0 -7.865,17.467 -7.21,22.906 -3.355,1.1 -4.845,4.186 0.176,7.91 5.486,4.068 18.961,3.716 29.59,-0.852 19.845,-8.529 32.213,-24.423 38.344,-34.516 1.432,-2.36 2.947,-3.508 3.996,-3.883 1.591,-0.574 12.537,0.086 17.662,-2.824 0.713,0.347 1.621,0.533 2.817,0.442 3.714,-0.282 5.976,-4.727 5.976,-4.727 0,0 -4.687,-8.941 -15.916,-15.615 z m -41.142,44.652 c -10.166,7.24 -21.192,9.26 -28.008,6.262 10.782,-7.818 30.624,-27.373 30.624,-27.373 0,0 -3.302,-8.318 -9.257,-3.225 -5.76,4.925 -11.081,11.078 -13.184,13.043 -1.301,1.213 -3.508,3.506 -4.812,2.52 -1.587,-1.199 3.137,-11.825 6.749,-20.631 4.928,-12.01 -0.742,-15.762 -7.379,-15.429 -5.947,0.299 -14.071,3.903 -19.891,7.462 -1.648,1.009 -2.773,1.629 -3.189,1.244 -0.364,-0.339 0.021,-0.977 1.102,-1.89 15.471,-13.108 37.549,-12.767 39.523,-3.175 1.571,7.65 -14.771,26.914 -13.697,27.223 0.104,0.029 0.338,-0.088 0.68,-0.322 5.364,-7.021 15.521,-17.801 19.331,-17.384 6.827,0.746 9.183,9.794 9.183,9.794 L 92.291,84.034 c 4.701,1.277 9.842,1.738 14.986,1.343 z" + id="path235" + style="fill:#d9d5d1;fill-opacity:1;stroke:url(#linearGradient1500)" /> + </g> + </g> + </g> +</svg> diff --git a/util/coreboot-configurator/src/static/meson.build b/util/coreboot-configurator/src/static/meson.build new file mode 100644 index 0000000..26f4726 --- /dev/null +++ b/util/coreboot-configurator/src/static/meson.build @@ -0,0 +1,52 @@ +## SPDX-License-Identifier: GPL-2.0-only + +# About Icon +about_icon_dir = join_paths(get_option('datadir'), meson.project_name()) +about_icon_sources = [ + 'aboutIcon.png', +] + +install_data(about_icon_sources, + install_dir: about_icon_dir) + +# Polkit Files +polkit_dir = join_paths(get_option('datadir'), 'polkit-1', 'actions') +polkit_sources = [ + 'org.coreboot.nvramtool.policy', + 'org.coreboot.reboot.policy', +] + +install_data(polkit_sources, + install_dir: polkit_dir) + +# Desktop Entry +desktop_dir = join_paths(get_option('datadir'), 'applications') +desktop_sources = [ + 'coreboot-configurator.desktop', +] + +install_data(desktop_sources, + install_dir: desktop_dir) + +# Icon +inkscape = find_program('inkscape') +icon_dir = join_paths(get_option('datadir'),'icons', 'hicolor') +foreach size: get_option('sizes') + target_temp_name = '@0@'.format(size) + dpi=size.to_int() * 2 + png = configure_file( + input: 'coreboot_configurator.svg', + output: target_temp_name + '.png', + command: [ + inkscape, + '--shell', + '--export-dpi=@0@'.format(dpi), + '--export-png=@OUTPUT@', + '@INPUT@', + ] + ) + + install_data(png, + rename: meson.project_name() + '.png', + install_dir: join_paths(icon_dir, '@0@x@1@'.format(size, size), 'apps')) +endforeach diff --git a/util/coreboot-configurator/src/static/org.coreboot.nvramtool.policy b/util/coreboot-configurator/src/static/org.coreboot.nvramtool.policy new file mode 100644 index 0000000..c95bc8b --- /dev/null +++ b/util/coreboot-configurator/src/static/org.coreboot.nvramtool.policy @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE policyconfig PUBLIC + "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" + "http://www.freedesktop.org/software/polkit/policyconfig-1.dtd"> +<policyconfig> + <action id="org.coreboot.nvramtool"> + <message>Authentication is required to read and write to coreboot settings.</message> + <defaults> + <allow_active>auth_admin_keep</allow_active> + </defaults> + <annotate key="org.freedesktop.policykit.exec.path">/usr/sbin/nvramtool</annotate> + </action> +</policyconfig> diff --git a/util/coreboot-configurator/src/static/org.coreboot.reboot.policy b/util/coreboot-configurator/src/static/org.coreboot.reboot.policy new file mode 100644 index 0000000..5364c8c --- /dev/null +++ b/util/coreboot-configurator/src/static/org.coreboot.reboot.policy @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE policyconfig PUBLIC + "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" + "http://www.freedesktop.org/software/polkit/policyconfig-1.dtd"> +<policyconfig> + <action id="org.coreboot.reboot"> + <defaults> + <allow_active>yes</allow_active> + </defaults> + <annotate key="org.freedesktop.policykit.exec.path">/usr/sbin/reboot</annotate> + </action> +</policyconfig>