Petrol engines are easy. There is a wide choice of aftermarket ECUs to make them run, From open source megasquirt to Haltech, Emerald, Weber etc etc etc.
It is the CDI bit that is hard to do.
The reason for this is simple when you think about it. A petrol EFI system throws a bit of fuel in every now and then (*) but late CDi engines use a short pre-injection followed by a number of very quick pulses of fuel at precise timings. This gives you a smoother burn and reduces the horrible combustion noise of high-pressure diesels. The timing of all this happens in a very, very short window which is why such high-tech injectors are needed
The diesel setup has to do all this within a 3D map and also manage boost and waste gate timing, manage torque output in low gears to stop blowing up the gearbox, manage torque output during shifts with autoboxes, manage idle & engine speed when the a/c kicks in & out, manage EGR, manage variable valve timing, manage rail pressure, & etc & etc
Manufacturers and the aftermarket have had years to come up with solutions for petrol engines. But modern diesels are serious high-tech sh*t and need lots of management to stop them going bang expensively
A friend has just spent about four months (hopefully) getting to the bottom of a fault on a Citroen HDi engine. It has at least two fuel pressure sensors, two fuel pumps, a fuel pressure regulator, two temp sensors, no MAF (strangely) and all the other sensors. When it refuses to run the ECU stores no fault codes so diagnosis is nigh-on impossible
I'd love a W124 E320 CDi but will wait for someone very clever (and with deep pockets) to make a kit of parts
* slight oversimplification
Nick Froome