can I write a piece of code that enables serial port and camera without using raspi-config? I would like to auto-config modules without manually using raspi-config to do so.
raspi-config
is a bash script, so you can read it with a text editor.
The file can be found here /usr/bin/raspi-config
But there is no need to do a C program, you could simply use the bash script and tweak it after your needs.
-
1Or use raspi-config in non-interactive mode, by calling it with command-line parameters. – Dirk Nov 11 '20 at 18:48
Yes you can.
Look at what raspi-config does and convert those actions to the programming language of your choice.
raspi-config
does is call binaries (that were mostly written in C); you either re-write all that or just make bunches ofsystem()
or fork/exec calls. The only reason to want to do that is because C is the only language you know -- which is fair enough, but a shell script to do this would be very, very simple, especially since you can get the content from theraspi-config
source (it's a shell script). – goldilocks♦ Nov 11 '20 at 19:25