2010年12月1日 星期三

Make Beagleboard to Be Hibernated

Previously, there's a Japanese company called Ubiquitous. It achieves very impressive demo which makes machine's boot time as one second. Its primitive idea is based on hibernation. IMHO, this solution is not _generic_ enough. It means that, the porting for platform would take a lot of effort. So it might be better to use more generic solution to achieve hibernation.

However, Hiroshi did a good job on improving boot time for Meego platform.
He gave a talk on LinuxConf in Japan. After his experiments, the boot time could be reduced about 3 seconds at some certain points.

http://www.slideshare.net/doyu/improving-meegobootuptime

or you can build the slide locally:

git clone git://gitorious.org/improving-meego-boot-up-time/t2t.git

Fortunately, his target platform is N900 whose CPU core is also ARM cortex A8 (OMAP3430). So, Beagleboard should be worked on hibernation. After some modification, either SWSUSP or TuxOnIce can work on Beagleboard.

Here is the result:

root@beagleboard:~# echo disk >/sys/power/state
[ 97.613098] Initiating a hibernation cycle.
[ 97.617980] Failed to launch userspace program '/usr/local/sbin/tuxoniceui_text': Error -2
[ 97.626403] Launch userspace program failed.
[ 97.630767] Freezing processes & syncing filesystems.
[ 97.635864] Stopping fuse filesystems.
[ 97.639648] Freezing user space processes ... (elapsed 0.00 seconds) done.
[ 99.313568] Stopping normal filesystems.
[ 99.379211] Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done.
[ 99.435852] Preparing Image. Try 1.
[ 99.440734] Restarting normal filesystems.
[ 99.466796] Stopping fuse filesystems.
[ 99.470611] Freezing user space processes ... (elapsed 0.00 seconds) done.
[ 99.532409] Stopping normal filesystems.
[ 99.590179] Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done.
[ 99.651702] Starting to save the image..
[ 99.655670] Writing caches...
[ 100.171966] ...20%...40%...60%...80%
[ 102.023406] Doing atomic copy/restore.
[ 102.027221] Suspending console(s) (use no_console_suspend to debug)
[ 102.906646] nand_resume called for a chip which is not in suspended state
[ 102.939483] Post atomic.
[ 102.942047] Writing kernel & process data...
[ 103.593719] ...20%...40%...60%...80%
[ 104.767242] Power down.
[ 104.769897] System halted.

[ 14.434020] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 1
[ 14.443267] TuxOnIce 3.2-rc2 (http://tuxonice.net)
[ 14.449829] TuxOnIce: Image found.
[ 14.982788] Failed to launch userspace program '/usr/local/sbin/tuxoniceui_text': Error -2
[ 14.991149] Launch userspace program failed.
[ 14.995513] Stopping fuse filesystems.
[ 14.999328] Freezing user space processes ... (elapsed 0.00 seconds) done.
[ 15.006591] Stopping normal filesystems.
[ 15.010559] Freezing remaining freezable tasks ... (elapsed 0.00 seconds) done.
[ 15.032104] Reading kernel & process data...
[ 15.420349] ...20%...40%...60%...80%
[ 15.822692] Atomic restore.
[ 15.825622] Doing atomic copy/restore.
[ 15.829376] Suspending console(s) (use no_console_suspend to debug)
[ 16.302551] omapdss DISPC error: SYNC_LOST, disabling LCD
[ 16.849487] nand_resume called for a chip which is not in suspended state
[ 17.184478] Post atomic.
[ 17.187103] Reading caches...
[ 18.130859] ...20%...40%...60%...80%
[ 18.612609] Cleaning up...
[ 18.616302] Restarting all filesystems ...
[ 18.620452] Restarting tasks ... Restarting tasks ... done.
[ 18.679138] TuxOnIce debugging info:
[ 18.679138] - TuxOnIce core : 3.2-rc2
[ 18.679168] - Kernel Version : 2.6.32.9-g25bf98b-dirty
[ 18.679168] - Compiler vers. : 4.4
[ 18.679168] - Attempt number : 3
[ 18.679168] - Parameters : 0 667648 0 0 0 0
[ 18.679199] - Overall expected compression percentage: 0.
[ 18.679199] - Compressor is 'lzo'.
[ 18.679199] Compressed 52920320 bytes into 16659760 (68 percent compression).
[ 18.679229] - Block I/O active.
[ 18.679229] Used 4110 pages from swap on /dev/......
[ 18.679229] - Max outstanding reads 404. Max writes 195.
[ 18.679229] Memory_needed: 1024 x (4096 + 200 + 72) = 4472832 bytes.
[ 18.679260] Free mem throttle point reached 0.
[ 18.679260] - Swap Allocator enabled.
[ 18.679260] Swap available for image: 34136 pages.
[ 18.679290] - File Allocator active.
[ 18.679290] Storage available for image: 0 pages.
[ 18.679290] - I/O speed: Write 12 MB/s, Read 22 MB/s.
[ 18.679290] - Extra pages : 0 used/2000.
[ 18.679321] - Result : Succeeded.
root@beagleboard:~#

Obviously, the boot time has a lot of space to improve. But it a first step to hack hibernation. And thanks Hiroshi's suggestion to make this working. :)

2010年7月13日 星期二

Power is not enough

Eventually, I got damn-spare time to post something interesting.
Last update was posted in the last year. It's so obvious to see
how busy/lazy I was in the past half year.

Tick and I are managed to build a robot project based on Beagleboard. We plan to share this project and concepts behind this on the event of COSCUP.

Well, I can say so far, the most tough work is not writing software to control robot. Instead, it's all about hardware such as providing power to servos. The ultimate goal is to make everything on robot wireless such as communication and power supply. Of course high capacity battery becomes the only option. Initially, we tried Ni-MH battery bought from RC car store. Even battery is full, it can't drive all revolute joints (servos). So we need plan B. :(

Occasionally, I found lead acid battery might be the candidate. After go shopping in the Guang-Hua market, Its voltage and capacity and size are all satisfied with our requirement. Most of important, it could drive all servos, totally 18 servos. Here is snapshot of the battery and debut robot.