that it boots up properly when you take out the battery and boot up from the mains?
If so, I would say that points to a failed and dead battery. Replace the battery and see if that stops the problem.
When I start my laptop, for 4 seconds it shows a black screen, then shuts off. It repeats that process twice. I take out the battery and have it start up on just the power, but that is after the several times it doesn't start up. It will boot up, but I can't figure out why this is happening. If I don't bother it while it is doing its start up, it will take at least 3 times of starting up and shutting off to finally get the HP logo. Then the enormous time it takes for the computer to start up in general. Please help!!!