Coreboot Build Script Failing

I’m seeing this on my Librem 13v2 also running Arch (I figured that was relevant because I saw you mentioned it in the other thread).

I think this is because @kakaroto’s changes to me_cleaner.py expect /usr/bin/python to be Python 2.x, but on Arch it’s Python 3. In Python 3, division of two integers using the / operator always returns a float, which explains why we get “required argument is not an integer”. Standard me_cleaner is supposedly both Python 2 and 3 compatible.

I tried replacing the offending / with the // operator to get integer division instead, but that causes a different error somewhere else:

Traceback (most recent call last):
  File "./me_cleaner/me_cleaner.py", line 640, in <module>
    me_start + min_start, b"\xff")
  File "./me_cleaner/me_cleaner.py", line 68, in fill_range
    raise OutOfRegionException()
__main__.OutOfRegionException

I tried changing the '\0' in line 617 to '\x00' after seeing that the comment above it references ‘MFS\0’ but both of our outputs have “MFS\x00” but it didn’t help.

I don’t have any other clues yet, but I suspect it’s a different Python 2/3 incompatibility. For now, you can just hardcode python2 into me_cleaner.py and it builds and verifies just fine:

diff --git a/me_cleaner.py b/me_cleaner.py
index 39641f1..6d1d10b 100755
--- a/me_cleaner.py
+++ b/me_cleaner.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 
 # me_cleaner - Tool for partial deblobbing of Intel ME/TXE firmware images
 # Copyright (C) 2016, 2017 Nicola Corna <nicola@corna.info>

I just flashed it. If I haven’t posted back in 15 minutes, something has gone horribly wrong.