49 lines
2.3 KiB
Bash
49 lines
2.3 KiB
Bash
#!/usr/bin/env bash
|
|
# SPDX-License-Identifier: (GPL-2.0-only OR MIT)
|
|
# Copyright (C) 2026 Amlogic, Inc. All rights reserved
|
|
#
|
|
# Environment configuration functions for AMLbian
|
|
## Force-regenerate /boot/initrd.img-<ver> with the Amlogic-specific module
|
|
## set so eMMC actually probes during boot.
|
|
##
|
|
## Why this exists:
|
|
## linux-image deb's postinst calls update-initramfs with default
|
|
## MODULES=dep, which only packs modules detected from the build host's
|
|
## running kernel. In a chroot the build kernel is unrelated to the target,
|
|
## so the resulting initramfs has NO pinctrl/clk/mmc drivers → kernel boots,
|
|
## sees deferred probe forever ("wait for supplier .../pinctrl@4000"),
|
|
## never mounts root.
|
|
##
|
|
## This helper:
|
|
## 1. Sets MODULES=most (so initramfs-tools scans the kernel-image deb's
|
|
## modules tree, not the host running kernel).
|
|
## 2. Writes /etc/initramfs-tools/modules with the explicit chain needed
|
|
## to bring up SCMI clock → pinctrl → eMMC.
|
|
## 3. Drops a init-premount script that modprobes them in fixed order
|
|
## (clk_scmi MUST be first — DT has &scmi_clk as parent of
|
|
## amlogic,general-clk, so without clk_scmi the clk node never resolves
|
|
## and every subsequent driver hangs in deferred probe).
|
|
## 4. Re-runs `update-initramfs -c -k <kver>` inside chroot.
|
|
##
|
|
## Only invoked from build_rootfs when GPT has a boot partition (A9 family).
|
|
|
|
function force_initramfs_with_amlogic_modules() {
|
|
# A9: amlogic-* drivers live in common_drivers/ which MODULES=most doesn't
|
|
# scan. Explicit list ensures they go into postinst-generated initramfs.
|
|
|
|
echo "=========================initramfs module start==================================="
|
|
mkdir -p ${ROOTFS_TEMP}/usr/local/amlramfs
|
|
export LOCAL_RAMFS=${ROOTFS_TEMP}/usr/local/amlramfs
|
|
|
|
cp ${AMLBIAN_DIR}/patches/ramfs/init ${LOCAL_RAMFS}
|
|
chmod +x ${LOCAL_RAMFS}/init
|
|
|
|
cp ${AMLBIAN_DIR}/patches/ramfs/hook ${ROOTFS_TEMP}/etc/initramfs-tools/hooks/amlhook
|
|
chmod +x ${ROOTFS_TEMP}/etc/initramfs-tools/hooks/amlhook
|
|
|
|
echo "=========================initramfs module end==================================="
|
|
}
|
|
|
|
# ==============================================================================
|
|
# End of function-initrd.sh
|
|
# ============================================================================== |