- base/initramfs/init builds the gadget with NCM and ACM at once: the root's stage 1 no longer rebinds it, so the host keeps its link and address and netconsole runs from 1.5 s. - The root grows itself online to its partition (base/void/rootfs/.../03-grow-root.sh), which the pmOS initramfs did; tools/mkrootimg.sh copies base/<base>/rootfs/ before the SoC's files. - tools/build-busybox.sh: SOURCE_DATE_EPOCH of the pinned source, so the initramfs is reproducible; pinned in device.conf (4950e286679ca4fa). - Makefile: INITRAMFS defaults to ours; bootimg checks the pins after the inputs are built. Measured on hotdogb: switch_root at 1.27 s (pmOS: about 3.5 s), a fresh root grown from 281468 to 25493504 blocks, 10 of 10 warm reboots, no WARNING, make flash end to end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
73 lines
2.5 KiB
Makefile
73 lines
2.5 KiB
Makefile
# Makronix Mobile -- kernel, boot image, flash, for any device under devices/.
|
|
#
|
|
# make devices list the supported phones
|
|
# make kernel DEVICE=hotdogb build the kernel Image
|
|
# make initramfs DEVICE=hotdogb build/initramfs-<device>.cpio.gz (our /init, our busybox)
|
|
# make bootimg DEVICE=hotdogb pack build/boot_<device>.img
|
|
# make flash DEVICE=hotdogb flash it to the test slot (phone in fastboot)
|
|
# make rootimg DEVICE=hotdogb root file system image (BASE=void, the default, or debian)
|
|
# make flash-root DEVICE=hotdogb write it to the root partition (phone in fastboot)
|
|
|
|
DEVICE ?= hotdogb
|
|
KERNEL_TREE ?= build/linux-$(DEVICE)
|
|
# ours (base/initramfs, make initramfs), pinned in device.conf; since
|
|
# 2026-11-08 instead of the pmOS one of the baseline, which still boots the
|
|
# same root: INITRAMFS=$(HOME)/.local/var/pmbootstrap/chroot_rootfs_oneplus-hotdogb/boot/initramfs
|
|
INITRAMFS ?= build/initramfs-$(DEVICE).cpio.gz
|
|
SLOT ?=
|
|
BASE ?= void
|
|
ROOT_PASSWORD ?= makronix
|
|
|
|
DEV = devices/$(DEVICE)
|
|
IMG = build/boot_$(DEVICE).img
|
|
IMAGE = $(KERNEL_TREE)/arch/arm64/boot/Image
|
|
ROOTFS = build/rootfs-$(BASE)-$(DEVICE).tar
|
|
ROOTIMG = build/root-$(BASE)-$(DEVICE).img
|
|
|
|
.PHONY: devices linux kernel initramfs rootfs rootfs-debian rootfs-void rootimg bootimg flash flash-root check
|
|
devices:
|
|
@for d in devices/*/; do \
|
|
n=$$(basename $$d); \
|
|
printf '%-12s %s\n' $$n "$$(sed -n 's/^DEVICE_NAME=//p' $$d/device.conf | tr -d '"')"; \
|
|
done
|
|
|
|
linux:
|
|
@mkdir -p build
|
|
sh tools/fetch-kernel.sh $(DEV) $(KERNEL_TREE)
|
|
|
|
kernel: linux
|
|
sh tools/build-kernel.sh $(DEV) $(KERNEL_TREE)
|
|
|
|
rootfs: rootfs-$(BASE)
|
|
|
|
# one glibc base per directory under base/; tools/mkrootfs-<base>.sh builds it
|
|
rootfs-void:
|
|
@mkdir -p build
|
|
sh tools/mkrootfs-void.sh $(DEV) build/rootfs-void-$(DEVICE).tar
|
|
|
|
rootfs-debian:
|
|
@mkdir -p build
|
|
sh tools/mkrootfs-debian.sh $(DEV) build/rootfs-debian-$(DEVICE).tar
|
|
|
|
check:
|
|
sh tools/check.sh $(DEV) $(INITRAMFS)
|
|
|
|
# the pins are checked after the inputs are built (the initramfs is ours)
|
|
bootimg: kernel initramfs
|
|
sh tools/check.sh $(DEV) $(INITRAMFS)
|
|
@mkdir -p build
|
|
sh tools/mkbootimg.sh $(DEV) $(IMAGE) $(INITRAMFS) $(IMG)
|
|
|
|
flash: bootimg
|
|
sh tools/flash.sh $(DEV) $(IMG) $(SLOT)
|
|
|
|
rootimg: kernel
|
|
sh tools/mkrootimg.sh $(DEV) $(ROOTFS) $(KERNEL_TREE) $(ROOTIMG) $(ROOT_PASSWORD)
|
|
|
|
flash-root:
|
|
sh tools/flash-root.sh $(DEV) $(ROOTIMG)
|
|
|
|
initramfs:
|
|
sh tools/build-busybox.sh $(DEV) build/busybox-$(DEVICE)
|
|
sh tools/mkinitramfs.sh build/busybox-$(DEVICE) build/initramfs-$(DEVICE).cpio.gz
|