Porting to Motorola Moto G (2013) LTE



  • Hi,

    I try to port ubport to my Motorola Moto G LTE (peregrine). I managed to get everything working with the cm12.1 sources. But after executing the make command, I get the following error:

    make_ext4fs -T -1 -S out/target/product/peregrine/root/file_contexts -l 79560704 -a system -L SYSTEM out/target/product/peregrine/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/peregrine/system
    Creating filesystem with parameters:
        Size: 79560704
        Block size: 4096
        Blocks per group: 32768
        Inodes per group: 4864
        Inode size: 256
        Journal blocks: 1024
        Label: SYSTEM
        Transparent compression: none
        Blocks: 19424
        Block groups: 1
        Reserved block group size: 7
    error: ext4_allocate_best_fit_partial: failed to allocate 2511 blocks, out of space?
    error: failed to build out/target/product/peregrine/obj/PACKAGING/systemimage_intermediates/system.img from out/target/product/peregrine/system
    Out of space? the tree size of out/target/product/peregrine/system is (MB): 
    66      out/target/product/peregrine/system
    The max is 1104 MB.
    build/core/Makefile:1188: recipe for target 'out/target/product/peregrine/obj/PACKAGING/systemimage_intermediates/system.img' failed
    

    I read somewhere that it could be the size of the system.img partition, but I think it wouldn't be a good idea to change this. The remaining hard-drive space also couldn't be an issue. Does anyone experienced the same or knows a solution?

    Regards,
    lagertonne



  • @lagertonne
    Hello you can look at the Halium wiki and the telegram group to get further help.



  • @lagertonne Are you sure you are not simply running out of disk space in the machine you are building on!? Check df -h.



  • @lagertonne, on the web i found this issue which seems to be exactly what you are facing but on a different device.

    There they say that your system.img size is in conflict with the property "based on BOARD_SYSTEMIMAGE_PARTITION_SIZE in device/manufacturer/product/BoardConfig.mk"(Don't know if this helps, and unfortunately the given solution [which would be using smaller gapps] in the link will not help here but perhaps finding out what's the problem is a first step?!).

    A quick comparison of the values for peregrine (lineageos sources) with different ubports devices shows that there are devices with smaller values stored inside BoardConfig.mk and i don't know how good it will work if you just change this property (the bootloader of the phone probably will make problems) but just for building you might try to double the stored BOARD_SYSTEMIMAGE_PARTITION_SIZE and see if it builds?



  • @doniks df says that it has enough space (2TB). But I'm building inside a lxc-container so I'll establish another build environment later without a container and check if this can be the issue.

    @demokrit I tried increasing the SYSTEMIMAGE_PARTITION_SIZE, but it didn't made any difference. My Partition (1157627904) is even bigger than the one from the Nexus 5 (1073741824).



  • @lagertonne said in Porting to Motorola Moto G (2013) LTE:

    @doniks df says that it has enough space (2TB). But I'm building inside a lxc-container so I'll establish another build environment later without a container and check if this can be the issue.

    Well, after reading @demokrit 's answer, I find that theory a lot more convincing than the df one :) But yeah, the df should be done INSIDE the lxc container

    @demokrit I tried increasing the SYSTEMIMAGE_PARTITION_SIZE, but it didn't made any difference. My Partition (1157627904) is even bigger than the one from the Nexus 5 (1073741824).

    I have deleted my obj/PACKAGING/systemimage_intermediates/system.img and have it recreated with make systemimage. For me it ends with

    [ 99% 242/243] Target system fs image: /media/peter/share2/data/halium/out/target/product/deb/obj/PACKAGING/systemimage_intermediates/system.img
    BuildImage: in_dir = /media/peter/share2/data/halium/out/target/product/deb/system, out_file = /media/peter/share2/data/halium/out/target/product/deb/obj/PACKAGING/systemimage_intermediates/system.img
    fs type is not ext4
    Running:  mkuserimg.sh -s /media/peter/share2/data/halium/out/target/product/deb/system /media/peter/share2/data/halium/out/target/product/deb/obj/PACKAGING/systemimage_intermediates/system.img ext4 system 880803840 -j 0 -D /media/peter/share2/data/halium/out/target/product/deb/system -L system /media/peter/share2/data/halium/out/target/product/deb/root/file_contexts.bin
    make_ext4fs -s -T -1 -S /media/peter/share2/data/halium/out/target/product/deb/root/file_contexts.bin -L system -l 880803840 -J -a system /media/peter/share2/data/halium/out/target/product/deb/obj/PACKAGING/systemimage_intermediates/system.img /media/peter/share2/data/halium/out/target/product/deb/system /media/peter/share2/data/halium/out/target/product/deb/system
    Creating filesystem with parameters:
        Size: 880803840
        Block size: 4096
        Blocks per group: 32768
        Inodes per group: 7680
        Inode size: 256
        Journal blocks: 0
        Label: system
        Blocks: 215040
        Block groups: 7
        Reserved block group size: 55
    Created filesystem with 1098/53760 inodes and 37403/215040 blocks
    Running ['mkuserimg.sh', '-s', '/media/peter/share2/data/halium/out/target/product/deb/system', '/media/peter/share2/data/halium/out/target/product/deb/obj/PACKAGING/systemimage_intermediates/system.img', 'ext4', 'system', '880803840', '-j', '0', '-D', '/media/peter/share2/data/halium/out/target/product/deb/system', '-L', 'system', '/media/peter/share2/data/halium/out/target/product/deb/root/file_contexts.bin'] command, exit code = 0
    [100% 243/243] Install system fs image: /media/peter/share2/data/halium/out/target/product/deb/system.img
    /media/peter/share2/data/halium/out/target/product/deb/system.img+/media/peter/share2/data/halium/out/target/product/deb/obj/PACKAGING/recovery_patch_intermediates/recovery_from_boot.p maxsize=899137536 blocksize=135168 total=143520351 reserve=9191424
    
    #### make completed successfully (56 seconds) ####
    

    and that number 880803840 is what I find in my board config

    grep -r 880803840 
    [...]
    device/asus/flo/BoardConfigCommon.mk:BOARD_SYSTEMIMAGE_PARTITION_SIZE := 880803840 # 840M
    [...]
    out/target/product/deb/obj/PACKAGING/systemimage_intermediates/system_image_info.txt:system_size=880803840 
    

    For you, it seems that the number passed to make_ext4fs is 880803840, which is NOT the number you say you have in your board config. Maybe that helps? Otherwise I'd suggest you post exactly the commands and file changes you perform from repo init to make.



  • I tried to build the same thing from a chroot environment, but still the same error. I even copied a few hundred gigabytes to the folder, so disk space can't be the issue.

    Setting the BOARD_SYSTEMIMAGE_PARTITION_SIZE higher and higher did not worked, I even tried setting it to 8808038400, which means 8400MB as System-image-partition-size, but same error.

    Here the steps I took until I could build:

    • Initializing repo with repo init -u https://github.com/ubports/android -b ubp-5.1
    • repo sync
    • . build/envsetup.sh
    • Adding a motorola_peregrine.xml file in local_manifests with the following content
    <?xml version="1.0" encoding="UTF-8"?>
    <manifest>
            <project name="android_device_motorola_peregrine" path="device/motorola/peregrine" remote="cm" revision="cm-12.1" />
            <project name="android_device_motorola_msm8226-common" path="device/motorola/msm8226-common" remote="cm" revision="cm-12.1" />
            <project name="android_kernel_motorola_msm8226" path="kernel/motorola/msm8226" remote="cm" revision="cm-12.1"/>
            <project name="android_device_qcom_common" path="device/qcom/common" remote="cm" revision="cm-12.1"/>
    
            <project name="proprietary_vendor_motorola" path="vendor/motorola" remote="them" revision="cm-12.1" />
    </manifest>
    
    • repo sync
    • Adding a missing vendorsetup.sh with the following content to use lunch:
    add_lunch_combo cm_peregrine-userdebug
    
    • lunch cm_peregrine-userdebug
    • make -j9
      At that point I'm getting the same error as above. If I change the BOARD_SYSTEMIMAGE_PARTITION_SIZE the only line that changes is the The max is xxxx MB. line.

    So basically, everything as it is written in the Porting Guide.
    Many thanks for your help :)



  • @lagertonne Have you tried to set GAPPS_VARIANT to mini?



  • @lagertonne said in Porting to Motorola Moto G (2013) LTE:
    Weird. Maybe you can trick it by running the make_ext4fs manually with the right number 1157627904

    make_ext4fs -T -1 -S out/target/product/peregrine/root/file_contexts -l 1157627904 -a system -L SYSTEM out/target/product/peregrine/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/peregrine/system
    

    and then make systemimage ?! I kinda doubt it, but worth a try. Or hack/disect the makefile that is issuing that make_ext4fs command.



  • Ok, some progress:
    @doniks is right, the wrong command is executed, I somehow missed this. Issuing the command manually works. make systemimage executes also the wrong command.

    I'll try to find the point where make_ext4fs is executed, and from where the "-l" value is taken, and maybe I can fix this for my environment. Any clue where to look in all the Makefiles would be highly appreciated :)

    Many thanks for your help so far!



  • @lagertonne said in Porting to Motorola Moto G (2013) LTE:

    I'll try to find the point where make_ext4fs is executed, and from where the "-l" value is taken, and maybe I can fix this for my environment. Any clue where to look in all the Makefiles would be highly appreciated :)

    not sure. Maybe those guys are a good starting point:

    grep -r --exclude-dir=out MAKE_EXT4FS *
    build/core/generate_extra_images.mk:$(INSTALLED_PERSISTIMAGE_TARGET): $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(INTERNAL_PERSISTIMAGE_FILES)
    build/core/config.mk:MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/make_ext4fs$(HOST_EXECUTABLE_SUFFIX)
    build/core/Makefile:INTERNAL_USERIMAGES_DEPS += $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(E2FSCK)
    [...]
    /mkuserimg.sh:MAKE_EXT4FS_CMD="make_ext4fs $ENABLE_SPARSE_IMAGE -T $TIMESTAMP $OPT -l $SIZE $JOURNAL_FLAGS -a $MOUNT_POINT $OUTPUT_FILE $SRC_DIR $PRODUCT_OUT"
    system/extras/ext4_utils/mkuserimg.sh:echo $MAKE_EXT4FS_CMD
    system/extras/ext4_utils/mkuserimg.sh:$MAKE_EXT4FS_CMD
    

    Hth



  • I didn't had that much time the last week, but I think I solved this issue. It has to be something with ZFS as underlying file system. After putting the source on an ext4 the make_ext4fs command succeeded, so I think this issue is solved for now. Thank you all :)


Log in to reply
 

Looks like your connection to UBports Forum was lost, please wait while we try to reconnect.