$npx -y skills add hyperb1iss/hyperdroid-skill --skill lineageosUse when working with LineageOS custom ROM development, including syncing sources, building, device trees, repopick, Gerrit contributions, or LineageOS-specific features. Triggers on "LineageOS", "lineage-sdk", "breakfast", "brunch", "repopick", "vendor/lineage", "lineage.depende
| 1 | # LineageOS Development |
| 2 | |
| 3 | This skill covers LineageOS custom ROM development - from syncing sources to building and contributing. |
| 4 | |
| 5 | ## Getting Started |
| 6 | |
| 7 | ### Initialize Source |
| 8 | |
| 9 | ```bash |
| 10 | mkdir ~/lineage && cd ~/lineage |
| 11 | |
| 12 | # Install repo (if needed) |
| 13 | mkdir -p ~/.bin |
| 14 | curl https://storage.googleapis.com/git-repo-downloads/repo > ~/.bin/repo |
| 15 | chmod a+x ~/.bin/repo |
| 16 | export PATH="$HOME/.bin:$PATH" |
| 17 | |
| 18 | # Init LineageOS 21 (Android 14) |
| 19 | repo init -u https://github.com/LineageOS/android.git -b lineage-21.0 --git-lfs |
| 20 | |
| 21 | # Sync |
| 22 | repo sync -c -j$(nproc) --force-sync --no-tags --no-clone-bundle |
| 23 | ``` |
| 24 | |
| 25 | ### Build Commands |
| 26 | |
| 27 | ```bash |
| 28 | # Setup environment |
| 29 | source build/envsetup.sh |
| 30 | |
| 31 | # Setup device (syncs device repos too) |
| 32 | breakfast <device> |
| 33 | |
| 34 | # Build flashable ZIP |
| 35 | brunch <device> |
| 36 | # Or separately: |
| 37 | breakfast <device> |
| 38 | mka bacon |
| 39 | |
| 40 | # Output: out/target/product/<device>/lineage-21.0-*-UNOFFICIAL-<device>.zip |
| 41 | ``` |
| 42 | |
| 43 | --- |
| 44 | |
| 45 | ## Essential Commands |
| 46 | |
| 47 | | Command | Purpose | |
| 48 | | -------------------- | -------------------------------- | |
| 49 | | `breakfast <device>` | Setup device + sync dependencies | |
| 50 | | `brunch <device>` | breakfast + full build | |
| 51 | | `mka bacon` | Build flashable ZIP | |
| 52 | | `mka bootimage` | Build kernel only | |
| 53 | | `mka systemimage` | Build system only | |
| 54 | | `repopick <change>` | Cherry-pick from Gerrit | |
| 55 | |
| 56 | --- |
| 57 | |
| 58 | ## Device Trees |
| 59 | |
| 60 | ### Required Files |
| 61 | |
| 62 | ``` |
| 63 | device/<vendor>/<device>/ |
| 64 | ├── lineage_<device>.mk # Product makefile |
| 65 | ├── lineage.dependencies # Repo dependencies |
| 66 | ├── vendorsetup.sh # Add to lunch |
| 67 | ├── BoardConfig.mk # Hardware config |
| 68 | ├── device.mk # Packages and configs |
| 69 | └── extract-files.sh # Vendor blob extraction |
| 70 | ``` |
| 71 | |
| 72 | ### lineage\_<device>.mk |
| 73 | |
| 74 | ```makefile |
| 75 | # Inherit device |
| 76 | $(call inherit-product, device/vendor/device/device.mk) |
| 77 | |
| 78 | # Inherit LineageOS common |
| 79 | $(call inherit-product, vendor/lineage/config/common_full_phone.mk) |
| 80 | |
| 81 | PRODUCT_NAME := lineage_device |
| 82 | PRODUCT_DEVICE := device |
| 83 | PRODUCT_BRAND := Vendor |
| 84 | PRODUCT_MODEL := Device Name |
| 85 | PRODUCT_MANUFACTURER := Vendor |
| 86 | ``` |
| 87 | |
| 88 | ### lineage.dependencies |
| 89 | |
| 90 | ```json |
| 91 | [ |
| 92 | { |
| 93 | "repository": "android_kernel_vendor_device", |
| 94 | "target_path": "kernel/vendor/device" |
| 95 | }, |
| 96 | { |
| 97 | "repository": "android_device_vendor_device-common", |
| 98 | "target_path": "device/vendor/device-common" |
| 99 | }, |
| 100 | { |
| 101 | "repository": "proprietary_vendor_device", |
| 102 | "target_path": "vendor/device" |
| 103 | } |
| 104 | ] |
| 105 | ``` |
| 106 | |
| 107 | --- |
| 108 | |
| 109 | ## repopick - Cherry-picking from Gerrit |
| 110 | |
| 111 | ```bash |
| 112 | # Single change |
| 113 | repopick 12345 |
| 114 | |
| 115 | # Multiple changes |
| 116 | repopick 12345 12346 12347 |
| 117 | |
| 118 | # By topic |
| 119 | repopick -t feature-topic |
| 120 | |
| 121 | # With dependencies |
| 122 | repopick -Q 12345 |
| 123 | |
| 124 | # Force overwrite local changes |
| 125 | repopick -f 12345 |
| 126 | |
| 127 | # Show what would be picked |
| 128 | repopick -n 12345 |
| 129 | ``` |
| 130 | |
| 131 | ### Find Change Numbers |
| 132 | |
| 133 | 1. Go to `https://review.lineageos.org` |
| 134 | 2. Search for changes |
| 135 | 3. Change number is in the URL or displayed |
| 136 | |
| 137 | --- |
| 138 | |
| 139 | ## Vendor Blobs |
| 140 | |
| 141 | ### Extract from Device |
| 142 | |
| 143 | ```bash |
| 144 | cd device/vendor/device |
| 145 | ./extract-files.sh |
| 146 | ``` |
| 147 | |
| 148 | ### Extract from OTA/Factory Image |
| 149 | |
| 150 | ```bash |
| 151 | ./extract-files.sh ~/Downloads/ota.zip |
| 152 | ``` |
| 153 | |
| 154 | ### proprietary-files.txt Format |
| 155 | |
| 156 | ```txt |
| 157 | # Audio HAL |
| 158 | vendor/lib64/hw/audio.primary.platform.so |
| 159 | vendor/etc/audio_policy_configuration.xml |
| 160 | |
| 161 | # With destination path |
| 162 | vendor/lib64/lib.so:vendor/lib64/libfoo.so |
| 163 | |
| 164 | # From another device |
| 165 | vendor/lib64/lib.so|other_device |
| 166 | ``` |
| 167 | |
| 168 | --- |
| 169 | |
| 170 | ## LineageOS Features |
| 171 | |
| 172 | ### Trust Interface |
| 173 | |
| 174 | Security dashboard showing device integrity: |
| 175 | |
| 176 | ```makefile |
| 177 | # device.mk |
| 178 | PRODUCT_PACKAGES += \ |
| 179 | LineageTrust |
| 180 | ``` |
| 181 | |
| 182 | ### LiveDisplay |
| 183 | |
| 184 | Hardware-accelerated display tuning: |
| 185 | |
| 186 | ```makefile |
| 187 | PRODUCT_PACKAGES += \ |
| 188 | lineage.livedisplay@2.0-service-sdm |
| 189 | ``` |
| 190 | |
| 191 | ### Styles / Themes |
| 192 | |
| 193 | System theming support: |
| 194 | |
| 195 | ```makefile |
| 196 | PRODUCT_PACKAGES += \ |
| 197 | ThemePicker |
| 198 | ``` |
| 199 | |
| 200 | --- |
| 201 | |
| 202 | ## Key Directories |
| 203 | |
| 204 | | Path | Purpose | |
| 205 | | --------------------------- | ------------------- | |
| 206 | | `vendor/lineage/` | LineageOS additions | |
| 207 | | `lineage-sdk/` | LineageOS SDK | |
| 208 | | `device/<vendor>/<device>/` | Device tree | |
| 209 | | `kernel/<vendor>/<device>/` | Kernel source | |
| 210 | | `vendor/<vendor>/` | Proprietary blobs | |
| 211 | |
| 212 | --- |
| 213 | |
| 214 | ## Contributing |
| 215 | |
| 216 | ### Setup Gerrit Access |
| 217 | |
| 218 | ```bash |
| 219 | git config --global review.review.lineageos.org.username <username> |
| 220 | ``` |
| 221 | |
| 222 | ### Submit Change |
| 223 | |
| 224 | ```bash |
| 225 | # Create branch |
| 226 | repo start my-feature . |
| 227 | |
| 228 | # Make changes |
| 229 | git add -A |
| 230 | git commit -m "subsystem: Short description |
| 231 | |
| 232 | Detailed explanation. |
| 233 | |
| 234 | Change-Id: <auto-generated>" |
| 235 | |
| 236 | # Push for review |
| 237 | git push ssh://<username>@review.lineageos.org:29418/<project> HEAD:refs/for/<branch> |
| 238 | ``` |
| 239 | |
| 240 | ### Commit Message Format |
| 241 | |
| 242 | ``` |
| 243 | subsystem: Short description |
| 244 | |
| 245 | Longer e |