Tesla’s Model X crossover. The company has reached a deal with Panasonic to build its “gigafactory,” needed to make electric-car batteries at scale. (Photo courtesy teslamotors.com.)

Tesla Motors and Panasonic have confirmed a partnership that will let Tesla share the cost of its plans to ramp up electric-vehicle production, moving the electric car maker’s much-vaunted “gigafactory” one step further past the idea stage, ahead of its second-quarter earnings report.

Panasonic has agreed to help build the gigafactory, a giant battery making facility that the high-flying California electric car manufacturer needs to deliver on its promised growth. The deal was leaked in reports that surfaced a few days ago.

Panasonic’s part in the deal entails building cylindrical lithium-ion cells and providing the equipment and necessary machinery and tools.  By 2020, the planned gigafactory will produce enough cells for 500,000 vehicles, Tesla has said, more than the entire existing global production. It could cost as much as $5 billion to build. Panasonic’s financial contribution, according to Forbes, is expected to start small – $200-$300 million – but will add up to about one-fifth of the factory’s total costs.

More: These 3 Charts Show How Electric Cars Will Dominate the Market 

The gigafactory will allow Tesla to produce less expensive batteries for electric cars, helping the company move from selling coveted machines with a sticker price over $70,000 toward becoming a household name.

Tesla stock shares closed at $228.92 on Wednesday, up 1.74 percent in anticipation of the company’s second-quarter earnings report, expected after market close Thursday. Shares in Tesla are riding high, up from $150.43 at the beginning of the year and up 500 percent in the last 18 months. Investors are betting Q2 earnings will deliver impressive results. The biggest question for investors is “can Tesla keep it this up?” If results come in under analysts’ sales forecast of $824 million, it won’t take much to push people to sell.

The final wild card in the current game of Tesla is the highly anticipated Model X. The company halted production of its Model S sedan on July 21 to gear up its assembly line to start making the crossover SUV. The company is spending $100 million to retool the Fremont, Calif., factory for production of multiple vehicles at the same time, which is critical to its ambition to become a mainstream car seller with a multi-vehicle lineup. Production there was set to resume in two weeks.