From: Steffen Trumtrar <s.trumtrar@pengutronix.de> To: Barebox List <barebox@lists.infradead.org> Subject: [PATCH] scripts: socfpga_import_preloader: make sdk optional Date: Fri, 11 Jun 2021 10:02:33 +0200 [thread overview] Message-ID: <20210611080233.15141-1-s.trumtrar@pengutronix.de> (raw) The commit a9b2e6089d82686564220013f14e9f0ffcc725e2 allowed generating everything needed in one step. This was however a bit too ambitious. The script now requires that the Altera Embedded SDK is always installed. There are situations where this is unwanted. Beef up the code a little bit to allow having the SDK as an optional argument and make the other input parameters location independent. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> --- Documentation/boards/socfpga.rst | 2 +- scripts/socfpga_import_preloader | 88 ++++++++++++++++++++++++++++---- 2 files changed, 78 insertions(+), 12 deletions(-) diff --git a/Documentation/boards/socfpga.rst b/Documentation/boards/socfpga.rst index 19d606030003..7e7f0619ea01 100644 --- a/Documentation/boards/socfpga.rst +++ b/Documentation/boards/socfpga.rst @@ -121,7 +121,7 @@ Now run the command: .. code-block:: sh - scripts/socfpga_import_preloader <EMBEDDED_SDK> <ISW_HANDOFF> <BOARD_DIRECTORY> + scripts/socfpga_import_preloader -e <EMBEDDED_SDK> -i <ISW_HANDOFF> -b <BOARD_DIRECTORY> where `<SPL_GENERATED_DIR>` is the directory where the bsp-editor generated the files, `<ISW_HANDOFF>` is the directory where Quartus generated the handoff files, and diff --git a/scripts/socfpga_import_preloader b/scripts/socfpga_import_preloader index 23e3c380db12..2bec9f2d2173 100755 --- a/scripts/socfpga_import_preloader +++ b/scripts/socfpga_import_preloader @@ -1,16 +1,70 @@ #!/usr/bin/env bash -if [ "$#" -lt "2" ] -then - echo "USAGE: $0 <EMBEDDED_SDK> <ISW_HANDOFF> <BOARD_DIRECTORY>" - echo "EXAMPLE: $0 ~/altera-embedded-sdk/ ~/cv_soc_devkit_ghrd/hps_isw_handoff/soc_system_hps_0/ arch/arm/boards/altera-socdk" +usage() { + echo "USAGE: $0 + parameters: + -s|--spl-dir <SPL_GENERATED_DIR> + -i|--isw-handoff <ISW_HANDOFF> + -b|--board <BOARD_DIRECTORY> + optional: + -e|--embedded-sdk <ALTERA_EMBEDDED_SDK>" + echo "EXAMPLE: $0 -i ~/cv_soc_devkit_ghrd/hps_isw_handoff/soc_system_hps_0/ -b arch/arm/boards/altera-socdk -e ~/altera-embedded-sdk/" exit 1 -fi +} + +die() { + printf '%s\n' "$1" >&2 + exit 1 +} + +generate= +splroot= +embeddedsw= +handoff= +boardroot= + +while :; do + case $1 in + -e|--embedded-sdk) + if [ "$2" ]; then + generate=1 + splroot="$(mktemp -d)" + embeddedsw=${2} + shift + else + die 'ERROR: "--embedded-sdk" requires a non-empty option argument.' + fi + ;; + -s|--spl-dir) + if [ "$2" ]; then + splroot="$2" + shift + else + die 'ERROR: "--spl-dir" requires a non-empty option argument.' + fi + ;; + -i|--isw-handoff) + if [ "$2" ]; then + handoff="$2" + shift + else + die 'ERROR: "--isw-handoff" requires a non-empty option argument.' + fi + ;; + -b|--board) + if [ "$2" ]; then + boardroot="$2" + shift + else + die 'ERROR: "--board" requires a non-empty option argument.' + fi + ;; + *) + break + esac + shift +done -splroot="$(mktemp -d)" -embeddedsw=$1 -handoff=$2 -boardroot=$3 bareboxsrc=. cd ${bareboxsrc} @@ -57,7 +111,17 @@ copy_source() { sed -i 's/ $//g' $tgt } -python2.7 ${embeddedsw}/embedded/ip/altera/preloader/scripts/iswgen.py -i ${handoff} -o ${splroot}/ +generate_spl() { + python2.7 ${embeddedsw}/embedded/ip/altera/preloader/scripts/iswgen.py -i ${handoff} -o ${splroot}/ +} + +if [ -z $splroot ] || [ -z $boardroot ] || [ -z $handoff ]; then + usage +fi + +if [ $generate ]; then + generate_spl +fi copy_source ${splroot}/iocsr_config_cyclone5.c ${boardroot}/iocsr_config_cyclone5.c copy_source ${splroot}/pinmux_config_cyclone5.c ${boardroot}/pinmux_config.c @@ -69,6 +133,8 @@ copy_source ${handoff}/sequencer_auto_ac_init.c ${boardroot}/sequencer_auto_ac_i copy_source ${handoff}/sequencer_auto_inst_init.c ${boardroot}/sequencer_auto_inst_init.c copy_source ${handoff}/sequencer_defines.h ${boardroot}/sequencer_defines.h -rm -r ${splroot} +if [ $generate ]; then + rm -r ${splroot} +fi echo "DONE" -- 2.29.2 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2021-06-11 8:04 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-06-11 8:02 Steffen Trumtrar [this message] 2021-08-09 18:52 ` Sascha Hauer
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210611080233.15141-1-s.trumtrar@pengutronix.de \ --to=s.trumtrar@pengutronix.de \ --cc=barebox@lists.infradead.org \ --subject='Re: [PATCH] scripts: socfpga_import_preloader: make sdk optional' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox