Circling back to this to close off the thread with an answer at least.
Here are the changes I used to convert the bootloader codebase to build for 168p.
Note that this change set is not complete enough to fully handle choosing between either MCU - some changes will become hard coded for 168 instead of 328 so it would not be suitable as a formal submission as it is. Unfortunately I got busy and now also have plenty of 328s back in my inventory. Also I cannot guarantee it's 100% correct but it seems to work well for me on the ~8 nodes I've used it on:
--- MySensorsBootloaderRF24/boards.txt 2020-10-14 22:50:32.182131357 +1030
+++ MySensorsBootloaderRF24.at168clean/boards.txt 2020-10-14 21:34:35.482909793 +1030
@@ -1,18 +1,18 @@
## Add these lines to your boards.txt file in the Arduino installation directory
##
-## Arduino Pro or Pro Mini (3V3 & 5V, 1 - 16 MHz) w/ ATmega328 MYSBootloader
+## Arduino Pro or Pro Mini (3V3 & 5V, 1 - 16 MHz) w/ ATmega168 MYSBootloader
## -------------------------------------------------
menu.frequency=Frequency
-MYSBL.name=ATmega328 with MYSBootloader 1.3.0
+MYSBL.name=ATmega168 with MYSBootloader 1.3.0
MYSBL.upload.tool=avrdude
MYSBL.upload.protocol=arduino
MYSBL.upload.maximum_size=30720
MYSBL.upload.maximum_data_size=2048
MYSBL.bootloader.tool=avrdude
-MYSBL.build.mcu=atmega328p
+MYSBL.build.mcu=atmega168p
MYSBL.build.board=AVR_UNO
MYSBL.build.core=arduino
MYSBL.build.variant=standard
diff -u MySensorsBootloaderRF24/Core.h MySensorsBootloaderRF24.at168clean/Core.h
--- MySensorsBootloaderRF24/Core.h 2020-10-14 22:50:32.181131338 +1030
+++ MySensorsBootloaderRF24.at168clean/Core.h 2020-10-14 22:52:38.760633493 +1030
@@ -14,8 +14,8 @@
#define MYSBOOTLOADER_VERSION ((MYSBOOTLOADER_MINVER << 8) + MYSBOOTLOADER_MAJVER)
// size setting ********************************************************************************************************
-#define BOOTLOADER_SIZE (2048)
-#define BOOTLOADER_START_ADDRESS (0x8000 - BOOTLOADER_SIZE)
+#define BOOTLOADER_SIZE (1024)
+#define BOOTLOADER_START_ADDRESS (0x4000 - BOOTLOADER_SIZE)
// DEBUG led patterns *************************************************************************************************
diff -u MySensorsBootloaderRF24/Definitions.h MySensorsBootloaderRF24.at168clean/Definitions.h
--- MySensorsBootloaderRF24/Definitions.h 2020-10-14 22:50:32.181131338 +1030
+++ MySensorsBootloaderRF24.at168clean/Definitions.h 2020-10-04 23:30:41.494466259 +1030
@@ -9,7 +9,7 @@
#define Definitions_H
#define FIRMWARE_BLOCK_SIZE (16)
-#define EEPROM_SIZE 1024 // 1024 bytes for ATMEGA328
+#define EEPROM_SIZE 512 // 512 bytes for ATMEGA168
#define false (0)
#define true (1)
diff -u MySensorsBootloaderRF24/Makefile MySensorsBootloaderRF24.at168clean/Makefile
--- MySensorsBootloaderRF24/Makefile 2020-10-14 22:50:32.181131338 +1030
+++ MySensorsBootloaderRF24.at168clean/Makefile 2020-10-14 21:43:48.433871688 +1030
@@ -1,6 +1,6 @@
PROJECT = MYSBootloader
-MCU = atmega328p
+MCU = atmega168pa
CLK = 1000000L
BAUDRATE = 9600
@@ -8,16 +8,16 @@
ISP_PORT = com5
ISP_SPEED = $(BAUDRATE)
ISP_PROTOCOL = stk500v2
-ISP_MCU = m328p
-ISP_HFUSE = DA
-ISP_LFUSE = F7
-ISP_EFUSE = 06
+ISP_MCU = m168p
+ISP_HFUSE = DD
+ISP_LFUSE = FF
+ISP_EFUSE = F8
ISP_ARGS = -c$(ISP_PROTOCOL) -P$(ISP_PORT) -b$(ISP_SPEED) -p$(ISP_MCU)
BINPATH = /usr/bin/
CFLAGS = -funsigned-char -funsigned-bitfields -DF_CPU=$(CLK) -DBAUD_RATE=$(BAUDRATE) -Os -ffunction-sections -fdata-sections -fpack-struct -fshort-enums -mrelax -Wall -Wextra -Wundef -pedantic -mmcu=$(MCU) -c -std=gnu99 -MD -MP -MF "$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -MT"$(@:%.o=%.o)"
-LDFLAGS = -nostartfiles -Wl,-s -Wl,-static -Wl,-Map="$(OutputFileName).map" -Wl,--start-group -Wl,--end-group -Wl,--gc-sections -mrelax -Wl,-section-start=.text=0x7800 -mmcu=$(MCU)
+LDFLAGS = -nostartfiles -Wl,-s -Wl,-static -Wl,-Map="$(OutputFileName).map" -Wl,--start-group -Wl,--end-group -Wl,--gc-sections -mrelax -Wl,-section-start=.text=0x3800 -mmcu=$(MCU)
all: clean out
Hopefully this helps someone...
Cheers
Charles