Commits on Mar 28, 2018
  1. Create own kernel logger

    vasishath committed Mar 28, 2018
    The one in libcutils is crashing the kernel for some reason
Commits on Mar 14, 2018
  1. Remove old adbd

    vasishath committed Mar 14, 2018
  2. Fix signed zip generation

    vasishath committed Mar 14, 2018
  3. Switch to getpwuname from pwd.h

    vasishath committed Mar 14, 2018
    As recommended by google
  4. Remove old adbd

    vasishath committed Mar 14, 2018
  5. Allow users to manually add a firmware scan directory

    vasishath committed Mar 13, 2018
    Some devices have certain drivers which probe and request for a firmware
    before multirom has symlinked /mrom_enc/vendor. Add a new flag to allow
    users to specify manual scan directories where users can put their own
    needed firmwares.
  6. Use lstat instead of access to check file existence

    vasishath committed Mar 13, 2018
    Some devices have a permanent /vendor symlink to /system/vendor in
    ramdisk. As during multirom bootup neither system nor vendor partition
    is mounted, so /vendor points to a non-existent target. Running access()
    on this symlink results in error with NOENT (no such file or directory)
    as it tries to dereference the target of symlink. Thus, the symlinking
    of /mrom_enc/vendor to /vendor also fails since the link with same name
    already exists.
    Fix this by using lstat() which reports the existence of symlink (broken
    or working) and real file properly.
Commits on Nov 6, 2017
  1. multirom: Support handling the immutable flag for external

    AdrianDC committed Nov 6, 2017
    Change-Id: I49fa63560649e72aaa11469dd8fe726e611d59bd
    Signed-off-by: Adrian DC <>
Commits on Nov 2, 2017
  1. multirom: Use MultiROM/external instead of external_multirom

    AdrianDC committed Nov 2, 2017
    Signed-off-by: Adrian DC <>
  2. Log change to +i on main dir

    nkk71 authored and AdrianDC committed Oct 19, 2017
  3. Block sdcardfs uid/gid/mode derivation on MultiROM

    nkk71 authored and AdrianDC committed Oct 15, 2017
    * sdcardfs (re)sets uid+gid+mode on /data/media and it's subdirectories
      to media_rw:media_rw or to the appropriate settings for a per app
      directory. Refer to for more details.
    * This will effectively break all secondary ROMs since they are stored
      in /data/media/0/multirom.
    * To block this from happening move multirom to a subdirectory within
      a 'container' directory in /data/media/0 and set this 'container'
      directory to be immutable.
      Doing so will result in /data/media/0/MultiROM not being affected by
      any changes (nor can it be manipulated), it's subdirectories however
      '/data/media/0/MultiROM/multirom/...' can be used normally.
    * The directory is set immutable during MultiROM installation, in
      trampoline, as well as MultiROM-TWRP to avoid potential problems
      if someone decides to flash a ROM/kernel with the sdcardfs issue
      to primary without injection or using normal TWRP. This would break
      any secondaries currently existing in Internal Storage.
    * However, setting/keeping the container immutable will interfere with
      'Wipe Internal Storage' in MultiROM-TWRP, as well as regular TWRP,
      though maybe that is a good thing.
      TODO: set -i during 'Wipe Internal Storage' and/or add a new
           'Wipe MultiROM' option in MultiROM-TWRP.
    Other options that were considered and tested successfully:
      (1) Use /data/multirom
      Move multirom to /data/multirom (don't forget to adjust TWRP
      to exclude /data/multirom from wipe and backups, as well as
      take into account that some installers will actually wipe
      data excluding media as part of their installation).
      This was my initial attempt, but was reconsidered due to the
      current change being effective, while minimizing code changes
      and maintaining the current directory in Internal Storage.
      At some point it may need to be reconsidered if this would make
      the most sense. Perhaps once we see devices with FBE this may
      become the most logical step.
      (2) Use .img files
      Similar to System Partition Mode, use .img files and loop
      mount them during boot. Since the secondary ROMs directories
      become actual files in /data/media/[0/]multirom/roms... these
      are unaffected by any change to /data/media/...
      The problem is that the data partition will become constrained
      and/or susceptible to 'overflow' crashes both while booted and
      in TWRP, since the actual free space is not properly reflected
      since it will show the free space within the .img file as
      opposed to the device's free space.
      (3) Use one of the already excluded 'names'
      'autorun.inf', '.android_secure' and 'android_secure' are
      excluded by default from uid/gid derivation, and are hardcoded
      here so renaming /data/media/0/multirom
      to /data/media/0/autorun.inf (for example) will not let sdcardfs
      perform a chown on it and it's subdirectories.
      Not very intuitive though to have something called 'autorun.inf'
      in the root directory of Internal Storage which in fact is
      multirom. (Even if there's a multirom symlink to it, and the
      symlink will be affected by the uid/gid derivation)
  4. All MultiROM tags should be optional

    nkk71 authored and AdrianDC committed Oct 7, 2017
  5. rom_quirks: Separate file_contexts injection code

    nkk71 authored and AdrianDC committed Oct 7, 2017
    * Use a separate .c file for the 'inject_file_contexts()'
      function which will handle both text and binary format
    * Only rely on the 'multirom_exclusion_path' string array to
      add the needed exclusions. This will become useful once the
      multirom directory changes.
    * This also allows us to use the same file for exclusions in
  6. Update default android rom icon

    nkk71 authored and AdrianDC committed Oct 3, 2017
  7. rom_quirks: Add Android 8.0 plat_file_contexts exclusions

    nkk71 authored and AdrianDC committed Sep 15, 2017
    * Android 8 uses plat_file_contexts and nonplat_file_contexts
    * Android 8 also uses 'restorecon --recursive --skip-ce /data'
  8. Don't build MultiROM when building TWRP

    nkk71 authored and AdrianDC committed Sep 8, 2017
  9. encmnt: Use linker[64] from /mrom_enc dir

    nkk71 authored and AdrianDC committed Aug 30, 2017
  10. Fixup installer/uninstaller mk file

    nkk71 authored and AdrianDC committed Aug 30, 2017
  11. encmnt: Build required libs

    nkk71 authored and AdrianDC committed Aug 30, 2017
    * is dependent on
    * For qcom hardware encryption and its
      other libs ( are needed
  12. Add 'System Partition Mode' (hybrid) ROMs

    nkk71 authored and AdrianDC committed Aug 18, 2017
    * Magisk loop mounts the /system by parsing /proc/mounts
      to get the partition information:
      In MultiROM this has two problems: (1) the /system
      partition is a bind mount and therefore would fail the
      mount command and (2) the partition that is listed in
      /proc/mounts would be the real block device which is
      just the userdata partition (/dev/block/mmcblk0pNN).
    * To workaround this we create an img file (for system
      only) and use loop mount instead of bind mount.
    * During boot the the fake system img will get loop
      mounted to /multirom/dev/system which will properly
      show up in /proc/mounts and being a loop mount
      will properly work with mount().
    * Note: In order to avoid more interference with the
      existing loop devices, we now create our own loop
      devices at a higher range (MULTIROM_LOOP_NUM_START).
    * The accompanying change in MultiROM-TWRP is needed to
      be able to flash 'System Partition Mode' ROMs.
  13. multirom: Support mounting booted external EXT4/F2FS

    AdrianDC committed Jun 4, 2017
     * When booting from an EXT4 or F2FS MicroSD / USB Drive,
        the external partition itself is not mountable and
        accessible from the Android userspace for media or data
     * External booted partition is mounted early for /system,
        /data and /cache, therefore e2fsck fails to check,
        and vold avoids mounting the 'corrupted' partition
     * Furthermore on CM/LineageOS based ROMs, external drives
        using EXT4 or F2FS are mounted with an sdcard context,
        which fails due to the superblock mounts mismatching
        the early MultiROM mount of the same partition
     * Work around this limitation from vold and external boots
        by flagging such a boot as an external_mount path,
        remove the fstab entry matching the external MicroSD
        or external USB, and finally mount the partition
        to a new 'external_multirom' folder inside the internal
        media storage under /data/media or /data/media/0
     * Stores external mount paths and filesystem globally
        for later use upon Android mounts preparation
    Change-Id: Ifab658ac03a481b40b517a978621f25e09f8622b
    Signed-off-by: Adrian DC <>
  14. multirom: Fix /data/media/0 media linkage for SDCardFS

    AdrianDC committed May 21, 2017
     * In a MultiROM environment, /data is owned by the
        booted secondary ROM, specifically it can even be
        part of an external MicroSD (for example with EXT4)
     * By using a ROM supporting SDCardFS, the interal
        media storage will be accessed through its driver,
        but the fact /data/media/0 could be used under
        specific conditions means the /data/media mounts
        used by the emulated storage loop through:
         - /data/media (external ROM)
         - /data/media/0 (internal storage)
     * SDCardFS prevents "cross-device" linkage by
        returning -EXDEV, breaking internal storage access
     * Always use the proper /data/media path on newer APIs
        to avoid any cross-device linkage of internal storage,
        and preserve old handling up to API 22 (Android 5.1)
    Change-Id: Ib49db68eede289d3943b9537d542eef5082e3118
    Signed-off-by: Adrian DC <>
  15. multirom: install: Add a new recovery injector target

    AdrianDC committed Oct 16, 2016
     * Inject MultiROM UI into the recovery partition
     * Detect the /boot.txt from init_sony or
    Change-Id: Icf416aca8d1b44068172b115c2c1ede93700eb83
    Signed-off-by: Adrian DC <>
Commits on Nov 1, 2017
  1. multirom: core: Support booting MultiROM from recovery

    AdrianDC committed Oct 16, 2016
     * Display 'Recovery' instead of 'Internal' on first line
     * Set 'Recovery' as default booting element
     * Avoid showing MultiROM on init_sony recovery boot
     * Detect the /boot.txt from init_sony or
        the /bootrec/boot-log.txt from
        to bypass the MultiROM UI for recovery
    Change-Id: Ie4895f90400ee7a2c574f015f7ce628a4bb21a28
    Signed-off-by: Adrian DC <>
  2. multirom: trampoline: Add support for loading different MRom binaries

    Diewi authored and AdrianDC committed Oct 29, 2016
    This commit allows to load different multirom binaries from trampoline.
    It is enabled by defining MR_BINARY_SELECTOR in a device's Makefile
    which points a C source file from the android root directory. In this
    file, the function get_multirom_binary_string must be implemented which
    writes a string to the passed parameter that is the name of the multirom
    binary to load.
    Any implementation must follow these conventions:
    - On an error, or if the default binary ("multirom") shall be loaded, -1
    must be returned.
    - The name of the multirom binary may not exceed 255 chars.
    The reasoning behind this change is that incompatible changes between
    different kernel versions may occur which require multirom binaries to
    be compiled for these specific kernel/android versions. Since the main
    distribution path via the multirom app does not allow to deliver
    different multirom zip files, runtime dispatching is required.
    This case has been observed for the Z2 (or similar devices) when
    switching from the 1.2.2 to the 1.3.3 AOSP kernel that included a change
    in the display driver. This caused a crash in multirom if the binary was
    compiled for the other kernel that was not the primary one of the
    Change-Id: I76df9e0ac022b5e7d62259e7fac41c3951451ebc
    Signed-off-by: Alexander Diewald <>
  3. multirom: build: Append an "x" to the version number

    olivier97 authored and AdrianDC committed Sep 16, 2014
    - the "x" stands for "Xperia"
    Change-Id: If6e3a3758fd7a8d8cdd5f79f1f6621f2fa8f5dbd
  4. multirom: arm64: Add more logging for loading dtb.img

    oshmoun authored and AdrianDC committed Jun 20, 2016
     * Exclude more places where --dtb is passed with no parameter.
     * This causes arm64 kexec to error out.
    Change-Id: I830c97df5e58dded58abf4afa05d9c6d27676fc1