I don’t think it’s possible to disable it with a kernel compile. We have 10 cent embedded chips that support ipv6. So I’m not really sure what the ask is here.
Footnote on the gain of disabling ipv6 on ESP32: * Disabling CONFIG_LWIP_IPV6 can save about 39 KB for firmware size and 2 KB RAM when the system is powered up and 7 KB RAM when the TCP/IP stack is running. If there is no requirement for supporting IPV6, it can be disabled to save flash and RAM footprint.