Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode . Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

Hello there 🙂

Thanks for checking out my post.
This is the first time I'm doing any android/linux porting.
I figured I could try to port Ubuntu Touch to my HTC J Butterfly 3.
Also know as HTC HTV31 or HTC b3uhl.

I was lucky enough that someone had sources for LineageOS 16.0.
However after following the porting guide I got stuck at making mkbootimg.
The error I get is as follows:

build/make/core/droiddoc.mk:188: error: FindEmulator: find: `tools/metalava/manual': No such file or directory
22:28:23 ckati failed with: exit status 1
#### failed to build some targets (02:26 (mm:ss)) ####

I haven't noticed much wrong with my setup.
The only thing that seemed weird was when I ran

source build/envsetup.sh

As it gave me the following ouput:

including vendor/lineage/vendorsetup.sh

I expected a bit more lines and also some lines mentioning HTC or my specific model.

Another thing I tried was resyncing the repo and trying to apply those hybris patches as well.
However applying the pathes also didn't work and gave me another error...

Applying: (hybris) Fix __get_tls and related functions (>=Android 8)
error: libc/bionic/ndk_cruft.cpp: does not match index
error: libc/libc.arm.map: does not match index
error: libc/libc.arm64.map: does not match index
error: libc/libc.x86.map: does not match index
error: libc/private/__get_tls.h: does not match index
Patch failed at 0001 (hybris) Fix __get_tls and related functions (>=Android 8)
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Don't worry, I aborted the operation so I should be on the original branch again.
But I don't know how to go from this.
I tried to look in that droiddoc.mk file.
Apart from seeing something about metalava I couldn't make much from it.
Hopefully someone here can point me in the right direction again

Thanks again for reading this 🙂

@nvriezen said in [HTC J Butterfly 3] Error building mkbootimg - tools/metalava/manual not found:

The only thing that seemed weird was when I ran

source build/envsetup.sh

As it gave me the following ouput:

including vendor/lineage/vendorsetup.sh

I expected a bit more lines and also some lines mentioning HTC or my specific model.

I figured out why this was happening.
The repo for my device (android_device_htc_b3uhl) was missing the vendorsetup.sh.
I then researched this file a bit and found some other (working) repos for different devices also lacking this file.
However I could not find what other method they could be using to setup all the things that envsetup.sh is taking care of.

So I figured the easiest way to solve this for me right now was to make that vendorsetup.sh file myself.
Not much goes into it as well.
But even after including that file and running build/envsetup.sh again I could still not build mkbootimg.
I really don't understand what goes wrong.
Maybe it's still not picking the right sources? It maybe tries to use android sources while it shouldn't?

I finally understood why I actually have to do mka mkbootimg (stupid me)
So I figured to just get a compiled version from the web.
Then I tried to make halium-boot.img with:

export USE_HOST_LEX=yes
mka halium-boot

However the exact same errors came up as when I tried to make mkbootimg...
So there should be something wrong with my setup, but at this point I really have no clue what it could be...

Dude...

That is one oldass phone : https://www.gsmarena.com/htc_butterfly_3-7592.php

Are you using this just as a learning process or are you actually planning to use the phone as a daily ?!

If so, where do you buy a new battery for it ??

  • BQ Aquaris E5 HD Ubuntu Phone Edition - Ubuntu Touch 16.04 LTS
  • ZUK Z2 Pro - ZUI Android 8.x
  • Xiaomi Mi 9T - Jolla SailFish 3.4.x Community Build
  • P.S. : I am NOT a developer! ;)

    I made some progress today.
    I redid the whole guide.
    So deleted everything (except my sources and manifest).

    That resulted in that I could actually apply those hybris patches this time.
    That partially fixed the first bug for building mkbootimg.
    I had to take one module out of the building process by renaming the Android.mk file for it.
    Since that module was being build 2 times.

    However when building halium-boot.img I got a new error unfortunately.
    But this turned out to be one of the known issues.
    So changing the config a bit resulted in the build finally being successful!

    The only problem left now is that the device doesn't boot.
    I only get the telnet connection.
    The guide doesn't say what to do next.
    Hopefully someone can point me towards the right direction.

    I was planning to check the halium docs since that one seems to have more information regarding the debugging.
    However I disconnected the phone and now I can reconnect to it or even reboot it 😕
    So I guess I have to wait until the battery has been drained...

    @nero355 said in [HTC J Butterfly 3] Error building mkbootimg - tools/metalava/manual not found:

    Dude...

    That is one oldass phone : https://www.gsmarena.com/htc_butterfly_3-7592.php

    Are you using this just as a learning process or are you actually planning to use the phone as a daily ?!

    If so, where do you buy a new battery for it ??

    I found a new battery for my HTC J Butterfly 3 on Ebay actually.
    Pretty cheap as well.
    https://www.ebay.nl/itm/383508077735?hash=item594adcdca7:g:WsMAAOSwqCthgsOH

    I do want to use it as a second phone. Just bringing it with me sometimes to enjoy some Ubuntu and maybe even try some wacky stuff on it.
    I wish dual booting was a thing for phones. Then I would dual boot my daily driver with ubuntu touch and android 🙂
    But I figured this phone could be a good model to test ubuntu touch and try the porting process myself.

    @nvriezen said in [HTC J Butterfly 3] Error building mkbootimg - tools/metalava/manual not found:

    I found a new battery for my HTC J Butterfly 3 on Ebay actually.
    Pretty cheap as well.
    https://www.ebay.nl/itm/383508077735?hash=item594adcdca7:g:WsMAAOSwqCthgsOH

    I hope it's a reliable battery considering it's age... 🙂

    I wish dual booting was a thing for phones. Then I would dual boot my daily driver with ubuntu touch and android 🙂

    Some phones can actually do that! Even without A/B slots! 😉

    I can Dual Boot LineageOS 16.x and Jolla Sailfish 3.4.x that way on my Xiaomi Mi 9T by just flashing their own boot.img for example 🙂

    But I figured this phone could be a good model to test ubuntu touch and try the porting process myself.

    Good luck with the project! 😃

  • BQ Aquaris E5 HD Ubuntu Phone Edition - Ubuntu Touch 16.04 LTS
  • ZUK Z2 Pro - ZUI Android 8.x
  • Xiaomi Mi 9T - Jolla SailFish 3.4.x Community Build
  • P.S. : I am NOT a developer! ;)

    @nero355 Thanks! 🙂
    Also interesting to know that dual booting is actually possible 😃

    Unfortunately I can't connect the phone to telnet anymore, even after rebooting 😞
    Really hope someone here can point me in the right direction

    EDIT:
    I managed to get the kernel log file, however I don't see anything regarding ubuntu touch/halium... (how do I upload it here though?)

    @nvriezen said in [HTC J Butterfly 3] Error building mkbootimg - tools/metalava/manual not found:

    EDIT:
    I managed to get the kernel log file, however I don't see anything regarding ubuntu touch/halium... (how do I upload it here though?)

    Just copy paste it between the Code Tags :

    Your text here! :)
    
  • BQ Aquaris E5 HD Ubuntu Phone Edition - Ubuntu Touch 16.04 LTS
  • ZUK Z2 Pro - ZUI Android 8.x
  • Xiaomi Mi 9T - Jolla SailFish 3.4.x Community Build
  • P.S. : I am NOT a developer! ;)

    @nero355 said in [HTC J Butterfly 3] Error building mkbootimg - tools/metalava/manual not found:

    Just copy paste it between the Code Tags :

    Your text here! :)
    

    The log is way too long to post it here 😕
    The only way would be to upload the file itself I guess

    @nvriezen
    As in the forum doesn't allow you to or you think it's too long ?!

    The Code Tags cut off after a certain amount of lines so it's OK to post a large amount of code I guess ??

    Otherwise use something like pastebin.com for such things 😉

  • BQ Aquaris E5 HD Ubuntu Phone Edition - Ubuntu Touch 16.04 LTS
  • ZUK Z2 Pro - ZUI Android 8.x
  • Xiaomi Mi 9T - Jolla SailFish 3.4.x Community Build
  • P.S. : I am NOT a developer! ;)

    @nero355 I guess it's not needed anymore.
    I managed to get telnet to work again.
    It seems I was setting it up incorrectly somehow, but this page in the Halium docs helped me.

    So now that I can connect to the phone again I can start looking into more what is going wrong.
    The first thing I noticed was that I don't see any /data folder when I run the ls command.
    I found in the Halium docs what the boot image is supposed to do, which is mounting the data partition. However when I run mount $DATA_PARTITION /data it returns that it couldn't find /data in fstab.

    Currently I am looking into stuff that could have gone wrong while flashing according to some other replies you gave in other threads.
    Especially this one here where someone also has the error umount: .halium-install-rootfs.hUAJA: not mounted
    The phone is flashing right now without any partitions being mounted in TWRP (cache and data were mounted all the previous times) to see if that makes any difference.

  • BQ Aquaris E5 HD Ubuntu Phone Edition - Ubuntu Touch 16.04 LTS
  • ZUK Z2 Pro - ZUI Android 8.x
  • Xiaomi Mi 9T - Jolla SailFish 3.4.x Community Build
  • P.S. : I am NOT a developer! ;)

    @nvriezen said in [HTC J Butterfly 3] Error building mkbootimg - tools/metalava/manual not found:

    @nero355 I guess it's not needed anymore.
    I managed to get telnet to work again.
    It seems I was setting it up incorrectly somehow, but this page in the Halium docs helped me.

    So now that I can connect to the phone again I can start looking into more what is going wrong.
    The first thing I noticed was that I don't see any /data folder when I run the ls command.
    I found in the Halium docs what the boot image is supposed to do, which is mounting the data partition. However when I run mount $DATA_PARTITION /data it returns that it couldn't find /data in fstab.

    Currently I am looking into stuff that could have gone wrong while flashing according to some other replies you gave in other threads.
    Especially this one here where someone also has the error umount: .halium-install-rootfs.hUAJA: not mounted
    The phone is flashing right now without any partitions being mounted in TWRP (cache and data were mounted all the previous times) to see if that makes any difference.

    Well that didn't work...
    It somehow rebooted TWRP halfway during flashing the rootfs to /data.
    So the flashing failed, twice.
    Now I'm reflashing the normal way as I also have seen more people with the umount error.
    Someone mentioned it had something to do with the phone not booting instead of the actual installer script.
    I don't know how though since the phone is not actually rebooting or anything when cleanup starts.
    Maybe if I look more closely to dmesg -w output that I can find a clue on what's happening

    So this is the dmesg output filtered on initrd:

    [    3.050478] c1      1 initrd: checking filesystem integrity for the userdata partition
    [    3.093157] c1      1 initrd: checking filesystem for userdata took (including e2fsck) 0 seconds
    [    3.103620] c0      1 initrd: mounting /dev/mmcblk0p69
    [    3.126205] c1      1 initrd: Halium rootfs is /tmpmnt/rootfs.img 
    [    3.126831] c0      1 initrd: mounting system rootfs at /halium-system
    [    3.141646] c0      1 initrd: mounting  /tmpmnt/rootfs.img (user mode)
    [    3.146123] c0      1 initrd: mounting android system image (/tmpmnt/android-rootfs.img) ro, in /android-rootfs (rootfs mode)
    [    3.146215] c0      1 initrd: mounting android system image from userdata partition
    [    3.172121] c1      1 initrd: Android system image API level is 28
    [    3.172202] c1      1 initrd: boot mode: halium
    [    3.173274] c1      1 initrd: Normal boot
    [    3.205264] c0      1 initrd: device is halium_arm64
    [    3.212544] c1      1 initrd: Adding bind-mounts to /root/etc/fstab
    [    4.101235] c0      1 initrd: checking fstab /root/var/lib/lxc/android/rootfs/fstab* for additional mount points
    [    4.107906] c1      1 initrd: moving Android system to /android/system
    [    4.659792] c0    776 ########################## usb_info: Halium initrd Debug telnet on port 23 on rndis0 192.168.2.15 - also running udhcpd
    

    The whole dmesg output can be found here: https://0paste.com/343730
    The most interesting line is probably the one saying something about not being able to find init.

    After looking at a lot of github issues and other posts I think the problem lies in the After mounting rootfs.img it will start the systemd init from the rootfs step of the boot sequence (from the Halium docs).
    Unfortunately this is out of my league so I can't do much anymore.
    Hopefully someone with experience in the boot process of Linux/Ubuntu Touch can help out here.

    The log lines that pointed me to this are:

    [    4.101235] c0      1 initrd: checking fstab /root/var/lib/lxc/android/rootfs/fstab* for additional mount points
    [    4.103681] c0    755 cat: can't open '/root/var/lib/lxc/android/rootfs/fstab*': No such file or directory
    [    4.106813] c0    759 mkdir: can't create directory '/root/android/cache': File exists
    [    4.107906] c1      1 initrd: moving Android system to /android/system
    [    4.114412] c1      1 Begin: Running /scripts/local-bottom ... done.
    [    4.114583] c1      1 done.
    [    4.118526] c1      1 Begin: Running /scripts/nfs-bottom ... done.
    [    4.118872] c1      1 Begin: Running /scripts/init-bottom ... done.
    [    4.128084] c0    769 run-init: opening console: No such device
    [    4.128224] c0      1 Target filesystem doesn't have requested /sbin/init.
    [    4.128896] c1    770 run-init: opening console: No such device
    [    4.129720] c0    771 run-init: opening console: No such device
    [    4.130458] c1    772 run-init: opening console: No such device
    [    4.131154] c0    773 run-init: opening console: No such device
    [    4.131946] c1    774 run-init: opening console: No such device
    [    4.133078] c0      1 No init found. Try passing init= bootarg.
    

    Though stupid thing is that sbin/init does exist as I can see it through the telnet connection...

    Made some great progress tonight after I got some help through the Telegram group!
    Turns out the error;

    [    4.128084] c0    769 run-init: opening console: No such device
    [    4.128224] c0      1 Target filesystem doesn't have requested /sbin/init.
    [    4.128896] c1    770 run-init: opening console: No such device
    [    4.129720] c0    771 run-init: opening console: No such device
    [    4.130458] c1    772 run-init: opening console: No such device
    [    4.131154] c0    773 run-init: opening console: No such device
    [    4.131946] c1    774 run-init: opening console: No such device
    [    4.133078] c0      1 No init found. Try passing init= bootarg.
    

    Had something to do with console=tty0 missing from the kernel cmdline.
    Basically I had to follow these step for Halium 7.1 even though I am using Halium 9.0.

    After that I also needed to use this fix because my phone uses arm64.
    But after that I was able to boot Ubuntu 16.04 correctly on my phone!!

    Unfortunately trying to get Lomiri to work (the GUI) didn't go so well.
    But that is for another day.
    I'm already happy that the phone now runs Ubuntu! 😃

    @doniks Well, just make sure that the thing about console=tty0 is not only mentioned on the Halium 7.1 page but also on the Halium 9.0 page in the docs.
    And that the docs points to the above mentioned fix for people with an arm64 architecture phone. That could just be in the errors section I think.

    Another thing I ran into was e2fsdroid giving me errors. I didn't realize this at first.
    So for people that see something like env: 'e2fsdroid' No such file or directory
    Just run mka e2fsdroid in the build directory because you probably miss it on your machine somehow.
    That made it finally possible for me to build a system image as well.