Mac Os X can't compile full FOTA due to readelf

RESOLVED FIXED in 2.1 S1 (1aug)

Status

RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: nhirata, Assigned: gerard-majax)

Tracking

unspecified
2.1 S1 (1aug)
ARM
Gonk (Firefox OS)

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [systemsfe])

Attachments

(1 attachment)

1. ./build.sh gecko-update-fota

Expected: Fota build
Actual: 
Generating FOTA update package
mkdir -p `dirname out/target/product/flame/fota/partial/update.zip` || true
Traceback (most recent call last):
File "tools/update-tools/build-flash-fota.py", line 123, in <module>
  main()
File "tools/update-tools/build-flash-fota.py", line 117, in main
  build_flash_fota(parser.parse_args())
File "tools/update-tools/build-flash-fota.py", line 54, in build_flash_fota
  output_zip, update_bin)
File "/Volumes/Projects/B2G_Flame/tools/update-tools/update_tools.py", line 955, in build_flash_fota
  flash_zip.write_updater_script(self.build_flash_script())
File "/Volumes/Projects/B2G_Flame/tools/update-tools/update_tools.py", line 985, in build_flash_script
  self.AssertGonkVersion()
File "/Volumes/Projects/B2G_Flame/tools/update-tools/update_tools.py", line 913, in AssertGonkVersion
  for e in self.GetSha1Values():
File "/Volumes/Projects/B2G_Flame/tools/update-tools/update_tools.py", line 891, in GetSha1Values
  deps_list = list(set(deps_list + self.GetDependencies(p)))
File "/Volumes/Projects/B2G_Flame/tools/update-tools/update_tools.py", line 871, in GetDependencies
  result = run_command(["readelf", "-d", path])
File "/Volumes/Projects/B2G_Flame/tools/update-tools/update_tools.py", line 68, in run_command
  return subprocess.check_output(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 537, in check_output
  process = Popen(stdout=PIPE, *popenargs, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 679, in __init__
  errread, errwrite)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1249, in _execute_child
  raise child_exception
OSError: [Errno 2] No such file or directory
make: *** [out/target/product/flame/fota/partial/update.zip] Error 1

Note:
1) looking for readelf : /Volumes/Projects/B2G_Flame/prebuilts/tools/gcc-sdk
has readelf listed there
2) nhirata-19333:gcc-sdk nhirata$ readelf
ERROR: The gcc this script points to can only run on linux
Flags: needinfo?(mwu)

Comment 1

4 years ago
Redirecting to someone who might know more about this update code.
Flags: needinfo?(mwu) → needinfo?(lissyx+mozillians)
(Assignee)

Comment 2

4 years ago
We can probably do as in bug 767024 :)
Assignee: nobody → lissyx+mozillians
Flags: needinfo?(lissyx+mozillians)
Whiteboard: [systemsfe]
Target Milestone: --- → 2.1 S1 (1aug)
(Assignee)

Comment 3

4 years ago
Created attachment 8463332 [details] [review]
B2G patch for update_tools.py

This patch makes proper use of readelf from Android prebuilt on my Flame build tree. As far as I could test, it also works properly on my Nexus S build tree.

Naoki, can you give it a try on your side, I don't have a mac to test :)
Attachment #8463332 - Flags: review?(gsvelto)
Flags: needinfo?(nhirata.bugzilla)
Comment on attachment 8463332 [details] [review]
B2G patch for update_tools.py

LGTM. I would assume this should work across all devices but for extra safety have you tried at least with another device build?
Attachment #8463332 - Flags: review?(gsvelto) → review+
(Assignee)

Comment 5

4 years ago
(In reply to Gabriele Svelto [:gsvelto] from comment #4)
> Comment on attachment 8463332 [details] [review]
> B2G patch for update_tools.py
> 
> LGTM. I would assume this should work across all devices but for extra
> safety have you tried at least with another device build?

Thanks. I checked on Flame and Nexus S, and per IRC discussion you checked also on Hamachi. So I think we're all good :)
(Assignee)

Updated

4 years ago
Flags: needinfo?(nhirata.bugzilla)
(Assignee)

Comment 6

4 years ago
https://github.com/mozilla-b2g/B2G/commit/aea28e69dd7b35a04d8339f0a001b803826f2577
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
I still end up getting the issue after updating my repo.

I think I may need to get a mac version of readelf:
http://www.opensource.apple.com/source/cctools/cctools-478/file/readelf.h ?

Still investigating.
reading this article, should we be using otool instead for the darwin platform?

http://0xfe.blogspot.com/2006/03/how-os-x-executes-applications.html
Flags: needinfo?(lissyx+mozillians)
(Assignee)

Comment 9

4 years ago
(In reply to Naoki Hirata :nhirata (please use needinfo instead of cc) from comment #7)
> I still end up getting the issue after updating my repo.
> 
> I think I may need to get a mac version of readelf:
> http://www.opensource.apple.com/source/cctools/cctools-478/file/readelf.h ?
> 
> Still investigating.

There is readelf for Darwin in prebuilts, that does not make any sense.

Sorry for asking this, but are you sure you have uptodate tree ? The code we changed is in B2G/, so ./repo sync will not be enough and you need to |git pull| to make sure. Do you still see the same error ?
Flags: needinfo?(lissyx+mozillians) → needinfo?(nhirata.bugzilla)
Sorry, you are right.  I got a different error.  I did a git pull and a ./repo sync.  I also clobbered my out folder and obj folder. 

Install system fs image: out/target/product/flame/system.img
out/target/product/flame/system.img+out/target/product/flame/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p maxsize=385363968 blocksize=135168 total=183125637 reserve=3919872
Using ext4 filesystem
Extracting partitions from linux fstab (device/t2m/flame/recovery.fstab)
Mounting /system from /dev/block/platform/msm_sdcc.1/by-name/system
Mounting /data   from /dev/block/platform/msm_sdcc.1/by-name/userdata
Generating FOTA update package
mkdir -p `dirname out/target/product/flame/fota/partial/update.zip` || true
readelf: Error: 'out/target/product/flame/system/b2g/updater': No such file
Error: Process returned error code 1: /Volumes/Projects/B2G_Flame/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.7/bin/arm-linux-androideabi-readelf -d out/target/product/flame/system/b2g/updater
make: *** [out/target/product/flame/fota/partial/update.zip] Error 1

~~~~~~~~~~~~~~~~~~
When going to out/target/product/flame/fota/partial, I don't see a update.zip file.
Flags: needinfo?(nhirata.bugzilla)
(Assignee)

Comment 11

4 years ago
Thanks. Can you ls -al out/target/product/flame/system/b2g/ ? It seems you are lacking the |updater| binary.
(Assignee)

Comment 12

4 years ago
Naoki, one contributor hacking the Open C ran into the same issue and I now underst
Flags: needinfo?(nhirata.bugzilla)
(Assignee)

Comment 13

4 years ago
Naoki, one contributor hacking the Open C ran into the same issue and I now understand why: I hardcoded the updater binary, but in your case maybe it was not built because you did not built recovery.

This should be properly dealt with when bug 1063520 lands.
So I took a look at this today; 

I initially got an error:
Unable to launch "/Volumes/Projects/B2G_Flame/build/fake-jdk-tools/bin/java" (13)
Error: Process returned error code 13: /usr/bin/java -Xmx2048m -jar /Volumes/Projects/B2G_Flame/tools/update-tools/bin/signapk.jar -w /Volumes/Projects/B2G_Flame/build/target/product/security/testkey.x509.pem /Volumes/Projects/B2G_Flame/build/target/product/security/testkey.pk8 /var/folders/kb/th4wrwpn5mj_4dbs6r8y_s580000gn/T/tmprzue5S out/target/product/flame/fota/partial/update.zip

It turns out that the java is located at : 
/Volumes/Projects/B2G_Flame/build/fake-jdk-tools/java

I did a hack and created a bin folder with java at the location it requested with the java being executable, just to see if I can get further.

I still fail even with that temporary hack:
Generating FOTA update package
mkdir -p `dirname out/target/product/flame/fota/partial/update.zip` || true
FOTA Flash ZIP generated: out/target/product/flame/fota/partial/update.zip
Error: update.zip does not exist: out/target/product/flame/fota/partial/update.zip
make: *** [out/target/product/flame/fota-flame-update.mar] Error 1

I checked the directory and I did not find the update.zip.  I did see the partial folder.
Flags: needinfo?(nhirata.bugzilla) → needinfo?(lissyx+mozillians)
I guess since the original bug of the readelf is fixed; I can file a new bug.  I was wondering if you may have seen this before I file a bug?
Oops.  nm I read bug 1067005 and bug 1095380
Flags: needinfo?(lissyx+mozillians)
You need to log in before you can comment on or make changes to this bug.