Reducing OS Boot Times for In-Car Computer Applications, Part II

May 24th, 2004 by Damien Stolarz in

Part II breaks down the boot process into nine steps and analyzes the time cost involved in each.
Your rating: None

In our last article, we discussed the motivation for wanting boot time reduction. As discussed, we are trying to create as "instantly on" an experience as we can for in-car computers. We're taking a holistic approach to the problem by looking at every place that the system delays during bootup and trying to list all our options for reducing the times in that area.

Car Stereo Boot Times

You may have noticed over the last several years that the delay has increased between when you start a car and when you hear the radio. When head units were simply analog FM and cassette adapters, music would start blaring out, at the current volume, the instant the car was started. These old stereo units had analog potentiometers for the volume control, analog tuners to get the FM signal and analog tapes that instantly started producing sound. Nowadays, a CD player/FM tuner is a mini-computer. The volume can be set to a non-blaring volume automatically between startups. The buttons and knobs now used rarely are potentiometers; they merely send plus/minus information to the tuner controls. To play a CD now requires spinning up the CD, and the firmware on these devices has to boot up, going through some sort of POST (power-on self-test). Sometimes the newest devices actually have to talk to the car's computer, adding additional delay.

There are other reasons for the increasing delay. When aftermarket amplifiers are installed in a car, you often have a staged system where the head unit turns on and sends 12 volts back to an amplifier, which then turns on, at which point you get sound. The amplifier has to charge up its capacitors and level out its power in order to produce high volume. Thus, you now have a cascading delay effect where the car turns on, then the head unit (radio) boots up, then it tells the amp to power on and then the amp boots up--thus, it takes several seconds before you hear anything. If the amp is wired to start up at the same time as the head unit, you may experience a loud pop as the amplifier pumps out transient voltages from the not-yet-powered head unit. They even sell devices that add several seconds of delay to a 12-volt line to solve these popping problems.

So while the BMW 7-series navigation unit is engineered to show a video splash within milliseconds, the norm for audio devices is to produce output after several seconds. Thus, it is reasonable to give this same leeway to an aftermarket in-car computer. However, fully booting an in-car PC can take almost a minute. The question is, how does one reduce that time?

In-Car PC Boot Time Overview

Booting many homebrew in-car PCs can take, literally, a minute. A lot of the delay results from the operating system booting or waking up from hibernation, but it's worth looking at the entire sequence to establish a baseline for the hardware we're using. For the purposes of our analysis, booting up a computer in a car consists of the following steps:

Car power stabilization: The 13.8V power line, which dips down to as low as 6V or gets cut off during engine cranking, must stabilize over 12V. This takes fractions of a second but it does take time. (Cost: ~ tens of milliseconds)

Power supply/regulator stabilization: The circuitry that powers the engine, be it a 120V inverter or a DC-DC power supply, and the associated power regulation circuitry that delivers clean 12V/5V to the computer must stabilize. Inverters can take several seconds to deliver 120V, while DC-DC boards are pretty quick. (Cost: ~ hundreds of milliseconds to seconds)

Power sequencer hits ATX-on button: This step can add time. Many motherboards now have a wake on power loss feature (technically a wake after power loss) that makes them instantly start up when power becomes available. However, many power sequencer/shutdown controllers, which make sure computers turn on and off with the car, tend to add delays to start-up. They usually give the power supply 2-3 seconds to fully stabilize its voltage at 12V; if this doesn't occur, the motherboard can hang on boot. (Cost: up to 3 seconds)

POST: The power-on self-test is the first part of the bios code. This can be reduced greatly but not eliminated by disabling memory checks, startup flash screens, floppy seeks and the like. Without getting a custom BIOS, however, this still takes time. In practice, it can be reduced on some motherboards to less than a second. (Cost: ~ 1 second)

BIOS: These are the rest of the BIOS functions that occur after the possibly necessary self-test. They include a variety of auto-configuration of plug-and-play settings, auto-detection of hard drives, power management and the dreaded DMI pool message that lingers on the screen for many seconds. This is the bulk of the pre-OS boot time. (Cost: ~ 1-10 seconds)

Bootstrap: This doesn't take long at all, but this step can vary based on the boot device. Because it could be hard drive or Flash, at the minimum you have the access time and transfer speed of the device, so it can take several tens to hundreds of milliseconds. If this is a two-staged process, as can be the case with boot loaders (that redirect from the beginning of the disk to some offset on the disk, if I understand correctly) that can add a bit more time. Although the latency of the disk or solid-state memory can change this bootstrap timing, the more important impact of changing the disk is in the boot times discussed below. (Cost: ~hundreds of milliseconds for bootstrap; tens of seconds to minutes for actual OS load)

Run boot loader: This step of the process is the first time we get to run code we may have written. In the Linux case, this would be GRUB or LILO. (Cost: less than a second)

Operating System and Drivers: This step is the long (potentially upwards of a minute) leg of our journey to a user prompt. The baseline we used when benchmarking this particular step is the venerable DOS, which boots in about the same time as the Linux boot loader. The worst case would be a full install of some operating system, un-tuned, with tons of unnecessary drivers, which could take another minute to boot. (Cost: Un-optimized, over 60 seconds. Somewhat optimized, as low as 15 seconds. Goal, less than five seconds).

Show user prompt: The OS eventually must finish booting and show the prompt, whether that is a GUI screen, a text prompt or a voice prompt for audio commands. At this point the system must be fully functional and able to accept any commands.

In-Car TiVo for Radio and Other Cron-Job Functionality

There are several good reasons to reduce boot times besides getting the system up quickly when the car starts. PVRs (personal video recorders) such as TiVo are available everywhere, but there are no good, well-integrated PMRs (personal media recorders) for in the car. Two key ingredients are needed to make this type of device work well with an in-car computer: the ability to download dynamically a list of program times; and the ability for the in-car computer to wake up on a schedule, do some work and go back to sleep.

The ability to download dynamically program times requires some sort of network connectivity. The second ingredient requires an in-car computer that can wake up when it needs to, day or night, to record a program. However, most PCs, including most small, low power motherboards that are being used for in-car PCs, take too much power even when they are sleeping. They consume 200mW of power, supplying standby power to Ethernet (for Wake-on-LAN features) to the USB ports and to whatever circuitry is needed to start the computer. This is the power equivalent of leaving the dome light on in a car, unsuitable for long use.

At CarBot we've taken the approach of reprogramming the power sequencer in order to implement a power budget. Instead of the car computer being on only when the car is on and for a short time after, the computer starts up on a schedule--in our case, every two hours--checks for Wi-Fi connectivity, downloads any new e-mail, geoblogs or software updates and takes care of any other cron-job type tasks. Because the unit uses about 1.5-2 Amps of power while running and accessing the hard disk, we've calculated that the unit can run for about 45 minutes between drives, to be ultra-conservative about not draining the car battery. As a simplified explanation, when the car is driven for roughly 15 minutes, we assume the battery has recharged and we reset the budget.

Based on a four-minute round trip cold boot->powered and checking for tasks->shutdown, the CarBot can go about 2.5 days before it must shut down for good. That means if we woke up every hour (the kind of granularity needed for PVR functionality), we would go for only 1.5 days between drives. If the driver didn't drive their car for two days (say, the weekend) and expected to have NPR waiting for her on Monday morning, it might not work out.

If we can reduce that boot time by half, we can double the frequency of startups. For a point of reference, OnStar starts up and phones home by way of the analog cellular network every ten minutes. This is because of the feature of OnStar where you can call and ask your car to be unlocked if you locked your keys inside. In order for CarBot or other in-car computers to do useful cron-job type work, the boot times need to be reduced to almost nothing, more for power reasons than time reasons. Examples of cron-job functions would be waking up and taking time lapse photographs of the environment for surveillance; waking up during the night and downloading a large batch of MP3s from the house over Wi-Fi in-car PMR; recording on-air radio; and downloading software updates blogs, news and so on, on a schedule.

In our current power budget scheme, at 2 Amps we support only 45 minutes of uptime when the car is not driving. Obviously, most radio shows last more than 45 minutes, so the current power budget is insufficient for true PMR functionality. However, by reducing boot times, using very low-power sleep modes and using low-power solid state storage instead of hard drives, we should be able to get this functionality going.

Reducing Boot Times Step by Step

Now we're going to look at each step of our boot process and see where we can shave off time.

1) Power stabilization in car: The ideal solution for this step would be to have a sleeping computer that simply woke up the moment the user started cranking the ignition. In fact, this sometimes is possible. If the aforementioned cron functionality exists in the car, the software can be programmed to learn when the daily commuter starts their car in the morning and adaptively wake up in time for the person to start their car.

2) Power supply stabilization: Because engine cranking lasts several seconds itself, starting the computer at the beginning of engine cranking can shave time off booting. This functionality requires a power supply that can survive engine cranking, such as the Morex 80W power supply.

3) Power sequencer hits ATX button: There are two common approaches to starting an ATX-based computer. One is wake-on-power-loss feature, available in many motherboard BIOS settings. When the board loses power for any reason, it reboots when power is reapplied. This is fairly low-latency, but measurements show it still runs on the order of a second. An ideal situation would be to go back to the old AT days where power-on automatically would boot the PC; alas, those days are gone. Even if the ATX power supply is shorted (purple to ground) to automatically power itself up, the motherboard does not automatically power up unless the power switch is hit. This is the other approach, and power sequencer boards such as the ITPS from Mini-Box can connect to the power header on the motherboard and press the switch when the car's accessory power (key on) is activated. However, the drawback of these systems is they add their own delays, both to help with 2) (waiting until a smooth 12V is achieved) and waiting for the ignition cranking to stop. For instance, this ITPS sequencer has exactly three seconds of additional delay from key on to pressing the computer's power switch. To alleviate this delay, the firmware on this ITPS can be reprogrammed, which we've done, and the wake-on-power-loss feature can be used instead.

4) Power-on self-test (POST): There's not much to be done about POST without replacing the BIOS. With a BIOS replacement, memory testing and initial board diagnostics can be exactly controlled. However, it is a good idea to have a hardware test when any system boots up to determine properly if it's safe to go on booting. You wouldn't want to get in an undefined state that drained the car's battery, for instance, and part of controlling what state the machine gets into is making sure it is working. POST generally takes a second, and for our purposes we assume that even if we reprogrammed the BIOS we would not completely eliminate POST.

5) BIOS: This part of the boot process can take 2-10 or more seconds to complete, because of all the mostly unnecessary functions it performs. We've already been able to get it down to several seconds by disabling any unused devices and disabling auto-detection of any kind. However, because the OS simply reinitializes all the devices anyway, this time should be zero.

Several BIOS replacements were found in the process of trying to get the boot times down, including Linuxbios, Tinybios, General Software's embedded BIOS 4.3/2000 and Phoenix's embedded BIOS.

The most interesting candidate for BIOS replacement is, of course, from linuxbios.org, which uses it for bootstrapping nodes in a high-performance computing environment. The Epia-M motherboards we are using are one of the more popular boards they support. The Tinybios option would cost us about $3000, but it also looked extremely promising from a time reduction standpoint. This link from 2001 documents merely 800ms from power up to LILO using General Software's embedded BIOS. Both General Software and Phoenix BIOSes look increasingly more expensive (judging from their Web sites; I haven't received pricing yet), but so did the original $10,000 quote we got when we asked one company if they could help us boot Linux faster. So we're getting better.

Some vendors are giving up on the OS altogether and putting application functionality into the BIOS itself. This article on LinDVD is a Linux-flavored example of a general trend to replace the PC BIOS. And that may be the approach we eventually have to take. If we simply took the GRUB boot loader and added a splash screen, sound drivers, an MP3 player and a DMR, we would be pursuing a similar path to other pre-OS multimedia environment vendors.

In the research for this article, I learned of a general desire to replace all PC BIOS with some more modern firmware. The Extensible Firmware Interface has been introduced by Intel and other vendors and is available on some boards. I imagine, however, this would tend in the direction of lengthening boot times with more digital-rights management, diagnostics and other bric-a-brac instead of helping our goals of creating an embedded system.

6) Bootstrap from disk: This particular step is noted mostly because the disks can vary in speed and because parts of the OS might be able to be crammed into the BIOS chip itself. However, the fractions of a second that can be recovered at bootstrap are less useful than the many tens of seconds that can be reduced through improving the speed of storage device during OS load (see 8) below).

7) Run boot loader: This is the beginning of our journey into OS code. Although the boot loader is strictly not the OS, it was found in testing that boot times for Win98 DOS are almost identical to the boot times for GRUB. In fact, over several tests with our hardware, we got about 13-14 seconds from power on to a GRUB screen or DOS prompt.

Looking at it another way, ignoring the OS, GRUB is actually our first chance to do some useful work for the end user. Several eye candy solutions for Linux boot screens were found for LILO, and I'm sure GRUB has some of the same. Adding only the EPIA-M sound driver, it would be possible to emit both a product splash screen and start playing some music--either off the disk or canned--while the OS loaded.

Using DOS boot times as the baseline, we found that it should be possible to get the system displaying an image and playing sounds within approximately 15 seconds of boot, without any of the aforementioned BIOS time reductions.

8) OS load all drivers: After all the prior optimizations, we have to look at how actually to get the system up and fully running by booting the operating system. One question yet unsolved is that if we use a boot loader hack to get audio playing, we may not be able to keep audio playing without interruption. The solution to this is instead of shoving the OS functions into the BIOS or the boot loader, we keep them where they belong while starting the essential (video and sound) services first. So there are two aspects involved. One, because we have a controlled hardware configuration, we can create a deterministic boot process, analyze it carefully for dependencies and parallelize boot tasks that don't depend on one another. Two, because we need splash screens and sound as soon as possible, we would put these as early in the boot process as possible and perhaps finish the booting process as a lower priority task.

An IBM article written by James Hunt documents how to speed up the Linux boot process by parallelizing dependencies in the boot process. This article confirmed my long-held suspicions that the computer was sitting there waiting for much of the boot process.

On the vendor-supplied front, FSMlabs documents a 200ms boot until user code execution with its optimized Linux boot. However, FSMlabs are focused on delivering Linux with a hard real-time kernel, something we don't need. They were one of the two vendors that offered to solve our problem for $10,000, a rather steep budget for a solution that would be tied to the particular hardware we were using.

And for our motherboard in particular, Mini-box provides a fine-tuned Linux distribution that suppresses all text output and goes straight to an OS prompt. We purchased and tested their distribution. Out of the box, it did a full Linux boot--all drivers for our board--to a prompt in less than 30 seconds. Unfortunately, this still isn't quick enough for our needs, so we're going to need to optimize further, as well as adding video display to the booting process.

9) Show user prompt: The system can't be considered booted until it stops thrashing and can provide uninterrupted functionality of all applications. If the boot process is going to make the MP3 playback sound choppy, then it's going to need to be modified to take a lower priority than the sound driver. However, if the user immediately tries to have their e-mail read to them or tries to activate a GPS, the illusion of readiness provided by getting audio and splash screens up quickly is be broken. Thus, the entire boot process must be fast enough. Getting the user prompt available (or its equivalent, such as a menu, or a spoken "I'm ready to accept input" for voice activated systems), is the primary concern of the system. Although this is easy to do for a single-purpose embedded computer, such as a navigation system, the real challenge of our system is to get a general purpose computing device to behave like an embedded device.

Conclusion

In this second installment, we explored the methodology we've been using to attack the boot time reduction problem. I've split the boot process up into about nine steps, analyzing each, and assessed how much it will cost me in development time and in licensing fees to cut down the time for that step. I have sent e-mails out to the least expensive and most relevant vendors (LinuxBios, General Bios), and I'm working on how quickly we can get our car PC unit booted.

In Part III, I will summarize the boot time reducing solutions I have found and will report on the boot times we've achieved on our hardware.

Damien Stolarz is an, inventor, writer and engineer with years of experience making different kinds of computers talk to one another. He is the CEO of Carbot, Inc., an in-car computer company, and Robotarmy Corp., a networking software development house.

__________________________


Special Magazine Offer -- Free Gift with Subscription
Receive a free digital copy of Linux Journal's System Administration Special Edition as well as instant online access to current and past issues. CLICK HERE for offer

Linux Journal: delivering readers the advice and inspiration they need to get the most out of their Linux systems since 1994.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

How about with Hybrid vehicles. They have over 120 High Quality rechargable batteries, more than enough to restart the car instantly. They already are full of computers for other things, like controling the power supply itself. (In banks of 20).
In near future all cars will have more than enough power to boot up the sloppiest pc hardware and keep it running long after engine is shut off.

how about running the in-car computer on batteries?
When you shut down the computer, the OS would be put in standby mode. For extended period like 12 hours, just swap the memory on the hard drive (hibernate) then shut off totally (like you can set a battery drain threshold in linux and then use apm...). Then once the car startsup, you can recover almost immediately. The battery would be charged when the car is on.
The idea is the OS is always running and the power usage is minimum when no display and devices are powered and the cpu stepped to its lowest frequency.
My 2 cents.

Franck Rougier
promo at ptronsys dot com

Hi, sorry for my english!
- If you boot when You open the door (maybe with the remote too)?? You can gain some second.
My car turn the dome light and the main cockpit on, when I open the door.
- If You disjoin the main battery during engine cranking with an auxiliary power supply??
Like an auxiliary battery or something more complex like this:
a) A first switching unit that rise the voltage from 12 to something very high (120V? 1200V or more?).
b) A big high voltage capacitor (high voltage=high mAh).
c) A second switching unit for fall back to 12V (etc..)
This could supply the power for some second??
I don't really known if this works, but...

andrea.diodato@farma3.it

I was thinking of using the flashing of the tail lights to power up the computer. Most cars today have a remote to unlock the doors. The flashing lights would be more than enough to kick off the boot. IF you do it from the other side of the parking lot your system would be ready as soon as you sat down.

Andrea,

You're totally correct. Some of the power supplies raise the power so that it doesn't fall low enough during cranking. The real solution is a laptop battery circuit for the car computer itself, which I'm considering. These batteries only last a couple of years so I'm trying to avoid that.

Also, the door-opening idea is fantastic.

-damien

Levi Hall's picture

I've been thinking about usin

On February 3rd, 2005 Levi Hall (not verified) says:

I've been thinking about using a UPS to handle the cranking spike

Batteries

Most batteries only last a few years, even the traditional lead acid car battery.

So you could put in to the car, adjacent to the standard battery an inexpensive battery (maybe also lead acid), say of the type used for push bike lights.

Grab a battery with an expected life equivilant to / a little longer than the car's main battery, and replacing it would form part of the normal car maintanence.

It however should only be required during the cranking of the car engine, so it would not require lots of capacity.

Alternatively, you could increase the second batteries capacity, using it for to increase the pc's duration for the downloading emails etc.

Also, to assist with battery durations.
You have a computer, a battery, fuel, and a generator (engine).

If your battery time is running low, start the engine, and use it to re-charge your battery.

Of course, you'd have to have faith in your engine's ability to start unattended, and keep an eye on the fuel levels.

Anonymous's picture

Why not use a UPS to power th

On April 13th, 2005 Anonymous (not verified) says:

Why not use a UPS to power the PC? The ups can be charged by either a DC/AC inverter or (if it is 12V) by the car's main battery. Just use some high curent diodes so the car will charge the UPS and not the UPS charge the car. The UPS will turn the PC off if it's battery loses power and the car's batery will never be touched.

You could fit a deep-cycle battery, such as is used for caravan/RV power, and a split-charging relay. This would power the PC for about an hour without touching the "main" battery.

This is pretty much the setup that emergency service vehicles use for RT, warning lights and other electrical accessories.

Gordonjcp.

Kurt Catania's picture

powering an in car pc diuring cranking

On August 17th, 2005 Kurt Catania (not verified) says:

Hi guys, i managed to keep my pc started diuring cranking by using a battery isolator(actually two diodes of 150Amps each) and two batteries, one in front 55Ah and one at the back of 100Ah, i start from the front (55ah) leaving the one at the back (100ah) untouched for the pc to boot from. thus i can leave my rear battery drain out with the pc (~200w) and the sound at full volume (~400w rms) and start the engine w/o problems from the fully charged front battery.
this should solve your problem of power. btw if you have an alarm you can use its central locking output to togle the atx button for on or off

Do you guys know how to install a car radio in a pc?

Anonymous's picture

Chinese mini-PCs run Linux, target specialty apps

On January 14th, 2006 Anonymous (not verified) says:

A systems integrator in GuangDong province, China, is shipping an extensive line of Pentium-based miniPCs that run Linux. The SD-Omega MiniPC line comprises 44 variations, include passively cooled and quiet models targeting car PCs and HTPCs (home-theater PCs), car pcs, and DVR models.

More details from Linuxdevices.com, http://www.linuxdevices.com/news/NS3892602873.html

Additional details are available at the SD-Omega mini pc website,http://www.sd-omega.com

Post new comment

Please note that comments may not appear immediately, so there is no need to repost your comment.
The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd> <i> <b>
  • Lines and paragraphs break automatically.

More information about formatting options

Newsletter

Each week Linux Journal editors will tell you what's hot in the world of Linux. You will receive late breaking news, technical tips and tricks, and links to in-depth stories featured on www.linuxjournal.com.
Sign up for our Email Newsletter

Tech Tip Videos

From the Magazine

July 2009, #183

News Flash: Linux Kernel 3.0 to include an on-the-go Expresso machine interface! Ok, maybe not, but Linux is definitely going mobile, from phones to e-readers. Find out more inside about Android, the Kindle 2, the Western Digital MyBook II, The Bug, and Indamixx (a portable recording studio). And if you've gone mobile and you been wanting more Emacs in your life then check out Conkeror.


To compliment the mobile we've got the stationary: parsing command line options with getopt, checking your Ruby code with metric_fu, and building a secure Squid proxy. How is this stationary you ask? What can we say? It's not. We just wanted to see if anybody actually read this part of the page :) .


All this and more, and all you have to do is get your hot sweaty hands on the latest copy of Linux Journal.





Read this issue