IMU yaw orientation aligment?

Hello,

How does the ardupilot achieves to correct YAW aligment for the IMU (accelerometers mainly)?
Accelerometer calibration seems to do only offset and scaling fit on X,Y and Z axes. However this doesn’t align sensor forward axis with the frame forward axis. Is this error corrected by EKF? Anyway this could cause drifting from wanted direction at beginning of the flight before EKF has converged that error?

Is there a way to correct this by parameter or by a calibration?

IMU (Accelerometer) can be offset compared to actual housing “forward” direction, as seen on the image below.

These IMU’s are mounted on that soft damping material, but the IMU PCB is not always aligned correctly.

The error in the image below is extrapolated, but shows the issue that a IMU rotational (yaw) alignment error could cause. I’m not sure if this is true, but please correct me if not. This error goes away after a while on air as it seems that EKF corrects this. However at beginning of the flight the behavior is horrible as pilot doesn’t have precise control due to this drifting.