German automakers and politicians have come to an agreement to cut emissions by updating the software of 5 million diesel cars.