Tiny Core Base > TCB Bugs

resume= handling exits tc-config

(1/1)

dentonlt:
If I boot with resume=, TC ignores some of my other kernel args (specifically tce= ). So I was reading tc-config.

tc-config exits if resume= doesn't come up with a valid $SWAP_SIZE. I think this is why my tce= arg gets ignored. I think it should read continue, instead ... that breaks the resume= handling without exiting.


--- Code: ------ tc-config.orig Thu Jan 22 04:28:24 2009
+++ tc-config.fix Thu Jan 22 04:27:38 2009
@@ -389,7 +389,7 @@
   RESUME=`basename $RESUME`
   SWAP_SIZE=$(cat /proc/swaps | grep "$RESUME" | awk '{print $3}')
   [ -z "$SWAP_SIZE" ] && /sbin/swapon /dev/"$RESUME" &&  SWAP_SIZE=$(cat /proc/swaps | grep "$RESUME" | awk '{print $3}')
-  [ -z "$SWAP_SIZE" ] && exit 1
+  [ -z "$SWAP_SIZE" ] && continue
   MEM_SIZE=$(cat /proc/meminfo | awk '/MemTotal/{print $2}')
   if [ $SWAP_SIZE -gt $MEM_SIZE ]; then
     grep -q disk /sys/power/state &&  echo "disk" > /etc/sysconfig/tc.resume

--- End code ---

curaga:
Thanks for noticing where the bug is.

Continue and break though have no effect in if-conditionals; to archieve needed results, another if would prob be better:
--- Quote ------ tc-config   2009-01-22 18:19:30.000000000 +0200
+++ tc-config.new       2009-01-22 18:20:02.000000000 +0200
@@ -378,11 +378,12 @@
   RESUME=`basename $RESUME`
   SWAP_SIZE=$(cat /proc/swaps | grep "$RESUME" | awk '{print $3}')
   [ -z "$SWAP_SIZE" ] && /sbin/swapon /dev/"$RESUME" &&  SWAP_SIZE=$(cat /proc/swaps | grep "$RESUME" | awk '{print $3}')
-  [ -z "$SWAP_SIZE" ] && exit 1
+ if [ -n "$SWAP_SIZE" ]; then
   MEM_SIZE=$(cat /proc/meminfo | awk '/MemTotal/{print $2}')
   if [ $SWAP_SIZE -gt $MEM_SIZE ]; then
     grep -q disk /sys/power/state &&  echo "disk" > /etc/sysconfig/tc.resume
   fi 
+ fi
 fi
 
 if [ -n "$SECURE" ]; then
--- End quote ---

roberts:
Thanks for the input. I had not put resume on the F2/F3 screens as it was untested.
Now that we have several users who can test, this section can be implemented. Will be in 1.1rc2.

dentonlt:
Curaga - oops. Thanks for that.
Roberts - I'll be interested/happy to try it out and report back.

dentonlt:
After much mucking about, I finally got s2disk/resume working. Summary at http://forum.tinycorelinux.net/index.php?topic=455.0

In addition to the change by curaga (thanks again for that), I needed to add a mkswap call to the 1.1rc2 tc-config:


--- Code: ------ /tmp/extract/etc/init.d/tc-config Sat Feb  7 19:26:57 2009
+++ /etc/init.d/tc-config Sat Feb  7 19:03:56 2009
@@ -388,12 +395,13 @@
   rm -f /etc/sysconfig/tc.resume 2>/dev/null
   RESUME=`basename $RESUME`
   SWAP_SIZE=$(cat /proc/swaps | grep "$RESUME" | awk '{print $3}')
-  [ -z "$SWAP_SIZE" ] && /sbin/swapon /dev/"$RESUME" &&  SWAP_SIZE=$(cat /proc/swaps | grep "$RESUME" | awk '{print $3}')
-  [ -z "$SWAP_SIZE" ] && exit 1
-  MEM_SIZE=$(cat /proc/meminfo | awk '/MemTotal/{print $2}')
+  [ -z "$SWAP_SIZE" ] && /sbin/mkswap /dev/"$RESUME" && /sbin/swapon /dev/"$RESUME" &&  SWAP_SIZE=$(cat /proc/swaps | grep "$RESUME" | awk '{print $3}')
+  if [ -n "$SWAP_SIZE" ]; then
+ MEM_SIZE=$(cat /proc/meminfo | awk '/MemTotal/{print $2}')
   if [ $SWAP_SIZE -gt $MEM_SIZE ]; then
     grep -q disk /sys/power/state &&  echo "disk" > /etc/sysconfig/tc.resume
   fi 
+  fi
 fi
 
 if [ -n "$SECURE" ]; then

--- End code ---

The kernel has what it needs for resume ... but tinycore.gz needs the resume binary and some config stuff (500k+). That's a pretty hefty addition, so I can't imagine this becoming a 'stock' feature beyond the resume arg handler.

Over at the wiki, I'll thoroughly document the initrd changes I made.

Navigation

[0] Message Index

Go to full version