Jewel data/media transition

Information

The HTC EVO 4G LTE (jewel) was pulled from nightlies on Jul 29, 2014 due to frequent modem PIL (Peripheral Image Loader) failures. In short, the kernel was failing to bring the modem out of reset. These modem PIL failures vanish when jewel’s firmware is updated to 4.13.651.4. This guide instructs users on how to update jewel to firmware 4.13.651.4 and install CyanogenMod. Discussion on this topic should be posted to this forum thread.

The decision to take the firmware update route was not reached easily. There is a major caveat: there is no data migration path from an existing CyanogenMod installation. If you opt to perform this firmware update, all of your data, applications, and anything stored on /sdcard will be erased. The latest updates for jewel were published only semi-officially via twitter, likely because the stock ROM would face the same issue of no data migration from older stock ROM versions. The reason for this is a change in partition layout. The latest firmware update follows the recent trend of making /sdcard a directory on the /data partition rather than giving it its own partition. There are advantages and disadvantages to this. Some changes worth noting:

  1. Can only mount /sdcard to computer via MTP (media transport protocol)
  2. Available application installation space is now shared with media storage
  3. Separate user profiles store media in their own directories
    • Example: the first user profile has /sdcard linked to /data/media/0, the second user has /sdcard linked to /data/media/1, etc.

More information about this firmware update, including a short FAQ was put together by Captain_Throwback at XDA Forums:

The instructions provided below only give information on updating, not downgrading your firmware and are only intended for S-OFF users. For all intents and purposes, consider this a one-way street, no going back.

Not sure if you need the firmware update? Restart your phone to the bootloader and look for the HBOOT version. If your HBOOT version is lower than 2.10.0000, this update is for you. If your HBOOT is 2.10.0000 or greater, you can skip this guide and follow the standard installation instructions for jewel.

Backup CyanogenMod+Apps and store on computer

  1. Backup your existing application data with either adb backup or an app from the Play store (e.g. Helium, TitaniumBackup)
    If you have any applications that are partially stored to /sdcard (i.e. the “Move to SD Card” button for applications under Settings > Applications), then first move them back to Phone storage. This storage option is not needed or supported after transitioning to /data/media storage.
  2. Backup your existing ROM in recovery
  3. Copy all /sdcard contents to your computer
  4. Remove your microSD card from the phone to ensure it doesn’t get wiped

You can potentially use the application backups to save some time when setting up CyanogenMod after reinstallation.

The ROM backup is made because it is technically possible to downgrade via RUU 3.17.651.4. Instructions on this process are not provided on this wiki. Once your firmware has been updated, we recommend you stay with it; consider this a one-way street! If you really want to downgrade though, you may find help from users in this xda thread.

Update your firmware

You must be S-OFF to follow these instructions! If you are not S-OFF already, look into rumrunner, or possibly firewater.

Before you begin, be sure that both ADB and fastboot are installed and working on your computer. With your phone booted and connected to your computer, you should be able to type adb devices to see your device’s serial number. Similarly, test fastboot by first rebooting your phone to the bootloader (adb reboot-bootloader) and then typing fastboot devices to see your serial number again. Only continue if you have working adb and fastboot!

  1. Download jewel-firmware-4.13.651.4-twrp-2.7.1.2.zip (mirror)
    SHA1: 3d95f764dc79d6d63c146985760542d150e5984d
    It is imperative that you verify the SHA1 checksum before flashing!
    This firmware package contains an unofficial build of TWRP 2.7.1.2. More information about this recovery can be found here.
  2. Reboot the device to HBOOT:
    adb reboot-bootloader
  3. Enter the OEM update mode:
    fastboot oem rebootRUU
  4. Flash the firmware package. cd to the directory containing jewel-firmware-4.13.651.4-twrp-2.7.1.2.zip and run:
    fastboot flash zip jewel-firmware-4.13.651.4-twrp-2.7.1.2.zip
  5. You will see a FAILED message: remote: 90 hboot pre-update! please flush image again immediately. Do not be alarmed. Wait a few seconds for the HTC logo to reappear on your device, then run the same command again:
    fastboot flash zip jewel-firmware-4.13.651.4-twrp-2.7.1.2.zip
  6. Wait for the process to finish
  7. Reboot the phone to the bootloader:
    fastboot reboot-bootloader
  8. Use the volume keys to navigate to BOOTLOADER and the power key to select; you should see HBOOT-2.10.0000 if the firmware update was successful.
  9. Choose RECOVERY from the HBOOT menu to boot into TWRP

Install CyanogenMod

You have a choice of CyanogenMod build to install:

  1. Official nightlies later than or equal to 20140806
  2. Official M-builds later than or equal to M10

You may also want to download the Google Apps package (version 20140606)

TWRP

  1. Select the Wipe button, followed by Format Data. Type yes to continue, wait for the process to finish, and then return to the home screen with the Home icon at the bottom of the screen.
  2. Select the Wipe button, followed by Advanced Wipe. Select the Cache and System partitions and confirm their wipe. Return to the home screen.
  3. You can now either use adb to push the installation package(s) to /sdcard, or copy the package(s) to a microSD card on your computer and insert it into your device. You may have to reboot recovery for the microSD card to become available.
    adb method: adb push cm-11-20140916-SNAPSHOT-M10-jewel.zip /sdcard/

From here, installation is as you’ve always done. Discussion should be directed to this forum thread.

Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

Goldcard

Before You Begin

  • Some SD cards simply will not work as a “goldcard”. The most likely reason is that the SD card does not have a partition table(MBR) and sector 0 of the card starts with the file system boot sector, So writing the Goldcard image on the SD card will overwrite the boot sector of file system thus rendering the card unusable. You can use HP USB Disk Storage Format Tool to format the card correctly with MBR partition scheme, just make sure to format the card with fat32 file system(This will erase everything that is on the SD card, so backup anything that is on it that you consider important). But If you still cannot get the SD card to work properly, try a different SD card.
  • You will need some form of adapter to connect the SD card to the computer, whether it be a microSD to USB adapter, or a microSD to SD adapter plugged into a SD card slot on the computer.
  • You will need to install the Terminal Emulator from the Android Market.

Creating a Goldcard

  1. Insert the SD card you want use for the goldcard into the device.
  2. Unmount the SD card (Settings » SD card & device storage » Unmount SD card) and then format it (Erase/Format SD card).
    NOTE: This will erase everything that is on the SD card, so backup anything that is on it that you consider important.
    NOTE: Make sure your sdcard was formatted to fat32.
  3. On the device, open the Terminal Emulator and type the following command:
    cat /sys/class/mmc_host/mmc1/mmc1:*/cid

    NOTE: If that does not work, try cat /sys/class/mmc_host/mmc0/mmc0:*/cid
    NOTE: For Desire HD / Inspire 4G phones, try cat /sys/class/mmc_host/mmc2/mmc2:*/cid
  4. A 32 character, alphanumeric code will be displayed. Write it down exactly as it is presented.
  • Go to http://huygens.hoxnet.com/goldcard.html and enter the code as a “normal code”.
  • Once you click on “Download Goldcard”, download/save the binary file.
  • Download & install HxD.
  • Take your SD card out of the device and put it into the SD adapter it came with. Then put that into your computer so it shows up on your computer as Removable Disk.
  • Open the Hex Editor (Run as Administrator if one Vista or Windows 7) and click on the Extra tab, then click on Open Disk. Under Physical Disk select Removable Disk (your SD card you just put into the computer). Make sure to UNcheck “Open as ReadOnly”. Click OK.
  • Goto the Extra tab again and click Open Disk Image. Open up the goldcard.img that you saved from your email. You should now have two tabs, one is the SD card (Removable Disk) and the other is the goldcard.img Press OK when prompted for Sector Size 512 (Hard Disks/Floppy Disks).
  • Click on the Goldcard.img tab and click on the Edit tab and click Select All. Then click on the Edit tab again and click Copy.
  • Click on the Removable Disk tab (Your SD Card) and select offset 00000000 to 00000170 then click on the Edit tab and click Paste Write.
  • Click on File then click Save.
  • Close the Hex Editor.
  • Test what we’ve done:
    1. Take out the memory card from the computer, then put it back in.
    2. Try to open the memory card on the computer (Removable Disk), if it lets you, you are all set. If it asks/tells you to reformat the card, then try steps 13 – 19 again. If it gives you the same error again, then try a different memory card (Erlern said it didn’t work for him until he finally went and bought a Kingston 2GB card, then it worked on that card).
  • You can now use this goldcard to root devices that were previously unrootable!
  • Creating a Goldcard on POSIX

    1. Insert the SD card you want use for the goldcard into the device.
    2. Unmount the SD card (Settings » SD card & device storage » Unmount SD card) and then format it (Erase/Format SD card).
      NOTE: This will erase everything that is on the SD card, so backup anything that is on it that you consider important.
      NOTE: Make sure your sdcard was formatted to fat32.
    3. On the device, open the Terminal Emulator and type the following command:
      cat /sys/class/mmc_host/mmc1/mmc1:*/cid

      NOTE: If that does not work, try cat /sys/class/mmc_host/mmc0/mmc0:*/cid
      NOTE: For Desire HD / Inspire 4G phones, try cat /sys/class/mmc_host/mmc2/mmc2:*/cid
  • Go to http://huygens.hoxnet.com/goldcard.html and input the code as “normal”
  • Once you click on “Download Goldcard”, download/save the binary file.
  • Take your SD card out of the device and put it into your computer, you may need a micro to full size SD adapter. If it doesn’t have an SD card slot, you’ll have to buy a USB card reader, these are US$5 for a cheap one
  • Open a Terminal
  • Determine the device that matches the memory card; executing “dmesg” should show any recent cards/card readers connected to the PC, this is written below as /dev/(usbdevice)
  • Umount the SD card; that depends on your OS
    # umount -l /dev/(usbdevice) # on linux
    # umount -f /dev/(usbdevice) #on mac
  • Execute the following command:
    # dd if=goldcard.img of=/dev/(usbdevice)
  • Test what we’ve done:
    1. Take out the memory card from the computer, then put it back in.
    2. Try to open the memory card on the computer (Removable Disk), if it lets you, you are all set. If it asks/tells you to reformat the card, then try steps 13 – 19 again. If it gives you the same error again, then try a different memory card (Erlern said it didn’t work for him until he finally went and bought a Kingston 2GB card, then it worked on that card).
  • You can now use this goldcard to root devices that were previously unrootable!
  • Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

    HTC fstab updates

    Encryption Notice

    Beginning with nightly 20140501 (or milestone 7, if you prefer the stable channel), the location where encryption information is stored is being moved on the following devices:

    • evita – HTC One XL
    • fireball – HTC Droid Incredible 4G LTE
    • jewel – HTC EVO 4G LTE
    • ville – HTC One S

    If you utilize Android’s built-in data encryption (i.e. Settings > Security > Encrypt phone), read and follow these instructions before installing a new recovery and any nightly equal to or newer than 20140501 (or milestone 7). If you do not utilize data encryption, you can safely skip to the next section, “Recovery Update”.

    Technical info for the curious: the “extra” mmcblk partition is the new home for encryption information, rather than the footer of /data.

    In order to preserve your data, follow this procedure:

    1. Install a recent build of TWRP with the “legacy” encryption location
      twrp-2.7.0.7-device-oldenc.img recoveries are available at android.cmphys.com
    2. Upon entering TWRP, enter your passcode to allow reading from /data
    3. Make a backup of your /data partition
    4. Reboot to Android
    5. Delete /sdcard/TWRP/.twrps    Many thanks to Clark008 for debugging this
    6. Flash TWRP 2.7.0.8 or newer (available at android.cmphys.com and AFH)
    7. Restart to recovery, but this time do not enter your passcode when entering TWRP (cancel)
    8. Restore your /data backup (this will wipe it beforehand) – it is now decrypted
    9. You should be able to boot into Android without a passcode now. Only re-encrypt your phone if using a build of CyanogenMod equal to or newer than 20140501.

    Recovery Update

    Beginning with nightly 20140501 (or milestone 7, if you prefer the stable channel), several HTC devices are being transitioned to a new fstab layout. This will not affect your data. This change requires kernel support in recovery for CyanogenMod packages to install.

    Affected devices include:

    • evita – HTC One XL
    • fireball – HTC Droid Incredible 4G LTE
    • jewel – HTC EVO 4G LTE
    • m4 – HTC One Mini
    • m7 – HTC One [GSM]
    • m7spr – HTC One [Sprint]
    • m7vzw – HTC One [Verizon]
    • ville – HTC One S

    jewel and ville users: This is not the /data/media transition. That change is still being ruled out because there is simply no migration path that preserves data. With that said, if you are running an unofficial build of CyanogenMod that also incorporates this fstab change, TWRP recoveries are available from android.cmphys.com.

    All of these recoveries are backwards compatible.

    • ClockworkMod recoveries with version greater than or equal to 6.0.4.8 support this fstab change. HTC One AT&T (m7att), HTC One T-Mobile (m7tmo), and HTC One non-US GSM (m7ul) can safely use the recovery for the generic “HTC One” (m7). Note: version 6.0.4.8 for m4 may have been built before by-name support was added to the kernel.
    • TWRP recoveries with version greater than or equal to 2.7.0.8 support this fstab change.* If you have a favorite recovery maintainer, encourage them to incorporate “block: by-name” support into their recovery kernels!
      • (*) Official 2.7.1.0 for m4, m7, m7spr/m7wls, and m7vzw/m7wlv mistakenly did not include the necessary fstab support, so 2.7.1.1 was released for these devices, addressing the issue.
      • More recent unofficial builds of TWRP can be found at android.cmphys.com. You’ll find source code for all these devices linked there as well.

    Troubleshooting

    If booting into TWRP 2.7.0.8 causes the TeamWin logo to repeatedly flash without ever reaching the home screen:

    1. Reboot your device to Android: either hold power until the device turns off or use adb reboot
    2. Delete the settings file /sdcard/TWRP/.twrps
    3. Reboot back to recovery

    This problem is fixed in TWRP 2.7.1.0 and later.

    Mirrors for recoveries

    All TWRP recoveries mentioned above have been mirrored to Android File Host

    Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

    Unofficial Ports

    This page lists ports of CyanogenMod to devices which are not officially supported. If you have taken the time to port CyanogenMod to your device, feel free to add a link to your release here. CyanogenMod encourages open development, so links to source code are required for every entry.

    We suggest the following layout:

    '''CyanogenMod 11'''
    *[http://forum.url Thread on forum name (developer name)]
    *[https://github.com/devname/android_device_manufacturer_model Github device repo]
    *[https://github.com/devname/android_kernel_manufacturer_model Github kernel repo]
    

    Contents

    Alcatel

    Alcatel OneTouch 995 Ultra

    CyanogenMod 10.1

    Acer

    Acer Iconia Tab A500

    CyanogenMod 10.2

    CyanogenMod 10.1

    CyanogenMod 10

    Acer Iconia Tab A510/A511

    CyanogenMod 11

    Acer CloudMobile S500

    CyanogenMod 10

    Amazon

    Kindle Fire HD 7″ (2nd Generation)

    CyanogenMod 12

    Kindle Fire HD 8.9″ (2nd Generation)

    CyanogenMod 12

    Kindle Fire HDX 7″ (3rd Generation)

    CyanogenMod 12.1

    Kindle Fire HDX 8.9″ (3rd Generation)

    CyanogenMod 12.1

    Fire Phone

    CyanogenMod 11

    Fire Tablet

    CyanogenMod 12.1

    Fire TV

    CyanogenMod 12

    Asus

    Asus Transformer TF101

    No-name CyanogenMod 10.1

    Asus Transformer TF101G

    No-name CyanogenMod 10.1

    Asus Transformer TF201

    CyanogenMod 11

    Asus ZenFone 2 Z00A

    CyanogenMod 12.1

    Asus ZenFone 2 Z008

    CyanogenMod 12.1

    ASUS Zenfone 5 T00F

    CyanogenMod 12.1

    ASUS Zenfone 4 T00I

    CyanogenMod 12.1

    bq

    bq Aquaris E5 4G (vegetalte)

    CyanogenMod 11

    Dell

    Dell Streak 7

    CyanogenMod 10.1

    Google

    Google Nexus One

    Evervolv — based on CyanogenMod 9

    Hisense

    Hisense Sero 7 Pro (M470BSA)

    CyanogenMod 12

    Hewlett-Packard

    HP Touchpad

    CyanogenMod 11

    CyanogenMod 12

    HTC

    HTC Aria (Liberty / Gratia)

    also see: Liberty Info

    CyanogenMod 9

    CyanogenMod 10

    HTC Desire 816

    CyanogenMod 11

    HTC Desire C (Golf)

    CyanogenMod 10

    HTC Desire HD / Inspire 4G (Ace)

    also see: Ace Info

    CyanogenMod 10.1

    CyanogenMod 11

    CyanogenMod 12

    CyanogenMod 12.1

    CyanogenMod 13.0

    HTC Desire S

    CyanogenMod 11

    CyanogenMod 12

    CyanogenMod 12.1

    CyanogenMod 13.0

    HTC Desire X (Protou)

    CyanogenMod 9

    CyanogenMod 10.1

    HTC Droid DNA (Monarudo)

    CyanogenMod 10

    HTC EVO 3D CDMA (shooter)

    CyanogenMod 10.1

    CyanogenMod 10.2

    HTC EVO 3D GSM (shooteru)

    also see: Shooteru Info

    CyanogenMod 10.1

    HTC Explorer/Pico

    CyanogenMod 7

    CyanogenMod 9

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 10.2

    HTC G2 / Desire Z (Vision)

    also see: Vision Info

    Andromadus Audacity — based on CyanogenMod 9

    Andromadus Mimicry James Wilson

    Flinny’s Andromadus Test Builds — based on CyanogenMod 10

    Andromadus Jelly Belly Beta — based on Cyanogenmod 10

    Flinny’s Andromadus Test Builds — based on CyanogenMod 10.1

    AlterNdromadusJ — based on CyanogenMod 10.1

    HTC Holiday (Vivid and Raider)

    CyanogenMod 10.1 – AOSP

    CyanogenMod 10.1 – RootBox

    CyanogenMod 10.1 – AOKP

    CyanogenMod 10.1 – PAC-Man

    CyanogenMod 10.2 – AOSP

    CyanogenMod 10.2 – PAC-Man

    HTC Incredible

    Official support ended with CM7/gingerbread.

    CyanogenMod 10

    CyanogenMod 11

    HTC Leo (HD2)

    CyanogenMod 7

    NexusHD2-ICS-CM9 – based on CyanogenMod 9

    NexusHD2-JellyBean-CM10.0 – based on CyanogenMod 10.0

    NexusHD2-JellyBean-CM10.1 – based on CyanogenMod 10.1

    NexusHD2-JellyBean-CM10.2 – based on CyanogenMod 10.2

    NexusHD2-KitKat-CM11.0 – based on CyanogenMod 11.0

    GPS HAL Lib

    HTC Legend

    also see: Legend Info

    CyanogenMod 9

    CyanogenMod 10

    CyanogenMod 10.1

    HTC myTouch 3G Slide (Espresso)

    also see: Espresso Info

    CyanogenMod 9

    CyanogenMod 10

    HTC One S C2 (VilleC2)

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 10.2

    HTC Rezound (Vigor)

    CyanogenMod 10.1

    CyanogenMod 10.2

    HTC Sensation (Pyramid)

    also see: Pyramid Info

    CyanogenMod 10.1

    CyanogenMod 10.2

    CyanogenMod 11

    CyanogenMod 11 with 3.4 kernel

    CyanogenMod 11 and 12

    HTC Wildfire S (Marvel)

    CyanogenMod 7

    CyanogenMod 9

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 11

    HTC One V

    CyanogenMod 10

    Huawei

    Huawei U8100/U8110/U8120 (a.k.a. T-Mobile Pulse Mini)

    CyanogenMod 7

    Huawei U8150 IDEOS (TMobile Comet)

    also see: U8150 Info

    CyanogenMod 6 & 7 (Ideos Dev Team version)

    Huawei U8500 (IDEOS X2)

    CyanogenMod 7

    Huawei U8800

    CyanogenMod 12 / 12.1

    Huawei U8815 (Ascend G300)

    CyanogenMod 9

    CyanogenMod 10

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 10.2

    CyanogenMod 11

    Huawei u9508 (Ascend G615/Honor 2)

    CyanogenMod 10.1

    Huawei u8833/u8951 (Ascend Y300/G510)

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 10.2

    CyanogenMod 11

    Huawei U8850 (Vision)

    CyanogenMod 9

    MIUI based on CyanogenMod 9

    Huawei S7-301u (Mediapad)

    CyanogenMod 10

    CyanogenMod 10.1

    Huawei U8860 (Honor)

    CyanogenMod 11

    CyanogenMod 12 / 12.1

    Huawei U9200 (Ascend P1)

    CyanogenMod 10.2

    CyanogenMod 11

    Huawei C8813Q

    CyanogenMod 11

    Huawei Honor 4/4X (C8817D/G620S-UL00/G620S-TL00/G620S-L01/Che1-CL20/Che1-CL10)

    CyanogenMod 11

    CyanogenMod 12.1

    Inew

    Inew V3

    CyanogenMod 12.1

    Lenovo

    Lenovo Yoga 10″ Blade (b8000)

    CyanogenMod 10.1

    LG

    LG G Pad 8.3 Google Play Edition (V510/Palman)

    CyanogenMod 11

    LG G2 Mini (D610/D618/D620)

    CyanogenMod 12.1

    CyanogenMod 13.0

    LG GT540 (Optimus)

    OpenSwift — based on CyanogenMod 6

    LG GW620 (Eve)

    OpenEtna — based on CyanogenMod 6

    OpenEve — based on CyanogenMod 7

    OpenEve — based on CyanogenMod 9

    LG Lucid (VS840)

    Cyanogenmod 10

    LG Optimus C (LW690, Cricket)

    CyanogenMod 7

    LG Optimus F6 (D500/MS500)

    CyanogenMod 11

    LG Optimus G Pro (E980, AT&T)

    CyanogenMod 10.1

    CyanogenMod 10.2

    LG Optimus L5 (E610/E612)

    CyanogenMod 10.1

    CyanogenMod 10.2

    CyanogenMod 11

    LG Optimus L9 (P760/P765)

    CyanogenMod 11

    LG Optimus L7 II (P710/P713)

    CyanogenMod 11

    LG Optimus L9 II (D605)

    CyanogenMod 10

    CyanogenMod 11

    LG Optimus L90 LG-D415

    CyanogenMod 11

    LG Optimus L70 LG-D325 (D320, D320n)

    CyanogenMod 11

    CyanogenMod 12

    LG Optimus L40 LG-D170

    CyanogenMod 11

    LG Optimus M (MS690, MetroPCS)

    CyanogenMod 7

    LG Optimus Мe (P350)

    also see: P350 Info

    CyanogenMod 6

    CyanogenMod 9.1

    CyanogenMod 10

    CyanogenMod 10.1

    LG Optimus Net

    Optimus Net (P690), Gelato (P692)

    CyanogenMod 10

    LG Optimus One GSM Phones

    Optimus One (P500), Phoenix (P505), Thrive (P506), Optimus T (P509)
    also see: P500 Info

    CyanogenMod 9

    CyanogenMod 10

    LG Optimus S (LS670, Sprint)

    CyanogenMod 7

    LG Optimus Sol (E730)

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 11

    LG Optimus V (VM670, Virgin Mobile)

    CyanogenMod 10

    CyanogenMod 9

    CyanogenMod 7

    aospCMod — based on CyanogenMod 7

    LG Optimus Slider (VM701, Verizon)

    CyanogenMod 7

    LG Optimus Vortex (VS660, Verizon)

    CyanogenMod 7

    LG Prada 3.0 (P940)

    CyanogenMod 10.1

    CyanogenMod 10

    CyanogenMod 9

    Micromax

    Micromax Canvas MAD (A94) / Wiko Cink Five

    CyanogenMod 11

    Micromax Canvas energe (A091)

    CyanogenMod 11

    Motorola

    Motorola Atrix 2 (MB865/edison)

    CyanogenMod 11

    Motorola Atrix 4G (MB860)

    Cyanogenmod 11

    Motorola Bravo (MB520)

    Cyanogenmod 7

    Motorola Cliq 2 (MB611)

    CyanogenMod 7

    Motorola Defy (MB525)/Motorola Defy+ MB526

    CyanogenMod 9

    CyanogenMod 10

    Motorola DROID X (MB810)

    CyanogenMod 11

    Motorola DROID X2 (MB870)

    CyanogenMod 7

    CyanogenMod 9

    CyanogenMod 10

    Motorola Milestone (A853)

    CyanogenMod 7

    Motorola Milestone 2 (A955)

    CyanogenMod 10.2

    CyanogenMod 10

    CyanogenMod 9

    Motorola Moto G (XT1028, XT1032, XT1034)

    CyanogenMod 11

    Motorola Moto G (XT1028, XT1031)

    CyanogenMod 12

    Motorola Moto E (XT1021, XT1022, XT1023)

    CyanogenMod 11

    Motorola Xoom

    CyanogenMod 11

    Nokia

    Nokia X (RM-980)

    CyanogenMod 11

    Nokia X2 (RM-1013)

    CyanogenMod 11

    Nvidia

    Nvidia Shield Tablet (P1761)

    CyanogenMod 12.1

    Pantech

    Pantech Burst (P9070)

    CyanogenMod 11

    CyanogenMod 10

    Prestigio

    CyanogenMod 11

    Samsung

    Samsung Galaxy Epic 4G (Galaxy S I)

    CyanogenMod 10.2

    Samsung Galaxy (GT-i7500)

    GAOSP — based on CyanogenMod 7

    Samsung Galaxy 3 (GT-i5800)

    CyanogenMod 7

    CyanogenMod 10

    Samsung Galaxy 5 (GT-i5500/i5503)

    CyanogenMod 10.1

    CyanogenMod 10

    CyanogenMod 7 & 9

    Samsung Galaxy Alpha (SM-G850F)

    CyanogenMod 12.1

    Samsung Galaxy Ace (GT-S5830i/M/C/5839i)

    yajnab CyanogenMod 11

    Mardon modded-CyanogenMod 10.2

    ankur850 CyanogenMod 10.2

    Mardon modded-CyanogenMod 10.1

    bieltv.3 CyanogenMod 10.1

    bieltv.3 CyanogenMod 9.1

    bieltv.3 CyanogenMod 7.2

    SpaceCaker AOSP GB 2.3.7

    Lopicl.00 CyanMobileX

    Samsung Galaxy Ace Plus (GT-S7500)

    CyanogenMod 10

    CyanogenMod 10

    CyanogenMod 10.1

    Samsung Galaxy Ace 2 (GT-I8160)

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 10.2

    CyanogenMod 11

    CyanogenMod 11

    CyanogenMod 12/12.1

    Samsung Galaxy Ace 2 NFC (GT-I8160P)

    CyanogenMod 10.2

    CyanogenMod 11

    CyanogenMod 12/12.1

    Samsung Galaxy Ace 2 x (GT-S7560M)

    CyanogenMod 11

    Samsung Galaxy Ace 3 (GT-S7275R)

    CyanogenMod 11

    Samsung Galaxy Callisto / 551 (GT-I5510)

    CyanogenMod 10.2

    CyanogenMod 10.1

    CyanogenMod 10

    CyanogenMod 9

    CyanogenMod 7

    Samsung Galaxy Fame (GT-S6810)

    CyanogenMod 10.0

    CyanogenMod 11.0

    CyanogenMod 12.1

    Samsung Galaxy Gio (GT-S5660)

    9.0.0 — based on CyanogenMod 9 (and 10)

    7.2.0 — based on CyanogenMod 7

    7.1.0 — based on CyanogenMod 7

    Samsung Galaxy Grand DUOS (GT-I9082/9082L)

    CyanogenMod 10.1

    CyanogenMod 11

    CyanogenMod 12

    CyanogenMod 12.1

    Samsung Galaxy Grand 2 Duos (SM-G7102)

    CyanogenMod 11

    CyanogenMod 12/12.1

    Samsung Galaxy Note 2 (Galaxy GT-N7100)

    CyanogenMod 12.1

    Samsung Galaxy Note 10.1 (GT-N8000/GT-N801x)

    CyanogenMod 12.1

    Samsung Galaxy Note 10.1 WiFi 2014 Edition (SM-P600)

    CyanogenMod 11

    CyanogenMod 12.1

    Samsung Galaxy Pocket plus S5301

    CyanogenMod 10

    Samsung Galaxy Pop / Mini (Tass) S5570

    also see: Tass Info

    CyanogenMod 10.2

    CyanogenMod 10.1

    CyanogenMod 10

    Cyanogenmod 9

    Samsung Galaxy Pop Plus / Mini (Tassve) S5570i

    Rooting and installing ClockworkMod Recovery:

    Firmware (incl. various Cyanogen):

    Samsung Galaxy Mini 2

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 10.2

    CyanogenMod 11

    Samsung Galaxy R/Z (GT-I9103)

    also see: I9103 Info

    CyanogenMod 10

    CyanogenMod 10.1

    Samsung Galaxy S 4G (SGH-T959V)

    CyanogenMod 10.1

    CyanogenMod 10

    CyanogenMod 9

    CyanogenMod 7

    Samsung Galaxy S III (GT-I9300)

    CyanogenMod 12.1

    Samsung Galaxy S III Mini (GT-I8190)

    CyanogenMod 12.0

    CyanogenMod 11.0

    CyanogenMod 10.2

    CyanogenMod 10.1

    Samsung Galaxy S 5 Mini (SM-G800F)

    CyanogenMod 12.1

    Samsung Galaxy S Plus (GT-I9001)

    CyanogenMod 7

    CyanogenMod 9

    CyanogenMod 9

    CyanogenMod 10

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 10.1

    CyanogenMod 10.1

    CyanogenMod 10.2

    CyanogenMod 11

    CyanogenMod 12

    Samsung Galaxy S Advance (GT-I9070)

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 11

    Samsung Galaxy S Duos (GT-S7562)

    CyanogenMod 11

    Samsung Galaxy S II G (GT-I9100G)

    CyanogenMod 12.1

    Samsung Galaxy S II Plus (GT-I9105P)

    CyanogenMod 10.1

    CyanogenMod 10.2

    CyanogenMod 11

    CyanogenMod 12

    Samsung Galaxy S III Neo (GT-I9301I)

    CyanogenMod 12

    Samsung Galaxy S4 (GT-I9500)

    also see: i9500 Info

    CyanogenMod 12

    CyanogenMod 11 (GearCM)

    CyanogenMod 10.2 (Old)

    Samsung Galaxy S4 International LTE (GT-I9505) jfltexx

    also see: Jfltexx Info

    CyanogenMod 10.1

    Samsung Galaxy S4 Value Edition (GT-I9515) jfvelte

    CyanogenMod 12.1

    Samsung Galaxy S4 Mini (SPH-L520) serranoltespr

    Cyanogenmod 11

    Samsung Galaxy Player 5.0 / Galaxy S Wifi 5.0 (YP-G70 USA/EU/KOR)

    CyanogenMod 12

    Samsung Galaxy Player 3.6 / Galaxy S WiFi 3.6 (YP-GS1)

    CyanogenMod 10 (Stable)(Recommended)(Supported)

    CyanogenMod 7(Outdated)(Stable)(Discontinued/Unsupported)

    CyanogenMod 11 (Extremely unstable)(NOT recommended)(Unsupported/Discontinued)

    Samsung Galaxy SL (GT-I9003, GT-I9003L)

    CyanogenMod 7

    CyanogenMod 9

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 10.2

    CyanogenMod 11

    Kernels

    Samsung Galaxy Spica (GT-i5700)

    CyanogenMod-Spica — based on CyanogenMod 6

    CyanogenMod-Spica — based on CyanogenMod 7

    Samsung Galaxy Tab 2 VZW LTE 7″ (I705)

    CyanogenMod 12.1

    Samsung Galaxy Tab 3 8″ (SM-T310/T311/T315)

    CyanogenMod 10.2/11.0

    CyanogenMod 12

    CyanogenMod 12.1

    CyanogenMod 13

    Samsung Galaxy Tab Pro 12.2″ (SM-T900)

    CyanogenMod 11.0/12.0

    Samsung Galaxy Trend Lite (GT-S7390/GT-S7392)

    CyanogenMod 10.1

    Samsung Galaxy Trend Plus/Samsung Galaxy S Duos 2 (GT-S7580/GT-S7582)

    CyanogenMod 12.1

    Samsung Galaxy Victory 4G LTE (SPH-L300)

    CyanogenMod 10

    Samsung Galaxy W (GT-I8150)

    CyanogenMod 9

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 11

    Samsung Galaxy X Cover 2 (GT-S7710)

    CyanogenMod 10.1/10.2

    CyanogenMod 11

    Samsung Galaxy Y (GT-S5360) (totoro)

    CyanogenMod 7

    CyanogenMod 7

    CyanogenMod 7.2

    CyanogenMod 9

    CyanogenMod 9

    CyanogenMod 9.1

    CyanogenMod 11

    Samsung Infuse 4G (SGH-i997R)

    CyanogenMod 7

    Samsung i927 Captivate Glide (SGH-i927)

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 10.2

    CyanogenMod 11

    Samsung Wave I and II (GT-S8500, GT-S8530)

    Cyanogenmod 10

    Cyanogenmod 10.1

    Samsung Galaxy Express 2 (SM-G3815)

    CyanogenMod 11

    Samsung Galaxy Exhibit (SGH-T599/SGH-T599N/SGH-T599V)

    CyanogenMod 11

    CyanogenMod 12

    Samsung Dart (SGH-T499)

    CyanogenMod 7.2.0

    Samsung Galaxy Pocket Neo (GT-S5312)

    CyanogenMod 10.1

    CyanogenMod 11

    CyanogenMod 11

    CyanogenMod 12

    CyanogenMod 12.1

    Samsung Galaxy S5 Mini (G800H)

    CyanogenMod 12.1

    Sharp

    Sharp FX Plus (ADS1)

    CyanogenMod 7

    Sony

    Sony Xperia X10 Mini / X10 Mini Pro / X8

    MiniCM: CyanogenMod for the Xperia Mini series

    Sony Xperia J (JLo)

    CyanogenMod 11

    Sony Xperia S (nozomi)

    CyanogenMod 10.1

    Sony Xperia P

    CyanogenMod 11

    Sony Xperia U

    CyanogenMod 11

    2011 Sony Ericsson Xperia Devices

    CyanogenMod 10.1 / 10.2 / 11.0 / 12.0 / 12.1

    All Sony Xperia Devices

    FreeXperia Project

    Toshiba

    Toshiba AC100/Dynabook AZ

    CyanogenMod 9/10

    Toshiba Folio 100

    CyanogenMod 7

    Xiaomi

    Xiaomi Mi-2/Mi-2S

    CyanogenMod 10

    CyanogenMod 10.1

    CyanogenMod 10.2

    Xiaomi Mi-2A

    CyanogenMod 11

    Xiaomi Redmi 1S (armani)

    CyanogenMod 11

    CyanogenMod 12.1

    Xiaomi Redmi Note 4G (dior)

    CyanogenMod 11

    CyanogenMod 12

    PAC ROM 5.1 based on CyanogenMod 12.1

    Xiaomi Mi4i (ferrari)

    CyanogenMod 12.1

    Xiaomi Redmi 2 (HM2014811)

    CyanogenMod 11

    CyanogenMod 12

    ZTE

    ZTE Blade G Lux And Digicel DL800

    also see: Blade Info

    KonstaKANG — based on CyanogenMod 12.1

    ZTE Open C

    KonstaKANG — based on CyanogenMod 11

    KonstaKANG — based on CyanogenMod 12

    ZTE Blade

    also see: Blade Info

    KonstaKANG — based on CyanogenMod 10.1

    ZTE Blade III

    KonstaKANG — based on CyanogenMod 10.1

    ZTE Carl/Racer/Freddo

    RacerMod — based on CyanogenMod 7

    ZTE Optik

    CyanogenMod 10

    ZTE P752D (Vodafone SmartChat 865)

    CyanogenMod 10.2

    ZTE Tureis

    CyanogenMod 10.1/10.2

    ZTE V9

    also see: V9 Info

    CyanogenMod 11.0

    CyanogenMod 10.2

    CyanogenMod 10.1

    CyanogenMod 10

    ZTE Nubia Z9 Max

    CyanogenMod 12.1 (dianlujitao)

    Files in an unofficial ports installation

    See also

    Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

    Paths

    “Command not found” errors

    If the binary is installed on your computer and you see a “command not found” type of error when entering your command into the terminal, the problem may be that the /platform-tools directory (or whichever directory contains the binary such as ~/bin) is not in the “path of execution” for your terminal session. This means that your computer doesn’t know where exactly the binary is located.

    The solution to this is to add the directory containing the binary to your PATH.

    Linux/OSX

    On most Linux/OSX systems using the Bourne Again Shell (bash), you can do the following:

    1. Edit the .bashrc file in your home directory. You can use any text editor (the example below uses “gedit”) to make this change.
      $ gedit ~/.bashrc
    2. Add the following line (/path/to/dir below would need to be replaced with whatever directory you want added to your PATH)
      $ export PATH=/path/to/dir:$PATH
    3. Save the file, then use the source command from the Terminal to load your .bashrc file:
      $ source ~/.bashrc

    Alternately, you can simply open a new window or tab to load the changes in the new terminal.

    That’s it!

    Windows

    On Windows systems, you can do the following:

    1. Right-click on My Computer and select Properties.
    2. Choose Advanced and click on the Environment Variables button.
    3. Navigate to System Variables and double-click on Path to edit.
    4. Enter the full path to the directory/folder you want added to your PATH.

    Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

    Envsetup help

    At a glance

    Invoking $ source build/envsetup.sh from your shell adds several functions to the build environment. These are listed below with short descriptions. Reference build/envsetup.sh for the most recent list of commands.

    mka Builds using SCHED_BATCH on all processors
    lunch lunch <vendor_name>_<product_name>-<build_variant>
    breakfast breakfast <product_name>
    brunch brunch <product_name>
    omnom omnom <product_name>
    tapas tapas [<App1> <App2> …] [arm|x86|mips] [eng|userdebug|user]
    croot Changes directory to the top of the tree
    m Makes from the top of the tree
    mm Builds all of the modules in the current directory
    mmp Builds all of the modules in the current directory and pushes them to the device
    mmm Builds all of the modules in the supplied directories
    mmmp Builds all of the modules in the supplied directories and pushes them to the device
    cgrep Greps on all local C/C++ files
    jgrep Greps on all local Java files
    resgrep Greps on all local res/*.xml files
    godir Go to the directory containing a file
    cmremote Add git remote for CM Gerrit Review
    cmgerrit A git wrapper that fetches/pushes patch from/to CM Gerrit Review
    cmrebase Rebase a Gerrit change and push it again
    aospremote Add git remote for matching AOSP repository
    mkap Builds the module(s) using mka and pushes them to the device
    cmka Cleans and builds using mka
    reposync Parallel repo sync using ionice and SCHED_BATCH
    repopick Utility to fetch changes from Gerrit.
    installboot Installs a boot.img to the connected device
    installrecovery Installs a recovery.img to the connected device

    Helpful Tip

    See also Building Basics

    Commands in greater detail

    A few important functions that $ source build/envsetup.sh adds to the build environment are detailed below.

    mka

    mka improves upon make by using sched_tool to make full use of all the CPU threads available on your machine. This is usually equal to the number of cores in your CPU, unless you have HyperThreading, in which case it is twice the number of cores in your processor.

    breakfast

    Breakfast is used to prepare the build environment for a specific device. You can use it in one of two ways:

    $ breakfast [device name]
    

    or

    $ breakfast
    

    The first method prepares a device for building. If the device tree is not found locally, roomservice fetches the device tree and its dependencies from CyanogenMod’s GitHub repository (only officially supported CyanogenMod devices, of course). If you do not specify a device, a list of available devices that can be built is output.

    brunch

    brunch is equivalent to

    $ breakfast [device name] && mka bacon
    

    brunch sets up your build environment for a device and commences the build process of a full CyanogenMod (unofficial) release that can be installed through recovery.

    lunch

    lunch is used like breakfast, except you can specify non-official devices or non-standard builds for your device. If building for an unofficial device, you must already have the device tree and all of its dependencies synced locally. The non-standard builds include special debug versions (e.g. eng) and also allows you to build CyanogenMod for use on the Android Emulator. Unlike breakfast, lunch makes no assumptions with regard to device configuration locations and formats, so it will scan the entire tree for matching options (depending on the number of locally available devices, this may take a significant amount of time). To build after running lunch, simply issue the command mka. No bacon here… sorry.

    List of all commands in envsetup.sh

    • addcompletions
    • add_lunch_combo
    • aospremote
    • breakfast
    • brunch
    • cgrep
    • check_product
    • check_variant
    • choosecombo
    • chooseproduct
    • choosetype
    • choosevariant
    • cmgerrit
    • cmka
    • cmrebase
    • cmremote
    • cproj
    • croot
    • dopush
    • eat
    • findmakefile
    • gdbclient
    • get_abs_build_var
    • getbugreports
    • get_build_var
    • getlastscreenshot
    • getprebuilt
    • getscreenshotpath
    • getsdcardpath
    • gettargetarch
    • gettop
    • godir
    • hmm
    • installboot
    • installrecovery
    • isviewserverstarted
    • jgrep
    • key_back
    • key_home
    • key_menu
    • lunch
    • _lunch
    • m
    • makerecipe
    • mka
    • mm
    • mmm
    • omnom
    • pid
    • printconfig
    • print_lunch_menu
    • repodiff
    • repolastsync
    • reposync
    • repopick
    • resgrep
    • runhat
    • runtest
    • set_java_home
    • setpaths
    • set_sequence_number
    • set_stuff_for_environment
    • settitle
    • smoketest
    • startviewserver
    • stopviewserver
    • systemstack
    • tapas
    • tracedmdump

    Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

    After Build

    I’ve built CM Successfully. What’s Next?

    In several forums, people have been asking what to do AFTER they’ve completed their builds successfully. What’s next? Once you go from source code to .zip file, how to make improvements, test code, and create your own modifications?

    This page is dedicated to this “What’s Next?” question for new developers.

    Note:

    Note: This page is very much a WORK IN PROGRESS. Feel free to add to this page

    Enable Developer Options

    Once you boot your shiny new image, as a developer, you may want to have some more information then a regular user. As of Android 4.2.x the DeveloperSettings are now hidden and are required to be enabled again. This is done by Going into Settings -> About Phone/Tablet Scroll down to the build number tag and tap 7 times on it. That reveals the developer settings once more and allows you to start the development tools from the developer settings.

    Try out submitted, but as-yet unmerged code

    Here’s a quick walkthrough to pulling and trying out code submissions from Gerrit, the source-review system used by CyanogenMod.org.

    After you’ve re-built CM with these experimental changes, you can sign up for Gerrit and offer your comments and any coding improvements.

    Build with other toolchains

    A toolchain refers to the compiler, linker, and other build tools which together are used to compile Android. There are alleged improvements in file size and/or performance from building with non-standard toolchains.

    Mix-and-match git repositories

    If you, say, have source code for an app that you want to automatically add to the build, or maybe you’d like to try a different kernel. You can add/remove or swap out the source code so that repo sync automatically updates from YOUR custom repositories rather than the official one.

    You can learn more about adding your own apps here. Or find more info about using a local_manifest to adjust which source code repositories are synced on your computer.

    Add a translation

    If you are multi-lingual, you can help the project by translating commands and other verbiage into other languages.

    You can find a complete guide about translations here: Doc: Translation Guide

    Make Other Original Modifications…

    First, familiarize yourself with the various directories in the source code. If you are a programmer (or even if you’re just learning), you can look at the files and experiment, changing files and recompiling to see what happens.

    If you make a change to a file, you can generally “revert” by issuing the following command from within the directory of the file you changed:

    git reset --hard

    This should reset all the file change back to the last time you did a repo sync.

    To rebuild only the module which you are changing (ie, the stuff in your current directory), you can usually do this:

    mm -B

    to rebuild all the files for this module and send the results to $OUT.

    Helpful Tip

    Be sure to read Building Basics for a list of must-know commands that will save you hours when playing with the source code.

    Submit your changes back to CyanogenMod

    Once you’ve made some changes that you think will improve the code, you can submit your code back to CM for inclusion in the next version(s). To do so, check out these instructions on submitting code back via Gerrit.

    Start a port to a new device!

    One of the best way to learn about Android is to get CM running on a new device that has never run CM before. It’s pretty satisfying to see the CM logo boot up on a new device. If you like, you may find it easier to start with a device that has an older version of Android (CM or otherwise) that hasn’t yet been upgraded to the latest. You might be the one to get the newest version working!

    See here for a basic outline of how to get a new port started!

    Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

    The CM source

    Each of the main directories has different stuff in it. Here are just a few off the top of my head to get you started. The description is fairly flippant and incomplete and perhaps inaccurate, and I’m going to skip some directories because it’ll get unwieldy (and I don’t know necessarily what every directory does), but it’s just to give you a vague idea of some of the more important folders…

    Note:

    This is seriously all just typed off the cuff, without really much thought. It’s certainly an incomplete description. The best way to discover what to play with is just to start exploring, changing stuff, and building. The directory names are usually indicative of what you’ll find inside, and the best source of documentation is the code itself.

    bionic/

    Bionic is the Android mobile-friendly version of libc. You generally don’t need to touch anything in here. Lots of cpu-specific stuff and better not to stick your nose in here, although Linaro did manage to speed up performance on some devices by tweaking various things. If you’re a coding ninja, you can play with this. But on the other hand, if you were a coding ninja you probably aren’t reading this.

    build/

    The scripts and various files that are used for the actual build process. Take a look in here if you’re curious what steps are taken to make all the parts of Android compile, as well as various “make” commands. (Some of the flags used for compiling have been further enhanced by CyanogenMod for Google non-supported platforms.) Some familiarity with GNU make and the Makefile build system are helpful. There’s also documentation here and here.

    bootable/

    Among other things, the source for ClockworkMod recovery is in here.

    dalvik/

    Dalvik is the virtual machine that runs the java apps. It’s how you can write an app and it’ll run on any android machine, regardless of the underlying architecture. In the “Lollipop” 5.0 version of Android, Dalvik was replaced with ART, the Android Run Time.

    art/

    ART (Android RunTime) is a replacement for Dalvik introduced in Android 4.4 (KitKat). Rather than “just-in-time” compilation, ART pre-compiles every app in advance for faster execution later.

    device/

    device/ contains part (if not all) of the board support packages and configurations for a ‘particular’ device, and is organized as device/<vendor>/<codename>. So the files for the Nexus 7 tablet are under device/asus/grouper/, the files for Nexus 4 phone are under device/lge/mako/, etc. The device/ folder, therefore, is where to put the customized stuff for EACH particular device running Android. So– if you want to do a port of Android for a particular device that currently has no source, you should probably start by finding a similar device (with a similar underlying platform) and use it as a “base” for modifying for that device. Do take a peek into device/asus/grouper to see the various files that are used to build for the Nexus 7 and compare with other devices.

    Note:

    Many of the xml files that control Android core functionality and verbiage (strings) can be overridden by new .xml files that you place in the device-specific device/[vendor]/[codename]/overlay folder.

    Note:

    Just downloading the source code for CyanogenMod does *not* download the device/ directories for every single device that has been ported to CyanogenMod (that would be a LOT of extra folders you probably don’t need or want). To get the device folder for a particular device, use the breakfast command from the root of the source code. So to get the grouper device (and kernel) folders, you’d type breakfast grouper and then repo sync and it should appear.

    docs/

    Contains the source code for the Android Open Source website.

    external/

    This is where non-android specific utilities go. Lots of the stuff in here are just regular open source projects that are used by Android (or CyanogenMod) and just have the Android.mk make files to work with the Android build system.

    frameworks/

    This refers to the core Android frameworks. It’s the stuff that makes Android, Android. The frameworks contain the Android user experience and the abstracted “hooks” that programmers use to build Android apps. So, for example, this folder contains the Java windows-manipulation and activity stuff and java sound support and Android graphics layers and Android media stuff and UI as well as services and basically the Android API in general. There are also some platform-specific optimization here as well that CyanogenMod adds for Qualcomm, OMAP, and other manufacturers to get the best performance out of specific architectures. This folder has many different parts, but if you want to play with the Android platform itself and its basic functionality, this is probably the place to look.

    hardware/

    Platform/hardware-specific libraries and such go in this folder. For example, the code in hardware/ti is used to support devices using a chipset by Texas Instruments.

    kernel/

    Like device/, kernel/ directories are organized like kernel/<vendor>/<codename> and inside there you’ll find the source for the kernel. This source may be downloaded “on the fly” by the CyanogenMod build system. See the note in the device/ section above about using the breakfast command to auto-include a particular device’s kernel/ directory when you repo sync to auto-update the codebase.

    ndk/

    See here. Tools for allowing cross-platform C code to be included in Android apps (as JNI shared libraries, apparently). Used if you’re writing C-based apps, but I’ve never used any of this or even poked my nose in there. See /ndk/docs/OVERVIEW.html for more.

    out/

    The output of your build will go in here by default. When you type cd $OUT after building, you’re actually getting a shortcut to out/target/product/<devicename>. This is the only folder that should have stuff added to it (or changed) when you’re doing a build. stuff that will become the system folder on your device goes in system. Stuff that will become your ramdisk goes in root. The various stages and temporary scripts used to create your recovery.img and boot.img and your kernel go here as well. The object files get built into the obj directory. And there are generic compiler tools and other build (such as from the ndk) and such that get built in out/ as well. When you do a make clobber, you’re just getting rid of out/.

    packages/

    packages/apps/ is where Android standalone apps, such as the Settings app, the Browser, the Launcher (in CM10’s case it’s called Trebuchet), and other apps go. Note that many of these apps are integrated directly with functionality within the frameworks/ directory. So the settings changed in the Settings app will correlate to stuff in the frameworks/ folder. Non-app packages such as input methods and wallpapers go here as well.

    prebuilt/ (and prebuilts/)

    These folders contain prebuilt toolchains for cross-compiling on linux and darwin (MacOS X) and a few tools for Windows. Cross-compiling allows you to build Android for an architecture (such as ARM-based CPU) from another architecture (such as x86_64).

    system/

    Lower-level linuxy system stuff such as netd, fastboot support, the shell (which you can use to type commands into your device), etc. are here.

    vendor/

    The /vendor folder contains stuff particular to a vendor build such as CyanogenMod. It’s also the place where proprietary blobs are extracted from the device, again using the same vendor/device codename convention as under device/.

    Based On: http://forum.xda-developers.com/showthread.php?p=30802167#post30802167

    See also

    Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

    How To Port CyanogenMod Android To Your Own Device

    Note:

    If you came to this page by searching for information about porting Android, and you’re not sure what CyanogenMod is, learn more about the CyanogenMod distribution of Android here.

    Some tips on porting CyanogenMod to your own device

    So you may come across a phone or tablet or whatever that does not yet have CyanogenMod available.

    You’ve previously built CyanogenMod on your computer for another device or two, and you feel comfortable with the process. In fact, you’ve still got the source code standing by and are ready to tackle a big project.

    Looks like this is your opportunity to shine!

    Note:

    For the purposes of this tutorial, all references to directories will assume you are in the root of the source code (ie, where you did the repo init), and folder names will be relative to there. If you followed the build guide, the root of the source code is at ~/android/system

    Prerequisites

    Porting CyanogenMod to a new device can be ridiculously easy or ridiculously difficult, depending on the device itself, whether it currently runs a recent version of Android or not, and of course your skills as a developer matter too.

    It would be pretty hard to do a port without having built CyanogenMod (and recovery) previously for another device. So if you haven’t done a build or two, give it a shot.

    Helpful Tip

    If you found this page other than via the CyanogenMod Learning Center, head over to Development for much more information.

    Additionally, you should familiarize yourself with the CyanogenMod source code. You should expect that, barring some rare exceptions, nearly everything you need to do will be in the /device/[vendor]/[codename], /vendor/[vendor]/[codename], and /kernel/[vendor]/[codename] directories.

    Helpful Tip

    For a more-detailed overview of what’s where in the CyanogenMod source folders, see here. In fact, you really should read this if you plan on doing a port.

    Collect information about your device

    Before you begin your port, you will want to collect as much information about your device as you can. Go to wikipedia and identify the product name, code name, architecture, memory size, internal storage size, and platform architecture. Put this information in a file for easy retrieval. Try to learn as much about the device, including any similarities it may have to other devices.

    Helpful Tip

    Many devices are architecturally similar to other devices that are already on the market and have existing CM ports. When a new device comes out, see if you can find out if it may be identical to another device, only with a different sized screen or more memory or some other minor difference. If you find an “ancestor” or “sibling” of your device, much of the work may already be done for you!

    Much of the information you need may be available online, but assuming the device is already running a non-CyanogenMod version Android, you may also get some of that information from the device itself. To view the files containing this information, the device may need to be rooted. However, sometimes you can find a stock firmware update package online, and can view the files from the .zip archive file.

    Look at the device’s current /system/build.prop

    Assuming the device is already running a version of Android, there should be a file, /system/build.prop, on the device which may contain useful information that will come into play as you do your port. This file contains definitions for various parameters and settings used by Android.

    So, if you have previously installed adb onto your computer, you can use the following command to pull this file to your computer:

    adb pull /system/build.prop

    If you receive an error relating to permissions, the device may need to be rooted to gain access to this file. However, there are other ways to locate this file. For example, it may be included in any stock firmware “upgrade” package online.

    Once you have the file…

    • Write down the value of the ro.product.manufacturer parameter. This will be your vendor name. The [vendor] is the name of the manufacturer/vendor of the device. CM has established naming conventions for most major vendors, such as samsung, htc, lge, etc. Note that in these directory names, the vendor is always lowercase and contains no spaces.
    • Write down the value of the ro.product.device parameter. This will be your device codename. The [codename] corresponds to the project code name of the device itself. This is almost never the sales name of the device. If you have built CM before (and again, you better have!), you should be familiar with the concept of a code name for each device. Like the vendor name, the codename is always lowercase and contains no spaces.

    Note:

    Sometimes a device is identified in other parameters such as ro.product.board

    Keep the build.prop file handy, as you may refer to it later.

    Examine boot.img and recovery.img

    As stated, when doing your port, you may wish to use an existing pre-built kernel that you know works instead of building one from source code. Depending on your device, you may need to extract this kernel file from the device. The kernel may exist as a single file (as it does on many OMAP devices) or may be wrapped up along with the ramdisk in a boot or recovery partition.

    Similarly, the contents of the stock ramdisk may be extremely helpful and can often be extracted and reviewed. It may be the case that a device requires specific files from the stock ramdisk in order to boot properly, load a module, etc. In most cases you can view files in the ramdisk from the device itself, but it you may prefer to look at the full directory.

    Note:

    The ramdisk is a tiny group of files and directories that are loaded into memory along with the kernel. The kernel then runs one of the files in the ramdisk called init, which then runs a script (init.rc, init.[codename].rc, etc.) that in turns loads the rest of Android. The ramdisk and kernel can be packaged together in a number of different ways using tools with names like mkbootimg, mkimage, and other methods.

    You can frequently extract the boot and recovery images (to a file you name boot.img and recovery.img) on a rooted Android device using dd. Or, if you have access to an update .zip file from the vendor, you can often find those files within.

    Collect any available existing source code

    The manufacturer or vendor of any device using Android will minimally need to make the source code available for all GPL components upon request, including (and especially) the kernel. You definitely want to request a copy of the kernel source and keep it handy.

    Determine the partition scheme

    The primary long-term storage portion of your mobile device– usually an “emmc” (embedded multimedia card)– is much like a computer hard drive in that it is prepared in a particular way to identify and isolate different areas of data. These unique areas are called partitions and they can have any kind of data stored there. Some partitions contain raw data– firmware, kernels, ramdisks, etc. More often, a partition is formatted to use a particular file system that the kernel will recognize so that individual files and directories can be read and written there.

    Before you can replace the stock operating system with CyanogenMod, it is therefore important to ascertain the partition scheme of the device. The recovery image you build will need this information to know where to find the various Android directories. Particularly, you want to know which partitions are assigned to /system, /data, /cache, and /sdcard.

    You want to know which partitions exist, on what device, how they are mounted, as well as the size of the partitions. This information may be transferred later to the BoardConfig.mk file in your /vendor directory.

    If you’re lucky, a recovery.fstab file can be located in a recovery.img file, speeding up the process of figuring out what goes where. Also, the init.[codename].rc file in the ramdisk may have the information. Look for the lines near the top where the partitions are mounted.

    Also, the command:

    $ cat /proc/partitions

    from a running device can also help you identify the partitions. Also see /proc/emmc, /proc/mounts or /proc/mtd. You may also get some information from the command mount (run as root).

    Also check /cache/recovery.log or /tmp/recovery.log.

    Finally, if you have source code to the bootloader (such as the u-boot used by many OMAP-based devices), you will likely find the information there as well.

    Note:

    Be aware that in some rare cases, such as the HP Touchpad, an abstracted virtual file system is used.

    Set up three new directories

    Now that you’ve gathered information about your device, it’s time to generate the folders for your device configuration, located in the following directories, relative to the code source directory.

    • device/[vendor]/[codename]/ — this is where the installation files specific to your device will go. The device/ directory contain 99-100% of the configuration settings and other code for particular devices. You’ll get to know this directory pretty well. As mentioned, when starting the folder for this device, it may be a good idea to adapt a directory for an existing device that is architecturally similar to the one you wish to port. Look for a device that is based on the same platform, for example.
    • vendor/[vendor]/[codename]/ — The vendor/ directory contains proprietary, binary “blobs” that are backed up from the original device (or provided by the vendor, such as in the case of Google Nexus devices and some TI graphics blobs).
    • kernel/[vendor]/[codename]/ — the kernel source goes here. When you first start your porting effort, you may wish to simplify things by using a pre-built kernel (such as the one that came with the stock installation) rather than building the kernel from scratch. The trick to that will be extracting the kernel out of the stock system from whatever format it may be in, and then re-packaging it, along with a new ramdisk, into a form that your device can use. This can vary from device-to-device, so it may again be helpful to look at similar devices to yours that use a similar architecture. Building the kernel from source is not strictly necessary for every device, but in the spirit of open source, it is the preferred practice for CyanogenMod. See here for a detailed discussion about how CyanogenMod builds the kernel source from scratch.

    There are at least three methods to generate these directories:

    Method 1: Use mkvendor.sh to generate skeleton files

    Use the mkvendor.sh script in build/tools/device/ to automatically generate the directories.

    Note:

    The mkvendor script only works with devices that use a standard boot.img file, using the standard Android conventions and headers. It won’t work for devices that deviate from this standard (Nook Color, Touchpad, etc.).

    This script accepts three parameters: vendor, codename, and a boot.img file.

    Example usage:

    $ ./build/tools/device/mkvendor.sh samsung i9300 ~/Desktop/i9300boot.img
    

    In the above example, samsung represents the vendor, i9300 represents the codename and the last parameter is the path to the boot.img file that was extracted from the boot partition with dd or provided by the vendor in an update .zip as discussed above.

    The command above should create a /device/samsung/i9300/ folder within your CyanogenMod source repo structure. And inside the folder, the files AndroidBoard.mk, AndroidProducts.mk, BoardConfig.mk, cm.mk, device_[codename].mk, kernel (the binary), recovery.fstab, etc.

    This will not build the kernel/ directory. You will need to do that later, when you are ready to build the kernel.

    Note:

    If it returns the message “unpackbootimg not found. Is your
    android build environment set up and have the host tools been built?” please be sure that you run the following command during setting up the developer environment:

    $ make -j4 otatools

    Method 2: Fork a similar device’s git repository

    If you’ve got a GitHub account, you might want to start by forking another, similar device, and then rename it for your device. See the section on setting up github for a discussion on how to name your repository.

    Always be sure you’re compliant with the license of any repository you fork.

    Method 3: create the directories and files manually

    You can always start with an empty directory and start creating the files by hand. This is the least recommended and perhaps the most tedious method, but it may be the most instructive. You can look at other devices for reference on what files you need.

    Customize the files

    There are many files in the device/ folders. We will start by focusing on four files BoardConfig.mk, device_[codename].mk, cm.mk, recovery.fstab, and kernel to get recovery working for your device.

    Helpful Tip – Start with the recovery!

    The first major step is to get a working recovery image for your device so that testing subsequent update.zips is easy and so that you can do backups if necessary. These next few steps will therefore focus more on getting a working recovery than getting CM itself to work. Once the recovery is built and operating safely, the work you’ve done for it will apply directly to the CM part.

    Lets examine each of these files:

    BoardConfig.mk

    This file contains vital architectual and build information about the architecture of your device’s motherboard, CPU, and other hardware. Getting this file right is essential.

    To get a basic recovery booting, a few parameters need to be set in this file.

    The following parameters must be set properly in BoardConfig to compile a working recovery image:

    • TARGET_ARCH: this is the architecture of the device it is usually something like arm or omap3.
    • BOARD_KERNEL_CMDLINE: not all devices pass boot parameters however if your device does this must be filled out properly in order to boot successfully. You can find this information in the ramdisk.img. (You can learn more about configuring the integrated kernel build-from-source here.)
    • BOARD_KERNEL_PAGESIZE: the pagesize of the stock boot.img and must be set properly in order to boot. Typical values for this are 2048 and 4096 and this information can be extracted from the stock kernel.
    • BOARD_BOOTIMAGE_PARTITION_SIZE: the number of bytes allocated to the kernel image partition.
    • BOARD_RECOVERYIMAGE_PARTITION_SIZE: the number of bytes allocated to the recovery image partition.
    • BOARD_SYSTEMIMAGE_PARTITION_SIZE: the number of bytes allocated to the Android system filesystem partition.
    • BOARD_USERDATAIMAGE_PARTITION_SIZE: the number of bytes allocated to the Android data filesystem partition.

    Note:

    The above information can be obtained by multiplying the size from /proc/partitions or /proc/mtd by the block size, typically 1024.

    • BOARD_HAS_NO_SELECT_BUTTON: (optional), use this if your device needs to use its Power button to confirm selections in recovery.
    • BOARD_FORCE_RAMDISK_ADDRESS / BOARD_MKBOOTIMG_ARGS: (optional), use these to force a specific address for the ramdisk. This is usually needed on larger partitions in order for the ramdisk to be loaded properly where it’s expected to exist. This value can be obtained from the stock kernel. The former is deprecated as of Android 4.2.x and the latter will now be used in 4.2.x and beyond.

    device_[codename].mk

    The device_codename.mk makefile contains instructions about which Android packages to build, and where to copy specific files and packages, or specific properties to set during your compilation.

    This file can be used to copy vital files into the ramdisk at compilation time.

    • PRODUCT_COPY_FILES: used to copy files during compilation into the ramdisk, which will be located at $OUT/recovery/root.

    Example:

    $(LOCAL_PATH)/sbin/offmode_charging:recovery/root/sbin/offmode_charging \
    

    This will copy the file offmode_charging binary into the sbin folder within the ramdisk.

    • PRODUCT_NAME / PRODUCT_DEVICE: used for setting the value of your codename. This is the name of the device you load with Lunch.

    kernel

    This is simply the prebuilt kernel image or a kernel you built yourself used to boot the device. The format of the kernel may be in a zImage or uImage, depending on the requirements of the architecture of your device.

    cm.mk

    You’ll need to make a few changes to this file to integrate with the lunch, brunch, and breakfast commands, so that your device shows up on the list and builds properly. You’ll also set some variables (see other devices) to indicate what size splash animation should be used, whether this is a tablet or phone, etc.

    Some of these settings aren’t used for building just the recovery, but you may as well set them now because once recovery is done and working, the settings here will be important.

    Again, take a look at a similar device to yours to get an idea of what the settings here should be. It’s fairly intuitive.

    recovery.fstab

    recovery.fstab defines the file system mount point, file system type, and block device for each of the partitions in your device. It works almost exactly like /etc/fstab in a standard Linux operating system.

    Example:

    /systemext4/dev/block/mmcblk0p32 
    

    This sets the block device at mmcblk0p32 to be mounted on /system as filesystem type ext4

    All mountpoints should exist in this file and it is crucial this information be correct or else very bad things can happen, such as a recovery flash writing to the wrong location.

    Note:

    The filesystem type datamedia can be used for internal sdcards as well as setting the block device to /dev/null.

    vendorsetup.sh

    vendorsetup.sh is called when setupenv.sh is run. It is used to add non-standard lunch combos to the lunch menu.

    To add your device to the lunch menu:

    add_lunch_combo cm_<codename>-userdebug
    

    Then build a test recovery image

    To build only the recovery, set up lunch as with a regular build, and say make recoveryimage

    If things break (and they will break), have a look at these tips for dealing with build errors.

    Helpful Tip

    If you have fastboot, you can try it to install the recovery image to the recovery partition. There are other methods for installing the recovery, such as using dd from a rooted system to flash it into place.

    Not much needs to be said here, but make sure the recovery is working before you move on to getting CyanogenMod working. A 100%-working and reliable recovery mode is absolutely necessary before you start testing experimental Android builds.

    Adjust recovery_ui.cpp if necessary

    You may discover that although the recovery image runs, some of the hardware buttons, such as the volume buttons or power buttons, which would normally be used to scroll through the options, don’t work.

    You may need to adjust the GPIO values to get the buttons to be recognized. Similarly, you may wish to include/exclude options or modify other UI elements.

    To do this, you may wish to create and edit the /device/[vendor]/[codename]/recovery/recovery_ui.cpp. You can find ample examples of this file, the associated recovery/Android.mk file that builds it, and how it is used.

    Helpful Tip

    The GPIO values for your device may be found in the kernel source.

    Put your device folder in github, and use a local manifest to automatically sync it with repo sync

    Once you’ve started your device folder, create your own GitHub account and set up your folder as a public GitHub repository. This is a great opportunity to learn about git, and also your source can be accessible to others who can collaborate with you.

    When naming your repository, use the format android_device_VENDOR_CODENAME, where VENDOR and CODENAME use the new device’s values. So, let’s say your GitHub account name is “fat-tire” and your device codename is “encore“, manufactured by Barnes and Noble. You should call your repository android_device_bn_encore. It would be accessible at https://github.com/fat-tire/android_device_bn_encore. Similarly, the kernel repository would be called android_kernel_bn_encore. It would be accessible at https://github.com/fat-tire/android_kernel_bn_encore.

    The last thing to do is create a local manifest for other people to use to automatically download and their keep up-to-date with your changes. Here’s an example, using the above scenario:

    <?xml version="1.0" encoding="UTF-8"?>
    <manifest>
      <project name="fat-tire/android_device_bn_encore" path="device/bn/encore" remote="github" revision="cm-10.1" />
      <project name="fat-tire/android_kernel_bn_encore" path="kernel/bn/encore" remote="github" revision="cm-10.1" />
    </manifest>
    

    Note:

    The revision attribute is optional. If it is omitted, repo sync will use the revision specified by the <default ... /> tag in the default manifest.

    Once you’ve tested that the local manifest file works, you can pass it on to others, who can then try out your work. At that point you can continue to push your changes to GitHub, and even give other users commit access so that you can work on the device together.

    Helpful Tip – Using other repositories

    If you find that for some reason you need to replace or supplement other repositories provided by CyanogenMod, you can add additional repositories using the local manifest. Once you’ve got everything working, you can use Gerrit to submit stuff found in those repositories back upstream to CyanogenMod.

    Add the blobs to the vendor/ directory

    Once you have a working recovery, it’s now time to get CyanogenMod building and working.

    The first thing to do is to get all the proprietary, binary blobs into the vendor/ folder, along with a .mk file that will include them in the final build.

    This requires three steps:

    1. Create extract-files.sh and setup-makefiles.sh scripts to pull those blob files from the device using adb and put them in the right /vendor/ directory. There are plenty of examples available for other devices.
    2. Create an .mk Makefile to copy those files to the $OUT folder during the build process and put them in the right place. Again, use other devices as a guide for what this Makefile should look like. An example filename might be BoardConfigVendor.mk
    3. Make sure that the Makefile you just created is included from your main BoardConfig.mk via a command such as -include vendor/[vendor]/[codename]/BoardConfigVendor.mk. Again, existing devices can illustrate how this is done.

    Now revise the device/ directory

    Since you have a working recovery, go back and start modifying the files in the device/ folder. As always, use other similar devices as a reference.

    You now have a easy means to do backups and test your builds. So start tweaking the device folder itself, and see if you get it to boot… Once you do, from there its a matter of building and supporting the various parts and peripherals, one-by-one.

    Getting help from the manufacturers & vendors

    Many of the OEMs (Original Equipment Manufacturers) who make the underlying platform used by your device frequently provide wikis, documentation, and sample code that can assist you in completing your port. You’ll find that some companies are more friendly to the development community than others. Here are some of the more common OEMs and vendors, along with web sites and repositories that may help.

    (This list is incomplete. Please help add to it)

    OEM Platform Repositories/Resources
    Google various Google’s Git Repository , Nexus binary blobs
    HTC various Dev Center
    HP various HP Open Source
    Lenovo various Lenovo Smartphones (Search your device)
    LG various LG Open Source Code Distribution
    Motorola various Motorola Open Source Center
    Nvidia Tegra Tegra’s GitWeb
    Qualcomm MSM/QSD Code Aurora Forum
    Samsung various Samsung Open Source Release Center
    Texas Instruments OMAP www.omapzoom.com , Omappedia

    Sometimes if you have questions you can even reach out to the developers via email or the support forums.

    Adding XML Overlays

    It’s very likely in your device_[codename].mk file, there’s a line that looks like this:

    DEVICE_PACKAGE_OVERLAYS := \
        device/[vendor]/[codename]/overlay
    

    What this does is set the overlay/ folder to allow you to override any XML file used by Android frameworks or apps, just for this device. To do so, create a directory structure which mirrors the path leading to an XML file, starting from the root of your source. Then replace the file you want to overlay.

    Example: Let’s say you want to override some standard Android settings. Look at the file in frameworks/base/core/res/res/values/config.xml. Then copy it to device/[vendor]/[codename]/overlay/frameworks/base/core/res/res/values/config.xml. Now YOUR version will be used instead of the other one. You only need to include the settings you wish to override– not all of them, so you can pare down the file to those few that change from the default.

    You can overlay any XML file, affecting layouts, settings, preferences, translations, and more.

    Make the kernel and kernel modules build from source

    If you have previously used a pre-built kernel, you may at some point want to start building the kernel from scratch.

    See the instructions for how to change the BoardConfig.mk file to make CyanogenMod build the kernel and any required kernel modules automatically.

    Conclusion

    There’s no way a single wiki page will tell you everything you need to know to do a port from beginning to end. However, hopefully you now have an understanding of how things are set up and the steps you need to take. You an always ask for help on the forums or on IRC. Others with the same device may jump in to help too.

    Hopefully you’ll find the process rewarding and educational. And it’ll get you some street cred as well.

    When you’re all done, and your port works better than stock… when it’s stable and shiny and marvelous and wonderful…

    You may want to contribute your work upstream. Here are the instructions for how to do just that.

    Good luck!

    See Also

    Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.

    UDEV

    To access devices connected to USB via adb or fastboot on linux, you need to configure udev rules. For detailed information about udev, take a look at udev – Arch Linux from the ArchLinux wiki (note that UDEV rules are not exclusive to Arch; udev is used in numerous distributions). You can follow the method below to add rules for any user that is part of the plugdev group, or you can follow Google Android’s instructions to add rules only for your username.

    Follow these steps to setup the correct rules:

    1. Verify your username is included in the plugdev group. Type
      groups
      from a terminal and look for plugdev in the listed groups. If you do not see plugdev listed, you can add your username to the group with:
      sudo gpasswd -a username plugdev
      where username should be replaced with your linux username.
    2. Copy the set of rules listed below these steps to a text file and save it as /etc/udev/rules.d/51-android.rules. You will need sudo/su to write to that directory. So, for instance:
      sudo nano /etc/udev/rules.d/51-android.rules
      These rules cover all vendors listed by Google. Optionally, you can add just the vendor corresponding to the device(s) you plan to connect to your computer.
    3. Restart your computer and then test plugging in your device to the computer with USB debugging enabled.
    #Acer
    SUBSYSTEM=="usb", ATTR{idVendor}=="0502", MODE="0664", GROUP="plugdev"
    #ASUS
    SUBSYSTEM=="usb", ATTR{idVendor}=="0b05", MODE="0664", GROUP="plugdev"
    #Dell
    SUBSYSTEM=="usb", ATTR{idVendor}=="413c", MODE="0664", GROUP="plugdev"
    #Foxconn
    SUBSYSTEM=="usb", ATTR{idVendor}=="0489", MODE="0664", GROUP="plugdev"
    #Fujitsu & Fujitsu Toshiba
    SUBSYSTEM=="usb", ATTR{idVendor}=="04c5", MODE="0664", GROUP="plugdev"
    #Garmin-Asus
    SUBSYSTEM=="usb", ATTR{idVendor}=="091e", MODE="0664", GROUP="plugdev"
    #Google
    SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", MODE="0664", GROUP="plugdev"
    #Haier
    SUBSYSTEM=="usb", ATTR{idVendor}=="201e", MODE="0664", GROUP="plugdev"
    #Hisense
    SUBSYSTEM=="usb", ATTR{idVendor}=="109b", MODE="0664", GROUP="plugdev"
    #HTC
    SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", MODE="0664", GROUP="plugdev"
    #Huawei
    SUBSYSTEM=="usb", ATTR{idVendor}=="12d1", MODE="0664", GROUP="plugdev"
    #Intel
    SUBSYSTEM=="usb", ATTR{idVendor}=="8087", MODE="0664", GROUP="plugdev"
    #K-Touch
    SUBSYSTEM=="usb", ATTR{idVendor}=="24e3", MODE="0664", GROUP="plugdev"
    #KT Tech
    SUBSYSTEM=="usb", ATTR{idVendor}=="2116", MODE="0664", GROUP="plugdev"
    #Kyocera
    SUBSYSTEM=="usb", ATTR{idVendor}=="0482", MODE="0664", GROUP="plugdev"
    #Lenovo
    SUBSYSTEM=="usb", ATTR{idVendor}=="17ef", MODE="0664", GROUP="plugdev"
    #LG
    SUBSYSTEM=="usb", ATTR{idVendor}=="1004", MODE="0664", GROUP="plugdev"
    #Motorola
    SUBSYSTEM=="usb", ATTR{idVendor}=="22b8", MODE="0664", GROUP="plugdev"
    #MTK
    SUBSYSTEM=="usb", ATTR{idVendor}=="0e8d", MODE="0664", GROUP="plugdev"
    #NEC
    SUBSYSTEM=="usb", ATTR{idVendor}=="0409", MODE="0664", GROUP="plugdev"
    #Nook
    SUBSYSTEM=="usb", ATTR{idVendor}=="2080", MODE="0664", GROUP="plugdev"
    #Nvidia
    SUBSYSTEM=="usb", ATTR{idVendor}=="0955", MODE="0664", GROUP="plugdev"
    #OTGV
    SUBSYSTEM=="usb", ATTR{idVendor}=="2257", MODE="0664", GROUP="plugdev"
    #Pantech
    SUBSYSTEM=="usb", ATTR{idVendor}=="10a9", MODE="0664", GROUP="plugdev"
    #Pegatron
    SUBSYSTEM=="usb", ATTR{idVendor}=="1d4d", MODE="0664", GROUP="plugdev"
    #Philips
    SUBSYSTEM=="usb", ATTR{idVendor}=="0471", MODE="0664", GROUP="plugdev"
    #PMC-Sierra
    SUBSYSTEM=="usb", ATTR{idVendor}=="04da", MODE="0664", GROUP="plugdev"
    #Qualcomm
    SUBSYSTEM=="usb", ATTR{idVendor}=="05c6", MODE="0664", GROUP="plugdev"
    #SK Telesys
    SUBSYSTEM=="usb", ATTR{idVendor}=="1f53", MODE="0664", GROUP="plugdev"
    #Samsung
    SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", MODE="0664", GROUP="plugdev"
    #Sharp
    SUBSYSTEM=="usb", ATTR{idVendor}=="04dd", MODE="0664", GROUP="plugdev"
    #Sony
    SUBSYSTEM=="usb", ATTR{idVendor}=="054c", MODE="0664", GROUP="plugdev"
    #Sony Ericsson
    SUBSYSTEM=="usb", ATTR{idVendor}=="0fce", MODE="0664", GROUP="plugdev"
    #Teleepoch
    SUBSYSTEM=="usb", ATTR{idVendor}=="2340", MODE="0664", GROUP="plugdev"
    #Toshiba
    SUBSYSTEM=="usb", ATTR{idVendor}=="0930", MODE="0664", GROUP="plugdev"
    #Wileyfox
    SUBSYSTEM=="usb", ATTR{idVendor}=="2970", MODE="0664", GROUP="plugdev"
    #YU
    SUBSYSTEM=="usb", ATTR{idVendor}=="1ebf", MODE="0664", GROUP="plugdev"
    #ZTE
    SUBSYSTEM=="usb", ATTR{idVendor}=="19d2", MODE="0664", GROUP="plugdev"
    #ZUK
    SUBSYSTEM=="usb", ATTR{idVendor}=="2b4c", MODE="0664", GROUP="plugdev"
    

    Troubleshooting

    1. Make sure your device is connected and accessible via usb. lsusb should show a list of connected devices. The section after ‘ID’ in the output should match one of the idVendor numbers from the udev rules. For example, a Nexus One with idVendor 18d1 should return something like:

    Bus 001 Device 005: ID 17ef:480d Lenovo Integrated Webcam [R5U877]
    Bus 002 Device 002: ID 0bda:0119 Realtek Semiconductor Corp. 
    Bus 002 Device 009: ID 18d1:4e12 Google Inc. Nexus One (debug)
    Bus 004 Device 003: ID 0a5c:2145 Broadcom Corp. Bluetooth with Enhanced Data Rate II
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    

    2. If the device is detected in lsusb, try running adb devices. If you get ???????????? device, try reloading the udev rules:

     sudo sh -c "(udevadm control --reload-rules && udevadm trigger --action=change)"
    

    You can also try disconnecting and reconnecting the usb cable to your device.

    3. If you cannot access your device via adb, even after adding your linux user to the plugdev group and restarting the computer, you can try starting the adb service as root. This is dangerous and not recommended:

    adb kill-server
    sudo $(which adb) start-server
    adb devices
    

    Similarly, if fastboot devices returns no permissions, try running fastboot as root:

    sudo $(which fastboot) devices
    

    Content of this page is based on informations from wiki.cyanogenmod.org, under CC BY-SA 3.0 licence.