For 12V DC voltage, two diodes can be connected in series at the positive output end (the current should be adapted to the needs), so that the voltage is reduced to 10V, followed by two equivalent resistors in series, and the output is positive or negative 5V. The current flowing through the resistor is larger than the current required by the load behind, so that the output voltage is more stable.
The two resistors can be replaced by two regulator tubes (voltage regulator value is 5V), and the two diodes in front can be replaced by a resistor.
Two resistors can also be used two integrated voltage regulator circuit 7805, 7905 generation, two diodes are not needed, because the front input voltage is only 2V higher than 10V, should be higher than 4V to meet the requirements.
As for the power supply of 5V, it has to go through the inverter to AC, and then boost the voltage and rectify to achieve it, which is more troublesome.