Resume from hibernate

I’m attempting to hibernate a ConnectCore 6UL, but it hangs while resuming immediately after loading the image from swap. I’m using a custom Yocto distro based on Digi’s BSP and Yocto Thud. I ran the tests supported by /sys/power/pm_test and they all pass, and it can hibernate/resume when I set the hibernate mode to “test_resume” (with “echo test_resume > /sys/power/disk”), but a complete hibernate/resume fails to resume. I added “no_console_suspend initcall_debug” to the kernel arguments and got similar output (over serial) as when I suspend-to-RAM (which works), and I couldn’t find any errors. The kernel docs suggest this could be an issue with the platform firmware (maybe the MCA?). Has anyone gotten hibernate/resume working on the ConnectCore 6UL?

Edit: The “test_resume” hibernate mode fails with a kernel error (NULL pointer dereference) the second time I trigger a hibernation.

Edit2: After setting up kdump/kexec, “test_resume” no longer causes a kernel panic, and I haven’t been able to reproduce the kernel panic. The system still fails to resume from hibernate, but no errors are printed to the console.

Edit3: I’ve found that the hibernated kernel successfully resumes execution, but the serial console, ethernet port, and SPI-connected display don’t work. So far I’ve only been able to confirm that writing to the NAND and SD card work. I wrote the contents of dmesg to a file on NAND after resuming from hibernate, but I didn’t see any errors.

How are you putting system to sleep? In stock images there is a special script /bin/suspend - you might be missing some things from it.

Sorry I didn’t update this question, but I was able to resume from hibernation by building some kernel drivers as modules instead of integrating them into the kernel. I’m hibernating with a very simple script that writes “disk” to /sys/power/state.