- mkbootimg.mk: boot.img uses the normal ramdisk again; the recovery.img rule is guarded so it only builds when recovery is enabled (PAWLET_BUILD_RECOVERY=1) and carries the recovery ramdisk. - config.txt [tryboot] back to boot_partition=2 (A/B trial); recovery enters via reboot,3. - vendor.prop reboot reason back to reboot,tryboot. - drop the no-op reserved-size lines (AOSP ignores RESERVED_SIZE for fixed non-dynamic partitions).
60 lines
2.4 KiB
Makefile
60 lines
2.4 KiB
Makefile
#
|
|
# Copyright (C) 2021-2022 KonstaKANG
|
|
# Copyright (C) 2025-2026 oxmc
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
DEVICE_PATH := device/pawlet/rpi5
|
|
KERNEL_PATH := device/brcm/rpi5-kernel
|
|
|
|
# Recovery is a separate image, built on demand (PRODUCT_BUILD_RECOVERY_IMAGE,
|
|
# via the `precovery` helper) and flashed to the recovery partition. The normal
|
|
# build only produces boot.img.
|
|
RECOVERY_RAMDISK := $(PRODUCT_OUT)/ramdisk-recovery.img
|
|
|
|
# Use a stamp file so ninja tracks the directory contents correctly.
|
|
# Targeting the directory itself confuses ninja when inner files change.
|
|
RPI_BOOT_OUT := $(PRODUCT_OUT)/rpiboot
|
|
RPI_BOOT_STAMP := $(RPI_BOOT_OUT)/.stamp
|
|
|
|
# Shared boot-partition staging: kernel, DTBs, overlays, config.txt. The ramdisk
|
|
# and cmdline.txt are added per-image in the rules below, so a stray
|
|
# cmdline/ramdisk in the staging dir can never collide with the per-image mcopy
|
|
# (which would hang on mtools' interactive overwrite prompt).
|
|
$(RPI_BOOT_STAMP): $(INSTALLED_RAMDISK_TARGET)
|
|
rm -rf $(RPI_BOOT_OUT)
|
|
mkdir -p $(RPI_BOOT_OUT)/overlays
|
|
cp $(DEVICE_PATH)/boot/* $(RPI_BOOT_OUT)
|
|
cp $(KERNEL_PATH)/Image $(RPI_BOOT_OUT)
|
|
cp $(KERNEL_PATH)/bcm2712*-rpi-*.dtb $(RPI_BOOT_OUT)
|
|
cp $(KERNEL_PATH)/overlays/* $(RPI_BOOT_OUT)/overlays
|
|
rm -f $(RPI_BOOT_OUT)/cmdline*.txt $(RPI_BOOT_OUT)/ramdisk*.img
|
|
touch $@
|
|
|
|
# Normal boot partition: the standard Android ramdisk + cmdline.
|
|
$(INSTALLED_BOOTIMAGE_TARGET): $(RPI_BOOT_STAMP) $(INSTALLED_RAMDISK_TARGET)
|
|
$(call pretty,"Target boot image: $@")
|
|
echo "$(BOARD_KERNEL_CMDLINE)" > $@.cmdline
|
|
dd if=/dev/zero of=$@ bs=1M count=128
|
|
mkfs.fat -F 32 -n "BOOT" $@
|
|
mcopy -s -i $@ $(RPI_BOOT_OUT)/* ::
|
|
mcopy -i $@ $(INSTALLED_RAMDISK_TARGET) ::ramdisk.img
|
|
mcopy -i $@ $@.cmdline ::cmdline.txt
|
|
rm -f $@.cmdline
|
|
|
|
# Recovery partition image — only defined when recovery is enabled
|
|
# (PAWLET_BUILD_RECOVERY=1 -> INSTALLED_RECOVERYIMAGE_TARGET set). Same FAT
|
|
# layout but carrying the recovery ramdisk. Flash it to the recovery partition.
|
|
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
|
|
$(INSTALLED_RECOVERYIMAGE_TARGET): $(RPI_BOOT_STAMP) $(RECOVERY_RAMDISK)
|
|
$(call pretty,"Target recovery image: $@")
|
|
echo "$(BOARD_KERNEL_CMDLINE)" > $@.cmdline
|
|
dd if=/dev/zero of=$@ bs=1M count=128
|
|
mkfs.fat -F 32 -n "RECOVERY" $@
|
|
mcopy -s -i $@ $(RPI_BOOT_OUT)/* ::
|
|
mcopy -i $@ $(RECOVERY_RAMDISK) ::ramdisk.img
|
|
mcopy -i $@ $@.cmdline ::cmdline.txt
|
|
rm -f $@.cmdline
|
|
endif
|