[Gta04-owner] initrd proposal for low battery boot
Andreas Kemnade
andreas at kemnade.info
Sun Dec 8 23:19:36 CET 2013
Hi,
On Sun, 8 Dec 2013 21:30:51 +0100
"Dr. H. Nikolaus Schaller" <hns at goldelico.com> wrote:
> Hi,
>
> Am 08.12.2013 um 21:08 schrieb Josua Mayer:
>
> > Hi
> >
> > Am 02.12.2013 07:41, schrieb Andreas Kemnade:
> >> Hi,
> >>
> >> here is my proposal for an initrd script for low battery boot.
> >> It waits with boot until battery voltage is over 3.45 V,
> >> switches the charging to linear charging while doing that.
> > I personally like this idea very much. But I would probably also want to use this for charging without booting e.g. when there is no working OS installed.
>
> Well, you always need a kernel and some root file system to control the charger.
> The only alternative were to enable charging very early in MLO or U-Boot [1] but that would lack a lot of options that can be done by the kernel and by scripts.
>
> >> In automatic charging the charger limits the usb current
> >> (not the charging current!) to 100mA if the battery voltage is below
> >> some certain level (if it is even lower, the device turns off automatically)
> >>
> >> The result is that I never had any boot failures after the kernel starts due to
> >> low battery while the charger is attached.
> >> I put it into an initrd so there are no delays because of log-replaying on
> >> the rootfs.
> >> It works with the klibc environment and excepts fb0 and the rootdevice available in /dev.
> >>
> >> URLs:
> >> script:
> >> http://misc.andi.de1.cc/linuxrc-gta04
> >>
> >> fb background set quickhack:
> >> http://misc.andi.de1.cc/fillfb.c
> >>
> >> it can be compiled using klcc -o fillfb killfb.c
> >> so that it uses the klibc (which is used in initramfs environments)
> > But I am missing the ability to use this now. It would be nice if you could publish a built initrd that can be directly used or the instructions how to produce one.
> > The biggest issue for me though is to find out how to have the initrd loaded by u-boot(bootargs.scr additions?).
>
I can probably do this. The original intention was that distribution
developer can build it into their already existing initramfs setups
> I think you just have to modify your /etc/init.d files. I.e. nothing to compile. AFAIK, the init process will just run his script very early during the boot process.
> When I find some time we can test and add it to the Debian-Wheezy config [2].
>
There is one problem with /etc/init.d. If you boot with low battery,
you will probably have a filesystem in an unclean state. That means that
the initial mount might take a long time since it replays the journaling
logs of the filesystem (also if it is mounted readonly!) to bring it
into a consistent state. This happens before anything in /etc/init.d is
executed.
But if it is in initramfs, it is executed before the initial root mount,
so that problem does not exist.
Greetings
Andreas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20131208/a95d2e08/attachment.bin>
More information about the Gta04-owner
mailing list