Skip to content

Commit

Permalink
commonrc: allow petalinux command from any directory
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
nunojsa committed Jan 7, 2025
1 parent c592eb7 commit 65e4cf2
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions commonrc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 65e4cf2

Please sign in to comment.