No, not latest source. I think, I started with 4.6 version and did several modifications. My version is probably little bit far from actual official optiboot. I missed the switch -mrelax because I'm using gcc 4.7.2 for the years, since Arduino IDE 1.0.6 was released. This version of IDE uses gcc 4.3.2 which was very old at this time. So, I replaced the whole AVR toolchain with gcc 4.7.2 to be same as Atmel Studio 6.1 has.
I don't want to critize the Arduino 1.6.x versions but the reason why I'm not using it is that there is a lot of bugs and the changes in SW don't offer me a benefit concerning to ATmega. I have modified core for my needs focused mainly to a size.
I know about the difference in size of UNO bootloader: official 464 vs mine 488. I cannot say why at now. I have a dozen genuine UNOs but never changed the bootloader and I would use original in case. Mainly I am interesting in 1284P. I have my own variant. My bootloader allows to upload into EEPROM and reads the fuses and lock etc. to utilize 1kB of boot space.
Here is a snippet for a fuses and lock.
/* STK500 Universal Command */
} else if(ch == STK_UNIVERSAL) { // universal command - fuse & lock bits
#if defined(BIGBOOT)
/* read fuse and lock bits; it takes additional 80 bytes */
uint8_t ucb1 = getch(); // universal command byte 1
uint8_t ucb2 = getch(); // universal command byte 2
getNch(2); // discard universal command byte 3-4
uint8_t ucr = 0; // response
/* mapping algorithm for function parameter, optimized to save a space:
ucb1(0x50), ucb2(0x00) -> GET_LOW_FUSE_BITS (0x0000)
ucb1(0x58), ucb2(0x00) -> GET_LOCK_BITS (0x0001)
ucb1(0x50), ucb2(0x08) -> GET_EXTENDED_FUSE_BITS(0x0002)
ucb1(0x58), ucb2(0x08) -> GET_HIGH_FUSE_BITS (0x0003)
*/
if((ucb1 & ~(0x08)) == 0x50 && (ucb2 & ~(0x08)) == 0x00) {
ucb1 = ((ucb1 & 0x08) ? 1 : 0) | (ucb2 >> 2);
ucr = boot_lock_fuse_bits_get((uint16_t)ucb1);
}
putch(ucr);
#else // universal command is ignored
getNch(4); // 4 bytes of data/command
putch(0x00); // response
#endif
It should produce this:
/* STK500 Universal Command */
} else if(ch == STK_UNIVERSAL) { // universal command - fuse & lock bits
1fcb8: 86 35 cpi r24, 0x56 ; 86
1fcba: d1 f4 brne .+52 ; 0x1fcf0
#if defined(BIGBOOT)
/* read fuse and lock bits; it takes additional 82 bytes */
uint8_t ucb1 = getch(); // universal command byte 1
1fcbc: c5 d0 rcall .+394 ; 0x1fe48
1fcbe: c8 2e mov r12, r24
uint8_t ucb2 = getch(); // universal command byte 2
1fcc0: c3 d0 rcall .+390 ; 0x1fe48
1fcc2: d8 2e mov r13, r24
getNch(2); // discard universal command byte 3-4
1fcc4: 82 e0 ldi r24, 0x02 ; 2
1fcc6: da d0 rcall .+436 ; 0x1fe7c
ucb1(0x50), ucb2(0x00) -> GET_LOW_FUSE_BITS (0x0000)
ucb1(0x58), ucb2(0x00) -> GET_LOCK_BITS (0x0001)
ucb1(0x50), ucb2(0x08) -> GET_EXTENDED_FUSE_BITS(0x0002)
ucb1(0x58), ucb2(0x08) -> GET_HIGH_FUSE_BITS (0x0003)
*/
if((ucb1 & ~(0x08)) == 0x50 && (ucb2 & ~(0x08)) == 0x00) {
1fcc8: 8c 2d mov r24, r12
1fcca: 87 7f andi r24, 0xF7 ; 247
1fccc: 80 35 cpi r24, 0x50 ; 80
1fcce: 71 f4 brne .+28 ; 0x1fcec
1fcd0: 8d 2d mov r24, r13
1fcd2: 87 7f andi r24, 0xF7 ; 247
1fcd4: 59 f4 brne .+22 ; 0x1fcec
ucb1 = ((ucb1 & 0x08) ? 1 : 0) | (ucb2 >> 2);
1fcd6: c3 fa bst r12, 3
1fcd8: ee 27 eor r30, r30
1fcda: e0 f9 bld r30, 0
1fcdc: d6 94 lsr r13
1fcde: d6 94 lsr r13
1fce0: ed 29 or r30, r13
ucr = boot_lock_fuse_bits_get((uint16_t)ucb1);
1fce2: f0 e0 ldi r31, 0x00 ; 0
1fce4: 40 92 57 00 sts 0x0057, r4
1fce8: 84 91 lpm r24, Z
1fcea: cd cf rjmp .-102 ; 0x1fc86
#if defined(BIGBOOT)
/* read fuse and lock bits; it takes additional 82 bytes */
uint8_t ucb1 = getch(); // universal command byte 1
uint8_t ucb2 = getch(); // universal command byte 2
getNch(2); // discard universal command byte 3-4
uint8_t ucr = 0; // response
1fcec: 80 e0 ldi r24, 0x00 ; 0
1fcee: cb cf rjmp .-106 ; 0x1fc86
getNch(4); // 4 bytes of data/command
putch(0x00); // response
#endif
Feel free to use it.