Hi @nico23, and sorry for the late reply.
After checking, this is an expected behavior starting from STM32CubeMX 6.16 version. “Generate Code” option is by default greyed out with the Middleware/Packages function.
Users are able only to activate or disactivate the generation call of the code in the main.c.
There is currently no CubeMX option to independently disable the generation of the MX_FATFS_Init() implementation in fatfs.c while keeping the FATFS middleware enabled.
If you need to use your own implementation, you’ll need to avoid having two definitions of the same function, for example by using a different function name or adapting the generated code within the supported USER CODE sections.
Hope this clarifies the situation.