Busybox 'hwclock' bug

The busybox 'hwclock' applet is used in the 'init' script in the initramfs, however I found that it doesn't work:

# ./busybox hwclock --hctosys --localtime

hwclock: illegal option -- -
BusyBox v1.4.2 (2009-11-20 09:03:17 UTC) multi-call binary

Usage: hwclock [-r|--show] [-s|--hctosys] [-w|--systohc] [-l|--localtime] [-u|--utc]

Query and set the hardware clock (RTC)

Options:
-r Read hardware clock and print result
-s Set the system time from the hardware clock
-w Set the hardware clock to the current system time
-u The hardware clock is kept in coordinated universal time
-l The hardware clock is kept in local time


Even though I configured Busybox to accept long options, and the built-in help says it does, it actually doesn't. The fix:

hwclock -s -l

Well, to be fair, that is an old version of Busybox in the initramfs. Testing with version 1.16.0, which is in the main Quirky/Wary f.s., the long options do work.


Posted on 28 Apr 2010, 15:34


Comments:

Posted on 30 Apr 2010, 2:14 by technosaurus
busybox binaries
The busybox crew is compiling static uclibc binaries of releases (with nearly all useful applets) available here:

http://busybox.net/downloads/binaries/1.16.1/

I have a script that will make the symlinks for applets where existing versions are not already installed. At <900k with nearly every useful applet, it may be worth having it in the init and just copying it over to the file system like the kernel modules are.

My only complaint is that I think they have it configured for the "small" modutils