* [PATCH] scripts: socfpga_import_preloader: make sdk optional
@ 2021-06-11 8:02 Steffen Trumtrar
2021-08-09 18:52 ` Sascha Hauer
0 siblings, 1 reply; 2+ messages in thread
From: Steffen Trumtrar @ 2021-06-11 8:02 UTC (permalink / raw)
To: Barebox List
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] scripts: socfpga_import_preloader: make sdk optional
2021-06-11 8:02 [PATCH] scripts: socfpga_import_preloader: make sdk optional Steffen Trumtrar
@ 2021-08-09 18:52 ` Sascha Hauer
0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2021-08-09 18:52 UTC (permalink / raw)
To: Steffen Trumtrar; +Cc: Barebox List
On Fri, Jun 11, 2021 at 10:02:33AM +0200, Steffen Trumtrar wrote:
> 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(-)
Applied, thanks
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-09 18:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 8:02 [PATCH] scripts: socfpga_import_preloader: make sdk optional Steffen Trumtrar
2021-08-09 18:52 ` Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox