Sunday 11 December 2011

Suspend with root on tmpfs/squashfs

Suspend with root on tmpfs/squashfs

Hello!
My computer boots to gentoo linux using a initrd that creates a squashfs on top of a tmpfs mount.
I'm having trouble getting the computer to resume after suspend.

initrd /init
Code:

#!/bin/busybox sh
rescue_shell()
{
    busybox --install -s
    exec /bin/sh
}
mount -n -t proc none /proc
mount -n -t sysfs none /sys
mount -n -t nfs -o nolock,ro 192.168.0.102:/export/Jaguar /mnt || rescue_shell
mount -n -t tmpfs tmpfs.root /tmp -osize=1g
mksquashfs /mnt /tmp/root.sfs -processors 2 -noappend -comp gzip -no-recovery -e usr/src usr/share/man usr/share/gtk-doc
umount -n /mnt
mount -n -t squashfs /tmp/root.sfs /mnt -oro,loop || rescue_shell
mount --move /tmp /mnt/tmp
umount -n /proc /sys
exec switch_root /mnt /init

system /init
Code:

#!/bin/bash
#Added following line for suspend testing:
exec /bin/bash
###
echo "Mounting tmpfs"
mount -n -t tmpfs -o nosuid,nodev,noatime,size=1300m tmpfs /tmp
echo "nameserver 192.168.0.1" > /tmp/resolv.conf
mount -n -t tmpfs -o nosuid,nodev,noexec,noatime,size=50m tmpfs /var/spool/rsyslog
mount -n -t tmpfs -o nosuid,nodev,noexec,noatime,size=50m tmpfs /var/log
mount -n -t tmpfs -o nosuid,nodev,noexec,noatime,size=50m tmpfs /var/run
mount -n -t tmpfs -o nosuid,nodev,noexec,noatime,size=50m tmpfs /var/lock
mount -n -t tmpfs -o nosuid,nodev,noexec,noatime,size=200m tmpfs /var/cache
mount -n -t tmpfs -o nosuid,nodev,noexec,noatime,size=500m tmpfs /var/tmp
mkdir -p /var/run/lirc
mount -n -t tmpfs -o nosuid,nodev,noexec,noatime,size=20m tmpfs /var/run/lirc
echo "Syncing xbmc to tmpfs"
rsync -ax /home/xbmc/.xbmc/* /var/tmp/
mount --move /var/tmp /home/xbmc/.xbmc
exec /sbin/init </dev/console >/dev/console 2>&1

After the shell is up i mount proc and sys, then suspend system using either: "echo mem>/sys/power/state" or all the variations of s2ram from the list on the opensuse site (Can't post link)

My kernel options are: initrd=initrd.squash ip=192.168.0.104:192.168.0.102:192.168.0.1:255.255 .255.0:Jaguar:eth0:off hpet=disable noapic
I tried without disabling hpet and apic, but no luck.

I tried activating pm_trace, but I do not get any "hash matches" after it reboots after a failed suspend. I do however get a magic cookie/match, but it does not point to any pci or usb device (From what I can tell from lspci -v -v, lshw and /sys,/proc trees)

I can post kernel .config if it's needed, but for now i'll just mention that my dvb-s tuner and soundcard is compiled as modules, so they are not loaded when I try to suspend. S-ata support is removed since this is a diskless system, but I still have block devices enabled because of a IDE dvd-rw(built into kernel)
The kernel i'm using is ck-sources from gentoo.
My video card is from nvidia, but the module is not loaded when i suspend.
Motherboard is Abit KN9. In bios I selected suspend mode=S3 (S1 was an option, but it does not work to suspend using it)


Since nothing seems to work i'm wondering if the problem is that the root filesystem is a squashfs image on tmpfs.
Any ideas? What can I do to get this working?

Thanks in advance!

No comments:

Post a Comment