You are not logged in.

#1 2024-12-07 02:38:55

vindicator
Member
Registered: 2016-02-25
Posts: 19

[android-tools] Avbtool Defaults To Generating FEC Which Fails

FEC=Forward Error Correction

I don't know how this wants to be handled, especially since it looks like FEC is prebuilt (not sure if it can be built from the "external/fec" project).

Using https://wiki.postmarketos.org/wiki/Andr … Boot_(AVB) as a guide, I found that using the `add_hashtree_footer` results in a failure because it defaults to generating an fec:

Traceback (most recent call last):
  File "/usr/bin/avbtool", line 4973, in <module>
    tool.run(sys.argv)
  File "/usr/bin/avbtool", line 4773, in run
    args.func(args)
  File "/usr/bin/avbtool", line 4855, in add_hashtree_footer
    self.avb.add_hashtree_footer(
  File "/usr/bin/avbtool", line 3673, in add_hashtree_footer
    max_fec_size = calc_fec_data_size(partition_size, fec_num_roots)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/avbtool", line 4084, in calc_fec_data_size
    p = subprocess.Popen(
        ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'fec'
p = subprocess.Popen(
      ['fec', '--print-fec-size', str(image_size), '--roots', str(num_roots)],
      stdout=subprocess.PIPE,
      stderr=subprocess.PIPE)

https://cs.android.com/search?q=%22fec%22 points to:
https://cs.android.com/android/kernel/s … =%22fec%22
but also https://cs.android.com/android/platform … ernal/fec/
So maybe it can be built without too much issue (other than it being a soong/bazel built process).

The only other option I can think of would be to patch it so it defaults to "--do_not_generate_fec", which I found odd that https://android.googlesource.com/platfo … /README.md states:

Typical options to be used here include --hash_algorithm, --salt, --block_size, and --do_not_generate_fec

I made mention of this in https://groups.google.com/g/android-building (if the post gets approved), so maybe they can do something on their end to include it in the android-tools build process.
I just found it odd that the default is to generate FEC, and Google's own GSI's include it ("$ avbtool info_image <...>"), but they also say it's typical to NOT generate it. Odd stuff.

EDIT0: I just noticed that "prebuilts" link I provided was for the "common-android-mainline" branch, which doesn't appear to exist in the "main" or even "android-15-release" branches. Perhaps deprecated?

EDIT1: A heads-up, building "external/configure", while it DOES have a "configure" file, "make" fails with:

/usr/bin/ld: fec.o: warning: relocation against `P_init' in read-only section `.text'
/usr/bin/ld: fec.o: relocation R_X86_64_PC32 against symbol `Partab' can not be used when making a shared object; recompile with -fPIC

So just use that with CFLAGS, and it builds.
Errmm, negative on that. I just found it build a lib. There's no executable for that "external/fec" project.

EDIT2: Maybe it's https://cs.android.com/android/platform … Android.bp since it shows "fec" as "cc_binary_host"

EDIT3: I only just now thought to search for "--print-fec-size" in relation to "fec", and finally saw the binary (source) in "system/extras" (https://android.googlesource.com/platfo … c/main.cpp).

Last edited by vindicator (2024-12-10 11:18:19)

Offline

#2 2024-12-07 11:43:46

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,245

Re: [android-tools] Avbtool Defaults To Generating FEC Which Fails

Moving to Creating & Modifying Packages .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

Board footer

Powered by FluxBB