How should I modify it to enable A/B redundancy for rootfs?

hello actiondo,

you’ll need to create a define config and also have your own functional implementations.
for example, you may refer to add_boot_slot_suffix() function which add boot.slot_suffix=… to command line.

#if defined(CONFIG_ENABLE_A_B_SLOT)
static int add_boot_slot_suffix(char *cmdline, int len, char *param, void *priv){...}

you should have to enable BUP generation utility to create image with APP/APP_b partitions.
according to Topic 139810, please refer to a workaround to avoid the failures when running BUP generation.
thanks