Document mka/mkimg.sh/wrimg.sh build and flash workflow

This commit is contained in:
Brendan Szymanski 2026-07-12 00:08:48 -04:00
parent 2b036dc5f9
commit e89b472dbd

View file

@ -7,6 +7,7 @@ Local manifest for building [LineageOS 23.2](https://lineageos.org/) (Android TV
- A Linux build host with [LineageOS build dependencies](https://wiki.lineageos.org/requirements) installed
- ~250GB free disk space
- `repo` tool installed
- An SD card (or other block device) at least 20GB, plus `sfdisk`/`kpartx`/`mkfs.vfat`/`mkfs.ext4` (all standard `util-linux`/`e2fsprogs` tools) for creating the flashable image
## Setup
@ -38,9 +39,46 @@ source build/envsetup.sh
breakfast tart
# Build
mka bacon
mka
```
Use plain `mka` (no target — this builds the default `droid` goal), **not** `mka bacon`. This device has no Android recovery (`TARGET_NO_RECOVERY := true`, U-Boot/extlinux boots it directly), which means `INTERNAL_OTA_PACKAGE_TARGET` is never assigned by the build system. `bacon`'s OTA-zip packaging rule depends on that variable and has no other build dependencies, so it fails almost instantly and aborts the whole build before `system.img`/`vendor.img` are even produced. Plain `mka` builds everything this device actually needs — `boot.img`, `system.img`, `vendor.img`, `ramdisk.img` — without ever touching that broken rule.
## Creating a flashable image
Once the build finishes, `device/rockchip/tart/mkimg.sh` assembles a bootable GPT image (U-Boot + FAT32 boot partition with `extlinux.conf`/kernel/DTB/ramdisk + system/vendor/metadata/userdata partitions):
```bash
# Run in the same shell you built in (needs TARGET_PRODUCT / ANDROID_PRODUCT_OUT
# from `breakfast`), from the root of the source tree. Do NOT prefix with sudo —
# root wouldn't see those env vars; the script escalates privileges internally
# per-command only where needed:
device/rockchip/tart/mkimg.sh
```
This produces `out/target/product/tart/lineage-<LINEAGE_VERSION>.img`. Write it to an SD card:
```bash
sudo dd if=out/target/product/tart/lineage-*.img of=/dev/sdX bs=4M status=progress
```
(Replace `/dev/sdX` with your SD card's device node — **not** a partition like `/dev/sdX1`.)
### Fast re-flashing during development
`device/rockchip/tart/wrimg.sh` writes individual partition images directly to an already-flashed physical device, without rebuilding the whole GPT image — useful when iterating on `system`/`vendor` without wanting to recreate the boot partition each time:
```bash
device/rockchip/tart/wrimg.sh # writes boot + system + vendor
device/rockchip/tart/wrimg.sh system # writes system only
device/rockchip/tart/wrimg.sh vendor # writes vendor only
device/rockchip/tart/wrimg.sh boot # writes boot only
device/rockchip/tart/wrimg.sh wipe # reformats userdata
device/rockchip/tart/wrimg.sh wipe-metadata # reformats metadata
```
It auto-detects the target device by matching partition labels/sizes against `mkimg.sh`'s layout (`boot`/`system`/`vendor`/`metadata`/`userdata`), so the device must already have been flashed with an image from `mkimg.sh` at least once.
## Repositories
This local manifest pulls in the following repositories from `git.bscubed.dev/lineage-rockchip/`: