From 65e4cf2e7965026687459b6ff96805a891f248c6 Mon Sep 17 00:00:00 2001 From: Nuno Sa Date: Tue, 7 Jan 2025 16:43:01 +0000 Subject: [PATCH] commonrc: allow petalinux command from any directory Petalinux commands were relying on being run in the installation path or in one directory deeper. Hence, let's use an env variable (PETA_PATH) to specify the installation directory. Signed-off-by: Nuno Sa --- commonrc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/commonrc b/commonrc index 5d71fbd..654d154 100644 --- a/commonrc +++ b/commonrc @@ -45,28 +45,32 @@ bbgrep() { # petalinux wrappers. Assumption is that we run the command either from the installation dir or from # the project topdir. Makes things easier and it covers 99% od the cases petalinux-build() { - [[ -f settings.sh ]] && local settings="settings.sh" || local settings="../settings.sh" + local peta_path=${PETA_PATH:-..} + [[ -f settings.sh ]] && local settings="settings.sh" || local settings="${peta_path}/settings.sh" local args="$@" drun petalinux bash -c "source ${settings} 1>/dev/null; petalinux-build $args" } petalinux-config() { - [[ -f settings.sh ]] && local settings="settings.sh" || local settings="../settings.sh" + local peta_path=${PETA_PATH:-..} + [[ -f settings.sh ]] && local settings="settings.sh" || local settings="${peta_path}/settings.sh" local args="$@" drun petalinux bash -c "source ${settings} 1>/dev/null; petalinux-config $args" } petalinux-create() { - [[ -f settings.sh ]] && local settings="settings.sh" || local settings="../settings.sh" + local peta_path=${PETA_PATH:-..} + [[ -f settings.sh ]] && local settings="settings.sh" || local settings="${peta_path}/settings.sh" local args="$@" drun petalinux bash -c "source ${settings} 1>/dev/null; petalinux-create $args" } petalinux-package() { - [[ -f settings.sh ]] && local settings="settings.sh" || local settings="../settings.sh" + local peta_path=${PETA_PATH:-..} + [[ -f settings.sh ]] && local settings="settings.sh" || local settings="${peta_path}/settings.sh" local args="$@" drun petalinux bash -c "source ${settings} 1>/dev/null; petalinux-package $args"