PS: we have many #if CONFIG is the fastboot source code
they can be replaced by CONFIG_IS_ENABLED macro and
__maybe_unused in .h and .c ?
and that avoids the compilation issue => let the linker
remove the used functions
for example
enum {
FASTBOOT_COMMAND_GETVAR = 0,
FASTBOOT_COMMAND_DOWNLOAD,
CONFIG_IS_ENABLED(FASTBOOT_FLASH, (FASTBOOT_COMMAND_FLASH,))
CONFIG_IS_ENABLED(FASTBOOT_FLASH, (FASTBOOT_COMMAND_ERASE,))
FASTBOOT_COMMAND_BOOT,
FASTBOOT_COMMAND_CONTINUE,
FASTBOOT_COMMAND_REBOOT,
FASTBOOT_COMMAND_REBOOT_BOOTLOADER,
FASTBOOT_COMMAND_REBOOT_FASTBOOTD,
FASTBOOT_COMMAND_REBOOT_RECOVERY,
FASTBOOT_COMMAND_SET_ACTIVE,
CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_FORMAT,
(FASTBOOT_COMMAND_OEM_FORMAT,))
CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_PARTCONF,
(FASTBOOT_COMMAND_OEM_PARTCONF,))
CONFIG_IS_ENABLED(FASTBOOT_CMD_OEM_BOOTBUS,
(FASTBOOT_COMMAND_OEM_BOOTBUS,))
CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT, (FASTBOOT_COMMAND_ACMD,))
CONFIG_IS_ENABLED(FASTBOOT_UUU_SUPPORT, (FASTBOOT_COMMAND_UCMD,))
FASTBOOT_COMMAND_COUNT
};
...
ommands[FASTBOOT_COMMAND_COUNT] = {
[FASTBOOT_COMMAND_GETVAR] = {
.command = "getvar",
.dispatch = getvar
},
[FASTBOOT_COMMAND_DOWNLOAD] = {
.command = "download",
.dispatch = download
},
CONFIG_IS_ENABLED(FASTBOOT_FLASH, (
[FASTBOOT_COMMAND_FLASH] = {
.command = "flash",
.dispatch = flash
},
[FASTBOOT_COMMAND_ERASE] = {
.command = "erase",
.dispatch = erase
},
))
....
staticvoid__maybe_unused erase(char*cmd_parameter, char*response)
{
if(CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC))
fastboot_mmc_erase(cmd_parameter, response);
if(CONFIG_IS_ENABLED(FASTBOOT_FLASH_NAND))
fastboot_nand_erase(cmd_parameter, response);
}