ModalAI Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Toolchain for m0054-data-fs.ext4

    VOXL SDK
    2
    5
    86
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Rowan DempsterR
      Rowan Dempster
      last edited by

      Hi Modal,

      I'm looking into adding some data in the m0054-data-fs.ext file system. I'm having some trouble getting the voxl2 to work correctly when I try to add the data and then create a new Android sparse image that I flash instead of m0054-data-fs.ext. Would it be possible to provide me with the tools used to create that m0054-data-fs.ext file system at ModalAI so that I can use the exact same tools to create the sparse android image after adding my files to it?

      Thank you,
      Rowan

      Rowan DempsterR 1 Reply Last reply Reply Quote 0
      • Rowan DempsterR
        Rowan Dempster @Rowan Dempster
        last edited by Rowan Dempster

        I found https://gitlab.com/voxl-public/system-image-build/meta-voxl2/-/blob/qrb5165-ubun1.0-14.1a/recipes-products/image/qti-ubuntu-robotics-image.bbappend#L148, which is in bitbake language (not familiar)?

        Is

        do_makeuserdata() {
            make_ext4fs -s -l ${USERDATA_SIZE_EXT4} ${IMAGE_EXT4_SELINUX_OPTIONS} \
                -a /data -b 4096 ${DEPLOY_DIR_IMAGE}/${OVERLAYIMAGE_TARGET} ${IMAGE_ROOTFS}/data
        }
        

        something I could do just on normal ubuntu in CI? I'm thinking to build a cleo-specific userdata in CI with all of our custom software.

        What are ${IMAGE_EXT4_SELINUX_OPTIONS}, is there some secret sauce there?

        Rowan DempsterR ModeratorM 2 Replies Last reply Reply Quote 0
        • Rowan DempsterR
          Rowan Dempster @Rowan Dempster
          last edited by

          For anyone reading this in the future this works:

          docker run --rm --privileged \
              -v "$SYSTEM_IMAGE_DIR":/system-image:ro \
              -v "$CLEO_IMAGE_DIR":/cleo-image \
              -v "$CLEO_PROVISION_DIR":/cleo-provision:ro \
              ubuntu:18.04 bash -c "
              set -e
              
              # Install tools
              apt-get update -qq
              apt-get install -y -qq android-tools-fsutils e2fsprogs >/dev/null
              
              # Extract stock data partition contents
              echo 'Extracting stock m0054-data-fs.ext4...'
              mkdir -p /tmp/data_root
              
              # Convert sparse to raw and mount
              simg2img /system-image/m0054-data-fs.ext4 /tmp/stock_raw.ext4
              mkdir -p /mnt/stock
              mount -o loop,ro /tmp/stock_raw.ext4 /mnt/stock
              
              # Copy all stock files
              cp -a /mnt/stock/* /tmp/data_root/
              umount /mnt/stock
              rm /tmp/stock_raw.ext4
              
              echo 'Stock contents copied.'
              
              # Add cleo-provision directory
              cp -a /cleo-provision /tmp/data_root/cleo-provision
              
              echo 'Added cleo-provision directory'
              
              # Create the ext4 image using same parameters as BitBake recipe:
              #   -s            : sparse output
              #   -l SIZE       : filesystem size in bytes
              #   -a /data      : android mount point
              #   -b 4096       : block size
              make_ext4fs -s -l $USERDATA_SIZE_EXT4 -a /data -b 4096 /cleo-image/m0054-data-fs.ext4 /tmp/data_root
              
              echo ''
              echo 'Created sparse ext4 image successfully'
          "
          

          You'll need to be on an arm64 architecture.

          1 Reply Last reply Reply Quote 0
          • ModeratorM
            Moderator ModalAI Team @Rowan Dempster
            last edited by

            @Rowan-Dempster thank you for sharing this! Does this mean you can create a custom data file partition that you can flash using fastboot? We have not explored this before but it has been asked a few times. This could be very helpful for other developers.

            Rowan DempsterR 1 Reply Last reply Reply Quote 0
            • Rowan DempsterR
              Rowan Dempster @Moderator
              last edited by

              @Moderator Hi Modal,

              Does this mean you can create a custom data file partition that you can flash using fastboot?

              Yes that is correct.

              We have not explored this before but it has been asked a few times. This could be very helpful for other developers.

              I'm certainly hopeful that it will be helpful here at Cleo Robotics! So far with my prototyping it works as expected and cuts flashing time of some large docker images we have here at Cleo down by a noticeable fraction (no file overhead via fastboot like with ADB).

              I think the snippet I posted covers the baseline functionality of getting a custom "payload" into the data partition. However if there is more I can elaborate on in terms of the toolchain / what's in the payload, and if that elaboration will be helpful to other VOXL2 developers, I would be happy to elaborate 🙂 Just let me know!

              Other similar discussion points I tackled recently that I'm happy to talk about lessons of:

              • Flashing the system image and VOXL/CLEO SDK through a Windows Machine (journeys in USB device drivers)
              • Building Flutter applications for uniform flashing process across all operating systems
              • Building release bundles (i.e. a collection of partition binaries) in CI
              1 Reply Last reply Reply Quote 0
              • First post
                Last post
              Powered by NodeBB | Contributors