From 7f1d83938e800adc59ea152dfae082a933512f28 Mon Sep 17 00:00:00 2001 From: "prompt.ac/@jeffrey" Date: Tue, 14 Apr 2026 10:53:36 -0700 Subject: [PATCH] native: eMMC drivers, SOF audio, Chromebook ESP install, sysrq reboot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes G7 Chromebook (Jasper Lake) install + audio + reboot issues diagnosed from USB pre-launch.log: - kernel/config-minimal: CONFIG_MMC + SDHCI_PCI/ACPI (eMMC was invisible — no /dev/mmcblk* nodes); CONFIG_MAGIC_SYSRQ=y so echo b > sysrq-trigger can rescue a hung reboot on kernels where busybox reboot(2) is blocked - CONFIG_CMDLINE: drop snd_intel_dspcfg.dsp_driver=0 — forcing legacy HDA breaks SOF on Jasper Lake; let the driver autoprobe (SOF on Chromebook, legacy HDA on ThinkPad X13) - ac-native.c: install loop scans p1..p16 over two passes; pass 0 is non-destructive so Chromebook ESP at p12 is found before the p1 rescue mkfs would clobber the stateful (ext4) partition - initramfs/init: log mmcblk/pci/rfkill/asound state; pipe /dev/kmsg instead of dmesg (busybox applet absent); after reboot -f, fall back to sysrq-b then sysrq-c so the machine never silently freezes Co-Authored-By: Claude Opus 4.6 (1M context) --- fedac/native/initramfs/init | 47 +++++++++++++++++++++++++++--- fedac/native/kernel/config-minimal | 20 +++++++++++-- fedac/native/src/ac-native.c | 15 ++++++++-- 3 files changed, 72 insertions(+), 10 deletions(-) diff --git a/fedac/native/initramfs/init b/fedac/native/initramfs/init index 65ca260bb9..076acf14cd 100755 --- a/fedac/native/initramfs/init +++ b/fedac/native/initramfs/init @@ -133,9 +133,39 @@ echo "gpu:" >> $LOG ls -la /dev/dri/ >> $LOG 2>&1 ls -la /dev/fb* >> $LOG 2>&1 echo "block devs:" >> $LOG -ls /dev/sd* /dev/nvme* >> $LOG 2>&1 -echo "=== DMESG ===" >> $LOG -dmesg >> $LOG 2>&1 +ls /dev/sd* /dev/nvme* /dev/mmcblk* 2>/dev/null >> $LOG +echo "net ifaces:" >> $LOG +ls /sys/class/net/ 2>/dev/null >> $LOG +echo "rfkill:" >> $LOG +for rf in /sys/class/rfkill/rfkill*; do + [ -d "$rf" ] || continue + echo " $(basename $rf): type=$(cat $rf/type 2>/dev/null) soft=$(cat $rf/soft 2>/dev/null) hard=$(cat $rf/hard 2>/dev/null)" >> $LOG +done +echo "sound cards:" >> $LOG +cat /proc/asound/cards 2>/dev/null >> $LOG +echo "pci devices (storage/audio/net):" >> $LOG +if [ -d /sys/bus/pci/devices ]; then + for d in /sys/bus/pci/devices/*; do + [ -d "$d" ] || continue + class=$(cat $d/class 2>/dev/null) + # 0x0c* = serial bus (eMMC), 0x0104* = RAID, 0x0106* = SATA, 0x0108* = NVMe + # 0x0280* = network wireless, 0x0403* = audio + case "$class" in + 0x010*|0x028*|0x040*|0x080501|0x0805*) + ven=$(cat $d/vendor 2>/dev/null) + dev=$(cat $d/device 2>/dev/null) + drv=$(basename $(readlink $d/driver 2>/dev/null) 2>/dev/null) + echo " $(basename $d) class=$class ven=$ven dev=$dev drv=${drv:-NONE}" >> $LOG + ;; + esac + done +fi +echo "=== DMESG (kernel ring) ===" >> $LOG +# Capture 2s of /dev/kmsg output (busybox dmesg applet may be absent) +( cat /dev/kmsg >> $LOG 2>&1 ) & +KMSG_PID=$! +sleep 2 +kill $KMSG_PID 2>/dev/null echo "=== CPUINFO ===" >> $LOG head -30 /proc/cpuinfo >> $LOG 2>&1 echo "=== CMDLINE ===" >> $LOG @@ -193,9 +223,18 @@ while true; do sync echo 0 > /proc/sys/kernel/printk 2>/dev/null printf '\033[?25l\033[2J' > /dev/tty0 2>/dev/null + # Enable all sysrq if kernel supports it (belt-and-suspenders) + echo 1 > /proc/sys/kernel/sysrq 2>/dev/null + # Try every reboot path in order — different kernels accept different ones reboot -f 2>/dev/null echo b > /proc/sysrq-trigger 2>/dev/null - sleep 30 + # Last resort: direct reboot(2) syscall via busybox `reboot` + busybox reboot -f 2>/dev/null + halt -f 2>/dev/null + sleep 5 + # If we're still here, kernel panic is preferable to a silent freeze + echo c > /proc/sysrq-trigger 2>/dev/null + sleep 5 break fi diff --git a/fedac/native/kernel/config-minimal b/fedac/native/kernel/config-minimal index e41949dee3..833ebf2672 100644 --- a/fedac/native/kernel/config-minimal +++ b/fedac/native/kernel/config-minimal @@ -424,7 +424,7 @@ CONFIG_HOTPLUG_CPU=y CONFIG_LEGACY_VSYSCALL_XONLY=y # CONFIG_LEGACY_VSYSCALL_NONE is not set CONFIG_CMDLINE_BOOL=y -CONFIG_CMDLINE="console=tty0 quiet loglevel=3 vt.global_cursor_default=0 init=/init mitigations=off snd_intel_dspcfg.dsp_driver=0 snd_hda_intel.power_save=0 nmi_watchdog=0 tsc=reliable no_timer_check acpi_backlight=native thinkpad_acpi.brightness_enable=1 i8042.reset i8042.nomux" +CONFIG_CMDLINE="console=tty0 quiet loglevel=3 vt.global_cursor_default=0 init=/init mitigations=off snd_hda_intel.power_save=0 nmi_watchdog=0 tsc=reliable no_timer_check acpi_backlight=native thinkpad_acpi.brightness_enable=1 i8042.reset i8042.nomux" # CONFIG_CMDLINE_OVERRIDE is not set CONFIG_MODIFY_LDT_SYSCALL=y # CONFIG_STRICT_SIGALTSTACK_SIZE is not set @@ -3336,7 +3336,18 @@ CONFIG_TYPEC_UCSI=y CONFIG_UCSI_ACPI=y CONFIG_USB_ROLE_SWITCH=y CONFIG_USB_ROLES_INTEL_XHCI=y -# CONFIG_MMC is not set +CONFIG_MMC=y +CONFIG_PWRSEQ_EMMC=y +CONFIG_PWRSEQ_SIMPLE=y +CONFIG_MMC_BLOCK=y +CONFIG_MMC_BLOCK_MINORS=32 +CONFIG_MMC_SDHCI=y +CONFIG_MMC_SDHCI_IO_ACCESSORS=y +CONFIG_MMC_SDHCI_PCI=y +CONFIG_MMC_RICOH_MMC=y +CONFIG_MMC_SDHCI_ACPI=y +CONFIG_MMC_SDHCI_PLTFM=y +CONFIG_MMC_CQHCI=y # CONFIG_SCSI_UFSHCD is not set # CONFIG_MEMSTICK is not set CONFIG_NEW_LEDS=y @@ -4355,7 +4366,10 @@ CONFIG_OBJTOOL=y # # Generic Kernel Debugging Instruments # -# CONFIG_MAGIC_SYSRQ is not set +CONFIG_MAGIC_SYSRQ=y +CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE=0x1ff +CONFIG_MAGIC_SYSRQ_SERIAL=y +CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE="" # CONFIG_DEBUG_FS is not set CONFIG_HAVE_ARCH_KGDB=y # CONFIG_KGDB is not set diff --git a/fedac/native/src/ac-native.c b/fedac/native/src/ac-native.c index f45cbf7ea4..4e5109594e 100644 --- a/fedac/native/src/ac-native.c +++ b/fedac/native/src/ac-native.c @@ -1176,8 +1176,14 @@ static int auto_install_to_hd(ACGraph *graph, ACFramebuffer *screen, if (rem == 1) continue; // removable = USB } - // Try partitions 1-8 - for (int p = 1; p <= 8 && !installed; p++) { + // Two-pass partition scan. Pass 0: probe p1..p16 for an existing + // vfat partition (non-destructive) — finds the Chromebook ESP at + // p12 before we would otherwise reformat p1 (stateful/ext4) on + // Chromebooks and clobber user data. Pass 1: fall back to the + // p=1 rescue reformat for stock Linux layouts where no ESP exists. + for (int pass = 0; pass < 2 && !installed; pass++) { + int allow_rescue_mkfs = (pass == 1); + for (int p = 1; p <= 16 && !installed; p++) { char devpath[32]; // NVMe + eMMC use "p" suffix (name ends in a digit); SATA // just appends the number to the base name. @@ -1197,7 +1203,9 @@ static int auto_install_to_hd(ACGraph *graph, ACFramebuffer *screen, // sfdisk created it but mkfs never succeeded), try to format // it now. Only attempt this on the first partition (which is // the ESP slot) and only if the partition is large enough. - if (p == 1) { + // Gated to pass==1 so we never clobber Chromebook p1 STATE + // when an existing vfat ESP is available elsewhere (e.g. p12). + if (p == 1 && allow_rescue_mkfs) { long long part_bytes = 0; int pfd = open(devpath, O_RDONLY | O_CLOEXEC); if (pfd >= 0) { @@ -1733,6 +1741,7 @@ static int auto_install_to_hd(ACGraph *graph, ACFramebuffer *screen, umount("/tmp/hd"); } + } } if (installed && display) { -- 2.51.2