Specifying a custom partition for ESP8266

I’ve read everything I can find on this subject but I feel I’m missing a few bits that I hope someone can help me out with…

Using the Arduino framework;

My objective is to maximise the usable space on my esp8266 for LittleFS. I need to support OTA, I dont need EEPROM.


My sketch is ~500kb, so I was hoping to end up with a partition table that has

500kb for sketch
500kb for OTA
Rest for FS + (rfcal/wifi/system bits)

I understand the max sketch size is 1mb, but can I also use less? Or am I forced to have 1mb for sketch?

I’m currently using Arduino/eagle.flash.4m1m.ld at master · esp8266/Arduino · GitHub as my board configuration, and whilst the comments at the top show what blocks are used for what, it only really sets FS_Start, FS_End and EEPROM_Start, how does it know where the sketch, OTA and WIFI are?

Looking inside the Update.cpp for Arduino OTA updates, it looks like it starts writing the OTA’d sketch at the start of the next sector after the end of the existing sketch, meaning even if you have 1mb for sketch and 1mb for OTA, downloading a 500kb update after a 500kb sketch will not venture into the second mb of flash (ignoring where 500kb falls regarding sector boundaries, i havent worked that out)

Does that mean there isnt really a sketch and OTA partition, just one large sketch partition that needs to hav enough free space for OTA should you want to use it?