Skip to contentSkip to conversation

boot/uboot: fix build for sunxi targets

PATCH Superseded Jörg Krause 2 participants 3 messages Mar 6, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 boot/uboot: fix build for sunxi targets

Since version 2017.01 U-Boot needs to run the binman tool on the host machine for building the 'u-boot-sunxi-with-spl.bin' target. The binman tool is written in Python 2 and therefore needs a Python 2 interpreter. The python scripts sets the shebang to: #!/usr/bin/env python. For modern Linux distributions python is used for the Python 3 interpreter. In this case, building U-Boot for a sunxi-based target fails:

```
  BINMAN  u-boot-sunxi-with-spl.bin
  File "./tools/binman/binman", line 49
    print result
               ^
SyntaxError: Missing parentheses in call to 'print'
make[1]: *** [Makefile:1090: u-boot-sunxi-with-spl.bin] Error 1
```

Add a patch to fix the shebang to #!/usr/bin/env python2 to ensure the Python 2 interpreter is used to run the script.

Upstream status: Pending
https://lists.denx.de/pipermail/u-boot/2017-March/283164.html

Cc Peter Korsgaard <[email protected]>
---
 ...n-change-shebang-from-python-into-python2.patch | 32 ++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 boot/uboot/2017.01/0001-tools-binman-change-shebang-from-python-into-python2.patch
boot/uboot/2017.01/0001-tools-binman-change-shebang-from-python-into-python2.patch new file +32 -0
new file mode 100644
index 000000000..875a962e6
@@ -0,0 +1,32 @@
+From 2d0e2173875d4df25c1642597cd68b14a0c8a733 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Krause?= <[email protected]>
+Date: Mon, 6 Mar 2017 21:02:58 +0100
+Subject: [PATCH] tools: binman: change shebang from python into python2
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This tool does not work with Python 3. Change the shebang to make sure the
+script is run by a Python 2 interpreter.
+
+Upstream status: Pending
+https://lists.denx.de/pipermail/u-boot/2017-March/283164.html
+
+Signed-off-by: J?rg Krause <[email protected]>
+---
+ tools/binman/binman.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/binman/binman.py b/tools/binman/binman.py
+index e1cb2fbb6f..857d698b4c 100755
+--- a/tools/binman/binman.py
++++ b/tools/binman/binman.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+ 
+ # Copyright (c) 2016 Google, Inc
+ # Written by Simon Glass <[email protected]>
+-- 
+2.12.0
+
Signature · 1 line
2.12.0
#1 lore raw

PATCH v2 1/1 boot/uboot: fix build for sunxi targets

Hi,

Quoted 69 lines · J?rg Krause

Since version 2017.01 U-Boot needs to run the binman tool on the host machine
for building the 'u-boot-sunxi-with-spl.bin' target. The binman tool is written
in Python 2 and therefore needs a Python 2 interpreter. The python scripts sets the shebang to: #!/usr/bin/env python. For modern Linux
distributions python is used for the Python 3 interpreter. In this case, building U-Boot for a sunxi-based target fails:

```
? BINMAN??u-boot-sunxi-with-spl.bin
? File "./tools/binman/binman", line 49
????print result
???????????????^
SyntaxError: Missing parentheses in call to 'print'
make[1]: *** [Makefile:1090: u-boot-sunxi-with-spl.bin] Error 1
```

Add a patch to fix the shebang to #!/usr/bin/env python2 to ensure the
Python 2 interpreter is used to run the script.

Upstream status: Pending
https://lists.denx.de/pipermail/u-boot/2017-March/283164.html

Cc Peter Korsgaard <[email protected]>

---
?...n-change-shebang-from-python-into-python2.patch | 32
++++++++++++++++++++++
?1 file changed, 32 insertions(+)
?create mode 100644 boot/uboot/2017.01/0001-tools-binman-change- shebang-from-python-into-python2.patch

(quoted diff) +0 -0

from-python-into-python2.patch b/boot/uboot/2017.01/0001-tools- binman-change-shebang-from-python-into-python2.patch new file mode 100644
index 000000000..875a962e6

boot/uboot/2017.01/0001-tools-binman-change-shebang-from- new file +0 -0

python-into-python2.patch

boot/uboot/2017.01/0001-tools-binman-change-shebang-from- new file +1 -0
@@ -0,0 +1,32 @@
+From 2d0e2173875d4df25c1642597cd68b14a0c8a733 Mon Sep 17 00:00:00

2001

boot/uboot/2017.01/0001-tools-binman-change-shebang-from- new file +3 -0
+From: =?UTF-8?q?J=C3=B6rg=20Krause?= <[email protected]>
+Date: Mon, 6 Mar 2017 21:02:58 +0100
+Subject: [PATCH] tools: binman: change shebang from python into

python2

boot/uboot/2017.01/0001-tools-binman-change-shebang-from- new file +5 -0
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This tool does not work with Python 3. Change the shebang to make

sure the

boot/uboot/2017.01/0001-tools-binman-change-shebang-from- new file +13 -0
+script is run by a Python 2 interpreter.
+
+Upstream status: Pending
+https://lists.denx.de/pipermail/u-boot/2017-March/283164.html
+
+Signed-off-by: J?rg Krause <[email protected]>
+---
+ tools/binman/binman.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tools/binman/binman.py b/tools/binman/binman.py
+index e1cb2fbb6f..857d698b4c 100755
+--- a/tools/binman/binman.py

boot/uboot/2017.01/0001-tools-binman-change-shebang-from-

Quoted 10 lines
boot/uboot/2017.01/0001-tools-binman-change-shebang-from- new file +10 -0
++++ b/tools/binman/binman.py
+@@ -1,4 +1,4 @@
+-#!/usr/bin/env python
++#!/usr/bin/env python2
+?
+ # Copyright (c) 2016 Google, Inc
+ # Written by Simon Glass <[email protected]>
+--?
+2.12.0
+

Sorry, I forget the changelog:

v2:
* add patch to fix shebang instead of adding a host dependency for
python (suggested by Peter Korsgaard)

J?rg

#2 lore raw

PATCH v2 1/1 boot/uboot: fix build for sunxi targets

In reply to Jörg Krause

Hello,

Quoted 16 lines · J?rg Krause

Since version 2017.01 U-Boot needs to run the binman tool on the host machine for building the 'u-boot-sunxi-with-spl.bin' target. The binman tool is written in Python 2 and therefore needs a Python 2 interpreter. The python scripts sets the shebang to: #!/usr/bin/env python. For modern Linux distributions python is used for the Python 3 interpreter. In this case, building U-Boot for a sunxi-based target fails:

```
  BINMAN  u-boot-sunxi-with-spl.bin
  File "./tools/binman/binman", line 49
    print result
               ^
SyntaxError: Missing parentheses in call to 'print'
make[1]: *** [Makefile:1090: u-boot-sunxi-with-spl.bin] Error 1
```
Quoted 8 lines

Add a patch to fix the shebang to #!/usr/bin/env python2 to ensure the Python 2 interpreter is used to run the script.

Upstream status: Pending
https://lists.denx.de/pipermail/u-boot/2017-March/283164.html

Cc Peter Korsgaard <[email protected]>

The problem that I see with this is that it only fixes the issue for 2017.01 precisely. Anybody using a custom version of U-Boot will not get this fix. Maybe we can simply the people using a custom version that they can anyway integrate your patch.

I was wondering if a post-patch hook doing a sed would not be more appropriate, but I'm not sure. Let's see what others think.

For example, for the kernel we have this LINUX_TRY_PATCH_TIMECONST hook that tries to fix a problem with older kernel versions built with too recent Perl versions.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com