Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60559677 authored by BigfootACA's avatar BigfootACA Committed by Danny Lin
Browse files

fastboot: Add support for boot image

Equivalent to fastboot boot boot.img
parent 99f07958
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -587,6 +587,30 @@ export class FastbootDevice {
        common.logDebug(`Flashed ${partition} with ${splits} split(s)`);
    }

    /**
     * Boot the given Blob on the device.
     * Equivalent to `fastboot boot boot.img`.
     *
     * @param {Blob} blob - The Blob to retrieve data from.
     * @param {FlashProgressCallback} onProgress - Callback for flashing progress updates.
     * @throws {FastbootError}
     */
    async bootBlob(
        blob: Blob,
        onProgress: FlashProgressCallback = (_progress) => {}
    ) {

        common.logDebug(`Booting ${blob.size} bytes image`);

        let data = await common.readBlobAsBuffer(blob);
        await this.upload("boot.img", data, onProgress);

        common.logDebug("Booting payload...");
        await this.runCommand("boot");

        common.logDebug(`Booted ${blob.size} bytes image`);
    }

    /**
     * Flash the given factory images zip onto the device, with automatic handling
     * of firmware, system, and logical partitions as AOSP fastboot and