Skip to content
Snippets Groups Projects
Verified Commit 6c2dbe36 authored by Karel Koci's avatar Karel Koci :metal:
Browse files

generate_medkit: add support for drivers

This allows primarily to include all drivers in medkit. The idea is that
some devices should work out of the box so we ensure they can be used to
connect to the Internet. Once connected any unneeded drivers are
removed.
parent f306b79c
Branches
Tags
2 merge requests!377Turris OS 5.2 (HBK),!241WIP: Feature/lists drivers
......@@ -14,7 +14,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
set -e
set -eu
src_dir="$(dirname "$(readlink -f "${0%/*}")")"
. "$src_dir/helpers/common.sh"
......@@ -26,6 +26,7 @@ export BRANCH="$PUBLISH_BRANCH"
export BOOTSTRAP_UPDATER_BRANCH=
export BOOTSTRAP_L10N=cs,de
export BOOTSTRAP_PKGLISTS=
export BOOTSTRAP_DRIVERS=
export BOOTSTRAP_CONTRACT=
export UPDATER_SCRIPT=
export OVERLAY=
......@@ -74,6 +75,12 @@ while [ $# -gt 0 ]; do
echo " means that they will be removed with first update. To"
echo " prevent this you have to include our own"
echo " /etc/config/pkglists in overlay."
echo " --drivers, -d DRIVER,.."
echo " What additional drivers should be included in medkit. Format"
echo " is CLASS:FLAG where CLASS is either 'pci' or 'usb'. Multiple"
echo " drivers can be specified by separating them by commas. This"
echo " affects only medkit. Unnecessary drivers are removed with"
echo " first system update."
echo " --contract CONTRACT"
echo " Build medkit for router under CONTRACT."
echo " --updater-script FILE"
......@@ -111,6 +118,10 @@ while [ $# -gt 0 ]; do
shift
BOOTSTRAP_PKGLISTS="$1"
;;
--drivers|-d)
shift
DRIVERS_DRIVERS="$1"
;;
--contract)
[ -z "$CONTRACT" ] || die "--contract can be specified only once"
shift
......
......@@ -5,12 +5,15 @@ This script expects following variables to be possibly defined in environment:
BOOTSTRAP_BOARD: board name (Mox|Omnia|Turris)
BOOTSTRAP_L10N: commas separated list of languages to be installed in root.
BOOTSTRAP_PKGLISTS: commas separated list of package lists to be included in
root. To specify options you can optionally add parentheses at the end of
package name and list pipe separated options inside them. (ex:
foo(opt1|opt2),fee)
root. To specify options you can optionally add parentheses at the end of
package name and list pipe separated options inside them. (ex:
foo(opt1|opt2),fee)
BOOTSTRAP_DRIVERS: comamas separated list of driver flags. Every driver class is
combination of bus ('usb' or 'pci') and class itself separated by colon (ex:
usb:foo,pci:fee). Special class 'all' can be used to include all drivers.
BOOTSTRAP_CONTRACT: name of contract medkit is generated for. Do not specify for
standard medkits
BOOTSTRAP_TESTKEY: if definied non-empty then test kyes are included in
BOOTSTRAP_TESTKEY: if defined non-empty then test kyes are included in
installation
]]
......@@ -29,8 +32,10 @@ if env_l10n then
end
Export('l10n')
-- Aways include base script
Script('base.lua')
-- Include any additional lists
local env_pkglists = os.getenv('BOOTSTRAP_PKGLISTS')
if env_pkglists then
......@@ -47,12 +52,37 @@ if env_pkglists then
Script(list_name .. '.lua')
end
end
-- Include any additional driver classes
local env_devices = os.getenv('BOOTSTRAP_DRIVERS')
if env_devices then
local usb_devices = {}
local pci_devices = {}
for device in env_devices:gmatch('[^,]+') do
local tp, class = device:match('([^:]+):(.*)')
if tp == "usb" then
table.insert(usb_device, class)
elseif tp == "pci" then
table.insert(pci_device, class)
else
WARN("Invalid device type, ignoring: " .. device)
end
end
devices = usb_devices
Export('devices')
Script('devices/usb.lua')
devices = pci_devices
Script('devices/pci.lua')
Unexport('devices')
end
-- Include contract if specified
local env_contract = os.getenv('BOOTSTRAP_CONTRACT')
if env_contract and env_contract ~= "" then
Script('contracts/' .. env_contract .. '.lua')
end
local env_testkey = os.getenv('BOOTSTRAP_TESTKEY')
if env_testkey and env_testkey ~= "" then
Install('cznic-repo-keys-test')
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment